Looking for maintainer(s) for fritzcap (Python project that captures calls from a Fritz!Box)
Posted by jpluimers on 2023/07/12
Given my health uncertainty, I am looking for maintainers for the fritzcap project (it captures calls from a Fritz!Box modem/router and is written in Python).
History
The fritzcap project was originally started in2007 by [Wayback/Archive] spongebob | IP Phone Forum, first as a binary fritzcap.exe Windows executable (see his first post at [Wayback/Archive] FritzBox: Tool für Etherreal Trace und Audiodaten-Extraktion | IP Phone Forum). In 2010 it became an open source Python project at [Wayback/Archive] Google Code Archive – Long-term storage for Google Code Project Hosting.
That year too both a pcap parser and G.711 codec support were added, so the capture file (the pcap format is compatible with Wireshark) can be decoded in caller/callee party .WAV files and merged into a single stereo WAV files (where both parties are correctly synchronised) in [Wayback/Archive] Fully functional initial version · jpluimers/fritzcap@6a44932.
There a version 2.0 was created by [Wayback/Archive] bor2tom | IP Phone Forum in thread [Wayback/Archive] fritzcap: Tool für Etherreal Trace und Audiodaten-Extraktion v2.0 | IP Phone Forum. Regrettably, bor2tom regrettably vanished from the forum in 2013, and spongebob did as well mid 2017. This query returns nothing meaningful: [Wayback/Archive] “bor2tom” – Google Search, so I could not further track down bor2com.
The main work by bor2com was adding call monitoring support (greatly reducing both capture file size and decoding times), way better separation of concerns (call monitor, capture monitor, capture worker, logging, string helper, sysinput reader), config file for fritzcap and logging, way better parameter parsing, tools for fixing failed WAV merges and malformed capture files, and improving multi-threading.
In 2015, there was a modified version at [Wayback/Archive] Internet traffic monitor – Raspberry Pi Forums that dig generic (including non-VoiP) capturing that I still want to research (if ever), and added scripts for starting/stopping it as a service so it could run unattended.
Over time, Google Code got closed in 2016. Before it went down, the project was rescued at [Wayback/Archive] elpatron68/fritzcap. However, elpatron68 did no maintenance. I forked it because I ran into some issues, but after my pull request went unanswered ([Wayback/Archive] Pull requests · elpatron68/fritzcap), went on continuing fixing my own fork:
- [Wayback/Archive] fritzcap: Tool für Etherreal Trace und Audiodaten-Extraktion v2.0 | Seite 15 | IP Phone Forum – #285
I’ve tried finding if anyone is still maintaining fritzcap in a public repository, but couldn’t.
I did find https://github.com/elpatron68/fritzcap which was an export of https://code.google.com/archive/p/fritzcap/ including the issues, but it has no further activity after march 2013.
Since I bumped into a few things while getting it to work, I’ve forked it to https://github.com/jpluimers/fritzcap and registered some of my own issues to https://github.com/jpluimers/fritzcap/issues, fixed a few and posted one matching issue as a pull request to https://github.com/elpatron68/fritzcap/pulls to see if it gets merged.
When not, I plan to keep my own repository for more fixes and keep the repository open for new issues and pull requests.
- [Wayback/Archive] [Info] – new fritzcap.py version 2.3 | IP Phone Forum – page 1 (I totally forgot I had started this thread) and [Wayback/Archive] [Info] – new fritzcap.py version 2.3 | Seite 2 | IP Phone Forum.
In 2017, this blog post [Wayback/Archive] fritzcap – VoIP-Telefongespräche mitschneiden und speichern leicht gemacht – Antary got quite some attraction, which was cool.
After that, I did some minimal modifications undoing tiny bits of the work bor2tom did (he broke the configurability of the Fritz!Box address), adding support for non-root Fritz!Box users, support for MacOS, logging of exceptions in all threads, logging for the common mistake that monitoring is enabled but capturing is not (and fix errors durig this combination), parameters for --show_interfaces and --cap_interface (so you can specify on which network interface to capture packets: ideal when the Fritz!Box is not configured as a router/modem, but as a switch), and a README.md document, the old Google Code project description as GoogleCode-README.md and a list of common Fritz!Box interfaces you can capture at fritzcap-interfaces-table.md.
Last year, in 2021, after all metastasised rectum cancer procedures were done and I hade a bit energy to go through backlogs, I put the project on hold.
This year, in 2022, I merged a pull-request for a regex fix, and asked for help.
Calls for help
My first call for help was in [Wayback/Archive] caller / dialled number · Issue #29 · jpluimers/fritzcap.
The second in Seeking contact (and new maintainers for fritzcap) · Issue #1 · J-Gras/fritz-capture.
The third in the forum: [Wayback/Archive] fritzcap: Tool für Etherreal Trace und Audiodaten-Extraktion v2.0 | Seite 24 | IP Phone Forum
Hopefully together with this blog post, some will take over maintenance.
Project links
- Project / README.md:
- [Wayback/Archive] jpluimers/fritzcap: Fork of elpatron68/fritzcap which was previously automatically exported from code.google.com/p/fritzcap
- [Wayback/Archive] fritzcap/README.md at master · jpluimers/fritzcap
- [Wayback/Archive] fritzcap/GoogleCode-README.md at master · jpluimers/fritzcap
- [Wayback/Archive] fritzcap/fritzcap-interfaces-table.md at master · jpluimers/fritzcap
- Issues: [Wayback/Archive] Issues · jpluimers/fritzcap
- Forks that are at the time of writing: [Wayback/Archive] Forks · jpluimers/fritzcap
- Original (unmaintained):
- [Wayback/Archive] Google Code Archive – Long-term storage for Google Code Project Hosting.
- [Wayback/Archive] elpatron68/fritzcap: Automatically exported from code.google.com/p/fritzcap (which has the Google Code issues that regrettably did not move over during my forking)
- Ahead of the current repository or still maintained:
- Unmaintained:
- [Wayback/Archive] franzfroemel/fritzcap: Fork of elpatron68/fritzcap which was previously automatically exported from code.google.com/p/fritzcap
- [Wayback/Archive] gmke/fritzcap: Fork of elpatron68/fritzcap which was previously automatically exported from code.google.com/p/fritzcap
- [Wayback/Archive] JackSlaterIV/fritzcap: Fork of elpatron68/fritzcap which was previously automatically exported from code.google.com/p/fritzcap
- [Wayback/Archive] jochen-01/fritzcap: Fork of elpatron68/fritzcap which was previously automatically exported from code.google.com/p/fritzcap
- [Wayback/Archive] mnezor/fritzcap: Fork of elpatron68/fritzcap which was previously automatically exported from code.google.com/p/fritzcap
- [Wayback/Archive] phoffi/fritzcap: Fork of elpatron68/fritzcap which was previously automatically exported from code.google.com/p/fritzcap
- [Wayback/Archive] rksm/fritzcap: Fork of elpatron68/fritzcap which was previously automatically exported from code.google.com/p/fritzcap
- [Wayback/Archive] Thofie0/fritzcap-1: Fork of elpatron68/fritzcap which was previously automatically exported from code.google.com/p/fritzcap
- [Wayback/Archive] voteforpresident/fritzcap: Fork of elpatron68/fritzcap which was previously automatically exported from code.google.com/p/fritzcap
- Original (unmaintained):
Some notes
Some goals (these need to go into the issues):
- Better documentation
- on the configuration file parameters, see
- [Wayback/Archive] fritzcap: Tool für Etherreal Trace und Audiodaten-Extraktion v2.0 | Seite 17 | IP Phone Forum – #330
In der fritzcap.py steht ganz einfach drin:
Code:# set the defaults defaults = {"capture_files": False, "decode_files": None, "monitor_calls": False,hier kann man weiter analysieren das bei decode_files folgendes geprüft wird:
Code:if (len(args.decode_files) > 0): # there is at least one file to decode throw the command line parameter. # Decode all the files for file in args.decode_files: work_queue.put(file)und hier ist wieder ein Fehler im weiteren Verlauf und der Übergabe der work_queue.put(file) . Du kannst ein decode-File angeben, aber was bringt das? Ob das decode-File /tmp/irgendwas oder ixelbrixel heißt, ist doch nebensächlich. Das Resultat ist entscheidend und das funktioniert.
Wenn es nicht in der Config gestanden hätte, hättest du nicht mal gewußt das diese Funktion für das debugging existiert. ;-)PS: Hier sind die Funktionen beschrieben:
Code:main_args.add_argument('-c', '--capture_files', default=None, action='store_true', help='capture file/s. If the monitor option is not set, only one file will be captured') main_args.add_argument('-d', '--decode_files', nargs='*', metavar='file', type=str, help='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.') main_args.add_argument('-m', '--monitor_calls', default=None, action='store_true', help='start the call monitor mode. The CALL/RING/DISCONNECT events will be used to start/stop the capture automatically')Ich könnte jetzt wirklich beigehen und das fritzcap noch modifizieren und verbessern, schade wirklich, dass das Projekt eingestellt wurde. Der Urheber ist sogar hier im Forum angemeldet, war aber wohl seit Jahren nicht mehr da.
- [Wayback/Archive] fritzcap: Tool für Etherreal Trace und Audiodaten-Extraktion v2.0 | Seite 17 | IP Phone Forum – #330
- how to get more context information in the capture folders or files:
- [Wayback/Archive] fritzcap: Tool für Etherreal Trace und Audiodaten-Extraktion v2.0 | Seite 16 | IP Phone Forum – #312
Vergleich:
compile_str = r"(%\(((\w+).(\w+)\)))"=> falsch
compile_str = r"(%\(((\w+).(\w+))\))"=> richtigAlles abspeichern, neu starten und siehe da – erhalten wir beim nächsten Telefonat in der log_info_fritzcap.txt den Eintrag:
Code:Start capture (capture_file:'captures/017xxxxxxxxx/capture_20200215092920.cap').Funktioniert auch mit der cap_file Variable -> Aber VORSICHT! Wenn der Filename immer zb. die
dialed.numberist, wird das cap-file immer überschrieben.cap_folder = captures/%(caller.number)/%(tcaps.Y-m-d/H:M:S)/
cap_file = capture_%(tcaps.YmdHMS).cap
ergibt:
/captures/017xxxxx/2020-02-15/14:41:07/capture_20200215144107.capcap_folder = captures/%(caller.number)/%(tcaps.Y-m-d/H:M:S)/
cap_file = capture_%(dialed.number).cap
ergibt:
captures/017xxxxxxxxx/2020-02-15/14:44:26/capture_08xxxx.cap - [Wayback/Archive] fritzcap: Tool für Etherreal Trace und Audiodaten-Extraktion v2.0 | Seite 18 | IP Phone Forum – #352
in der fritzcap.conf findest du die Variablen: “cap_folder” und “cap_file”.
Dort kannst du festlegen, wie und wo was gespeichert wird.Nehmen wir mal folgende Daten an:
Datum: 12.01.2021
Uhrzeit: 16:01:23 Uhr
eingehender Anruf von Telefonnummer: 082411234567
Eigene Telefonnummer: 012211234567Standart ist:
cap_folder = captures/%(tcaps.Y-m-d/HMS)/ => speichert im Verzeichniscaptures/2021-01-12/160123/
cap_file = capture_%(caller.number).cap=> speichert im o.g. Verzeichnis dieDatei capture_082411234567.capcap_folder = captures/%(dialed.number)/%(callevent.name)/%(tcaps.Y-m-d/H-M-S)/=> speichert im Verzeichniscaptures/012211234567/RING/2021-01-12/16-01-23/
cap_file = capture_%(tcaps.Y-m-d-H-M-S)_%(callevent.name)_%(dialed.number)_%(caller.number).cap=> speichert im o.g. Verzeichnis die Dateicapture_2021-01-12-16-01-23_RING_012211234567_082411234567.capRING= Anruf von außen /CALL= Anruf nach draussenDatum: 12.01.2021
Uhrzeit: 16:01:23 Uhr
ausgehender Anruf an Telefonnummer: 082411234567
Eigene Telefonnummer: 012211234567cap_folder = captures/%(dialed.number)/%(callevent.name)/%(tcaps.Y-m-d/H-M-S)/=> speichert im Verzeichniscaptures/082411234567/CALL/2021-01-12/16-01-23/
cap_file = capture_%(tcaps.Y-m-d-H-M-S)_%(callevent.name)_%(dialed.number)_%(caller.number).cap=> speichert im o.g. Verzeichnis die Dateicapture_2021-01-12-16-01-23_CALL_082411234567_012211234567.capDer Zusammenstellung der Klassen-Namen z.B.
%(callevent.name)sind keine Grenzen gesetzt.Eine zusätzliche Datei mit Anruferinformationen ablegen ist möglich, aber ein höherer Aufwand, wäre aber machbar z.B. in der
capture_monitor.pyunter “def init_capture_file(self):“. - [Wayback/Archive] fritzcap: Tool für Etherreal Trace und Audiodaten-Extraktion v2.0 | Seite 18 | IP Phone Forum – #355
Hier: https://www.ip-phone-forum.de/threads/fritzcap-tool-für-etherreal-trace-und-audiodaten-extraktion-v2-0.232682/post-2358036 und den Beiträgen danach.
Bitte mal lesen, mindestens bis POST #317!Ersetzt bitte mal die
core/string_helper.pyund diecore/capture_monitor.py. Ich glaube die zwei hatte ich damals korrigiert.
- [Wayback/Archive] fritzcap: Tool für Etherreal Trace und Audiodaten-Extraktion v2.0 | Seite 16 | IP Phone Forum – #312
- more examples
- instructions to run as a
- Linux service (see for instance [Wayback/Archive] fritzcap: Tool für Etherreal Trace und Audiodaten-Extraktion v2.0 | Seite 19 | IP Phone Forum – #370)
- or Windows service
- explain codec and encryption support (currently there is only the G.711 codec; there won’t be encryption support as that is impossible without having private keys used in the VoIP server, see [Archive] How do I decode Srtp in Wireshark? – Quora and[Wayback/Archive] Frequently Asked Questions :: Zoiper – How to decode SIP over TLS with Wireshark and Decrypting SDES Protected SRTP Stream:
- Decode TLS
First you need the private key used by you server.
…
- Obtain the keys and an RTP stream for decryption
- Decrypt the RTP stream with rtp_decoder (cisco libsrtp module from GitHub)
- Decode TLS
- document the most uses
--cap_interfacecandidates:- documenting them is kind of hard as a post like [Wayback/Archive] [Frage] – Looking for input on Fritz!Box capture interfaces | IP Phone Forum gives zero response.
2-1on most routers (see [Wayback/Archive] fritzcap: Tool für Etherreal Trace und Audiodaten-Extraktion v2.0 | Seite 24 | IP Phone Forum:
fritzcap.py (...) --cap_interface 2-1 (...)1-lanwhen configured as a switch, see [Wayback/Archive] File captured but no Voip traffic inside · Issue #30 · jpluimers/fritzcap – comment
Sometimes you need
1-lan, for instance when your Fritz!Box is configured as switch instead of router. I have that, so I use--cap_interface 1-lanthere. But before that, the Fritz!Box was a router, and I had to use--cap_interface 2-1.1-eth0- [Wayback/Archive] fritzcap – VoIP-Telefongespräche mitschneiden und speichern leicht gemacht – Antary comment:
fritzcap.py --capture_files --decode_files --cap_interface 1-eth0 --monitor_calls --box_name 192.168.178.1 --password foobar - [Wayback/Archive] fritzcap: Tool für Etherreal Trace und Audiodaten-Extraktion v2.0 | Seite 17 | IP Phone Forum – #333
daran dann über LAN 1 eine 7490 als Telefonanlage in der dann mehrere sip nummern liegen
…
das telefon ist in der 7490 (192.68.179.3) eingetragen.
…
wow.. ich habs
wenn es über einen netzwerkport in das modem geht: –cap_interface 1-eth0 hinter dem passwort anhängen ! Es werden alle 4 Dateien erzeugt.
- [Wayback/Archive] fritzcap – VoIP-Telefongespräche mitschneiden und speichern leicht gemacht – Antary comment:
- Document where you can view which codec was used; in Fritz!OS 7.x on my 7490 device this is under:
- English:
Telephony->Telephone Numbers->Voice Transmission - German:
Telefonie->Eigene Rufnummern->Sprachübertragung
- English:
- Document where to change VoIP protocol settings: [Wayback/Archive] fritzcap: Tool für Etherreal Trace und Audiodaten-Extraktion v2.0 | Seite 23 | IP Phone Forum – #449
Bei mir klappt es jetzt mit Telekom – ohne Modifikationen an fritzcap.
Ich musste nur einmal den Anbieter von Telekom auf „manuell“ unstellen und die auf gelb markierte Einstellung ändern!<<
Media Protocol=RTP/AVP>>
- on the configuration file parameters, see
- Upgrade to more modern Python, which might be easier than I anticipated:
- [Wayback/Archive] [Info] – new fritzcap.py version 2.3 | Seite 2 | IP Phone Forum – #23
gestern auf bullseye migriert und prompt in die Falle gelaufen. Mit python3 lief es nicht mehr. Aber mit
2to3den Code migriert und die restlichen Fehlermeldungen abgearbeitet und es tat wieder. Das waren nur Typwandlungen vonstrnachbyteoder umgekehrt. In Python 2 war das noch eins. Ich habe null Ahnung von Python aber einfaches googlen der Fehlermeldungen brachte schon die Lösung.apt install 2to3
apt install python3-lib2to3
apt install python3-toolzcd fritzcap-master; 2to3 . -wstr.encode()oderbytes()wo nötig
- [Wayback/Archive] [Info] – new fritzcap.py version 2.3 | Seite 2 | IP Phone Forum – #23
- More robust:
- it crashes every now and then, and should be able to recover from that, see for instance
- [Wayback/Archive] fritzcap: Tool für Etherreal Trace und Audiodaten-Extraktion v2.0 | Seite 18 | IP Phone Forum – #344
…
—> Das sieht für mich danach aus, wie wenn die Verbindung PC zur FritzBox gestört wäre …. war sie aber nicht. Oder die Fritzbox sagt irgendwann “ich will nicht mehr. Schluß. Ende.” – aber sowas würde ich eher nach einer immer festen Zeitspanne erwarten.
Ich habe nirgendwo einen Parameter gefunden, um eine Art time-out-Wert zu erhöhen – außer in
call_monitor.py:line = line + self.tn.read_until("\n", timeout=5) # Wait until one line data was readed from the telnet connection.Den Wert 5 habe ich testweise mal auf 35 erhöht – keine sichtbare Besserung. In der Box selber kann man (z.B. auf der Seite “Paketmitschnitt”) auch nichts einstellen.
…
1. Hat jemand auch schon mal diesen “Fehler” gehabt – und evtl. eine Abhilfe gefunden? Liegt es vielleicht am FritzOS 7.01 ?
2. Gibt es eine Möglichkeit, Fritzcap so zu starten, daß es sich nach einem solchen Fehler wieder von alleine neu startet?
3. Gibt es eine Möglichkeit, Fritzcap so zu starten, daß es sich nach z.B. 2 Stunden wieder automatisch beendet?
- [Wayback/Archive] fritzcap: Tool für Etherreal Trace und Audiodaten-Extraktion v2.0 | Seite 18 | IP Phone Forum – #344
- when the network connection is flaky, it keeps running but does not capture
- Fix G.711 support for missing RTP protocol entries,
- see these posts
- [Wayback/Archive] fritzcap: Tool für Etherreal Trace und Audiodaten-Extraktion v2.0 | Seite 21 | IP Phone Forum – #406
- [Wayback/Archive] fritzcap: Tool für Etherreal Trace und Audiodaten-Extraktion v2.0 | Seite 18 | IP Phone Forum – #346
- [Wayback/Archive] fritzcap: Tool für Etherreal Trace und Audiodaten-Extraktion v2.0 | Seite 18 | IP Phone Forum – #349
- [Wayback/Archive] fritzcap: Tool für Etherreal Trace und Audiodaten-Extraktion v2.0 | Seite 17 | IP Phone Forum – #332
- [Wayback/Archive] Network traffic: Data impact calculation, protocols G.711, G.729, G.723a, G.723b
- or support
cap2wavfrom- [Wayback/Archive] fritzcap: Tool für Etherreal Trace und Audiodaten-Extraktion v2.0 | Seite 15 | IP Phone Forum – post #293 / [Wayback/Archive]
- “cap2wav” – Google Search
- [Wayback/Archive] fritzcap: Tool für Etherreal Trace und Audiodaten-Extraktion v2.0 | Seite 15 | IP Phone Forum – #298
- there are so many audio codecs, but FFmpeg supports virtually all of them according to Comparison of audio coding formats – Wikipedia
- see these posts
- it crashes every now and then, and should be able to recover from that, see for instance
- I am ambivalent about Docker support, though there seems to be an image as per [Wayback/Archive] [Info] – new fritzcap.py version 2.3 | IP Phone Forum – #20
I have found this one: https://hub.docker.com/r/ralph/fritzcap-docker
- Take patches and ideas from the forum (requires 20+ pages of forum browsing) from [Wayback/Archive] fritzcap: Tool für Etherreal Trace und Audiodaten-Extraktion v2.0 | IP Phone Forum – page 1 onwards, including
- Numbering fix?
- [Wayback/Archive] fritzcap: Tool für Etherreal Trace und Audiodaten-Extraktion v2.0 | Seite 17 | IP Phone Forum – #326
- Username handling (might solve some SID=00000000 errors): [Wayback/Archive] fritzcap: Tool für Etherreal Trace und Audiodaten-Extraktion v2.0 | Seite 19 #363 | IP Phone Forum
Okay, hab es gerade geprüft und nachvollzogen.
In fritzcap.py – Zeile 131 den Eintrag auf:main_args.add_argument('-u', '--username', default=None, metavar='username', type=str, help='the username to login to the box (Default:\'root\')')und in der fritzbox.conf keine Anführungszeichen verwenden.
password = ichBinGeheim username = blahdefaults = { "name": "wert", ... }überschreiben nur Werte, die in der .conf nicht gesetzt werden.
- Seek connections to other related projects listed at [Wayback/Archive] Capture-Projects – BoxMatrix, especially these Python written ones:
- Motivate people to put support requests only on GitHub, for instance [Archive] Jim on Twitter: “@jpluimers Is there a chance you can possibly help out with an issue with fritzcap?” / Twitter.
–jeroen






Leave a comment