Python Forum
How to extract MSS (maximum size segment) from a pcap file ?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to extract MSS (maximum size segment) from a pcap file ?
#1
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:

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, cOptions
Then I call the last function in my main.py file.

Any Idea about why I got only 0 as value ?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Converted EXE file size is too large Rajasekaran 0 1,510 Mar-30-2023, 11:50 AM
Last Post: Rajasekaran
  Extract file only (without a directory it is in) from ZIPIP tester_V 1 985 Jan-23-2023, 04:56 AM
Last Post: deanhystad
  Python code a Max7219/7221 7 segment driver Aggie64 11 3,134 Dec-01-2022, 02:24 AM
Last Post: Larz60+
  How to extract specific data from .SRC (note pad file) Shinny_Shin 2 1,264 Jul-27-2022, 12:31 PM
Last Post: Larz60+
  check if a file exist on the internet and get the size kucingkembar 6 1,760 Apr-16-2022, 05:09 PM
Last Post: kucingkembar
  Extract parts of a log-file and put it in a dataframe hasiro 4 6,299 Apr-08-2022, 01:18 PM
Last Post: hasiro
  Extract a string between 2 words from a text file OscarBoots 2 1,870 Nov-02-2021, 08:50 AM
Last Post: ibreeden
  Extract specific sentences from text file Bubly 3 3,404 May-31-2021, 06:55 PM
Last Post: Larz60+
  Add a new column when I extract each sheet in an Excel workbook as a new csv file shantanu97 0 2,228 Mar-24-2021, 04:56 AM
Last Post: shantanu97
  How to extract a single word from a text file buttercup 7 3,546 Jul-22-2020, 04:45 AM
Last Post: bowlofred

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020