scapy.layers.http

HTTP 1.0 layer.

Load using:

from scapy.layers.http import *

Or (console only):

>>> load_layer("http")

Note that this layer ISN'T loaded by default, as quite experimental for now.

To follow HTTP packets streams = group packets together to get the whole request/answer, use TCPSession as:

>>> sniff(session=TCPSession)  # Live on-the-flow session
>>> sniff(offline="./http_chunk.pcap", session=TCPSession)  # pcap

This will decode HTTP packets using Content_Length or chunks, and will also decompress the packets when needed. Note: on failure, decompression will be ignored.

You can turn auto-decompression/auto-compression off with:

>>> conf.contribs["http"]["auto_compression"] = False

(Defaults to True)

class scapy.layers.http.HTTP(_pkt, /)[源代码]

基类:Packet

aliastypes
classmethod dispatch_hook(_pkt=None, *args, **kargs)[源代码]
fields_desc
guess_payload_class(payload)[源代码]

Decides if the payload is an HTTP Request or Response, or something else.

show_indent = 0
classmethod tcp_reassemble(data, metadata, _)[源代码]
class scapy.layers.http.HTTPRequest(_pkt, /, *, Method=b'GET', Path=b'/', Http_Version=b'HTTP/1.1', A_IM=None, Accept=None, Accept_Charset=None, Accept_Datetime=None, Accept_Encoding=None, Accept_Language=None, Access_Control_Request_Headers=None, Access_Control_Request_Method=None, Authorization=None, Cache_Control=None, Connection=None, Content_Length=None, Content_MD5=None, Content_Type=None, Cookie=None, DNT=None, Date=None, Expect=None, Forwarded=None, From=None, Front_End_Https=None, HTTP2_Settings=None, Host=None, If_Match=None, If_Modified_Since=None, If_None_Match=None, If_Range=None, If_Unmodified_Since=None, Keep_Alive=None, Max_Forwards=None, Origin=None, Permanent=None, Pragma=None, Proxy_Authorization=None, Proxy_Connection=None, Range=None, Referer=None, Save_Data=None, TE=None, Upgrade=None, Upgrade_Insecure_Requests=None, User_Agent=None, Via=None, Warning=None, X_ATT_DeviceId=None, X_Correlation_ID=None, X_Csrf_Token=None, X_Forwarded_For=None, X_Forwarded_Host=None, X_Forwarded_Proto=None, X_Http_Method_Override=None, X_Request_ID=None, X_Requested_With=None, X_UIDH=None, X_Wap_Profile=None, Unknown_Headers=None)[源代码]

基类:_HTTPContent

aliastypes
do_dissect(s)[源代码]

From the HTTP packet string, populate the scapy object

fields_desc
Display RFC-like schema
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             METHOD            |              PATH             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|          HTTP VERSION         |              A IM             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             ACCEPT            |         ACCEPT CHARSET        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|        ACCEPT DATETIME        |        ACCEPT ENCODING        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|        ACCEPT LANGUAGE        | ACCESS CONTROL REQUEST HEADERS|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| ACCESS CONTROL REQUEST METHOD |         AUTHORIZATION         |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|         CACHE CONTROL         |           CONNECTION          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|         CONTENT LENGTH        |          CONTENT MD5          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|          CONTENT TYPE         |             COOKIE            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|              DNT              |              DATE             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             EXPECT            |           FORWARDED           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|              FROM             |        FRONT END HTTPS        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|         HTTP2 SETTINGS        |              HOST             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|            IF MATCH           |       IF MODIFIED SINCE       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|         IF NONE MATCH         |            IF RANGE           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|      IF UNMODIFIED SINCE      |           KEEP ALIVE          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|          MAX FORWARDS         |             ORIGIN            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           PERMANENT           |             PRAGMA            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|      PROXY AUTHORIZATION      |        PROXY CONNECTION       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             RANGE             |            REFERER            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           SAVE DATA           |               TE              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|            UPGRADE            |   UPGRADE INSECURE REQUESTS   |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           USER AGENT          |              VIA              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|            WARNING            |         X ATT DEVICEID        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|        X CORRELATION ID       |          X CSRF TOKEN         |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|        X FORWARDED FOR        |        X FORWARDED HOST       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|       X FORWARDED PROTO       |     X HTTP METHOD OVERRIDE    |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|          X REQUEST ID         |        X REQUESTED WITH       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             X UIDH            |         X WAP PROFILE         |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|        UNKNOWN HEADERS        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                         Fig. HTTPRequest                         
HTTPRequest fields

Method

_HTTPHeaderField

b'GET'

Path

_HTTPHeaderField

b'/'

Http_Version

_HTTPHeaderField

b'HTTP/1.1'

A_IM

_HTTPHeaderField

None

Accept

_HTTPHeaderField

None

Accept_Charset

_HTTPHeaderField

None

Accept_Datetime

_HTTPHeaderField

None

Accept_Encoding

_HTTPHeaderField

None

Accept_Language

_HTTPHeaderField

None

Access_Control_Request_Headers

_HTTPHeaderField

None

Access_Control_Request_Method

_HTTPHeaderField

None

Authorization

_HTTPHeaderField

None

Cache_Control

_HTTPHeaderField

None

Connection

_HTTPHeaderField

None

Content_Length

_HTTPHeaderField

None

Content_MD5

_HTTPHeaderField

None

Content_Type

_HTTPHeaderField

None

Cookie

_HTTPHeaderField

None

DNT

_HTTPHeaderField

None

Date

_HTTPHeaderField

None

Expect

_HTTPHeaderField

None

Forwarded

_HTTPHeaderField

None

From

_HTTPHeaderField

None

Front_End_Https

_HTTPHeaderField

None

HTTP2_Settings

_HTTPHeaderField

None

Host

_HTTPHeaderField

None

If_Match

_HTTPHeaderField

None

If_Modified_Since

_HTTPHeaderField

None

If_None_Match

_HTTPHeaderField

None

If_Range

_HTTPHeaderField

None

If_Unmodified_Since

_HTTPHeaderField

None

Keep_Alive

_HTTPHeaderField

None

Max_Forwards

_HTTPHeaderField

None

Origin

_HTTPHeaderField

None

Permanent

_HTTPHeaderField

None

Pragma

_HTTPHeaderField

None

Proxy_Authorization

_HTTPHeaderField

None

Proxy_Connection

_HTTPHeaderField

None

Range

_HTTPHeaderField

None

Referer

_HTTPHeaderField

None

Save_Data

_HTTPHeaderField

None

TE

_HTTPHeaderField

None

Upgrade

_HTTPHeaderField

None

Upgrade_Insecure_Requests

_HTTPHeaderField

None

User_Agent

_HTTPHeaderField

None

Via

_HTTPHeaderField

None

Warning

_HTTPHeaderField

None

X_ATT_DeviceId

_HTTPHeaderField

None

X_Correlation_ID

_HTTPHeaderField

None

X_Csrf_Token

_HTTPHeaderField

None

X_Forwarded_For

_HTTPHeaderField

None

X_Forwarded_Host

_HTTPHeaderField

None

X_Forwarded_Proto

_HTTPHeaderField

None

X_Http_Method_Override

_HTTPHeaderField

None

X_Request_ID

_HTTPHeaderField

None

X_Requested_With

_HTTPHeaderField

None

X_UIDH

_HTTPHeaderField

None

X_Wap_Profile

_HTTPHeaderField

None

Unknown_Headers

_HTTPHeaderField

None

mysummary()[源代码]
class scapy.layers.http.HTTPResponse(_pkt, /, *, Http_Version=b'HTTP/1.1', Status_Code=b'200', Reason_Phrase=b'OK', Accept_Patch=None, Accept_Ranges=None, Access_Control_Allow_Credentials=None, Access_Control_Allow_Headers=None, Access_Control_Allow_Methods=None, Access_Control_Allow_Origin=None, Access_Control_Expose_Headers=None, Access_Control_Max_Age=None, Age=None, Allow=None, Alt_Svc=None, Cache_Control=None, Connection=None, Content_Disposition=None, Content_Encoding=None, Content_Language=None, Content_Length=None, Content_Location=None, Content_MD5=None, Content_Range=None, Content_Security_Policy=None, Content_Type=None, Date=None, Delta_Base=None, ETag=None, Expires=None, IM=None, Keep_Alive=None, Last_Modified=None, Link=None, Location=None, P3P=None, Permanent=None, Pragma=None, Proxy_Authenticate=None, Public_Key_Pins=None, Refresh=None, Retry_After=None, Server=None, Set_Cookie=None, Status=None, Strict_Transport_Security=None, Timing_Allow_Origin=None, Tk=None, Trailer=None, Transfer_Encoding=None, Upgrade=None, Vary=None, Via=None, WWW_Authenticate=None, Warning=None, X_Content_Duration=None, X_Content_Security_Policy=None, X_Content_Type_Options=None, X_Correlation_ID=None, X_Frame_Options=None, X_Powered_By=None, X_Request_ID=None, X_UA_Compatible=None, X_WebKit_CSP=None, X_XSS_Protection=None, Unknown_Headers=None)[源代码]

基类:_HTTPContent

aliastypes
answers(other)[源代码]
do_dissect(s)[源代码]

From the HTTP packet string, populate the scapy object

fields_desc
Display RFC-like schema
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|          HTTP VERSION         |          STATUS CODE          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|         REASON PHRASE         |          ACCEPT PATCH         |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|         ACCEPT RANGES         |ACCESS CONTROL ALLOW CREDENTIAL|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  ACCESS CONTROL ALLOW HEADERS |  ACCESS CONTROL ALLOW METHODS |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  ACCESS CONTROL ALLOW ORIGIN  | ACCESS CONTROL EXPOSE HEADERS |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     ACCESS CONTROL MAX AGE    |              AGE              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             ALLOW             |            ALT SVC            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|         CACHE CONTROL         |           CONNECTION          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|      CONTENT DISPOSITION      |        CONTENT ENCODING       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|        CONTENT LANGUAGE       |         CONTENT LENGTH        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|        CONTENT LOCATION       |          CONTENT MD5          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|         CONTENT RANGE         |    CONTENT SECURITY POLICY    |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|          CONTENT TYPE         |              DATE             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           DELTA BASE          |              ETAG             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|            EXPIRES            |               IM              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           KEEP ALIVE          |         LAST MODIFIED         |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|              LINK             |            LOCATION           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|              P3P              |           PERMANENT           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             PRAGMA            |       PROXY AUTHENTICATE      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|        PUBLIC KEY PINS        |            REFRESH            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|          RETRY AFTER          |             SERVER            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           SET COOKIE          |             STATUS            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|   STRICT TRANSPORT SECURITY   |      TIMING ALLOW ORIGIN      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|               TK              |            TRAILER            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|       TRANSFER ENCODING       |            UPGRADE            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|              VARY             |              VIA              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|        WWW AUTHENTICATE       |            WARNING            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|       X CONTENT DURATION      |   X CONTENT SECURITY POLICY   |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     X CONTENT TYPE OPTIONS    |        X CORRELATION ID       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|        X FRAME OPTIONS        |          X POWERED BY         |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|          X REQUEST ID         |        X UA COMPATIBLE        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|          X WEBKIT CSP         |        X XSS PROTECTION       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|        UNKNOWN HEADERS        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                        Fig. HTTPResponse                         
HTTPResponse fields

Http_Version

_HTTPHeaderField

b'HTTP/1.1'

Status_Code

_HTTPHeaderField

b'200'

Reason_Phrase

_HTTPHeaderField

b'OK'

Accept_Patch

_HTTPHeaderField

None

Accept_Ranges

_HTTPHeaderField

None

Access_Control_Allow_Credentials

_HTTPHeaderField

None

Access_Control_Allow_Headers

_HTTPHeaderField

None

Access_Control_Allow_Methods

_HTTPHeaderField

None

Access_Control_Allow_Origin

_HTTPHeaderField

None

Access_Control_Expose_Headers

_HTTPHeaderField

None

Access_Control_Max_Age

_HTTPHeaderField

None

Age

_HTTPHeaderField

None

Allow

_HTTPHeaderField

None

Alt_Svc

_HTTPHeaderField

None

Cache_Control

_HTTPHeaderField

None

Connection

_HTTPHeaderField

None

Content_Disposition

_HTTPHeaderField

None

Content_Encoding

_HTTPHeaderField

None

Content_Language

_HTTPHeaderField

None

Content_Length

_HTTPHeaderField

None

Content_Location

_HTTPHeaderField

None

Content_MD5

_HTTPHeaderField

None

Content_Range

_HTTPHeaderField

None

Content_Security_Policy

_HTTPHeaderField

None

Content_Type

_HTTPHeaderField

None

Date

_HTTPHeaderField

None

Delta_Base

_HTTPHeaderField

None

ETag

_HTTPHeaderField

None

Expires

_HTTPHeaderField

None

IM

_HTTPHeaderField

None

Keep_Alive

_HTTPHeaderField

None

Last_Modified

_HTTPHeaderField

None

Link

_HTTPHeaderField

None

Location

_HTTPHeaderField

None

P3P

_HTTPHeaderField

None

Permanent

_HTTPHeaderField

None

Pragma

_HTTPHeaderField

None

Proxy_Authenticate

_HTTPHeaderField

None

Public_Key_Pins

_HTTPHeaderField

None

Refresh

_HTTPHeaderField

None

Retry_After

_HTTPHeaderField

None

Server

_HTTPHeaderField

None

Set_Cookie

_HTTPHeaderField

None

Status

_HTTPHeaderField

None

Strict_Transport_Security

_HTTPHeaderField

None

Timing_Allow_Origin

_HTTPHeaderField

None

Tk

_HTTPHeaderField

None

Trailer

_HTTPHeaderField

None

Transfer_Encoding

_HTTPHeaderField

None

Upgrade

_HTTPHeaderField

None

Vary

_HTTPHeaderField

None

Via

_HTTPHeaderField

None

WWW_Authenticate

_HTTPHeaderField

None

Warning

_HTTPHeaderField

None

X_Content_Duration

_HTTPHeaderField

None

X_Content_Security_Policy

_HTTPHeaderField

None

X_Content_Type_Options

_HTTPHeaderField

None

X_Correlation_ID

_HTTPHeaderField

None

X_Frame_Options

_HTTPHeaderField

None

X_Powered_By

_HTTPHeaderField

None

X_Request_ID

_HTTPHeaderField

None

X_UA_Compatible

_HTTPHeaderField

None

X_WebKit_CSP

_HTTPHeaderField

None

X_XSS_Protection

_HTTPHeaderField

None

Unknown_Headers

_HTTPHeaderField

None

mysummary()[源代码]
scapy.layers.http.http_request(host, path='/', port=80, timeout=3, display=False, verbose=0, raw=False, iptables=False, iface=None, **headers)[源代码]

Util to perform an HTTP request, using the TCP_client.

参数:
  • host -- the host to connect to

  • path -- the path of the request (default /)

  • port -- the port (default 80)

  • timeout -- timeout before None is returned

  • display -- display the result in the default browser (default False)

  • raw -- opens a raw socket instead of going through the OS's TCP socket. Scapy will then use its own TCP client. Careful, the OS might cancel the TCP connection with RST.

  • iptables -- when raw is enabled, this calls iptables to temporarily prevent the OS from sending TCP RST to the host IP. On Linux, you'll almost certainly need this.

  • iface -- interface to use. Changing this turns on "raw"

  • headers -- any additional headers passed to the request

返回:

the HTTPResponse packet