示例#1
0
 def __init__(self, srcMac, srcIp, dstIp):
     self.srcMac = srcMac
     self.srcIp = srcIp
     self.dstIp = dstIp
     self.count = 0
     self.pkt = None
     Client.__init__(self)
示例#2
0
    def __init__(self, src, dst, payload=''):
        self.srcMac = src[0]
        self.srcIp  = src[1]
        if len(src) == 3:
            self.srcPort = src[2]
        else:
            self.srcPort = randint(40000, 60000)
        self.src = (self.srcMac, self.srcIp, self.srcPort)

        self.dstMac  = dst[0]
        self.dstIp   = dst[1]
        self.dstPort = dst[2]
        self.dst     = (self.dstMac, self.dstIp, self.dstPort)

        self.ipId = randint(0, 2**16-1)

        self.payload = payload
        Client.__init__(self)
示例#3
0
    def __init__(self, src, dst, payload=""):
        kwargs = {}
        kwargs["my_mac"] = src[0]
        kwargs["my_ip"] = src[1]
        if len(src) == 3:
            srcport = src[2]
            kwargs["my_port"] = srcport

        kwargs["other_mac"] = dst[0]
        kwargs["other_ip"] = dst[1]
        kwargs["other_port"] = dst[2]
        kwargs["connection_over_cb"] = self.connectionClosed
        kwargs["has_data_to_send_cb"] = self.connHasDataToSend
        kwargs["payload"] = payload

        self.d = None  # deferred

        TcpConnection.__init__(self, **kwargs)
        Client.__init__(self)
示例#4
0
 def __init__(self, src, dst, payload=None):
     self.src = src
     self.dst = dst
     self.payload = payload
     Client.__init__(self)