*UDP Port (4729) Conflict Between SIMTrace2 and pySim*
Hello community/admin,
I am experiencing an issue while using *SIMTrace2* and *pySim* to sniff and analyze SIM card communication. Below are the details: ------------------------------ *1. When SIMTrace2 Sniff is Turned Off*
I run the following command:
bash pySim-trace.py gsmtap-udp
*Output*:
plaintext Copy code INFO root: Opening source gsmtap-udp... Detected UICC Add-on "SIM" Detected UICC Add-on "GSM-R" Detected UICC Add-on "RUIM" Can't read AIDs from SIM -- 'list' object has no attribute 'lower' warning: EF.DIR seems to be empty! ADF.ECASD: a0000005591010ffffffff8900000200 ADF.ISD-R: a0000005591010ffffffff8900000100 ISIM: a0000000871004 USIM: a0000000871002 INFO root: Entering main loop...
When I check the UDP port (4729) usage:
bash sudo lsof -i :4729
*Output*:
plaintext COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME python3 198340 jun 4u IPv4 301846 0t0 UDP localhost:4729
------------------------------ *2. When SIMTrace2 Sniff is Turned On*
I run the following command:
bash simtrace2-sniff
*Output*:
plaintext simtrace2-sniff - Phone-SIM card communication sniffer (C) 2010-2017 by Harald Welte laforge@gnumonks.org (C) 2018 by Kevin Redon kredon@sysmocom.de
Using USB device 1d50:60e3 Addr=46, Path=1-5, Cfg=1, Intf=0, Alt=0: 255/1/0 (SIMtrace Sniffer) Entering main loop ATR: 3b 9f 96 80 1f c7 80 31 e0 73 fe 21 11 57 86 81 27 86 98 60 58 ec PPS: ff 00 ff TPDU: a0 a4 00 00 02 7f 20 9f 17 TPDU: a0 c0 00 00 17 00 00 00 00 7f 20 02 00 00 00 00 00 0a 93 00 1c 04 00 83 8a 83 8a 00 90 00
When I check the UDP port (4729) usage:
bash sudo lsof -i :4729
*Output*:
plaintext COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME simtrace2 198351 jun 7u IPv4 308389 0t0 UDP localhost:36190->localhost:4729 simtrace2 198351 jun 8u IPv4 308390 0t0 UDP localhost:4729
------------------------------ *UDP Port (4729) Conflict Between SIMTrace2 and pySim*
Hello community/admin,
I am experiencing an issue while using *SIMTrace2* and *pySim* to sniff and analyze SIM card communication. Below are the details: ------------------------------ *1. When SIMTrace2 Sniff is Turned Off*
I run the following command:
bash Copy code /usr/src/pysim/pySim-trace.py gsmtap-udp
*Output*:
plaintext Copy code INFO root: Opening source gsmtap-udp... Detected UICC Add-on "SIM" Detected UICC Add-on "GSM-R" Detected UICC Add-on "RUIM" Can't read AIDs from SIM -- 'list' object has no attribute 'lower' warning: EF.DIR seems to be empty! ADF.ECASD: a0000005591010ffffffff8900000200 ADF.ISD-R: a0000005591010ffffffff8900000100 ISIM: a0000000871004 USIM: a0000000871002 INFO root: Entering main loop...
When I check the UDP port (4729) usage:
bash sudo lsof -i :4729
*Output*:
plaintext COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME python3 198340 jun 4u IPv4 301846 0t0 UDP localhost:4729
------------------------------ *2. When SIMTrace2 Sniff is Turned On*
I run the following command:
bash simtrace2-sniff
*Output*:
plaintext simtrace2-sniff - Phone-SIM card communication sniffer (C) 2010-2017 by Harald Welte laforge@gnumonks.org (C) 2018 by Kevin Redon kredon@sysmocom.de
Using USB device 1d50:60e3 Addr=46, Path=1-5, Cfg=1, Intf=0, Alt=0: 255/1/0 (SIMtrace Sniffer) Entering main loop ATR: 3b 9f 96 80 1f c7 80 31 e0 73 fe 21 11 57 86 81 27 86 98 60 58 ec PPS: ff 00 ff TPDU: a0 a4 00 00 02 7f 20 9f 17 TPDU: a0 c0 00 00 17 00 00 00 00 7f 20 02 00 00 00 00 00 0a 93 00 1c 04 00 83 8a 83 8a 00 90 00
When I check the UDP port (4729) usage:
bash sudo lsof -i :4729
*Output*:
plaintext COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME simtrace2 198351 jun 7u IPv4 308389 0t0 UDP localhost:36190->localhost:4729 simtrace2 198351 jun 8u IPv4 308390 0t0 UDP localhost:4729
------------------------------ *3. When Running SIMTrace2 Sniff and pySim-trace.py Together*
If I try to run both *SIMTrace2 sniff* and *pySim-trace.py gsmtap-udp* simultaneously, I get the following error from *pySim*:
plaintext jun@jun-RDR:pySim-trace.py gsmtap-udp INFO root: Opening source gsmtap-udp... Traceback (most recent call last): File "pySim-trace.py", line 199, in <module> s = GsmtapApduSource(opts.bind_ip, opts.bind_port) File "pysim/pySim/apdu_source/gsmtap.py", line 44, in __init__ self.gsmtap = GsmtapReceiver(bind_ip, bind_port) File "/home/jun/.local/lib/python3.10/site-packages/osmocom/gsmtap.py", line 207, in __init__ self.sock.bind((self.bind_ip, self.bind_port)) OSError: [Errno 98] Address already in use
------------------------------ *Main Issue*
1. When *SIMTrace2 sniff* is running, it occupies UDP port 4729, preventing *pySim* from using the same port. 2. When SIMTrace2 sniff is stopped, *pySim* can access UDP port 4729 but fails to decode data, showing the following errors:
plaintext Can't read AIDs from SIM -- 'list' object has no attribute 'lower' warning: EF.DIR seems to be empty!
3. If I try to run both tools at the same time, *pySim* crashes with the error [Errno 98] Address already in use.
------------------------------ *Request for Help*
- Has anyone experienced a similar issue when running *SIMTrace2* and *pySim* together? - How can I avoid the port conflict and ensure both tools can run simultaneously? - What could cause the decoding error and the warning about an empty EF.DIR in *pySim*?
Any insights or advice would be greatly appreciated. Thank you!
On Sun, Jan 12, 2025 at 10:28:14AM -0000, bjgjuntak@gmail.com wrote:
Help me 🙏🙏
Please refrain from sending "reminders" - especially not on the same day.
You are asking somebody else [whom you don't know and who has no obligation to help you] to spend their spare time to help you - and that on a Sunday. So please allow at least for a few days for a response, before sending reminders.
Also, the same question has been brought up in the sysmocom support ticket system and in the osmocom redmine. Sending the same topic to many destinations will just increase the amount of work for people responding, rather than responding to your question.
Follow-up has been provided in https://osmocom.org/issues/6698