Пример #1
0
 def __init__(self, log):
     self.debug = config.DEBUG
     self.log = log
     self.wifi_helper = WiFiHelper(log)
     self.network_helper = NetworkHelper(log)
     self.parsing_helper = ParsingHelper(log)
     self.freq = 0
     self.channel = 0
     self.ssid = 0
Пример #2
0
    def __init__(self, log):
        self.log = log
        self.debug = config.DEBUG
        self.lostMessages = 0 # TODO: do we need this?

        # use the proper connector module
        if config.CONNECTOR == "mininet":
            self.connector = MininetConnector(log)
        elif config.CONNECTOR == "linux":
            self.connector = LinuxConnector(log)

        # Helper Objects
        self.wifi_helper = WiFiHelper(log)
        self.network_helper = NetworkHelper(log)
        self.security_helper = SecurityHelper(log)
        self.parsing_helper = ParsingHelper(log)

        # Config
        self.FWD_PORT = config.FWD_PORT
        self.SND_PORT = config.SND_PORT
        self.SLEEP_DUR = config.SLEEP_DUR
        self.keyChangeInterval = config.KEYCHANGEINTERVAL

        #Internal RX Callback
        self.rx_cb = self.rxCbInternal

        #Init thread handling objects
        self.init_thread_handling()
        self.init_local_credentials()
        self.init_security_credentials()

        self.connector.addIEtoProbeResponses(self.pubKeyHexStr, self.keyHexStr, self.ivHexStr, self.hostnameStrHex)

        self.initSendMsg()

        # ResFi forwarding thread
        fwd_t = threading.Thread(name='initForwarding', target=self.initForwardingTTL)
        fwd_t.setDaemon(True)
        fwd_t.start()

        time.sleep(1)

        self.init_self_connection()

        scanResults = self.connector.performActiveScan(True, "", 0, self.pubKeyHexStr, self.keyHexStr, self.ivHexStr, self.hostnameStrHex, self.freq)
        self.onAPJoined(scanResults)

        # thread responsible for handling probe requests received by hostapd, takes callback for probe request handling
        probereq_t = threading.Thread(name='subscribeToProbeRequests', target=self.connector.subscribeToProbeRequests, args=(self.handle_incoming_probe_requests,))
        probereq_t.setDaemon(True)
        probereq_t.start()


        # receive message thread
        sub_t = threading.Thread(name='receiveMessage', target=self.receiveMessage, args=(self.rx_cb,))
        sub_t.setDaemon(True)
        sub_t.start()

        # periodic key changing
        keychanger_t = threading.Thread(name='changeKeys', target=self.changeKeys)
        keychanger_t.setDaemon(True)
        keychanger_t.start()