Skip to content

Fixed "ImportError: cannot import name Raw" when using scapy >=2.40#2

Open
gpaliot-eurosec wants to merge 1 commit intogelim:masterfrom
gpaliot-eurosec:scapy24
Open

Fixed "ImportError: cannot import name Raw" when using scapy >=2.40#2
gpaliot-eurosec wants to merge 1 commit intogelim:masterfrom
gpaliot-eurosec:scapy24

Conversation

@gpaliot-eurosec
Copy link

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.

@martingalloar
Copy link

Opened a similar PR in chipik/SAP_GW_RCE_exploit#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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants