def __init__(self, interface): """ Init initialise all the variable either if there are not used (e.g: server variable when used as a client). Note: The default state is Closed """ Layer.__init__(self) self.name = "TCP" #Should stay here ! (otherwise will override real tcp layer in transversal_layer_access) self.ipregex = re.compile("^(\d{1,3}.){3}.\d{1,3}$") self.state = State_CLOSED(self) self.interface = interface self.localIP = get_if_addr(interface) self.localPort = None self.remoteIP = None self.remotePort = None self.connectionID = None #--Server related variables self.connections = [] #Used when server to know how many clients are connected .. self.nbconntoaccept = 0 self.currentconnection = 0 self.newinstance = None #When client connect either we send him on the same application or create a new instance #---- self.seqNo = 0 self.ackNo = 0 self.toAck = 0 self.nextAck = 0 self.lastPacket = None self.local_mss = 1460 #TODO: change it to be dynamic (RFC 879 default value is 536 self.remote_mss = None self.syn_retries = int(open("/proc/sys/net/ipv4/tcp_syn_retries", "r").read())
def __init__(self, interface): """ Init initialise all the variable either if there are not used (e.g: server variable when used as a client). Note: The default state is Closed """ Layer.__init__(self) self.name = "TCP" #Should stay here ! (otherwise will override real tcp layer in transversal_layer_access) self.ipregex = re.compile("^(\d{1,3}.){3}.\d{1,3}$") self.state = State_CLOSED(self) self.interface = interface self.localIP = get_if_addr(interface) self.localPort = None self.remoteIP = None self.remotePort = None self.connectionID = None #--Server related variables self.connections = [ ] #Used when server to know how many clients are connected .. self.nbconntoaccept = 0 self.currentconnection = 0 self.newinstance = None #When client connect either we send him on the same application or create a new instance #---- self.seqNo = 0 self.ackNo = 0 self.toAck = 0 self.nextAck = 0 self.lastPacket = None self.local_mss = 1460 #TODO: change it to be dynamic (RFC 879 default value is 536 self.remote_mss = None self.syn_retries = int( open("/proc/sys/net/ipv4/tcp_syn_retries", "r").read())
def __init__(self, iface): """ Takes the interface in argument to be able to distinguish the local MAC from others. The arp_cache is also instantiated empty. """ Layer.__init__(self) self.arp_cache = {} self.hwaddr = ARP().hwsrc self.ip = get_if_addr(iface)
def __init__(self): """ Init Just init class attributes like data which will act as a buffer for received data. In addition a mutex is initialised so that data attribute can't be read and written in the same time and so avoid improper reading.. """ Layer.__init__(self) self.data = "" self.mutex = Lock() self.lastclient = None
def __init__(self, interface=None): """ Init takes the local interface in order to retrieve the local MAC. This method also instantiate an ScapyIO class. We do not use the normal lower/upper layer system because in this case no any other lower layer is suitable other than ScapyIO. """ Layer.__init__(self) self.io = ScapyIO(interface) self.io.register_handler(self) self.addr = ARP().hwsrc self.packet_pool = [] #Packet will be stored as a tuple (packet, timestamp)
def __init__(self, interface=None): """ Init takes the local interface in order to retrieve the local MAC. This method also instantiate an ScapyIO class. We do not use the normal lower/upper layer system because in this case no any other lower layer is suitable other than ScapyIO. """ Layer.__init__(self) self.io = ScapyIO(interface) self.io.register_handler(self) self.addr = ARP().hwsrc self.packet_pool = [ ] #Packet will be stored as a tuple (packet, timestamp)
def __init__(self, method="last"): """Initialise the packet pool""" Layer.__init__(self) #self.domainCache = {} #Key: DN value: ip #self.reversedomainCache = {} #Key: ip, value: DN self.packet_pool = {} #Index will be (ipsrc,ipdst,ipid) value : {'timestamp':XXXXX, 'chunk':[p1,p2..]} self.ipregex = re.compile("^(\d{1,3}.){3}.\d{1,3}$") self.interface = conf.iface #or conf.route.route("0.0.0.0") self.MTU = 1480 #self._get_mtu_interface(self.interface) - 20 #Remove the 20 bytes of IP headers needed methods = ("first", "last", "bsd", "linux", "bsdright", "linux") #last is also called rfc791 self.protocols = {1:"ICMP", 6:"TCP", 17:"UDP"} if method not in methods: raise Exception("The fragment reassembly method is unknown") self.reassembly_method = getattr(self, "_"+method)
def __init__(self, iface=None): """ Init instantiate quite a lot of class attribute like ips, ports, datas etc.. """ Layer.__init__(self) self.data = [] self.mutex = Lock() self.connectionID = None self.ipregex = re.compile("^(\d{1,3}.){3}.\d{1,3}$") self.interface = iface if iface else conf.route.route("0.0.0.0")[0] self.localIP = get_if_addr(self.interface) self.remoteIP = None self.localPort = random.randrange(0, (2**16) - 1) self.remotePort = None
def __init__(self): """Just call Layer init method.""" Layer.__init__(self)
def __init__(self): """ Just call the layer init and give to the layer the appropriate name (UDP) """ Layer.__init__(self)
def __init__(self, win): Layer.__init__(self) self.win = win #Take the Qt window as attribute to be able to send it, newly detected connections
def __init__(self,win): Layer.__init__(self) self.win = win #Take the Qt window as attribute to be able to send it, newly detected connections
def __init__(self, interface=None): Layer.__init__(self)