本文整理汇总了Python中packet.Packet.returnIP方法的典型用法代码示例。如果您正苦于以下问题:Python Packet.returnIP方法的具体用法?Python Packet.returnIP怎么用?Python Packet.returnIP使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类packet.Packet
的用法示例。
在下文中一共展示了Packet.returnIP方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: sendAESKey
# 需要导入模块: from packet import Packet [as 别名]
# 或者: from packet.Packet import returnIP [as 别名]
def sendAESKey(self):
pkt = Packet()
pkt.state = '100'
pkt.toIP = ''
pkt.returnIP = 'MRS'
pkt.data = self.key
pkt.RSAEncryptData(self.RSAPublicKey)
pkt.length = len(pkt.data)
self.messageQ.put(pkt)
示例2: receiveFromClient
# 需要导入模块: from packet import Packet [as 别名]
# 或者: from packet.Packet import returnIP [as 别名]
def receiveFromClient(self,s,address):
while True:
pkt = Packet()
try:
pkt.construct(s)
except socket.error as error:
if error.errno == 10054 or error.errno == 104:
del self.toClient[address[0]]
print address[0] + " closed client!"
break
else:
raise
pkt.returnIP = address[0]
self.enqueueToVirus(pkt)
示例3: sendIPList
# 需要导入模块: from packet import Packet [as 别名]
# 或者: from packet.Packet import returnIP [as 别名]
def sendIPList(self,address=""):
state = "100"
ips = self.toVirus.keys()
data = ""
for ip in ips:
data += ip + ":" + self.toVirus[ip][2]
length = len(data)
pkt = Packet()
pkt.state = state
pkt.length = str(length)
pkt.data = data
pkt.encryptData(self.AESKey)
print "IPList: " + data
if address != "":
pkt.returnIP = address[0]
self.enqueueToClient(pkt)
else:
for ip in self.toClient.keys():
self.enqueueToClient(pkt,ip)