spacecat
spacecat

Reputation: 148

Cannot get scapy 2.4.3 http layer support to work

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.

Upvotes: 2

Views: 2322

Answers (1)

Cukic0d
Cukic0d

Reputation: 5431

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:

from scapy.layers.http import *

Or (mostly if you're using scapy's shell):

load_layers("http")

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)

Upvotes: 4

Related Questions