sap_ms
sap_ms copied to clipboard
Fixed "ImportError: cannot import name Raw" when using scapy >=2.40
Running the sap_ms* scripts with Scapy 2.4.3 gave me the following error:
$ ./sap_ms_monitor_storage.py
Traceback (most recent call last):
File "./sap_ms_monitor_storage.py", line 29, in <module>
from scapy.layers.inet import TCP,Raw
ImportError: cannot import name Raw
I can't pinpoint the change in Scapy which caused it, but guess it's the 2.4 release. Anyway, importing Raw from the scapy.packet module seems to fix the issue and the "try" statement should ensure backward compatibility with older versions, but I did not test that.
Opened a similar PR in https://github.com/chipik/SAP_GW_RCE_exploit/pull/4, but just wanted to mention that the Raw class was always defined in scapy.packet, so the try statement is not necessary in order to keep backwards compatibility, importing from there should be enough in all scapy versions.