问题
I am trying to craft and manipulate some http packets with scapy and python 3. I have been unable to get http layer support to work.
I am using PyCharm for package management. I am on a Kali Linux virtual box. I have installed different version of scapy through PyCharm to no avail.
from scapy.all import *
explore(scapy.layers.http)
I would expect the results shown in the documentation (https://scapy.readthedocs.io/en/latest/layers/http.html) but alas all I get is the following error message.
File "<ipython-input-3-1b9771949c77>", line 1, in <module>
explore(scapy.layers.http)
AttributeError: module 'scapy.layers' has no attribute 'http'
Please help, this is driving me absolutely insane. I've also tried it with conda on my main machine and gotten the same problem.
回答1:
The HTTP layer is currently not loaded by default (because it wasn't previously installed by default). You will need to load it manually via:
load_layers("http")
Or
from scapy.layers.http import *
Note that scapy-http should NOT be installed. See the disclaimer https://github.com/invernizzi/scapy-http (it will soon be deprecated on PyPI too)
来源:https://stackoverflow.com/questions/57447123/cannot-get-scapy-2-4-3-http-layer-support-to-work