pkts = sniff(prn=lambda x:x.sprintf("{IP:%IP.src% -> 
%IP.dst%\n}{Raw:%Raw.load%\n}"), filter="tcp port 80")

for i in range(1,len(pkts)):
    #if pkts[i][IP].sport == 80:
        i,pkts[i][TCP].payload

i find pkts[10] do not have html source code

(8, <Raw  load='GET /index2.html HTTP/1.1\r\nHost: 192.168.3.245\r\nConnection: 
keep-alive\r\nCache-Control: max-age=0\r\nUpgrade-Insecure-Requests: 
1\r\nUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 
(KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36\r\nAccept: 
text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8\r\nAccept-Encoding:
 gzip, deflate, sdch\r\nAccept-Language: en-US,en;q=0.8\r\nIf-None-Match: 
"100a41-15-552657bea38d3"\r\nIf-Modified-Since: Tue, 20 Jun 2017 14:58:27 
GMT\r\n\r\n' |>)
(9, <Padding  load='\x00\x00\x00\x00\x00\x00' |>)
(10, <Raw  load='HTTP/1.1 304 Not Modified\r\nDate: Tue, 20 Jun 2017 15:28:54 
GMT\r\nServer: Apache/2.2.15 (CentOS)\r\nConnection: close\r\nETag: 
"100a41-15-552657bea38d3"\r\n\r\n' |>)
(11, <Padding  load='\x00\x00\x00\x00\x00\x00' |>)

dir(pkts[10][TCP])

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to