How to extract information from an HTTP header with Python?

6

We know that in the HTTP protocol, the end of the header is indicated by " \r\n\r\n ". Example:

Forsomereason,theclientmaynotsendthe" \r\n\r\n " to the server (this could be an attack, for example):

Suppose I have a network traffic capture in PCAP format called dump.pcap. I can read it with the following Python code:

import pyshark

pkts = pyshark.FileCapture('dump.pcap')

I would like to read the dump.pcap file (code above) and after that, count how many packages have \r\n\r\n and how many packages do not have \r\n\r\n Is it possible to do this in Python? How could I do it?

    
asked by anonymous 01.09.2017 / 17:15

0 answers