Spinlogic / AMR-WB_extractor

Extracts AMR / AMR-WB frames from RTP inside PCAP files and builds a .amr file that complies with the storage format in RFC4867
MIT License
14 stars 12 forks source link

AttributeError: payload_type #1

Closed nagangu closed 2 years ago

nagangu commented 2 years ago

The *.pcap file processed below is an RTP stream filtered out as the outbound and inbound SSRC streams of the AMR VOIP call. It is believed to be a valid AMR flow, but getting the processing errors.

C=AMR:

root@garaz:/media/sf_05_VMs/tools/AMR-WB_extractor-master# python3 pcap_parser.py -i rtp-only.pcap -o amr-hiccups.3ga -c amr WARNING: No route found for IPv6 destination :: (no default route?). This affects only IPv6 Number of packets read from pcap: 13456 Traceback (most recent call last): File "pcap_parser.py", line 377, in ptype = rtp.payload_type File "/usr/lib/python3/dist-packages/scapy/packet.py", line 199, in getattr fld,v = self.getfield_and_val(attr) File "/usr/lib/python3/dist-packages/scapy/packet.py", line 195, in getfield_and_val return self.payload.getfield_and_val(attr) File "/usr/lib/python3/dist-packages/scapy/packet.py", line 195, in getfield_and_val return self.payload.getfield_and_val(attr) File "/usr/lib/python3/dist-packages/scapy/packet.py", line 1108, in getfield_and_val raise AttributeError(attr) AttributeError: payload_type

C=AMR-WB:

root@garaz:/media/sf_05_VMs/tools/AMR-WB_extractor-master# python3 pcap_parser.py -i rtp-only.pcap -o amr-hiccups.3ga -c amr-wb WARNING: No route found for IPv6 destination :: (no default route?). This affects only IPv6 Number of packets read from pcap: 13456 Traceback (most recent call last): File "pcap_parser.py", line 377, in ptype = rtp.payload_type File "/usr/lib/python3/dist-packages/scapy/packet.py", line 199, in getattr fld,v = self.getfield_and_val(attr) File "/usr/lib/python3/dist-packages/scapy/packet.py", line 195, in getfield_and_val return self.payload.getfield_and_val(attr) File "/usr/lib/python3/dist-packages/scapy/packet.py", line 195, in getfield_and_val return self.payload.getfield_and_val(attr) File "/usr/lib/python3/dist-packages/scapy/packet.py", line 1108, in getfield_and_val raise AttributeError(attr) AttributeError: payload_type

rtp-only.zip

Spinlogic commented 2 years ago

Seems to be AMR-WB. Probably the code got broken with some scapy update. Will check.

Spinlogic commented 2 years ago

No problem to decode the amr-wb audio (attached). audio.zip

I tested it on Kali Linux setup running python 3.9.7 and pipenv. I installed the latest versions of scapy and bitarray with:

pipenv install bitarray
pipenv install scapy

then executed:

python pcap_parser.py -i rtp-only.pcap -o audio.amr -c wb-amr -f ietf

The audio inside the audio.amr file is very clear when listening it with VLC.

I will close this close this issue if there are no further comments in the next few days.

nagangu commented 2 years ago

Thank you for checking.

Probably my virtualized Ubuntu Linux and python3+bitarray+scapy taken from its default repository are a bit old.

I'm still getting the same error, using the verified syntax.

/L.

@.***:/media/sf_05_VMs/tools/AMR-WB_extractor-master# hostnamectl Static hostname: garaz Icon name: computer-vm Chassis: vm Machine ID: 62a1b9e0858d4dfe8f9e63dda31d89b0 Boot ID: c41157e689204c8f9e5f45da0f5c9309 Virtualization: oracle Operating System: Ubuntu 18.04.1 LTS Kernel: Linux 4.15.0-162-generic Architecture: x86-64

..........

@.***:/media/sf_05_VMs/tools/AMR-WB_extractor-master# python3 Python 3.6.9 (default, Jan 26 2021, 15:33:00) [GCC 8.4.0] on linux Type "help", "copyright", "credits" or "license" for more information.

...........

@.***:/media/sf_05_VMs/tools/AMR-WB_extractor-master# python3 pcap_parser.py -i rtp-only.pcap -o retry-2.amr -c amr-wb -f ietf WARNING: No route found for IPv6 destination :: (no default route?). This affects only IPv6 Number of packets read from pcap: 13456 Traceback (most recent call last): File "pcap_parser.py", line 377, in ptype = rtp.payload_type File "/usr/lib/python3/dist-packages/scapy/packet.py", line 199, in getattr fld,v = self.getfield_and_val(attr) File "/usr/lib/python3/dist-packages/scapy/packet.py", line 195, in getfield_and_val return self.payload.getfield_and_val(attr) File "/usr/lib/python3/dist-packages/scapy/packet.py", line 195, in getfield_and_val return self.payload.getfield_and_val(attr) File "/usr/lib/python3/dist-packages/scapy/packet.py", line 1108, in getfield_and_val raise AttributeError(attr) AttributeError: payload_type

pi 10. 12. 2021 o 21:13 Juan Noguera @.***> napísal(a):

No problem to decode the amr-wb audio (attached). audio.zip https://github.com/Spinlogic/AMR-WB_extractor/files/7695191/audio.zip

I tested it on Kali Linux setup running python 3.9.7 and pipenv. I installed the latest versions of scapy and bitarray with:

pipenv install bitarray pipenv install scapy

then executed:

python pcap_parser.py -i rtp-only.pcap -o audio.amr -c wb-amr -f ietf

The audio inside the audio.amr file is very clear when listening it with VLC.

I will close this close this issue if there are no further comments in the next few days.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Spinlogic/AMR-WB_extractor/issues/1#issuecomment-991264043, or unsubscribe https://github.com/notifications/unsubscribe-auth/AW2TI3TNGEGCSAOT7V2HJADUQJNNVANCNFSM5JT72FLA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

nagangu commented 2 years ago

Hallo Juan again,

eventually, I made it with the upgraded Ubuntu 20.04.3 LTS, python 3.8.10 and bitarray and scapy installed over the the pipenv.

Thank you for your inspiring advice.

Case can be closed, the utility works well.

BR / Libor

python pcap_parser.py -i rtp-only.pcap -o audio-2.amr -c amr-wb -f ietf

Number of packets read from pcap: 13456 Codec: amr-wb, Total: 13456 , Valid: 11341 , Bad: 0 (AMR-WB_extractor-master-_R-PxNON)

ut 14. 12. 2021 o 17:01 Rayball Nagangu @.***> napísal(a):

Thank you for checking.

Probably my virtualized Ubuntu Linux and python3+bitarray+scapy taken from its default repository are a bit old.

I'm still getting the same error, using the verified syntax.

/L.

@.***:/media/sf_05_VMs/tools/AMR-WB_extractor-master# hostnamectl Static hostname: garaz Icon name: computer-vm Chassis: vm Machine ID: 62a1b9e0858d4dfe8f9e63dda31d89b0 Boot ID: c41157e689204c8f9e5f45da0f5c9309 Virtualization: oracle Operating System: Ubuntu 18.04.1 LTS Kernel: Linux 4.15.0-162-generic Architecture: x86-64

..........

@.***:/media/sf_05_VMs/tools/AMR-WB_extractor-master# python3 Python 3.6.9 (default, Jan 26 2021, 15:33:00) [GCC 8.4.0] on linux Type "help", "copyright", "credits" or "license" for more information.

...........

@.***:/media/sf_05_VMs/tools/AMR-WB_extractor-master# python3 pcap_parser.py -i rtp-only.pcap -o retry-2.amr -c amr-wb -f ietf WARNING: No route found for IPv6 destination :: (no default route?). This affects only IPv6 Number of packets read from pcap: 13456 Traceback (most recent call last): File "pcap_parser.py", line 377, in ptype = rtp.payload_type File "/usr/lib/python3/dist-packages/scapy/packet.py", line 199, in getattr fld,v = self.getfield_and_val(attr) File "/usr/lib/python3/dist-packages/scapy/packet.py", line 195, in getfield_and_val return self.payload.getfield_and_val(attr) File "/usr/lib/python3/dist-packages/scapy/packet.py", line 195, in getfield_and_val return self.payload.getfield_and_val(attr) File "/usr/lib/python3/dist-packages/scapy/packet.py", line 1108, in getfield_and_val raise AttributeError(attr) AttributeError: payload_type

pi 10. 12. 2021 o 21:13 Juan Noguera @.***> napísal(a):

No problem to decode the amr-wb audio (attached). audio.zip https://github.com/Spinlogic/AMR-WB_extractor/files/7695191/audio.zip

I tested it on Kali Linux setup running python 3.9.7 and pipenv. I installed the latest versions of scapy and bitarray with:

pipenv install bitarray pipenv install scapy

then executed:

python pcap_parser.py -i rtp-only.pcap -o audio.amr -c wb-amr -f ietf

The audio inside the audio.amr file is very clear when listening it with VLC.

I will close this close this issue if there are no further comments in the next few days.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Spinlogic/AMR-WB_extractor/issues/1#issuecomment-991264043, or unsubscribe https://github.com/notifications/unsubscribe-auth/AW2TI3TNGEGCSAOT7V2HJADUQJNNVANCNFSM5JT72FLA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.