Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to scan for Wi-Fi using Python?

Tags:

python

wifi

I am interested in writing a script in Python that is able to scan and show a list of nearby Wi-Fi networks. How could one do this? If possible.

Thanks.

Jake.

like image 852
Jake Avatar asked Jul 21 '10 11:07

Jake


1 Answers

Yes, it is possible. As far as the how is concerned, this might help you get started.

Additionally you can use the pywifi package to scan for all wireless devices in your area.

example:

 import pywifi
 import time

 wifi = pywifi.PyWiFi()
 iface = wifi.interfaces()[0]
 iface.scan()
 time.sleep(0.5)
 results = iface.scan_results()


 for i in results:
     bssid = i.bssid
     ssid  = i.ssid
     print(f"{bssid}: {ssid}")
like image 121
nmichaels Avatar answered Sep 21 '22 13:09

nmichaels