以以下利用一段代碼讀取http數(shù)據(jù)包里的request內(nèi)容:
創(chuàng)新互聯(lián)建站2013年開創(chuàng)至今,先為下城等服務(wù)建站,下城等地企業(yè),進(jìn)行企業(yè)商務(wù)咨詢服務(wù)。為下城企業(yè)網(wǎng)站制作PC+手機(jī)+微官網(wǎng)三網(wǎng)同步一站式服務(wù)解決您的所有建站問題。
#!/usr/bin/env python import scapy_http.http as http from scapy.all import * def process_tcp_packet(packet): if not packet.haslayer(http.HTTPRequest): return http_layer = packet.getlayer(http.HTTPRequest) print http_layer.show() ip_layer = packet.getlayer(IP) print '\n{0[src]} just requested a {1[Method]} {1[Host]}{1[Path]}'.format(ip_layer.fields, http_layer.fields) sniff(filter='tcp and port 80',prn=process_tcp_packet)
運(yùn)行結(jié)果如下:
###[ HTTP Request ]###
Method = 'GET'
Path = '/'
Http-Version= 'HTTP/1.1'
Host = '192.168.32.142'
User-Agent= 'curl/7.60.0'
Accept = '*/*'
Accept-Language= None
Accept-Encoding= None
Accept-Charset= None
Referer = None
Authorization= None
Expect = None
From = None
If-Match = None
If-Modified-Since= None
If-None-Match= None
If-Range = None
If-Unmodified-Since= None
Max-Forwards= None
Proxy-Authorization= None
Range = None
TE = None
Cache-Control= None
Connection= None
Date = None
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= None
Expires = None
Last-Modified= None
Cookie = None
Headers = 'Host: 192.168.32.142\r\nAccept: */*\r\nUser-Agent: curl/7.60.0'
Additional-Headers= None
192.168.32.10 just requested a GET 192.168.32.142/
分享文章:HTTP數(shù)據(jù)包結(jié)構(gòu)
標(biāo)題URL:http://m.newbst.com/article48/ggpsep.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供ChatGPT、外貿(mào)建站、手機(jī)網(wǎng)站建設(shè)、網(wǎng)站策劃、軟件開發(fā)、靜態(tài)網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)