示例#1
0
 def test_all_calls_check_output_with_good_args(self):
     args = ['/sbin/iwlist', 'interface', 'scan']
     kwargs = {'stderr': subprocess.STDOUT}
     with patch.object(subprocess,
                       'check_output',
                       return_value=expected_output):
         Cell.all('interface')
         subprocess.check_output.assert_called_with(args, **kwargs)
         args.insert(0, 'sudo')
         Cell.all('interface', sudo=True)
         subprocess.check_output.assert_called_with(args, **kwargs)
示例#2
0
 def getNetworkList(self):
     if self.oldInterfaceState is None:
         self.oldInterfaceState = iNetwork.getAdapterAttribute(
             self.iface, "up")
     if self.oldInterfaceState is False:
         if iNetwork.getAdapterAttribute(self.iface, "up") is False:
             iNetwork.setAdapterAttribute(self.iface, "up", True)
             Console().ePopen(
                 ["/sbin/ifconfig", "/sbin/ifconfig", self.iface, "up"])
             driver = iNetwork.detectWlanModule(self.iface)
             if driver == "brcm-wl":
                 Console().ePopen(["/usr/bin/wl", "/usr/bin/wl", "up"])
     try:
         scanResults = list(Cell.all(self.iface, 5))
         print("[Wlan] Scan results = '%s'." % scanResults)
     except Exception:
         scanResults = None
         print("[Wlan] No wireless networks could be found.")
     aps = {}
     if scanResults:
         for i in range(len(scanResults)):
             bssid = scanResults[i].ssid
             aps[bssid] = {
                 "active":
                 True,
                 "bssid":
                 scanResults[i].ssid,
                 "essid":
                 scanResults[i].ssid,
                 "channel":
                 scanResults[i].channel,
                 "encrypted":
                 scanResults[i].encrypted,
                 "encryption_type":
                 scanResults[i].encryption_type
                 if scanResults[i].encrypted else "none",
                 "iface":
                 self.iface,
                 "maxrate":
                 scanResults[i].bitrates,
                 "mode":
                 scanResults[i].mode,
                 "quality":
                 scanResults[i].quality,
                 "signal":
                 scanResults[i].signal,
                 "frequency":
                 scanResults[i].frequency,
                 "frequency_norm":
                 scanResults[i].frequency_norm,
                 "address":
                 scanResults[i].address,
                 "noise":
                 scanResults[i].noise,
                 "pairwise_ciphers":
                 scanResults[i].pairwise_ciphers,
                 "authentication_suites":
                 scanResults[i].authentication_suites,
             }
     return aps
示例#3
0
 def getNetworkList(self):
     if self.oldInterfaceState is None:
         self.oldInterfaceState = iNetwork.getAdapterAttribute(
             self.iface, "up")
     if self.oldInterfaceState is False:
         if iNetwork.getAdapterAttribute(self.iface, "up") is False:
             iNetwork.setAdapterAttribute(self.iface, "up", True)
             system("ifconfig " + self.iface + " up")
             if existBcmWifi(self.iface):
                 eConsoleAppContainer().execute("wl up")
     aps = {}
     try:
         scanresults = list(Cell.all(self.iface, 5))
         print("[Wlan.py] scanresults1 = %s" % scanresults)
     except:
         scanresults = None
         print("[Wlan.py] No wireless networks could be found")
     if scanresults is not None:
         for i in range(len(scanresults)):
             bssid = scanresults[i].ssid
             aps[bssid] = {
                 'active':
                 True,
                 'bssid':
                 scanresults[i].ssid,
                 'essid':
                 scanresults[i].ssid,
                 'channel':
                 scanresults[i].channel,
                 'encrypted':
                 scanresults[i].encrypted,
                 'encryption_type':
                 scanresults[i].encryption_type
                 if scanresults[i].encrypted else "n/a",
                 'iface':
                 self.iface,
                 'maxrate':
                 scanresults[i].bitrates,
                 'mode':
                 scanresults[i].mode,
                 'quality':
                 scanresults[i].quality,
                 'signal':
                 scanresults[i].signal,
                 'frequency':
                 scanresults[i].frequency,
                 'frequency_norm':
                 scanresults[i].frequency_norm,
                 'address':
                 scanresults[i].address,
                 'noise':
                 scanresults[i].noise,
                 'pairwise_ciphers':
                 scanresults[i].pairwise_ciphers,
                 'authentication_suites':
                 scanresults[i].authentication_suites,
             }
     print("[Wlan.py] apsresults1 = %s" % aps)
     return aps
示例#4
0
    def update(self):
        """Update Wifi stats using the input method.

        Stats is a list of dict (one dict per hotspot)

        :returns: list -- Stats is a list of dict (hotspot)
        """
        # Reset stats
        self.reset()

        # Exist if we can not grab the stats
        if not wifi_tag:
            return self.stats

        if self.input_method == 'local':
            # Update stats using the standard system lib

            # Grab network interface stat using the PsUtil net_io_counter method
            try:
                netiocounters = psutil.net_io_counters(pernic=True)
            except UnicodeDecodeError:
                return self.stats

            for net in netiocounters:
                # Do not take hidden interface into account
                if self.is_hide(net):
                    continue

                # Grab the stats using the Wifi Python lib
                try:
                    wifi_cells = Cell.all(net)
                except InterfaceError:
                    # Not a Wifi interface
                    pass
                except Exception as e:
                    # Other error
                    logger.debug("WIFI plugin: Can not grab cellule stats ({})".format(e))
                    pass
                else:
                    for wifi_cell in wifi_cells:
                        hotspot = {
                            'key': self.get_key(),
                            'ssid': wifi_cell.ssid,
                            'signal': wifi_cell.signal,
                            'quality': wifi_cell.quality,
                            'encrypted': wifi_cell.encrypted,
                            'encryption_type': wifi_cell.encryption_type if wifi_cell.encrypted else None
                        }
                        # Add the hotspot to the list
                        self.stats.append(hotspot)

        elif self.input_method == 'snmp':
            # Update stats using SNMP

            # Not implemented yet
            pass

        return self.stats
示例#5
0
    def getNetworkList(self):
        if self.oldInterfaceState is None:
            self.oldInterfaceState = iNetwork.getAdapterAttribute(
                self.iface, "up")
        if self.oldInterfaceState is False:
            if iNetwork.getAdapterAttribute(self.iface, "up") is False:
                iNetwork.setAdapterAttribute(self.iface, "up", True)
                system("ifconfig " + self.iface + " up")
                driver = iNetwork.detectWlanModule(self.iface)
                if driver in ('brcm-wl', ):
                    system("wl up")

        scanresults = list(Cell.all(self.iface))
        aps = {}
        if scanresults is not None:
            for i in range(len(scanresults)):
                bssid = scanresults[i].ssid
                aps[bssid] = {
                    'active':
                    True,
                    'bssid':
                    scanresults[i].ssid,
                    'essid':
                    scanresults[i].ssid,
                    'channel':
                    scanresults[i].channel,
                    'encrypted':
                    scanresults[i].encrypted,
                    'encryption_type':
                    scanresults[i].encryption_type
                    if scanresults[i].encrypted else "none",
                    'iface':
                    self.iface,
                    'maxrate':
                    scanresults[i].bitrates,
                    'mode':
                    scanresults[i].mode,
                    'quality':
                    scanresults[i].quality,
                    'signal':
                    scanresults[i].signal,
                    'frequency':
                    scanresults[i].frequency,
                    'frequency_norm':
                    scanresults[i].frequency_norm,
                    'address':
                    scanresults[i].address,
                    'noise':
                    scanresults[i].noise,
                    'pairwise_ciphers':
                    scanresults[i].pairwise_ciphers,
                    'authentication_suites':
                    scanresults[i].authentication_suites,
                }
        return aps
示例#6
0
    def iwconfigFinished(self, result, retval, extra_args):
        result = six.ensure_str(result)
        iface = extra_args
        ssid = "off"
        data = {
            'essid': False,
            'frequency': False,
            'accesspoint': False,
            'bitrate': False,
            'encryption': False,
            'quality': False,
            'signal': False,
            'channel': False,
            'encryption_type': False,
            'frequency': False,
            'frequency_norm': False
        }
        for line in result.splitlines():
            line = line.strip()
            if "ESSID" in line:
                if "off/any" in line:
                    ssid = "off"
                else:
                    if "Nickname" in line:
                        ssid = (line[line.index('ESSID') +
                                     7:line.index('"  Nickname')])
                    else:
                        ssid = (line[line.index('ESSID') + 7:len(line) - 1])
                if ssid != "off":
                    data['essid'] = ssid
            if "Access Point" in line:
                if "Sensitivity" in line:
                    ap = line[line.index('Access Point') +
                              14:line.index('   Sensitivity')]
                else:
                    ap = line[line.index('Access Point') + 14:len(line)]
                if ap is not None:
                    data['accesspoint'] = ap
            if "Frequency" in line:
                frequency = line[line.index('Frequency') +
                                 10:line.index(' GHz')]
                if frequency is not None:
                    data['frequency'] = frequency
            if "Bit Rate" in line:
                if "kb" in line:
                    br = line[line.index('Bit Rate') + 9:line.index(' kb/s')]
                elif "Gb" in line:
                    br = line[line.index('Bit Rate') + 9:line.index(' Gb/s')]
                else:
                    br = line[line.index('Bit Rate') + 9:line.index(' Mb/s')]
                if br is not None:
                    data['bitrate'] = br

        if ssid != None and ssid != "off":
            scanresults = list(Cell.all(iface))
            aps = {}
            if scanresults is not None:
                for i in range(len(scanresults)):
                    bssid = scanresults[i].ssid
                    aps[bssid] = {
                        'active':
                        True,
                        'bssid':
                        scanresults[i].ssid,
                        'essid':
                        scanresults[i].ssid,
                        'channel':
                        scanresults[i].channel,
                        'encrypted':
                        scanresults[i].encrypted,
                        'encryption_type':
                        scanresults[i].encryption_type
                        if scanresults[i].encrypted else "none",
                        'iface':
                        iface,
                        'maxrate':
                        scanresults[i].bitrates,
                        'mode':
                        scanresults[i].mode,
                        'quality':
                        scanresults[i].quality,
                        'signal':
                        scanresults[i].signal,
                        'frequency':
                        scanresults[i].frequency,
                        'frequency_norm':
                        scanresults[i].frequency_norm,
                        'address':
                        scanresults[i].address,
                        'noise':
                        scanresults[i].noise,
                        'pairwise_ciphers':
                        scanresults[i].pairwise_ciphers,
                        'authentication_suites':
                        scanresults[i].authentication_suites,
                    }
                #data['bitrate'] = aps[ssid]["maxrate"]
                data['encryption'] = aps[ssid]["encrypted"]
                data['quality'] = aps[ssid]["quality"]
                data['signal'] = aps[ssid]["signal"]
                data['channel'] = aps[ssid]["channel"]
                data['encryption_type'] = aps[ssid]["encryption_type"]
                #data['frequency'] = aps[ssid]["frequency"]
                data['frequency_norm'] = aps[ssid]["frequency_norm"]

        self.wlaniface[iface] = data
        self.backupwlaniface = self.wlaniface

        if self.WlanConsole is not None:
            if not self.WlanConsole.appContainers:
                print("[Wlan.py] self.wlaniface after loading:",
                      self.wlaniface)
                if self.statusCallback is not None:
                    self.statusCallback(True, self.wlaniface)
                    self.statusCallback = None
示例#7
0
    def iwconfigFinished(self, result, retval, extra_args):
        iface = extra_args
        ssid = "off"
        data = {
            'essid': False,
            'frequency': False,
            'accesspoint': False,
            'bitrate': False,
            'encryption': False,
            'quality': False,
            'signal': False,
            'channel': False,
            'encryption_type': False,
            'frequency': False,
            'frequency_norm': False
        }
        for line in result.splitlines():
            line = line.strip()
            if "ESSID" in line:
                if "off/any" in line:
                    ssid = "off"
                else:
                    if "Nickname" in line:
                        ssid = (line[line.index('ESSID') +
                                     7:line.index('"  Nickname')])
                    else:
                        ssid = (line[line.index('ESSID') + 7:len(line) - 1])
                if ssid != "off":
                    data['essid'] = ssid
            if "Frequency" in line:
                frequency = line[line.index('Frequency') +
                                 10:line.index(' GHz')]
                if frequency is not None:
                    data['frequency'] = frequency
            if "Access Point" in line:
                if "Sensitivity" in line:
                    ap = line[line.index('Access Point') +
                              14:line.index('   Sensitivity')]
                else:
                    ap = line[line.index('Access Point') + 14:len(line)]
                if ap is not None:
                    data['accesspoint'] = ap
            if "Bit Rate" in line:
                if "kb" in line:
                    br = line[line.index('Bit Rate') + 9:line.index(' kb/s')]
                elif "Gb" in line:
                    br = line[line.index('Bit Rate') + 9:line.index(' Gb/s')]
                else:
                    br = line[line.index('Bit Rate') + 9:line.index(' Mb/s')]
                if br is not None:
                    data['bitrate'] = br
            if "Encryption key" in line:
                if ":off" in line:
                    enc = "off"
                elif "Security" in line:
                    enc = line[line.index('Encryption key') +
                               15:line.index('   Security')]
                    if enc is not None:
                        enc = "on"
                else:
                    enc = line[line.index('Encryption key') + 15:len(line)]
                    if enc is not None:
                        enc = "on"
                if enc is not None:
                    data['encryption'] = enc
            if 'Quality' in line:
                if "/100" in line:
                    qual = line[line.index('Quality') +
                                8:line.index('  Signal')]
                else:
                    qual = line[line.index('Quality') + 8:line.index('Sig')]
                if qual is not None:
                    data['quality'] = qual
            if 'Signal level' in line:
                if "dBm" in line:
                    signal = line[line.index('Signal level') +
                                  13:line.index(' dBm')] + " dBm"
                elif "/100" in line:
                    if "Noise" in line:
                        signal = line[line.index('Signal level') +
                                      13:line.index('  Noise')]
                    else:
                        signal = line[line.index('Signal level') +
                                      13:len(line)]
                else:
                    if "Noise" in line:
                        signal = line[line.index('Signal level') +
                                      13:line.index('  Noise')]
                    else:
                        signal = line[line.index('Signal level') +
                                      13:len(line)]
                if signal is not None:
                    data['signal'] = signal
        if ssid != None and ssid != "off" and ssid != "":
            try:
                scanresults = list(Cell.all(iface, 5))
                print("[Wlan.py] scanresults2 = %s" % scanresults)
            except:
                scanresults = None
                print("[Wlan.py] No wireless networks could be found")
            aps = {}
            if scanresults is not None:
                config.misc.networkenabled.value = True
                print("[NetworkWizard] networkenabled value = %s" %
                      config.misc.networkenabled.value)
                for i in range(len(scanresults)):
                    bssid = scanresults[i].ssid
                    aps[bssid] = {
                        'active':
                        True,
                        'bssid':
                        scanresults[i].ssid,
                        'essid':
                        scanresults[i].ssid,
                        'channel':
                        scanresults[i].channel,
                        'encrypted':
                        scanresults[i].encrypted,
                        'encryption_type':
                        scanresults[i].encryption_type
                        if scanresults[i].encrypted else "n/a",
                        'iface':
                        iface,
                        'maxrate':
                        scanresults[i].bitrates,
                        'mode':
                        scanresults[i].mode,
                        'quality':
                        scanresults[i].quality,
                        'signal':
                        scanresults[i].signal,
                        'frequency':
                        scanresults[i].frequency,
                        'frequency_norm':
                        scanresults[i].frequency_norm,
                        'address':
                        scanresults[i].address,
                        'noise':
                        scanresults[i].noise,
                        'pairwise_ciphers':
                        scanresults[i].pairwise_ciphers,
                        'authentication_suites':
                        scanresults[i].authentication_suites,
                    }
                #data['bitrate'] = aps[ssid]["maxrate"]
                data['encryption'] = aps[ssid]["encrypted"]
                data['quality'] = aps[ssid]["quality"]
                data['signal'] = aps[ssid]["signal"]
                data['channel'] = aps[ssid]["channel"]
                data['encryption_type'] = aps[ssid]["encryption_type"]
                #data['frequency'] = aps[ssid]["frequency"]
                data['frequency_norm'] = aps[ssid]["frequency_norm"]
        print("[Wlan.py] apsresults2 = %s" % data)
        self.wlaniface[iface] = data
        self.backupwlaniface = self.wlaniface

        if self.WlanConsole is not None:
            if not self.WlanConsole.appContainers:
                print("[Wlan.py] self.wlaniface after loading:",
                      self.wlaniface)
                if self.statusCallback is not None:
                    self.statusCallback(True, self.wlaniface)
                    self.statusCallback = None
示例#8
0
 def iwconfigFinished(self, result, retVal, extraArgs):
     iface = extraArgs
     ssid = "off"
     data = {
         "essid": False,
         "frequency": False,
         "accesspoint": False,
         "bitrate": False,
         "encryption": False,
         "quality": False,
         "signal": False,
         "channel": False,
         "encryption_type": False,
         "frequency": False,
         "frequency_norm": False
     }
     for line in result.splitlines():
         line = line.strip()
         if "ESSID" in line:
             if "off/any" in line:
                 ssid = "off"
             else:
                 if "Nickname" in line:
                     ssid = (line[line.index("ESSID") +
                                  7:line.index("\"  Nickname")])
                 else:
                     ssid = (line[line.index("ESSID") + 7:len(line) - 1])
             if ssid != "off":
                 data["essid"] = ssid
         if "Access Point" in line:
             if "Sensitivity" in line:
                 ap = line[line.index("Access Point") +
                           14:line.index("   Sensitivity")]
             else:
                 ap = line[line.index("Access Point") + 14:len(line)]
             if ap is not None:
                 data["accesspoint"] = ap
         if "Frequency" in line:
             frequency = line[line.index("Frequency") +
                              10:line.index(" GHz")]
             if frequency is not None:
                 data["frequency"] = frequency
         if "Bit Rate" in line:
             if "kb" in line:
                 br = line[line.index("Bit Rate") + 9:line.index(" kb/s")]
             elif "Gb" in line:
                 br = line[line.index("Bit Rate") + 9:line.index(" Gb/s")]
             else:
                 br = line[line.index("Bit Rate") + 9:line.index(" Mb/s")]
             if br is not None:
                 data["bitrate"] = br
         if "Encryption key" in line:
             if ":off" in line:
                 enc = "off"
             elif "Security" in line:
                 enc = line[line.index("Encryption key") +
                            15:line.index("   Security")]
                 if enc:
                     enc = "on"
             else:
                 enc = line[line.index("Encryption key") + 15:len(line)]
                 if enc:
                     enc = "on"
             if enc:
                 data["encryption"] = enc
         if "Quality" in line:
             if "/100" in line:
                 qual = line[line.index("Quality") +
                             8:line.index("  Signal")]
             else:
                 qual = line[line.index("Quality") + 8:line.index("Sig")]
             if qual:
                 data["quality"] = qual
         if "Signal level" in line:
             if "dBm" in line:
                 signal = line[line.index("Signal level") +
                               13:line.index(" dBm")] + " dBm"
             elif "/100" in line:
                 if "Noise" in line:
                     signal = line[line.index("Signal level") +
                                   13:line.index("  Noise")]
                 else:
                     signal = line[line.index("Signal level") +
                                   13:len(line)]
             else:
                 if "Noise" in line:
                     signal = line[line.index("Signal level") +
                                   13:line.index("  Noise")]
                 else:
                     signal = line[line.index("Signal level") +
                                   13:len(line)]
             if signal:
                 data["signal"] = signal
     if ssid != None and ssid != "off" and ssid != "":
         try:
             scanResults = list(Cell.all(iface, 5))
             print("[Wlan] Scan results = '%s'." % scanResults)
         except Exception:
             scanResults = None
             print("[Wlan] No wireless networks could be found.")
         aps = {}
         if scanResults:
             for i in range(len(scanResults)):
                 bssid = scanResults[i].ssid
                 aps[bssid] = {
                     "active":
                     True,
                     "bssid":
                     scanResults[i].ssid,
                     "essid":
                     scanResults[i].ssid,
                     "channel":
                     scanResults[i].channel,
                     "encrypted":
                     scanResults[i].encrypted,
                     "encryption_type":
                     scanResults[i].encryption_type
                     if scanResults[i].encrypted else "none",
                     "iface":
                     iface,
                     "maxrate":
                     scanResults[i].bitrates,
                     "mode":
                     scanResults[i].mode,
                     "quality":
                     scanResults[i].quality,
                     "signal":
                     scanResults[i].signal,
                     "frequency":
                     scanResults[i].frequency,
                     "frequency_norm":
                     scanResults[i].frequency_norm,
                     "address":
                     scanResults[i].address,
                     "noise":
                     scanResults[i].noise,
                     "pairwise_ciphers":
                     scanResults[i].pairwise_ciphers,
                     "authentication_suites":
                     scanResults[i].authentication_suites,
                 }
             # data["bitrate"] = aps[ssid]["maxrate"]
             data["encryption"] = aps[ssid]["encrypted"]
             data["quality"] = aps[ssid]["quality"]
             data["signal"] = aps[ssid]["signal"]
             data["channel"] = aps[ssid]["channel"]
             data["encryption_type"] = aps[ssid]["encryption_type"]
             # data["frequency"] = aps[ssid]["frequency"]
             data["frequency_norm"] = aps[ssid]["frequency_norm"]
     self.wlanIface[iface] = data
     self.backupWlanIface = self.wlanIface
     if self.wlanConsole is not None:
         if not self.wlanConsole.appContainers:
             print("[Wlan] self.wlanIface after loading: '%s'." %
                   str(self.wlanIface))
             if self.statusCallback is not None:
                 self.statusCallback(True, self.wlanIface)
                 self.statusCallback = None
示例#9
0
def tick():
    '''
    ***REMOVE IF WE CAN TELL IF WE ARE CONNECTED
    If there is only 1 wifi network, it means
    that we are already connected or that there
    is only 1 wifi network. Do nothing since the
    user can try and connect to that network
    on there own.
    '''
    '''
    A list of the addresses of networks that are repetitive with each scan.
    Make the noted and previous network lists global
    '''
    global prevNetworks
    global notedNetworks
    
    lastingNetworks = []

    '''
    Parse the data from the already parsed data of
    Cell.all("wlan0") and turn it into a list of
    the wifi networks each represented by the 
    Network class. When parsing, if a network has
    the name of another in the list, keep/add
    whichever network has the strongest signal.
    If each have the same signal, choose the
    current network being iterated over.
    Ex: Two seperate xfinitywifi networks.
    '''
    liveNetworks = []
    for network in Cell.all("wlan0"):
        ssid = network.ssid
        address = network.address
        signal = round(int((network.quality.split("/")[0]))/.7)
        encrypted = network.encrypted
        parsedNetwork = Network(ssid,address,signal,encrypted)
        if (getNetworkFromSSID(liveNetworks, ssid) is not None):
            otherNetwork = getNetworkFromSSID(liveNetworks, ssid)
            if (otherNetwork.signal <= signal):
                removeNetwork(liveNetworks, ssid)
                liveNetworks.append(parsedNetwork)
        else:
            liveNetworks.append(parsedNetwork)
    
    '''
    With our fresh set of live parsed networks,
    we now need to compare them with our older
    previous set of networks so that we can
    update the vital list of lasting networks.
    We also need to average out the signal from
    the previous signal and current signal for
    more accuracy and increase the amount of times
    this network has been scanned in a row if it appears
    in the list of old networks. We also need to add
    its MAC Address if it's not already in the lasting
    list of networks.
    '''
            
    for network in liveNetworks:
        if (not(getNetworkFromMAC(prevNetworks,network.address) == None)):
            oldNetwork = getNetworkFromMAC(prevNetworks,network.address)
            network.count = (oldNetwork.count + 1)
            network.signal = round((network.signal + oldNetwork.signal) / 2)
            if (notedNetworks.count(network.address) == 0 and 
                lastingNetworks.count(network.address) == 0):
                lastingNetworks.append(network.address)
                
    
    '''
     Run through our list of lasting networks and check
     if each network has had an average signal of 50% or
     above and has been scanned 3 times in a row. If so,
     display the notification that the network is available
     and remove it from the list of lasting network MACs.
     Add it to the list of noted networks so it doesn't
     get thrown back in the mix.
    '''
                
                
    '''
    Remove noted network MAC addresses if they no longer are lasting
    '''
    
    removedMACS = []
    for address in lastingNetworks:
        network = getNetworkFromMAC(liveNetworks, address)
        if (network.signal >= 50 and network.count >= 3):
            removedMACS.append(address)
            if (notedNetworks.count(address) == 0):
                notedNetworks.append(address)
                ssid = network.ssid
                encrypted = None
                if (network.encrypted is True):
                    encrypted = "Yes"
                else:
                    encrypted = "No"
                if ("x00" in str(ssid)):
                    ssid = "Unknown"
            pynotify.init("netscan - " + network.ssid)
            notification = pynotify.Notification("Network Detected",
            "SSID: " + ssid + "\n" + "Signal Strength: " + str(network.signal).replace(".0", "") + "%\n" + "Encrypted: " + encrypted,
            "/home/max/tools/icons/wifi.png")
            notification.show()
            
    for address in removedMACS:
        lastingNetworks.remove(address)
        
    prevNetworks = liveNetworks