PortSDetect.py
def track(src_ip, dst_port):
    '''
    keep track of incoming pkts to detect port scanners

    params:
        src_ip          source ip
        dst_port        port on this machine contacted
    returns:
        None
    '''

    # new source
    if src_ip not in TRACKER:
        ports_visited = Consecutive.Consecutive()
        ports_visited.insert(dst_port, CON, TIME, MIN_PORT, MAX_PORT)
        TRACKER[src_ip] = ports_visited

    # source seen before
    else:
        # check if this machine is being port scanned
        if TRACKER[src_ip].insert(dst_port, CON, TIME, MIN_PORT, MAX_PORT):
            print "Scanner detected. The scanner originated from host {0:s}.".format(src_ip)

    keep track of incoming pkts to detect port scanners

    params:
        src_ip          source ip
        dst_port        port on this machine contacted
    returns:
        None
    
keep track of incoming pkts to detect port scanners
params:
src_ip          source ip
dst_port        port on this machine contacted
returns:
None
keep track of incoming pkts to detect port scanners params : src_ip source ip dst_port port on this machine contacted returns : None
def track(src_ip, dst_port):
    if src_ip not in TRACKER:
        ports_visited = Consecutive.Consecutive()
        ports_visited.insert(dst_port, CON, TIME, MIN_PORT, MAX_PORT)
        TRACKER[src_ip] = ports_visited
    else:
        if TRACKER[src_ip].insert(dst_port, CON, TIME, MIN_PORT, MAX_PORT):
            print "Scanner detected. The scanner originated from host {0:s}.".format(src_ip)
def track ( src_ip , dst_port ) : if src_ip not in TRACKER : ports_visited = Consecutive . Consecutive ( ) ports_visited . insert ( dst_port , CON , TIME , MIN_PORT , MAX_PORT ) TRACKER [ src_ip ] = ports_visited else : if TRACKER [ src_ip ] . insert ( dst_port , CON , TIME , MIN_PORT , MAX_PORT ) : print "Scanner detected. The scanner originated from host {0:s}." . format ( src_ip )
keep track of incoming pkts to detect port scanners
params:
src_ip          source ip
dst_port        port on this machine contacted
returns:
None
keep track of incoming pkts to detect port scanners params : src_ip source ip dst_port port on this machine contacted returns : None
'''
    keep track of incoming pkts to detect port scanners

    params:
        src_ip          source ip
        dst_port        port on this machine contacted
    returns:
        None
    ''' # new source # source seen before # check if this machine is being port scanned
src_ip
dst_port