Jun-29-2020, 09:06 AM
I want to extract the MSS (Maximum Size Segment)from a pcap file but I got only 0 while I have Not NULL values in this field:
Any Idea about why I got only 0 as value ?
def is_tcp_options(packet): if packet.haslayer(TCP): if packet[TCP].options: return True return False def get_tcp_options(packet, option=None): if is_tcp_options(packet): for opt in packet[TCP].options: if opt[0] == option: return opt return None def get_tcp_options_s(s, s_ip, c_ip, opt): sOptions = [] cOptions = [] for p in s: if p.haslayer(TCP) and p.haslayer(IP): if (p[IP].src == s_ip): o = get_tcp_options(p, opt) if o: sOptions.append(o[1]) if (p[IP].src == c_ip): o = get_tcp_options(p, opt) if o: cOptions.append(o[1]) return sOptions, cOptionsThen I call the last function in my main.py file.
Any Idea about why I got only 0 as value ?