本文整理汇总了Python中impacket.ImpactPacket.ICMP属性的典型用法代码示例。如果您正苦于以下问题:Python ImpactPacket.ICMP属性的具体用法?Python ImpactPacket.ICMP怎么用?Python ImpactPacket.ICMP使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类impacket.ImpactPacket
的用法示例。
在下文中一共展示了ImpactPacket.ICMP属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_06
# 需要导入模块: from impacket import ImpactPacket [as 别名]
# 或者: from impacket.ImpactPacket import ICMP [as 别名]
def test_06(self):
'Test WEPData body decryption'
dot11_decoder = Dot11Decoder()
dot11_decoder.FCS_at_end(False)
dot11_decoder.set_key_manager(self.km)
dot11_decoder.decode(self.dot11frame)
wep = dot11_decoder.get_protocol(Dot11WEP)
wepdata = dot11_decoder.get_protocol(Dot11WEPData)
decrypted = b'\xaa\xaa\x03\x00\x00\x00\x08\x00\x45\x00\x00\x3c\xa6\x07\x00\x00\x80\x01\xee\x5a\xc0\xa8\x01\x66\x40\xe9\xa3\x67\x08\x00\xc5\x56\x04\x00\x84\x05\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x61\x62\x63\x64\x65\x66\x67\x68\x69\xa1\xf9\x39\x85'
self.assertEqual(wepdata.get_packet(), decrypted)
self.assertEqual(wepdata.check_icv(), True)
ip = dot11_decoder.get_protocol(IP)
self.assertEqual(ip.get_ip_src(),'192.168.1.102')
self.assertEqual(ip.get_ip_dst(),'64.233.163.103')
icmp = dot11_decoder.get_protocol(ICMP)
self.assertEqual(icmp.get_icmp_type(),icmp.ICMP_ECHO)
self.assertEqual(icmp.get_icmp_id(),0x0400)
示例2: buildAnswer
# 需要导入模块: from impacket import ImpactPacket [as 别名]
# 或者: from impacket.ImpactPacket import ICMP [as 别名]
def buildAnswer(self, in_onion):
out_onion = IPResponder.buildAnswer(self, in_onion)
icmp = ImpactPacket.ICMP()
out_onion[O_IP].contains(icmp)
out_onion.append(icmp)
icmp.set_icmp_id(in_onion[O_ICMP].get_icmp_id())
icmp.set_icmp_seq(in_onion[O_ICMP].get_icmp_seq())
out_onion[O_IP].set_ip_id(self.machine.getIPID_ICMP())
return out_onion
示例3: isMine
# 需要导入模块: from impacket import ImpactPacket [as 别名]
# 或者: from impacket.ImpactPacket import ICMP [as 别名]
def isMine(self, in_onion):
if not IPResponder.isMine(self, in_onion): return False
if len(in_onion) < 3: return False
return (in_onion[O_ICMP].protocol == ImpactPacket.ICMP.protocol) and self.sameICMPTemplate(in_onion)
示例4: initIPIDGenerator
# 需要导入模块: from impacket import ImpactPacket [as 别名]
# 或者: from impacket.ImpactPacket import ICMP [as 别名]
def initIPIDGenerator(self):
seq = self.fingerprint.get_tests()['SEQ']
self.ip_ID = 0
try: TI = seq['TI']
except: TI = 'O'
if TI == 'Z': self.ip_ID_delta = 0
elif TI == 'RD': self.ip_ID_delta = 30000
elif TI == 'RI': self.ip_ID_delta = 1234
elif TI == 'BI': self.ip_ID_delta = 1024+256
elif TI == 'I': self.ip_ID_delta = 1
elif TI == 'O': self.ip_ID_delta = 123
else: self.ip_ID_delta = int(TI, 16)
try: ss = seq['SS']
except: ss = 'O'
self.ip_ID_ICMP_delta = None
if ss == 'S': self.ip_ID_ICMP = None
else:
self.ip_ID_ICMP = 0
try: II = seq['II']
except: II = 'O'
if II == 'Z': self.ip_ID_ICMP_delta = 0
elif II == 'RD': self.ip_ID_ICMP_delta = 30000
elif II == 'RI': self.ip_ID_ICMP_delta = 1234
elif II == 'BI': self.ip_ID_ICMP_delta = 1024+256
elif II == 'I': self.ip_ID_ICMP_delta = 1
elif II == 'O': self.ip_ID_ICMP_delta = 123
else: self.ip_ID_ICMP_delta = int(II, 16)
# generate a few, so we don't start with 0 when we don't have to
for i in range(10):
self.getIPID()
self.getIPID_ICMP()
print("IP ID Delta: %d" % self.ip_ID_delta)
print("IP ID ICMP Delta: %s" % self.ip_ID_ICMP_delta)
示例5: decode
# 需要导入模块: from impacket import ImpactPacket [as 别名]
# 或者: from impacket.ImpactPacket import ICMP [as 别名]
def decode(self, aBuffer):
i = ImpactPacket.IP(aBuffer)
self.set_decoded_protocol ( i )
off = i.get_header_size()
end = i.get_ip_len()
# If ip_len == 0 we might be facing TCP segmentation offload, let's calculate the right len
if end == 0:
LOG.warning('IP len reported as 0, most probably because of TCP segmentation offload. Attempting to fix its size')
i.set_ip_len(len(aBuffer))
end = i.get_ip_len()
if i.get_ip_p() == ImpactPacket.UDP.protocol:
self.udp_decoder = UDPDecoder()
packet = self.udp_decoder.decode(aBuffer[off:end])
elif i.get_ip_p() == ImpactPacket.TCP.protocol:
self.tcp_decoder = TCPDecoder()
packet = self.tcp_decoder.decode(aBuffer[off:end])
elif i.get_ip_p() == ImpactPacket.ICMP.protocol:
self.icmp_decoder = ICMPDecoder()
packet = self.icmp_decoder.decode(aBuffer[off:end])
elif i.get_ip_p() == ImpactPacket.IGMP.protocol:
self.igmp_decoder = IGMPDecoder()
packet = self.igmp_decoder.decode(aBuffer[off:end])
else:
self.data_decoder = DataDecoder()
packet = self.data_decoder.decode(aBuffer[off:end])
i.contains(packet)
return i
示例6: isMine
# 需要导入模块: from impacket import ImpactPacket [as 别名]
# 或者: from impacket.ImpactPacket import ICMP [as 别名]
def isMine(self, in_onion):
if not IPResponder.isMine(self, in_onion): return False
if len(in_onion) < 3: return False
return (
(in_onion[O_ICMP].protocol == ImpactPacket.ICMP.protocol) and
self.sameICMPTemplate(in_onion))
示例7: initIPIDGenerator
# 需要导入模块: from impacket import ImpactPacket [as 别名]
# 或者: from impacket.ImpactPacket import ICMP [as 别名]
def initIPIDGenerator(self):
seq = self.fingerprint.get_tests()['SEQ']
self.ip_ID = 0
try: TI = seq['TI']
except: TI = 'O'
if TI == 'Z': self.ip_ID_delta = 0
elif TI == 'RD': self.ip_ID_delta = 30000
elif TI == 'RI': self.ip_ID_delta = 1234
elif TI == 'BI': self.ip_ID_delta = 1024+256
elif TI == 'I': self.ip_ID_delta = 1
elif TI == 'O': self.ip_ID_delta = 123
else: self.ip_ID_delta = int(TI, 16)
try: ss = seq['SS']
except: ss = 'O'
self.ip_ID_ICMP_delta = None
if ss == 'S': self.ip_ID_ICMP = None
else:
self.ip_ID_ICMP = 0
try: II = seq['II']
except: II = 'O'
if II == 'Z': self.ip_ID_ICMP_delta = 0
elif II == 'RD': self.ip_ID_ICMP_delta = 30000
elif II == 'RI': self.ip_ID_ICMP_delta = 1234
elif II == 'BI': self.ip_ID_ICMP_delta = 1024+256
elif II == 'I': self.ip_ID_ICMP_delta = 1
elif II == 'O': self.ip_ID_ICMP_delta = 123
else: self.ip_ID_ICMP_delta = int(II, 16)
# generate a few, so we don't start with 0 when we don't have to
for i in range(10):
self.getIPID()
self.getIPID_ICMP()
print "IP ID Delta: %d" % self.ip_ID_delta
print "IP ID ICMP Delta: %s" % self.ip_ID_ICMP_delta
示例8: test_02
# 需要导入模块: from impacket import ImpactPacket [as 别名]
# 或者: from impacket.ImpactPacket import ICMP [as 别名]
def test_02(self):
'Test Packet Hierarchy'
dot11_decoder = Dot11Decoder()
dot11_decoder.FCS_at_end(False)
dot11_decoder.set_key_manager(self.km)
in0=dot11_decoder.decode(self.dot11frame)
if PY2:
self.assertEqual(str(in0.__class__), "impacket.dot11.Dot11")
else:
self.assertEqual(str(in0.__class__), "<class 'impacket.dot11.Dot11'>")
in1=in0.child()
if PY2:
self.assertEqual(str(in1.__class__), "impacket.dot11.Dot11DataFrame")
else:
self.assertEqual(str(in1.__class__), "<class 'impacket.dot11.Dot11DataFrame'>")
in2=in1.child()
if PY2:
self.assertEqual(str(in2.__class__), "impacket.dot11.Dot11WEP")
else:
self.assertEqual(str(in2.__class__), "<class 'impacket.dot11.Dot11WEP'>")
in3=in2.child()
if PY2:
self.assertEqual(str(in3.__class__), "impacket.dot11.Dot11WEPData")
else:
self.assertEqual(str(in3.__class__), "<class 'impacket.dot11.Dot11WEPData'>")
in4=in3.child()
if PY2:
self.assertEqual(str(in4.__class__), "impacket.dot11.LLC")
else:
self.assertEqual(str(in4.__class__), "<class 'impacket.dot11.LLC'>")
in5=in4.child()
if PY2:
self.assertEqual(str(in5.__class__), "impacket.dot11.SNAP")
else:
self.assertEqual(str(in5.__class__), "<class 'impacket.dot11.SNAP'>")
in6=in5.child()
#self.assertEqual(str(in6.__class__), "ImpactPacket.IP")
in7=in6.child()
#self.assertEqual(str(in7.__class__), "ImpactPacket.ICMP")
in8=in7.child()
#self.assertEqual(str(in8.__class__), "ImpactPacket.Data")
self.assertEqual(in8.get_packet(),b'abcdefghijklmnopqrstuvwabcdefghi')