PortSDetect.py
def parse_pkt(pkt):
    '''
    parse pkt and hand it off to the tracker an inbound pkt

    params:
        pkt<buffer>     packet given by pcap.pcap
    returns:
        None
    '''

    # extract ip
    eth = dpkt.ethernet.Ethernet(pkt)
    ip = eth.data
    src_ip = ipaddress.IPv4Address(ip.src)
    dst_ip = ipaddress.IPv4Address(ip.dst)

    # ignore outgoing packet
    if str(src_ip) == MY_IP:
       return

    # extract port
    dst_port = ip.data.dport

    # send to tracker
    track(src_ip, dst_port)

    parse pkt and hand it off to the tracker an inbound pkt

    params:
        pkt<buffer>     packet given by pcap.pcap
    returns:
        None
    
parse pkt and hand it off to the tracker an inbound pkt
params:
pkt     packet given by pcap.pcap
returns:
None
parse pkt and hand it off to the tracker an inbound pkt params : pkt packet given by pcap . pcap returns : None
def parse_pkt(pkt):
    eth = dpkt.ethernet.Ethernet(pkt)
    ip = eth.data
    src_ip = ipaddress.IPv4Address(ip.src)
    dst_ip = ipaddress.IPv4Address(ip.dst)
    if str(src_ip) == MY_IP:
       return
    dst_port = ip.data.dport
    track(src_ip, dst_port)
def parse_pkt ( pkt ) : eth = dpkt . ethernet . Ethernet ( pkt ) ip = eth . data src_ip = ipaddress . IPv4Address ( ip . src ) dst_ip = ipaddress . IPv4Address ( ip . dst ) if str ( src_ip ) == MY_IP : return dst_port = ip . data . dport track ( src_ip , dst_port )
parse pkt and hand it off to the tracker an inbound pkt
params:
pkt<buffer>     packet given by pcap.pcap
returns:
None
parse pkt and hand it off to the tracker an inbound pkt params : pkt<buffer > packet given by pcap . pcap returns : None
'''
    parse pkt and hand it off to the tracker an inbound pkt

    params:
        pkt<buffer>     packet given by pcap.pcap
    returns:
        None
    ''' # extract ip # ignore outgoing packet # extract port # send to tracker
pkt