mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-01-03 10:32:33 +01:00
auto-t: add spoofing frame support to hwsim util
Using the hwsim dbus interface ".Interface" under the radios object you can now send an arbitrary frame out from that radio. Two methods have been added, spoof_frame and spoof_disassociate.
This commit is contained in:
parent
fe616fbfa5
commit
13429f8f2d
@ -13,6 +13,7 @@ HWSIM_RULE_MANAGER_INTERFACE = 'net.connman.iwd.hwsim.RuleManager'
|
|||||||
HWSIM_RULE_INTERFACE = 'net.connman.iwd.hwsim.Rule'
|
HWSIM_RULE_INTERFACE = 'net.connman.iwd.hwsim.Rule'
|
||||||
HWSIM_RADIO_MANAGER_INTERFACE = 'net.connman.iwd.hwsim.RadioManager'
|
HWSIM_RADIO_MANAGER_INTERFACE = 'net.connman.iwd.hwsim.RadioManager'
|
||||||
HWSIM_RADIO_INTERFACE = 'net.connman.iwd.hwsim.Radio'
|
HWSIM_RADIO_INTERFACE = 'net.connman.iwd.hwsim.Radio'
|
||||||
|
HWSIM_INTERFACE_INTERFACE = 'net.connman.iwd.hwsim.Interface'
|
||||||
|
|
||||||
HWSIM_AGENT_MANAGER_PATH = '/'
|
HWSIM_AGENT_MANAGER_PATH = '/'
|
||||||
|
|
||||||
@ -266,3 +267,35 @@ class Hwsim(iwd.AsyncOpAbstract):
|
|||||||
@property
|
@property
|
||||||
def object_manager(self):
|
def object_manager(self):
|
||||||
return self._object_manager_if
|
return self._object_manager_if
|
||||||
|
|
||||||
|
def spoof_disassociate(self, radio, freq, station):
|
||||||
|
'''
|
||||||
|
Send a spoofed disassociate frame to a station
|
||||||
|
'''
|
||||||
|
frame = 'a0 00 3a 01'
|
||||||
|
frame += station.replace(':', '')
|
||||||
|
frame += radio.addresses[0].replace(':', '')
|
||||||
|
frame += radio.addresses[0].replace(':', '')
|
||||||
|
frame += '30 01 02 00'
|
||||||
|
self.spoof_frame(radio, freq, station, frame)
|
||||||
|
|
||||||
|
def spoof_frame(self, radio, freq, station, frame):
|
||||||
|
'''
|
||||||
|
Send a spoofed arbitrary frame to a station
|
||||||
|
'''
|
||||||
|
radio_path = None
|
||||||
|
objects = self.object_manager.GetManagedObjects()
|
||||||
|
|
||||||
|
for path in objects:
|
||||||
|
obj = objects[path]
|
||||||
|
for interface in obj:
|
||||||
|
if interface == HWSIM_INTERFACE_INTERFACE:
|
||||||
|
if obj[interface]['Address'] == radio.addresses[0]:
|
||||||
|
radio_path = path
|
||||||
|
break
|
||||||
|
|
||||||
|
iface = dbus.Interface(self._bus.get_object(HWSIM_SERVICE, radio_path),
|
||||||
|
HWSIM_INTERFACE_INTERFACE)
|
||||||
|
|
||||||
|
iface.SendFrame(bytearray.fromhex(station.replace(':', '')),
|
||||||
|
freq, -30, bytearray.fromhex(frame))
|
||||||
|
Loading…
Reference in New Issue
Block a user