예제 #1
0
 def setUp(self):
     self.WEPKey=None #Unknown
     self.WEPData=b'\x08\x41\x3a\x01\x00\x17\x3f\x44\x4f\x96\x00\x13\xce\x67\x0e\x73\x00\x17\x3f\x44\x4f\x96\xb0\x04\xeb\xcd\x8b\x00\x6e\xdf\x93\x36\x39\x5a\x39\x66\x6b\x96\xd1\x7a\xe1\xae\xb6\x11\x22\xfd\xf0\xd4\x0d\x6a\xb8\xb1\xe6\x2e\x1f\x25\x7d\x64\x1a\x07\xd5\x86\xd2\x19\x34\xb5\xf7\x8a\x62\x33\x59\x6e\x89\x01\x73\x50\x12\xbb\xde\x17\xdd\xb5\xd4\x35'
     dot11_decoder = Dot11Decoder()
     self.in0=dot11_decoder.decode(self.WEPData)
     self.in1=self.in0.child()
     self.in2=self.in1.child()
     self.in3=self.in2.child()
     if self.WEPKey:
         self.in4=self.in3.child()
         self.in5=self.in4.child()
예제 #2
0
 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')
예제 #3
0
    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)
예제 #4
0
    def test_05(self):
        'Test WEPData ICV getter and setter methods'

        dot11_decoder = Dot11Decoder()
        dot11_decoder.FCS_at_end(False)
        dot11_decoder.set_key_manager(self.km)
        dot11_decoder.decode(self.dot11frame)
        wepdata = dot11_decoder.get_protocol(Dot11WEPData)

        # The encrypted ICV is 0x361b0253, but it not the real,
        # we need decrypt it. The decrypted and real ICV is 0xA1F93985

        self.assertEqual(wepdata.get_icv(), 0xA1F93985)

        self.assertEqual(wepdata.get_computed_icv(), 0xA1F93985)

        self.assertEqual(wepdata.get_icv(), wepdata.get_computed_icv())

        wepdata.set_icv(0x11223344)
        self.assertEqual(wepdata.get_icv(), 0x11223344)