コード例 #1
0
 def __init__(self):
     self.mac_matcher = macmatcher.MACMatcher(MAC_PREFIX_FILE)
     self.network_manager = interfaces.NetworkManager()
     self.template_manager = phishingpage.TemplateManager()
     self.access_point = accesspoint.AccessPoint()
     self.fw = firewall.Fw()
     self.em = extensions.ExtensionManager(self.network_manager)
コード例 #2
0
 def test_multiple_extensions(self):
     # We need a NM to init EM
     nm = interfaces.NetworkManager()
     # Init an EM and pass some shared data
     em = extensions.ExtensionManager(nm)
     em.set_extensions(constants.DEFAULT_EXTENSIONS)
     shared_data = {"one": 1, "two": 2, "is_freq_hop_allowed": True}
     em.init_extensions(shared_data)
     # A deauth packet appears in the air
     packet = (
         dot11.RadioTap() /
         dot11.Dot11(
             type=0,
             subtype=12,
             addr1="00:00:00:00:00:00",
             addr2="00:00:00:00:00:00",
             addr3="00:00:00:00:00:00") /
         dot11.Dot11Deauth())
     em._process_packet(packet)
     # Packets to send have been merged from the two extensions
     # Validate with get_packet()
     assert em._packets_to_send["1"] == [1, 2, 3, 4]
     # Output has also been merged in one list.
     # Validate with send_output()
     assert em.get_output() == ["one", "two", "three", "four", "five"]
コード例 #3
0
 def test_multiple_extensions(self, send_func):
     # Init an EM and pass some shared data
     self.em = extensions.ExtensionManager()
     shared_data = {"one": 1, "two": 2}
     self.em.init_extensions(shared_data)
     self.em.start_extensions()
     # A deauth packet appears in the air
     packet = (dot11.RadioTap() / dot11.Dot11(type=0, subtype=12, \
             addr1="00:00:00:00:00:00", addr2="00:00:00:00:00:00", addr3="00:00:00:00:00:00") \
           / dot11.Dot11Deauth())
     self.em._process_packet(packet)
     # Packets to send have been merged from the two extensions
     # Validate with get_packet()
     assert self.em._packets_to_send == [1, 2, 3, 4]
     # Output has also been merged in one list.
     # Validate with send_output()
     assert self.em.get_output() == ["one", "two", "three", "four", "five"]
コード例 #4
0
 def test_single_extension(self):
     # Init an EM and pass some shared data
     em = extensions.ExtensionManager()
     em.set_extensions(constants.DEFAULT_EXTENSIONS)
     shared_data = {"one": 1, "two": 2}
     em.init_extensions(shared_data)
     # A deauth packet appears in the air
     packet = (dot11.RadioTap() / dot11.Dot11(type=0,
                                              subtype=12,
                                              addr1="00:00:00:00:00:00",
                                              addr2="00:00:00:00:00:00",
                                              addr3="00:00:00:00:00:00") /
               dot11.Dot11Deauth())
     em._process_packet(packet)
     # The extension1.py sent packet "1" and returned output
     # "one", "two". Validate with get_packet(), send_output()
     assert em._packets_to_send["1"] == [1]
     assert em._packets_to_send["2"] == []
     assert em.get_output() == ["one", "two"]
コード例 #5
0
 def test_single_extension(self, send_func):
     # Init an EM and pass some shared data
     self.em = extensions.ExtensionManager()
     shared_data = {"one": 1, "two": 2}
     self.em.init_extensions(shared_data)
     assert not send_func.called
     self.em.start_extensions()
     # A deauth packet appears in the air
     packet = (dot11.RadioTap() / dot11.Dot11(type=0, subtype=12, \
             addr1="00:00:00:00:00:00", addr2="00:00:00:00:00:00", addr3="00:00:00:00:00:00") \
           / dot11.Dot11Deauth())
     self.em._process_packet(packet)
     # After EM starts, the send daemon is triggered and
     # sends any packets from extensions
     assert send_func.called == 1
     # The extension1.py sent packet "1" and returned output
     # "one", "two". Validate with get_packet(), send_output()
     assert self.em._packets_to_send == [1]
     assert self.em.get_output() == ["one", "two"]