Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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 pushed a commit to martingalloar/SAP_GW_RCE_exploit that referenced this pull request Aug 20, 2020
Similar to what was reported in gelim/sap_ms#2, in Scapy >= 2.4, the `Raw` class is no longer available in `scapy.layers.inet` and instead it should be imported from where it is defined `scapy.packet`.
@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