Пример #1
0
    def _wifi_scanner(self):
        # reset the known access points
        self.access_points = []
        # walk through all known wireless interfaces to get complete coverage
        for interface in self.wireless_interfaces:
            # create a card instance to work with
            card = pyw.getcard(interface)
            # check if the card is still valid
            if pyw.validcard(card):
                # skip the card if it is hard blocked
                if pyw.isblocked(card)[1]:
                    continue
                else:
                    # try to unblock a softblock, put the card up and disable the powersave mode
                    try:
                        pyw.unblock(card)
                        pyw.up(card)
                        pyw.pwrsaveset(card, False)
                    except:
                        # ignore failures
                        pass
                    # start scanning
                    wifi_scanner = get_scanner(interface)
                    # extend the access point list
                    self.access_points.extend(wifi_scanner.get_access_points())

        # the first scan has been completed
        self.first_scan_complete = True
Пример #2
0
def get_access_point_mac(node_name):
    wifi = ap.get_scanner().get_access_points()
    for node in wifi:
        if (node['ssid'] == node_name):
            print('Gateway mac addr: {}'.format(node['bssid']))
            print('Gateway quality: {}'.format(node.quality))
            print "\n"
            return str(node['bssid'])
Пример #3
0
def sample(device=""):
    wifi_scanner = get_scanner(device)
    if not os.environ.get("PYTHON_ENV", False):
        aps = wifi_scanner.get_access_points()
    else:
        aps = [{"quality": 100, "bssid": "XX:XX:XX:XX:XX:84",
                "ssid": "X", "security": "XX"}]
    return aps_to_dict(aps)
Пример #4
0
def sample():
    wifi_scanner = get_scanner()
    if not os.environ.get("PYTHON_ENV", False):
        aps = wifi_scanner.get_access_points()
    else:
        aps = [{"quality": 100, "bssid": "XX:XX:XX:XX:XX:84",
                "ssid": "X", "security": "XX"}]
    return aps_to_dict(aps)
Пример #5
0
def sample():
    wifi_scanner = get_scanner()
    aps = wifi_scanner.get_access_points()
    dc = {}
    for ap in aps:
        key = ap['ssid'] + " " + ap['bssid']
        value = ap['quality']
        dc[key] = value
    return dc
Пример #6
0
    def run(self):
        #Wifi
        wifi_scanner = get_scanner()
        wifiInfo = wifi_scanner.get_access_points()
        print wifiInfo
        for x in range(0, len(wifiInfo)):
            print wifiInfo[x]["bssid"]

        #Bluetooth
        nearby_devices = discover_devices()
Пример #7
0
def ocid_get_location(api_key):
    url = "https://us1.unwiredlabs.com/v2/process.php"
    wifi_scanner = get_scanner()
    aps = wifi_scanner.get_access_points()
    aps = [{'bssid': ap.bssid, 'signal': ap.quality * -1} for ap in aps]

    payload = {'token': api_key, 'address': 0, 'wifi': aps}
    response = requests.request("POST", url, json=payload)

    return response.json()
Пример #8
0
def wifi_scanner():
    try:
        wifi_scan = get_scanner()

        result = ""
        for access_point in wifi_scan.get_access_points():
            result += f"{access_point.ssid}  {access_point.bssid}  {access_point.security}\n----------\n"

        return result

    except:
        return "⚠️ Victim does not have wifi enabled."
Пример #9
0
def fetch_datasets(label='default place', size=1):
    X = []
    y = []
    wifi_scanner = get_scanner()
    for index in range(int(size)):
        print('scan ' + str(index) + ' access points')
        access_points = wifi_scanner.get_access_points()
        X.append({
            ' '.join([ap.ssid, ap.bssid]): ap.quality
            for ap in access_points
        })
        y.append(label)
    return X, y
def get_Locations():
    wifi_scanner = get_scanner()
    accesspoints = wifi_scanner.get_access_points()
    for i in range(len(accesspoints)):

        ssids.append(accesspoints[i].ssid)
        bssid = accesspoints[i].bssid
        bssids.append(bssid)
        locationss = requests.get(
            "https://api.mylnikov.org/wifi?v=1.1&bssid=" + bssid).json()
        if locationss['result'] == 200:
            Coordinations.append(
                f"Lat:{locationss['data']['lat']} Long:{locationss['data']['lon']}"
            )
            search_in_Google.append(
                f"{locationss['data']['lat']},{locationss['data']['lon']}")

        else:
            Coordinations.append("Not Found")
            search_in_Google.append("Not Available")
Пример #11
0
    def run(self):
        try:
            subprocess.run([
                "nmcli", "d", "wifi", "connect", self.ssid, "password",
                self.password
            ],
                           timeout=0.5)
        except Exception as exp:
            print("Couldn't connect to name : {}. {}".format(self.ssid, exp))
        sleep(0.5)


if __name__ == "__main__":
    # AP scanning
    wifi_scanner = get_scanner()
    aps = wifi_scanner.get_access_points()
    for idx, item in enumerate(aps):
        print(idx, item.ssid, item.security)

    # select target AP
    x = (int)(input("select ssid: "))

    # WPA2의 경우 최소 8자리 제한 설정
    WPA2 = re.compile('WPA2')
    ssid = aps[x].ssid
    isWPA2 = (bool)(WPA2.match((str)(aps[x].security)))
    print("\n\n ssid: {} \n WPA2: {}".format(ssid, isWPA2))

    # load dictionary file
    data = pd.read_csv('engdic.txt', sep="\n", header=None)
Пример #12
0
def test_scan():
    scanner = get_scanner()
    aps = scanner.get_access_points()
    # We don't know if we necessarily get BSSIDs from a live scan;
    # best to err on the side of caution here and not require a match.
    assert_access_point(aps, False)
Пример #13
0
 def fillCombo(self):
     self.comboBox.clear()
     wifi_scanner = get_scanner()
     list1 = wifi_scanner.get_access_points()
     for i in list1:
         self.comboBox.addItem(i["ssid"])
Пример #14
0
def test_scan():
    scanner = get_scanner()
    aps = scanner.get_access_points()
    assert_access_point(aps)
Пример #15
0
 def __init__(self, model=None, device=""):
     self.model = model
     self.device = device
     self.clf = get_model(model)
     self.wifi_scanner = get_scanner(device)
     self.predicted_value = None
Пример #16
0
 def signal(self):
     scan = access_points.get_scanner().get_access_points()
     return scan[0]["quality"]
Пример #17
0
 def __init__(self):
     wifi_scanner = get_scanner()
     wifi_scanner.get_access_points()
     self.result = wifi_scanner.get_access_points()
Пример #18
0
def sample():
    wifi_scanner = get_scanner()
    aps = wifi_scanner.get_access_points()
    return aps_to_dict(aps)
Пример #19
0
 def run(self):
     scan = get_scanner()
     wifis = scan.get_access_points()
     print("BSSID               QUALITY    SSID")
     for w in wifis:
         self._print_access_point(w)
Пример #20
0
 def refresh(self):
     self.clf = get_model(self.model)
     self.wifi_scanner = get_scanner(self.device)
Пример #21
0
 def __init__(self, iface='wlan0'):
     self.iface = iface
     self.wifi_scanner = access_points.get_scanner(iface)
     if self.wifi_scanner.cmd.startswith('sudo ') and not shutil.which('sudo'):
         self.wifi_scanner.cmd = self.wifi_scanner.cmd[5:]
     self._failed_ssids = {}