I am sniffing packets, specificity http packets with html code using Scapy and I have noticed that some of the information is cut.
for example, I sniffed a packet from a http based website. this is the Raw layer's load:
HTTP/1.1 200 OK
Date: Thu, 15 Nov 2018 07:27:26 GMT
Expires: Wed, 17 Aug 2005 00:00:00 GMT
Last-Modified: Thu, 15 Nov 2018 07:27:26 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
X-Contenet-Type-Options: nosniff
Keep-Alive: timeout=15, max=99
Connection: Keep-Alive
Content-Type: text/html; charset=utf-8
Set-Cookie: TS01b8cd54=019790ad782c9eb6839f3157971e06ecc81f8acff3f19677e408b5865712e40ae0645c31bcbc54afa10731786a5113f826d49d9035879dad0938a56ab4040a76396a8b83fb; Path=/; Domain=.rishuy.mot.gov.il
Transfer-Encoding: chunked
14ef
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="he-il" lang="he-il" dir="rtl">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<base href="http://rishuy.mot.gov.il/he/" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="keywords" content="רשיומט, רישוי קול, משרד הרישוי, רישוי נהיגה, רישוי כלי רכב" />
<meta name="description" content="משרד התחבורה - רשות הרישוי" />
<title>רשות הרישוי</title>
<link href="/he/?format=feed&type=rss" rel="alternate" type="application/rss+xml" title="RSS 2.0" />
<link href="/he/?format=feed&type=atom" rel="alternate" ty
this is the code I am using:
fileNum = 0;
def handlePacket(pkt):
if pkt.haslayer(Raw) and pkt[Raw].load:#has content
if str(pkt[Raw].load).find("<html") != -1:#content is html
print('a')
f = open(outDir+'/'+str(fileNum)+'.txt','wb')#save file
f.write(pkt[Raw].load)
f.close()
sniff(prn = handlePacket)
and the content just ends there.
(I know that I am currently not getting all of it because there is more html code in the website).
Why aren't I getting all of the code and How do I get the rest of the code?