jpluimers / fritzcap

Fork of elpatron68/fritzcap which was previously automatically exported from code.google.com/p/fritzcap
https://wiert.me/category/power-user/internet/fritz/fritzbox-fritz/
27 stars 11 forks source link

"Invalid PCAP dump header. Probably not a valid capture file" #1

Closed jpluimers closed 7 years ago

jpluimers commented 7 years ago

This is another manifestation of https://github.com/elpatron68/fritzcap/issues/4

When capturing on a Fritz!Box 7360 v1 on a different address than fritz.box, I get this log:

# python fritzcap.py --capture_files -d --monitor_calls --box_name 192.168.124.23
2017-06-21 12:06:03,647 - FritzCap started.
Exter the FritzBox password:
2017-06-21 12:06:05,806 - Connect    to the call monitor service on 192.168.124.23:1012.
2017-06-21 12:06:05,815 - Connected  to the call monitor service on 192.168.124.23:1012.
2017-06-21 12:07:46,783 - Ring       (ID:0, ActiveCalls.:1, Caller:0654385135, DialedNumber:0252229699, LinePort:SIP0)
2017-06-21 12:07:47,309 - Start capture (capture_file:'captures/2017-06-21/120747/capture_20170621120747.cap').
2017-06-21 12:07:52,418 - Connect    (ID:0, ActiveCalls.:1, Caller:0654385135, DialedNumber:0252229699, LinePort:SIP0)
2017-06-21 12:07:57,406 - Disconnect (ID:0, ActiveCalls.:0, Caller:0654385135, DialedNumber:0252229699, LinePort:SIP0)
2017-06-21 12:08:07,992 - Capture finished (capture_file:'captures/2017-06-21/120747/capture_20170621120747.cap').
2017-06-21 12:08:08,001 - Decode process started  (worker_id:1, file:'captures/2017-06-21/120747/capture_20170621120747.cap')
2017-06-21 12:08:08,016 - Invalid PCAP dump header. Probably not a valid capture file
2017-06-21 12:08:08,022 - Decode process finished (worker_id:1, file:'captures/2017-06-21/120747/capture_20170621120747.cap')

The problem is this content:

# cat captures/2017-06-21/120747/capture_20170621120747.cap

Not authorized. Please login first..

The reason is that there are some hardcoded fritz.box references in the Python files:

# grep -r fritz\.box --include \*.py
fritzcap.py:    ext_args.add_argument('--box_name', default=None, metavar='host_or_IP', type=str, help='the host name or IP address of the FritzBox (Default:\'fritz.box\')')
fritzcap.py:                "box_name": "fritz.box",
core/capture_monitor.py:            conn_url = 'http://fritz.box/login_sid.lua'
core/capture_monitor.py:                conn_url = 'http://fritz.box/login_sid.lua?username=root&response=' + response_bf