Giter VIP home page Giter VIP logo

fritzcap's Introduction

fritzcap

Fritz!Box trace helper tool.

- This project is on hold as I am trying to recover from metastasized rectum cancer as of fall 2019. 
- It is unclear if I will ever be able to put effort in it again.

For historic purposes, I've put the historical 2011-2013 readme at Google Code - which isn't accurate any more - in a separate file.

Project objectives

This tool simplifies the initiation and termination of libpcap compatible traces taken from a FritzBox or SpeedPort (V)DSL router. It may also be used to record and mix captured RTP audio streams (currently G.711 audio only).

Note:

Many countries by law forbid authorised recording of (SIP) phone conversations.

The software may be used in order to debug problems with the local network installation. It is also intended to provide know how on SIP, VOIP and audio data packet formatting/decoding.

Prerequisites

You need to have Python >= v. 2.6 installed on your machine. Go to http://www.python.org/download/ to find an appropriate download for your system.

How to enable/disable call monitoring

To enable/disable the CallMonitor option in your Fritz!Box

  • Dial #96*5* to enable (response "CallMonitor On")
  • Dial #96*4* to disable (response "CallMonitor Off")

It seems not possible to ask for the current state (enabled/disabled).

After it is enabled, the TCP port 1012 on your Fritz!Box is available

Examples

Show the interfaces of a Fritz!Box in default xs4all configuration:

# python fritzcap.py --show_interfaces --box_name 192.168.178.1 --password foobar

Capture on router and switch configured Fritz!Box devices:

# python fritzcap.py --capture_files --decode_files --monitor_calls --box_name 192.168.171.1 --username foo --password bar
# python fritzcap.py --capture_files --decode_files --monitor_calls --cap_interface 1-lan --box_name 192.168.124.23 --username foo --password bar

Only monitors calls as implicit root:

# python fritzcap.py --monitor_calls --box_name 192.168.171.1 --password bar

Note this will neither capture, nor decode and logs that it cannot capture.

Command-line options

version

# python fritzcap.py --version
fritzcap.py 2.3

help

# feature/re-add_documentation(+0/-0)* ± python fritzcap.py --help
usage: fritzcap.py [-h] [-v] [-c] [-d [file [file ...]]] [-m] [-p password]
                   [-u username] [-s] [--config_file path_to_file]
                   [--logging_config path_to_file] [--box_name host_or_IP]
                   [--call_service_port port] [--login_not_required]
                   [--protocol protocol] [--cap_folder path_pattern]
                   [--cap_file file_pattern] [--cap_interface cap_interface]
                   [--after_capture_time time_in_seconds]
                   [--decode_workers_count int]

fritzcap - audio files analyse

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit

main arguments:
  -c, --capture_files   capture file/s. If the monitor option is not set, only
                        one file will be captured
  -d [file [file ...]], --decode_files [file [file ...]]
                        the list of captured files to decode. All the new
                        captures files will be decode automatically if the
                        --capture switch is set. Read the files from the
                        standard input if the list of files is empty and there
                        is no capture work.
  -m, --monitor_calls   start the call monitor mode. The CALL/RING/DISCONNECT
                        events will be used to start/stop the capture
                        automatically
  -p password, --password password
                        the password to login to the box. If not set and
                        --login_not_required is set to False, then the
                        password will be read from the console
  -u username, --username username
                        the username to login to the box (Default:'root')
  -s, --show_interfaces
                        shows the interfaces as key/description pairs

extended defaults arguments:
  --config_file path_to_file
                        the fritzcap configuration file
                        (Default:'fritzcap.conf')
  --logging_config path_to_file
                        the fritzcap logging configuration file
                        (Default:'logging.conf')
  --box_name host_or_IP
                        the host name or IP address of the FritzBox
                        (Default:'fritz.box')
  --call_service_port port
                        the port number of the FritzBox call monitor telnet
                        service (Default:1012)
  --login_not_required  set this flag, if the login is not needed to connect
                        to the box
  --protocol protocol   the protocol to used to login to the FritzBox
                        (Default: 'http')
  --cap_folder path_pattern
                        the folder where the capture files will be stored
                        (Default:'captures/%d%m%Y%H%M/')
  --cap_file file_pattern
                        the file name where the capture data will be saved
                        (Default:'capture.cap')
  --cap_interface cap_interface
                        the key of the interface to capture data from
                        (Default:'3-17' means value 'internet')
  --after_capture_time time_in_seconds
                        time in seconds how long the capture monitor should
                        still continue capture files after all calls were
                        finished (Default:10)
  --decode_workers_count int
                        the count parallel workers to decode captures files.
                        The minimal value is 1 (Default:2).

configuration parameters

Configuration parameters are obtained in this order of importance (from high to low):

  1. command-line
  2. configuration file (example in fritzcap.conf)
  3. defaults (from the above help)

How to obtain?

Source code available here:

fritzcap's People

Contributors

jackslateriv avatar jpluimers avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fritzcap's Issues

Fritzcap 10min record

maybe you can help me. I used the latest Fritzcap version 2.3.1 and always the record stopped after exactly 10 minutes for both streams and then i can only hear one voice.. The other voice disappeared .Also the captured wave folders are then ....-0 ...-1 .....-2 .....-3 .....4.
Have you any ideas why this can happen?

feature: WAV files named with telephone numbers

Hi!

Would it be possible to implement the new feature:

I would be nice to habe the WAV and the CAP files named like the telephone numbers.
For example: "calling person" (555-111) calls "called person" (555-222):

corresponding filename: 555-111__-__555-222____LENGTH_in_MINUTES.WAV

duffy6

Broken captures

Hi!

Is there anyone else using FritzCap 2.3.1 with a FritzBox 6490 Cable? In my setup, calls are detected and recorded but the capture file seems to be broken somehow. There will also be no extracted .wav files.

My guess is that the capture process starts a bit too late and misses the first SIP packets. Is there a way to fix this?

Debug log:

[INFO    ] [  capfile_worker::process           ] Decode process started  (worker_id:1, file:'captures/2018-03-23/153149/capture_20180323153149.cap')
[DEBUG   ] [    g711_decoder::decode            ] Unsupported payload type 48
[DEBUG   ] [ capture_monitor::run_logic         ] pre_capture acquire lock.
[DEBUG   ] [ capture_monitor::run_logic         ] pre_capture acquire lock finished.
[DEBUG   ] [ capture_monitor::run_logic         ] pre_capture wait().
[DEBUG   ] [    g711_decoder::decode            ] Unsupported payload type 10

Fix `KeyError: '0'` issue when call is in progress when starting fritzcap

This happened when:

  1. nobody was home
  2. an incoming phone call was ringing
  3. fritzcap starts
  4. the incoming phone call stops ringing
2017-06-28 16:59:27,401 - FritzCap version 2.3 started.
2017-06-28 16:59:27,402 - Connect    to the call monitor service on 192.168.124.23:1012.
2017-06-28 16:59:27,409 - Connected  to the call monitor service on 192.168.124.23:1012.
Exception in thread Thread-4:
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/Users/jeroenp/Versioned/fritzcap/core/call_monitor.py", line 176, in run
    self.logger.info("Disconnect (ID:%s, ActiveCalls.:%s, Caller:%s, DialedNumber:%s, LinePort:%s)" % (sline[2],callers_count,call_id_map[sline[2]][0],call_id_map[sline[2]][1],call_id_map[sline[2]][2]))
KeyError: '0'

Similar, but starting fritzcap when an outgoing call is in progress:

2017-06-28 17:11:22,274 - FritzCap version 2.3 started.
2017-06-28 17:11:22,275 - Connect    to the call monitor service on 192.168.124.23:1012.
2017-06-28 17:11:22,282 - Connected  to the call monitor service on 192.168.124.23:1012.
Exception in thread Thread-4:
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/Users/jeroenp/Versioned/fritzcap/core/call_monitor.py", line 176, in run
    self.logger.info("Disconnect (ID:%s, ActiveCalls.:%s, Caller:%s, DialedNumber:%s, LinePort:%s)" % (sline[2],callers_count,call_id_map[sline[2]][0],call_id_map[sline[2]][1],call_id_map[sline[2]][2]))
KeyError: '1'

No Capture / AVM fritzbox 7590 / Fritzcap 2.3.1 / Python 2.7.14

Hello, I have tried the following
Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:25:58) [MSC v.1500 64 bit (AMD64)] on win32
with
Fritzcap 2.3.1
with
AVM Fritzbox 7590
i install the Fritzcap 2.3.1 Files in the Same Directory c:\python27
starting with
C:\Python27>fritzcap.py -c -d -m
the message appears:
2018-08-15 21:46:16,993 - FritzCap version 2.3 started.
2018-08-15 21:46:16,994 - Connect to the call monitor service on fritz.box:1012.
2018-08-15 21:46:17,000 - Connected to the call monitor service on fritz.box:1012.
i make a call
the message appears:

Numbers are blackenedXXXXX (No message!)

2018-08-15 21:48:43,799 - Ring (ID:0, ActiveCalls.:1, Caller:blackenedXXXXX, DialedNumber:blackenedXXXXX, LinePort:SIP2)
2018-08-15 21:48:44,033 - Start capture (capture_file:'captures/2018-08-15/214844/capture_20180815214844.cap').
2018-08-15 21:48:45,042 - Connect (ID:0, ActiveCalls.:1, Caller:blackenedXXXXX, DialedNumber:(blackenedXXXXX, LinePort:SIP2)
2018-08-15 21:48:54,743 - Disconnect (ID:0, ActiveCalls.:0, Caller:blackenedXXXXX, DialedNumber:blackenedXXXXX, LinePort:SIP2)
2018-08-15 21:49:06,042 - Capture finished (capture_file:'captures/2018-08-15/214844/capture_20180815214844.cap').
2018-08-15 21:49:06,042 - Decode process started (worker_id:1, file:'captures/2018-08-15/214844/capture_20180815214844.cap')
2018-08-15 21:49:06,043 - Decode process finished (worker_id:1, file:'captures/2018-08-15/214844/capture_20180815214844.cap')
One File appears in the Capture Folder. But the File has only 1kb an it is empty.

The call Monitor in the Fritzbox ist aktiv with #965 that is not the Problem

The Passwort is in the File: fritzcap.conf

[settings]

capture_files =

decode_files =

monitor_calls =

password = blackenedXXXXX

logging_config =

box_name = fritz.box
call_service_port = 1012

login_not_required =

protocol = http

cap_folder = captures/%(tcaps.Y-m-d/HMS)/
cap_file = capture_%(tcaps.YmdHMS).cap

after_capture_time = 10

decode_workers_count = 2

default_login = getpage=../html/de/menus/menu2.html&errorpage=../html/index.html&var:lang=de&var:pagename=home&var:menu=home&=&login:command/password=%s
sid_challenge = getpage=../html/login_sid.xml
sid_login = login:command/response=%s&getpage=../html/login_sid.xml
start_str = ?start=1&start1=Start
stop_str = ?stop=1&stop1=Stop

What could be the mistake?

With Windows 10 64 Bit

Regards Andreas

fritzcap auto restart feature in case FritzBox restart

After a restart on the FritzBox, ( fw update, power outage, ...) it seems that the fritzcap it is not able to continue the connection with port 1012. So you have to manually restart the fritzcap.

It would be nice if the fritzcap have an auto restart feature in case it losts connection with 1012. Lets say after 5 min.

Error line 39

hello
i've install the master from https://github.com/jpluimers/fritzcap/archive/master.zip
and the Latest Python 3 Release - Python 3.6.4

and there is only

C:\fritzcap-master>fritzcap.py –capture_files –decode_files –monitor_calls —
box_name 192.168.179.1 —xxxxxxxxx PASSWORT
Traceback (most recent call last):
File „C:\fritzcap-master\fritzcap.py“, line 39, in
import argparse
ModuleNotFoundError: No module named ‚ConfigParser‘

please can you help me?

No valid CAP file captured - filesize 0

I've just installed Fritzcap and started to use it to record selected phone calls.

Here is what happens:

E:\FritzBox7272\fritzcap-master>fritzcap.py --capture_files --decode_files --monitor_calls --box_name 192.168.178.1 --password foobar
2018-05-15 17:58:51,378 - FritzCap version 2.3.1 started.
2018-05-15 17:58:51,381 - Connect to the call monitor service on fritzbox2:1012.
2018-05-15 17:58:51,390 - Connected to the call monitor service on fritzbox2:1012.
2018-05-15 17:59:03,808 - Call (ID:1, ActiveCalls.:1, Caller:6, DialedNumber:0123738487253, LinePort:SIP3)
2018-05-15 17:59:06,522 - Start capture (capture_file:'captures/2018-05-15/175906/capture_20180515175906.cap').
2018-05-15 17:59:09,588 - Connect (ID:1, ActiveCalls.:1, Caller:6, DialedNumber:0123738487253, LinePort:SIP3)
2018-05-15 17:59:27,924 - Disconnect (ID:1, ActiveCalls.:0, Caller:6, DialedNumber:0123738487253, LinePort:SIP3)
2018-05-15 17:59:39,490 - Capture finished (capture_file:'captures/2018-05-15/175906/capture_20180515175906.cap').
2018-05-15 17:59:39,490 - Decode process started (worker_id:1, file:'captures/2018-05-15/175906/capture_20180515175906.cap')
2018-05-15 17:59:39,492 - Seems, there is no valid PCAP file
2018-05-15 17:59:39,493 - Decode process finished (worker_id:1, file:'captures/2018-05-15/175906/capture_20180515175906.cap')
2018-05-15 18:00:42,930 - Connection to the call monitor service on fritzbox2:1012 stopped.
2018-05-15 18:00:42,936 - FritzCap version 2.3.1 finished.

The listing of the captured file reads

E:\FritzBox7272\fritzcap-master\captures\2018-05-15\175906>dir
Datenträger in Laufwerk E: ist Data1
Volumeseriennummer: BD0B-48E0
Verzeichnis von E:\FritzBox7272\fritzcap-master\captures\2018-05-15\175906
15.05.2018 17:59 <DIR> .
15.05.2018 17:59 <DIR> ..
15.05.2018 17:59 0 capture_20180515175906.cap
1 Datei(en), 0 Bytes
2 Verzeichnis(se), 66.667.581.440 Bytes frei
E:\FritzBox7272\fritzcap-master\captures\2018-05-15\175906>

FritzBox is Fritz!Box7272 with Fritz!OS 06.83

Any idea, what goes wrong and how to fix it?

Captures are just noisy but there is no voice

Hello,

everything works fine with FritzBox 7590, actual 2.* python Version and seperate phones.

BUT, the captured wav-Files aren't understandable.

You cannot understand anything, instead of an annoying noise.
Even the ringing at the beginning (before the person to be called answers the call) is contained in the recording, but right after the connection is build up, the wave-file starts getting noisy.

Might it be neccessary to downgrade the fritz from 7.12 to some lower version?

Oh and we used an android phone with the fritz fon app and another time we tried an older siemens gigaset 3000 phone.

Greets and thanks for your efforts so far.

Peter

When your Fritz!Box is a switch, fritzcap gives zero byte length files

When your Fritz!Box VOiP device is a switch instead of a router, fritzcap gives zero byte length files:

# python fritzcap.py --capture_files -d --monitor_calls --box_name 192.168.124.23
2017-06-21 13:00:47,052 - FritzCap started.
Exter the FritzBox password:
2017-06-21 13:00:49,306 - Connect    to the call monitor service on 192.168.124.23:1012.
2017-06-21 13:00:49,315 - Connected  to the call monitor service on 192.168.124.23:1012.
2017-06-21 13:01:22,357 - Ring       (ID:0, ActiveCalls.:1, Caller:0600000000, DialedNumber:0200000000, LinePort:SIP0)
2017-06-21 13:01:22,821 - Start capture (capture_file:'captures/2017-06-21/130122/capture_20170621130122.cap').
2017-06-21 13:01:26,972 - Connect    (ID:0, ActiveCalls.:1, Caller:0600000000, DialedNumber:0200000000, LinePort:SIP0)
2017-06-21 13:01:30,799 - Disconnect (ID:0, ActiveCalls.:0, Caller:0600000000, DialedNumber:0200000000, LinePort:SIP0)
2017-06-21 13:01:41,254 - Capture finished (capture_file:'captures/2017-06-21/130122/capture_20170621130122.cap').
2017-06-21 13:01:41,263 - Decode process started  (worker_id:1, file:'captures/2017-06-21/130122/capture_20170621130122.cap')
2017-06-21 13:01:41,278 - Seems, there is no valid PCAP file
2017-06-21 13:01:41,284 - Decode process finished (worker_id:1, file:'captures/2017-06-21/130122/capture_20170621130122.cap')
^C2017-06-21 13:05:16,084 - Connection to the call monitor service on 192.168.124.23:1012 stopped.
2017-06-21 13:05:16,155 - FritzCap finished.
# ls -al captures/2017-06-21/130122/capture_20170621130122.cap
-rw-r--r-- 1 root root 0 Jun 21 13:01 captures/2017-06-21/130122/capture_20170621130122.cap

This might be caused because fritzcap is not capturing the right network interface.

Research this two part solution:

  1. Figure out how to specify the network interface to capture within fritzcap
  2. Figure out the network interface your Fritz!Box using for VoIP communication

For the latter the below screenshots can help:

  1. Interface to which the actual router is connected to via http://fritz.box/net/network_user_devices.lua
  2. List of interfaces at http://fritz.box/html/capture.html

I think LAN1 in the first screenshot maps to eth0 in the second screenshot.

Interfaces with active devices

Capturable interfaces

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

This is another manifestation of elpatron68#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

feature: daemon mode

Hi!

Would it be possible to implement the new features:

  • allowing (or documenting) daemon mode in various operating systems (especially Linux based system eg. Ubuntu)

duffy6

"Exception in thread Thread-1" when doing monitoring, but no capture.

log_debug_fritzcap.txt
Hi!

I installed this on an ubuntu machine (Ubuntu 16.04.2 LTS) using it with a Fritzbox 7390 (V6.83).
Installed via GIT on 7. July 2017.

when I start fritzcap via

sudo python fritzcap.py -m -p MYPASSWORD

it throws this:

2017-07-07 14:50:28,761 - FritzCap version 2.3 started.
2017-07-07 14:50:28,765 - Connect to the call monitor service on fritz.box:1012.
2017-07-07 14:50:28,771 - Connected to the call monitor service on fritz.box:1012.

But when a call goes out/comes in this happends:

Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/home/couchdb/fritzcap/fritzcap/core/call_monitor.py", line 150, in run
self.capture_monitor.set_data("callevent.name", command)
AttributeError: 'NoneType' object has no attribute 'set_data'

Is this a bug or did I do something wrong?

greetz
duffy6

Link to the discussion: https://www.ip-phone-forum.de/threads/new-fritzcap-py-version-2-3.295776/

only .cap file (payload issue ?)

I am only getting a .cab file the decoding fails

FritzCap version 2.3.1 started.
my interfaces:

2018-10-12 10:52:18,756 [INFO    ] Fritz!Box interfaces from http://192.168.178.2/capture.lua?sid=a913984a027bbc95: key = value
2018-10-12 10:52:18,756 [INFO    ]   1-eth0              = eth0
2018-10-12 10:52:18,756 [INFO    ]   1-eth1              = eth1
2018-10-12 10:52:18,772 [INFO    ]   1-eth2              = eth2
2018-10-12 10:52:18,772 [INFO    ]   1-eth3              = eth3
2018-10-12 10:52:18,772 [INFO    ]   1-ifb0              = ifb0
2018-10-12 10:52:18,772 [INFO    ]   1-ifb1              = ifb1
2018-10-12 10:52:18,772 [INFO    ]   1-ing0              = ing0
2018-10-12 10:52:18,772 [INFO    ]   1-lan               = lan
2018-10-12 10:52:18,772 [INFO    ]   1-tunl0             = tunl0
2018-10-12 10:52:18,772 [INFO    ]   1-wan               = wan
2018-10-12 10:52:18,772 [INFO    ]   1-wifi0             = wifi0
2018-10-12 10:52:18,772 [INFO    ]   1-wifi1             = wifi1
2018-10-12 10:52:18,772 [INFO    ]   2-1                 = 1. Internetverbindung
2018-10-12 10:52:18,786 [INFO    ]   2-2                 = 2. Internetverbindung
2018-10-12 10:52:18,786 [INFO    ]   2-3                 = 3. Internetverbindung
2018-10-12 10:52:18,786 [INFO    ]   3-0                 = Routing-Schnittstelle
2018-10-12 10:52:18,802 [INFO    ]   3-17                = Schnittstelle 0 ('internet')
2018-10-12 10:52:18,802 [INFO    ]   3-18                = Schnittstelle 1 ('voip')
2018-10-12 10:52:18,802 [INFO    ]   3-19                = Schnittstelle 2 ('iptv')
2018-10-12 10:52:18,818 [INFO    ]   4-128               = WLAN Management Traffic - Schnittstelle 0
2018-10-12 10:52:18,818 [INFO    ]   5-161               = usb1
2018-10-12 10:52:18,818 [INFO    ]   5-162               = usb2
2018-10-12 10:52:18,834 [INFO    ]   5-163               = usb3
2018-10-12 10:52:18,834 [INFO    ]   5-164               = usb4

My Capture test:

2018-10-12 10:52:31,361 [INFO    ] Ring       (ID:0, ActiveCalls.:1, Caller:TEL1, DialedNumber:TEL2, LinePort:SIP0)
2018-10-12 10:52:31,641 [INFO    ] Start capture (capture_file:'captures/2018-10-12/105231/capture_20181012105231.cap').
2018-10-12 10:52:32,796 [INFO    ] Connect    (ID:0, ActiveCalls.:1, Caller:TEL1, DialedNumber:TEL2, LinePort:SIP0)
2018-10-12 10:52:40,984 [INFO    ] Disconnect (ID:0, ActiveCalls.:0, Caller:TEL1, DialedNumber:TEL2, LinePort:SIP0)
2018-10-12 10:52:52,325 [INFO    ] Capture finished (capture_file:'captures/2018-10-12/105231/capture_20181012105231.cap').
2018-10-12 10:52:52,325 [INFO    ] Decode process started  (worker_id:1, file:'captures/2018-10-12/105231/capture_20181012105231.cap')
2018-10-12 10:52:52,325 [INFO    ] Decode process finished (worker_id:1, file:'captures/2018-10-12/105231/capture_20181012105231.cap')

Now im getting an .cap file in my folder.
When i try to decode the .cap file i get this error and no .wav file

2018-10-12 11:05:13,019 [INFO    ] FritzCap version 2.3.1 started.
2018-10-12 11:05:13,020 [INFO    ] Decode process started  (worker_id:1, file:'captures/2018-10-12/094304/capture_20181012094304.cap')
2018-10-12 11:05:13,190 [INFO    ] Decode process finished (worker_id:1, file:'captures/2018-10-12/094304/capture_20181012094304.cap')
2018-10-12 11:05:14,221 [INFO    ] FritzCap version 2.3.1 finished.
2018-10-12 11:05:13,019 [MainThread::6436 ] [INFO    ] [        fritzcap::<module>          ] FritzCap version 2.3.1 started.
2018-10-12 11:05:13,019 [MainThread::6436 ] [DEBUG   ] [        fritzcap::<module>          ] Command line parameters: ['C:\\Users\\User\\Downloads\\fritzcap-master\\fritzcap.py', '-d', 'captures/2018-10-12/094304/capture_20181012094304.cap']
2018-10-12 11:05:13,019 [MainThread::6436 ] [DEBUG   ] [        fritzcap::<module>          ] Parsed parameters:       Namespace(after_capture_time=10, box_name='192.168.178.2', call_service_port=1012, cap_file='capture_%(tcaps.YmdHMS).cap', cap_folder='captures/%(tcaps.Y-m-d/HMS)/', cap_interface=' ', capture_files=None, config_file=<open file 'fritzcap.conf', mode 'r' at 0x0000000002D47AE0>, decode_files=['captures/2018-10-12/094304/capture_20181012094304.cap'], decode_workers_count=2, default_login='getpage=../html/de/menus/menu2.html&errorpage=../html/index.html&var:lang=de&var:pagename=home&var:menu=home&=&login:command/password=%s', logging_config='logging.conf', login_not_required=None, monitor_calls=None, password='password', protocol='http', show_interfaces=None, sid_challenge='getpage=../html/login_sid.xml', sid_login='login:command/response=%s&getpage=../html/login_sid.xml', start_str='?start=1&start1=Start', stop_str='?stop=1&stop1=Stop', username='root')
2018-10-12 11:05:13,019 [MainThread::6436 ] [DEBUG   ] [exception_logging_thread::__init__          ] ExceptionLoggingThread().
2018-10-12 11:05:13,019 [MainThread::6436 ] [DEBUG   ] [  capfile_worker::__init__          ] CapfileWorker(worker_id:0, decode_work_queue:<Queue.Queue instance at 0x0000000002E01888>).
2018-10-12 11:05:13,019 [MainThread::6436 ] [DEBUG   ] [exception_logging_thread::__init__          ] ExceptionLoggingThread().
2018-10-12 11:05:13,019 [MainThread::6436 ] [DEBUG   ] [  capfile_worker::__init__          ] CapfileWorker(worker_id:1, decode_work_queue:<Queue.Queue instance at 0x0000000002E01888>).
2018-10-12 11:05:13,020 [  Thread-2::5280 ] [DEBUG   ] [  capfile_worker::run_logic         ] Thread started.
2018-10-12 11:05:13,020 [  Thread-2::5280 ] [INFO    ] [  capfile_worker::process           ] Decode process started  (worker_id:1, file:'captures/2018-10-12/094304/capture_20181012094304.cap')
2018-10-12 11:05:13,022 [  Thread-2::5280 ] [DEBUG   ] [    g711_decoder::decode            ] Unsupported payload type 37
2018-10-12 11:05:13,022 [  Thread-2::5280 ] [DEBUG   ] [    g711_decoder::decode            ] Unsupported payload type 103
2018-10-12 11:05:13,023 [  Thread-2::5280 ] [DEBUG   ] [    g711_decoder::decode            ] Unsupported payload type 103
2018-10-12 11:05:13,121 [  Thread-2::5280 ] [DEBUG   ] [    g711_decoder::decode            ] Unsupported payload type 37
2018-10-12 11:05:13,121 [  Thread-1::1856 ] [DEBUG   ] [  capfile_worker::run_logic         ] Thread started.
2018-10-12 11:05:13,122 [  Thread-1::1856 ] [DEBUG   ] [  capfile_worker::run_logic         ] Became None element, put a None element to the queue for the others workers and break the work.
2018-10-12 11:05:13,122 [  Thread-1::1856 ] [DEBUG   ] [  capfile_worker::run_logic         ] Thread stopped.
2018-10-12 11:05:13,190 [  Thread-2::5280 ] [INFO    ] [  capfile_worker::process           ] Decode process finished (worker_id:1, file:'captures/2018-10-12/094304/capture_20181012094304.cap')
2018-10-12 11:05:13,190 [  Thread-2::5280 ] [DEBUG   ] [  capfile_worker::run_logic         ] Became None element, put a None element to the queue for the others workers and break the work.
2018-10-12 11:05:13,190 [  Thread-2::5280 ] [DEBUG   ] [  capfile_worker::run_logic         ] Thread stopped.
2018-10-12 11:05:14,221 [MainThread::6436 ] [DEBUG   ] [        fritzcap::<module>          ] There is no more active threads. Exiting.
2018-10-12 11:05:14,221 [MainThread::6436 ] [INFO    ] [        fritzcap::<module>          ] FritzCap version 2.3.1 finished.

OT
Where is the button to get

This code

insted of this
i have only copied one of your examples ans had to find out the structure

Thanks for help ;)

no wav file is being created

Hi there,
I am using following configuration:
FritzBox 7490
Ubuntu 18.04.1 with Python 2.7.12

CAP files were created, but there is no audio file being generated.
Sometimes there will also no CAP file.
How do I convert cap files to audio files?

Could not open Trace...

Hi there,

config: fritzbox7490 with firmware 7.1
software: ubuntu 18.04.1
fritzcap 2.3.1

capturing starts but sometimes does not create cap file
debug log:
2018-10-16 14:08:36,377 [ Thread-4::140146594236160] [DEBUG ] [ call_monitor::run_logic ] Wait for call monitor status change.
2018-10-16 14:09:31,977 [ Thread-6::140146560141056] [DEBUG ] [ tracer::run_logic ] Could not open Trace (url:'http://192.168.178.1/cgi-bin/capture_notimeout?start=1&start1=Start&ifaceorminor= &sid=bc13471ef5faa60b', filename:'captures/2018-10-16/140830/capture_20181016140830.cap')
2018-10-16 14:27:30,639 [ Thread-4::140146594236160] [DEBUG ] [ call_monitor::run_logic ] Telnet:'16.10.18 14:27:30;DISCONNECT;0;1135;'

any help appreciated:

In order to fix #5, print a list of available interfaces to potentially capture from

Issue #5 needs a means to specify the interface to capture from.

In order to specify it, it is convenient to have a list of the interfaces on a Fritz!Box.

To get those, basically you want to get the underlying data of which the http://fritz.box/html/capture.html?sid=################ is built from.

On the surface it looks like the base of these can be two kinds of data:

A closer inspection reveals that Fritz!Box 7490 with firmware 06.83 also supports http://fritz.box/capture.lua?sid=################

On Mac OS X, leaving out the password does not prompt for it

On Linux:

# python fritzcap.py --capture_files -d --monitor_calls --box_name 192.168.124.23
2017-06-21 13:00:47,052 - FritzCap started.
Exter the FritzBox password:
2017-06-21 13:00:49,306 - Connect    to the call monitor service on 192.168.124.23:1012.
2017-06-21 13:00:49,315 - Connected  to the call monitor service on 192.168.124.23:1012.

On Mac OS X, you do not get the prompt:

# python fritzcap.py --capture_files -d --monitor_calls --box_name 192.168.124.23
2017-06-21 16:51:12,286 - FritzCap 2.1 started.
2017-06-21 16:51:12,292 - Connect    to the call monitor service on 192.168.124.23:1012.
2017-06-21 16:51:12,299 - Connected  to the call monitor service on 192.168.124.23:1012.

Cause is likely that - despite Mac OS X being BSD based - it doesn't represent platform.system() as Linux (and certainly not Windows).

Need to figure out the platform and also how to get the password from the console.

Doesn't handle G.729 codec

The --decode_files option doesn't work with cap files containinig G.729 streams, which seem widely used today. It seems that G.711 is the only codec supported.

Tested on FritzBox 7590 with fritz.os 07.12. The Telephony->TelephoneNumbers->VoiceTransmission window shows that most calls are in G.729. The few calls in G.711 are decoded correctly.

No .wav created from .cap files which are saved

Used Command:
sudo python fritzcap.py --capture_files --decode_files --monitor_calls --box_name 192.168.178.1 --password xxx

Output:

2020-09-15 19:56:30,552 - FritzCap version 2.3.1 started.
2020-09-15 19:56:30,554 - Connect to the call monitor service on 192.168.178.1:1012.
2020-09-15 19:56:30,555 - Connected to the call monitor service on 192.168.178.1:1012.
2020-09-15 19:56:41,752 - Ring (ID:0, ActiveCalls.:1, Caller:MyNumber, DialedNumber:xxx, LinePort:SIP0)
2020-09-15 19:56:43,063 - Start capture (capture_file:'captures/2020-09-15/195643/capture_20200915195643.cap').
2020-09-15 19:56:43,385 - Connect (ID:0, ActiveCalls.:1, Caller:MyNumber, DialedNumber:xxx, LinePort:SIP0)
2020-09-15 19:56:54,354 - Disconnect (ID:0, ActiveCalls.:0, Caller:MyNumber, DialedNumber:xxx, LinePort:SIP0)
2020-09-15 19:57:06,230 - Capture finished (capture_file:'captures/2020-09-15/195643/capture_20200915195643.cap').
2020-09-15 19:57:06,231 - Decode process started (worker_id:1, file:'captures/2020-09-15/195643/capture_20200915195643.cap')
2020-09-15 19:57:06,240 - Decode process finished (worker_id:1, file:'captures/2020-09-15/195643/capture_20200915195643.cap') 

I don't know why it doesn't save as a .wav or isnt converted.
I didn't change anything in the .conf if that matters.

File captured but no Voip traffic inside

Hi,

using the command
fritzcap.py -c -m -d --cap_interface 1-lan
i can capture a file with what seems to be all of my network activity, but there's no Voip call in there. It triggers the recording automatically and the command line info about caller etc. is also correct. If i do not specify any interface, i get an empty file. I also tried many of the other interfaces and nothing seems to have any traffic, except 1-lan.

FritzCap version 2.3.1 started.
Fritz!Box interfaces from http://......
1-:acc0             = :acc0
1-:acc0             = :acc0
1-:acc0.4           = :acc0.4
1-:acc0.4           = :acc0.4
1-:l2sd0            = :l2sd0
1-:l2sd0            = :l2sd0
1-:l2sd0.2          = :l2sd0.2
1-:l2sd0.2          = :l2sd0.2
1-:l2sd0.3          = :l2sd0.3
1-:l2sd0.3          = :l2sd0.3
1-:l2sm0            = :l2sm0
1-:l2sm0            = :l2sm0
1-:lan0             = :lan0
1-:lan0             = :lan0
1-acc0              = acc0
1-acc0.4            = acc0.4
1-ath0              = ath0
1-ath1              = ath1
1-eth0              = eth0
1-eth1              = eth1
1-eth2              = eth2
1-eth3              = eth3
1-eth_udma0         = eth_udma0
1-eth_udma1         = eth_udma1
1-guest             = guest
1-guest4            = guest4
1-guest5            = guest5
1-guest_st2         = guest_st2
1-guest_st3         = guest_st3
1-ing0              = ing0
1-lan               = lan
1-vlan_master0      = vlan_master0
1-wifi0             = wifi0
1-wifi1             = wifi1
2-1                 = 1. Internetverbindung
2-2                 = 2. Internetverbindung
2-3                 = 3. Internetverbindung
3-0                 = Routing-Schnittstelle
3-17                = Schnittstelle 0 ('internet')
3-18                = Schnittstelle 1 ('lan0')
3001                = Minor = 3001 [':docsis_mng']
3001                = Minor = 3001 [':docsis_mng']
4-128               = WLAN Management Traffic - Schnittstelle 0
4-129               = HW (2.4 GHz, wifi0) - Schnittstelle 0
4-131               = AP (2.4 GHz, ath0) - Schnittstelle 0
4-132               = AP (2.4 GHz, ath0) - Schnittstelle 1
4-138               = AP2 (2.4 + 5 GHz, ath1) - Schnittstelle 1
4-141               = Guest (2.4 GHz, guest4) - Schnittstelle 0
4-142               = Guest (2.4 GHz, guest4) - Schnittstelle 1
4-144               = Guest2 (2.4 + 5 GHz, guest5) - Schnittstelle 1
5-161               = usb1
5-162               = usb2
5-163               = usb3
FritzCap version 2.3.1 finished.

I have a Fritz!Box 6490 Cable that is running FRITZ!OS: 07.02.
Can anybody help me trying to figure out what is going wrong?

Hardcoded `root` username disallows Fritz!Box configurations having named users

If your Fritz!Box has named users (other than the unnamed root user), then fritzcap will fail during logon with a Could not login to the FritzBox: Not authorized. message:

# python fritzcap.py --capture_files -d --monitor_calls --box_name 192.168.124.23
2017-06-21 12:53:07,313 - FritzCap started.
Exter the FritzBox password:
2017-06-21 12:53:09,553 - Connect    to the call monitor service on 192.168.124.23:1012.
2017-06-21 12:53:09,562 - Connected  to the call monitor service on 192.168.124.23:1012.
2017-06-21 12:53:10,106 - Could not login to the FritzBox: Not authorized.
2017-06-21 12:53:24,594 - Connection to the call monitor service on 192.168.124.23:1012 stopped.
2017-06-21 12:53:24,668 - FritzCap finished.

And there is an Exter typo.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.