Scapy HTTP层原始转换不正确

时间:2018-07-23 10:35:05

标签: python http scapy

当我对HTTP层执行raw()函数,然后对结果执行HTTP()函数时,其结果与原始HTTP层不同。

为简单起见,HTTP(raw(pack)) == pack[HTTP]返回False

例如,pack[HTTP].show()打印

###[ HTTP ]### ###[ HTTP Response ]### Status-Line= 'HTTP/1.1 301 Moved Permanently' Accept-Ranges= None Age = None E-Tag = None Location = 'http://www.bankfordata.com:2030/roundcube/' Proxy-Authenticate= None Retry-After= None Server = 'cwpsrv' Vary = None WWW-Authenticate= None Cache-Control= None Connection= 'keep-alive' Date = 'Mon, 23 Jul 2018 04:27:49 GMT' Pragma = None Trailer = None Transfer-Encoding= None Upgrade = None Via = None Warning = None Keep-Alive= None Allow = None Content-Encoding= None Content-Language= None Content-Length= '179' Content-Location= None Content-MD5= None Content-Range= None Content-Type= 'text/html' Expires = None Last-Modified= None Headers = 'Content-Length: 179\r\nServer: cwpsrv\r\nConnection: keep-alive\r\nLocation: http://www.bankfordata.com:2030/roundcube/\r\nDate: Mon, 23 Jul 2018 04:27:49 GMT\r\nContent-Type: text/html' Additional-Headers= None

另一方面,HTTP(raw(pack)).show()打印

###[ HTTP ]### ###[ HTTP Response ]### Status-Line= 'HTTP/1.1 301 Moved Permanently Content-Length: 179' Accept-Ranges= None Age = None E-Tag = None Location = 'http://www.bankfordata.com:2030/roundcube/' Proxy-Authenticate= None Retry-After= None Server = 'cwpsrv' Vary = None WWW-Authenticate= None Cache-Control= None Connection= 'keep-alive' Date = 'Mon, 23 Jul 2018 04:27:49 GMT' Pragma = None Trailer = None Transfer-Encoding= None Upgrade = None Via = None Warning = None Keep-Alive= None Allow = None Content-Encoding= None Content-Language= None Content-Length= None Content-Location= None Content-MD5= None Content-Range= None Content-Type= 'text/html' Expires = None Last-Modified= None Headers = 'Date: Mon, 23 Jul 2018 04:27:49 GMT\r\nConnection: keep-alive\r\nContent-Type: text/html\r\nLocation: http://www.bankfordata.com:2030/roundcube/\r\nServer: cwpsrv' Additional-Headers= None

为什么Content-Length标头不正确?

0 个答案:

没有答案