def setUp(self):
        # 802.11 Control Frame CFEndCFACK
        self.frame_orig=b'\xf4\x74\xde\xed\xe5\x56\x85\xf8\xd2\x3b\x96\xae\x0f\xb0\xd9\x8a\x03\x02\x38\x00'

        d = Dot11(self.frame_orig)
        
        type = d.get_type()
        self.assertEqual(type,Dot11Types.DOT11_TYPE_CONTROL)
        
        subtype = d.get_subtype()
        self.assertEqual(subtype,Dot11Types.DOT11_SUBTYPE_CONTROL_CF_END_CF_ACK)
        
        typesubtype = d.get_type_n_subtype()
        self.assertEqual(typesubtype,Dot11Types.DOT11_TYPE_CONTROL_SUBTYPE_CF_END_CF_ACK)
            
        self.cfendcfack = Dot11ControlFrameCFEndCFACK(d.get_body_as_string())
            
        d.contains(self.cfendcfack)
Beispiel #2
0
    def setUp(self):
        # 802.11 Control Frame ACK
        self.frame_orig=b'\xd4\x00\x00\x00\x00\x08\x54\xac\x2f\x85\xb7\x7f\xc3\x9e'

        d = Dot11(self.frame_orig)
        
        type = d.get_type()
        self.assertEqual(type,Dot11Types.DOT11_TYPE_CONTROL)
        
        subtype = d.get_subtype()
        self.assertEqual(subtype,Dot11Types.DOT11_SUBTYPE_CONTROL_ACKNOWLEDGMENT)
        
        typesubtype = d.get_type_n_subtype()
        self.assertEqual(typesubtype,Dot11Types.DOT11_TYPE_CONTROL_SUBTYPE_ACKNOWLEDGMENT)
            
        self.ack = Dot11ControlFrameACK(d.get_body_as_string())
            
        d.contains(self.ack)
Beispiel #3
0
 def setUp(self):
     # 802.11 Data Frame 
     #
     self.frame_orig='\x08\x49\x24\x00\x00\x21\x29\x68\x33\x5d\x00\x15\xaf\xe4\xf1\x0f\x00\x21\x29\x68\x33\x5b\xe0\x31\x1b\x13\x00\x20\x00\x00\x00\x00\x84\x7d\x6a\x30\x8c\x60\x7e\x3b\x22\xdc\x16\xc1\x4b\x28\xd3\x26\x76\x9d\x2e\x59\x96\x31\x3e\x01\x6f\x61\xa2\x59\xc8\xdc\xd3\xc4\xad\x7c\xcc\x32\xa8\x9f\xf6\x03\x02\xe1\xac\x1d\x1e\x02\x8a\xcd\x5b\x94\x20\x2d\xfc\x6e\x37\x40\x2e\x46\x17\x19\x0c\xc0\x34\x07\xae\xe7\x77\xaf\xf9\x9f\x41\x53'
     d = Dot11(self.frame_orig)
     
     self.assertEqual(d.get_type(),Dot11Types.DOT11_TYPE_DATA)
     self.assertEqual(d.get_subtype(),Dot11Types.DOT11_SUBTYPE_DATA)
     self.assertEqual(d.get_type_n_subtype(),Dot11Types.DOT11_TYPE_DATA_SUBTYPE_DATA)
     
     data = Dot11DataFrame(d.get_body_as_string())
     d.contains(data)
     
     self.wpa2_header = Dot11WPA2(data.body_string)
     data.contains(self.wpa2_header)
     
     self.wpa2_data = Dot11WPA2Data(self.wpa2_header.body_string)
     self.wpa2_header.contains(self.wpa2_data)
Beispiel #4
0
 def setUp(self):
     # 802.11 Data Frame 
     #
     self.frame_orig=b'\x08\x42\x00\x00\xff\xff\xff\xff\xff\xff\x00\x21\x29\x68\x33\x5d\x00\x1b\xfc\x1e\xca\x40\xa0\x16\x02\x22\x5a\x60\x00\x00\x00\x00\xa2\x0e\x77\x36\xea\x90\x76\x0f\x7a\x9f\x6e\x6c\x78\xb9\xe0\x3e\xb4\x9d\x09\xca\xde\xef\x95\x58\x28\x97\x17\x46\x53\x43\x41\x2b\x2a\xc6\xbe\xe4\x59\x60\xf0\x17\x1d\x20\x8c\xca\x3c\x26\x0d\x5d\x6b\x10\x81\xbc\xc6\xba\x90\xa5\x77\x0e\x83\xd0\xd0\xb9\xdd\xbf\x80\xbf\x65\x17\xee\xc0\x3a\x52\x32\x34\x75\xac\x0c\xc2\xbb\x25\x28\x8f\x6a\xe6\x96\x7a\x53\x4a\x77\xcc\x2b\xe5\x9a\x9a\x73\xc2\x08\x4c\x42\x15\xe9\x26\xa0\xce\x70\x0e\x50\x9b\x2d\xa2\x6e\xcb\x92\x54\xc0\x6d\xbc\x13\xfe\x4d\xd8\x6b\x8c\x76\x98\x9a\x71\x4d\x51\xb1\xf5\x4f\xe2\x43\x1b\xfa\x6f\x5c\x98\x6a\x3a\x64\x4f\x50\xc4\x09\x7d\x10\x3f\xa2\x64\xd9\xad\x6e\x44\xe3\x84\x3d\x2b\x77\x11\xd8\x04\x9d\x9d\xd4\x32\x35\xe8\x3d\xeb\xd5\x9a\xde\xf3\xb5\x41\x67\x94\xf9\xb1\xe0\x7a\xea\x33\xb2\x00\xef\x6a\x2e\x6c\x3b\xea\x23\x49\x23\xc2\xca\x24\x53\xea\xc0\x7e\x8c\xcf\x73\xcb\x2d\x0c\x8e\xdb\x7b\x9e\x0a\x66\x81\x90'
     d = Dot11(self.frame_orig)
     
     self.assertEqual(d.get_type(),Dot11Types.DOT11_TYPE_DATA)
     self.assertEqual(d.get_subtype(),Dot11Types.DOT11_SUBTYPE_DATA)
     self.assertEqual(d.get_type_n_subtype(),Dot11Types.DOT11_TYPE_DATA_SUBTYPE_DATA)
     
     data = Dot11DataFrame(d.get_body_as_string())
     d.contains(data)
     
     self.wpa_header = Dot11WPA(data.body_string)
     data.contains(self.wpa_header)
     
     self.wpa_data = Dot11WPAData(self.wpa_header.body_string)
     self.wpa_header.contains(self.wpa_data)
    def setUp(self):
        # 802.11 Control Frame PSPoll
        self.frame_orig=b'\xa6\x73\xf1\xaf\x48\x06\xee\x23\x2b\xc9\xfe\xbe\xe5\x05\x4c\x0a\x04\xa0\x00\x0f'

        d = Dot11(self.frame_orig)
        
        type = d.get_type()
        self.assertEqual(type,Dot11Types.DOT11_TYPE_CONTROL)
        
        subtype = d.get_subtype()
        self.assertEqual(subtype,Dot11Types.DOT11_SUBTYPE_CONTROL_POWERSAVE_POLL)
        
        typesubtype = d.get_type_n_subtype()
        self.assertEqual(typesubtype,Dot11Types.DOT11_TYPE_CONTROL_SUBTYPE_POWERSAVE_POLL)
            
        self.pspoll = Dot11ControlFramePSPoll(d.get_body_as_string())
            
        d.contains(self.pspoll)
Beispiel #6
0
 def setUp(self):
     # 802.11 Control Frame RTS
     self.frame_orig=b'\xb4\x00\x81\x01\x00\x08\x54\xac\x2f\x85\x00\x23\x4d\x09\x86\xfe\x99\x75\x43\x73'
     
     d = Dot11(self.frame_orig)
     
     type = d.get_type()
     self.assertEqual(type,Dot11Types.DOT11_TYPE_CONTROL)
     
     subtype = d.get_subtype()
     self.assertEqual(subtype,Dot11Types.DOT11_SUBTYPE_CONTROL_REQUEST_TO_SEND)
     
     typesubtype = d.get_type_n_subtype()
     self.assertEqual(typesubtype,Dot11Types.DOT11_TYPE_CONTROL_SUBTYPE_REQUEST_TO_SEND)
         
     self.rts = Dot11ControlFrameRTS(d.get_body_as_string())
         
     d.contains(self.rts)
Beispiel #7
0
 def setUp(self):
     # 802.11 Control Frame CTS
     self.frame_orig=b'\xc4\x00\x3b\x12\x00\x19\xe0\x98\x04\xd4\x2b\x8a\x65\x17'
     
     d = Dot11(self.frame_orig)
     
     type = d.get_type()
     self.assertEqual(type,Dot11Types.DOT11_TYPE_CONTROL)
     
     subtype = d.get_subtype()
     self.assertEqual(subtype,Dot11Types.DOT11_SUBTYPE_CONTROL_CLEAR_TO_SEND)
     
     typesubtype = d.get_type_n_subtype()
     self.assertEqual(typesubtype,Dot11Types.DOT11_TYPE_CONTROL_SUBTYPE_CLEAR_TO_SEND)
         
     self.cts = Dot11ControlFrameCTS(d.get_body_as_string())
         
     d.contains(self.cts)
    def setUp(self):
        # 802.11 Control Frame CFEnd
        self.frame_orig = '\xe4\x00\x00\x00\xff\xff\xff\xff\xff\xff\x00\x19\xe0\x98\x04\xd4\xad\x9c\x3c\xc0'

        d = Dot11(self.frame_orig)

        type = d.get_type()
        self.assertEqual(type, Dot11Types.DOT11_TYPE_CONTROL)

        subtype = d.get_subtype()
        self.assertEqual(subtype, Dot11Types.DOT11_SUBTYPE_CONTROL_CF_END)

        typesubtype = d.get_type_n_subtype()
        self.assertEqual(typesubtype,
                         Dot11Types.DOT11_TYPE_CONTROL_SUBTYPE_CF_END)

        self.cfend = Dot11ControlFrameCFEnd(d.get_body_as_string())

        d.contains(self.cfend)
Beispiel #9
0
 def setUp(self):
     # 802.11 Data Frame 
     #
     self.frame_orig=b'\x08\x01\x30\x00\x00\x08\x54\xac\x2f\x85\x00\x23\x4d\x09\x86\xfe\x00\x08\x54\xac\x2f\x85\x40\x44\xaa\xaa\x03\x00\x00\x00\x08\x00\x45\x00\x00\x28\x72\x37\x40\x00\x80\x06\x6c\x22\xc0\xa8\x01\x02\xc3\x7a\x97\x51\xd7\xa0\x00\x50\xa5\xa5\xb1\xe0\x12\x1c\xa9\xe1\x50\x10\x4e\x75\x59\x74\x00\x00\xed\x13\x22\x91'
     
     d = Dot11(self.frame_orig)
     
     type = d.get_type()
     self.assertEqual(type,Dot11Types.DOT11_TYPE_DATA)
     
     subtype = d.get_subtype()
     self.assertEqual(subtype,Dot11Types.DOT11_SUBTYPE_DATA)
     
     typesubtype = d.get_type_n_subtype()
     self.assertEqual(typesubtype,Dot11Types.DOT11_TYPE_DATA_SUBTYPE_DATA)
         
     self.data = Dot11DataFrame(d.get_body_as_string())
         
     d.contains(self.data)
Beispiel #10
0
def getBeacon(src, ssid):
    "Return 802.11 Beacon Frame."

    # Frame Control
    frameCtrl = Dot11(FCS_at_end=False)
    frameCtrl.set_version(0)
    frameCtrl.set_type_n_subtype(
        Dot11Types.DOT11_TYPE_MANAGEMENT_SUBTYPE_BEACON)
    # Frame Control Flags
    frameCtrl.set_fromDS(0)
    frameCtrl.set_toDS(0)
    frameCtrl.set_moreFrag(0)
    frameCtrl.set_retry(0)
    frameCtrl.set_powerManagement(0)
    frameCtrl.set_moreData(0)
    frameCtrl.set_protectedFrame(0)
    frameCtrl.set_order(0)

    # Management Frame
    sequence = random.randint(0, 4096)
    broadcast = [0xff, 0xff, 0xff, 0xff, 0xff, 0xff]
    mngtFrame = Dot11ManagementFrame()
    mngtFrame.set_duration(0)
    mngtFrame.set_destination_address(broadcast)
    mngtFrame.set_source_address(src)
    mngtFrame.set_bssid(broadcast)
    mngtFrame.set_fragment_number(0)
    mngtFrame.set_sequence_number(sequence)

    # Beacon Frame
    baconFrame = Dot11ManagementBeacon()
    baconFrame.set_ssid(ssid)
    baconFrame.set_supported_rates(
        [0x82, 0x84, 0x8b, 0x96, 0x0c, 0x18, 0x30, 0x48])
    baconFrame._set_element(
        dot11.DOT11_MANAGEMENT_ELEMENTS.EXT_SUPPORTED_RATES,
        "\x12\x24\x60\x6c")

    mngtFrame.contains(baconFrame)
    frameCtrl.contains(mngtFrame)

    return frameCtrl.get_packet()
 def setUp(self):
     # 802.11 Data Frame
     #
     self.dot11frame = b'\x08\x41\x2c\x00\x00\x21\x29\x68\x33\x5d\x00\x18\xde\x7c\x37\x9f\x00\x21\x29\x68\x33\x5b\xf0\xd6\x0c\x31\x65\x00\x8d\x23\x81\xe9\x25\x1c\xb5\xaa\x83\xd2\xc7\x16\xba\x6e\xe1\x8e\x7d\x3a\x2c\x71\xc0\x0f\x6a\xb8\x2f\xbc\x54\xc4\xb0\x14\xab\x03\x11\x5e\xde\xcc\xab\x2b\x18\xeb\xeb\x25\x0f\x75\xeb\x6b\xf5\x7f\xd6\x5c\xb9\xe1\xb2\x6e\x50\xba\x4b\xb4\x8b\x9f\x34\x71\xda\x9e\xcf\x12\xcb\x8f\x36\x1b\x02\x53'
     
     d = Dot11(self.dot11frame, FCS_at_end = False)
     
     self.assertEqual(d.get_type(),Dot11Types.DOT11_TYPE_DATA)
     self.assertEqual(d.get_subtype(),Dot11Types.DOT11_SUBTYPE_DATA)
     self.assertEqual(d.get_type_n_subtype(),Dot11Types.DOT11_TYPE_DATA_SUBTYPE_DATA)
     
     data = Dot11DataFrame(d.get_body_as_string())
     d.contains(data)
     
     self.wep_header = Dot11WEP(data.body_string)
     data.contains(self.wep_header)
     
     self.wep_data = Dot11WEPData(self.wep_header.body_string)
     self.wep_header.contains(self.wep_data)
     
     self.km=KeyManager()
     self.km.add_key([0x00,0x21,0x29,0x68,0x33,0x5d],unhexlify(b'999cbb701ca2ef030e302dcc35'))
Beispiel #12
0
 def setUp(self):
     # Frame control field
     a = b'\xd4\x00\x00\x00\x00\x08\x54\xac\x2f\x85\xb7\x7f\xc3\x9e'
     self.dot11fc = Dot11(a)