Python Forum
Network Scanning Libraries - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Homework (https://python-forum.io/forum-9.html)
+--- Thread: Network Scanning Libraries (/thread-6051.html)



Network Scanning Libraries - johnmaras - Nov-04-2017

My project is an experiment which will determine the best channel for the currently connected WIFI. Could you suggest any good libraries that will help me do that?


RE: Network Scanning Libraries - Larz60+ - Nov-04-2017

I don't have an answer, but this page should help:
https://pypi.python.org/pypi?%3Aaction=search&term=wifi&submit=search


RE: Network Scanning Libraries - wavic - Nov-04-2017

You are not saying anything about what OS you are using.
And I don't understand "currently connected WIFI". If you are connected to a wifi network the connection is on a certain channel already. If you want to determine on which channel to set your wifi network, you have to scan for others networks and see which channels they are using and go away from them. To avoid the interference.


RE: Network Scanning Libraries - johnmaras - Nov-04-2017

(Nov-04-2017, 12:37 PM)wavic Wrote: You are not saying anything about what OS you are using.
And I don't understand "currently connected WIFI". If you are connected to a wifi network the connection is on a certain channel already. If you want to determine on which channel to set your wifi network, you have to scan for others networks and see which channels they are using and go away from these them. To avoid the interference.

I am planning on working on Windows. If a library is great but OS specific(Linux lets say), I am fine with working on that OS too.
I know that the "currently" connected wifi is already on a certain channel, but this channel might not be the best one(that's what I am trying to find out). I want to be able to scan nearby networks, but I guess I can determine the best channel just by monitoring my own network if no library can give me such functionality.


RE: Network Scanning Libraries - wavic - Nov-04-2017

Well, subprocess with netsh should do what you want. See this: http://www.toptip.ca/2011/03/find-out-what-wifi-channels-your.html
So, subprocess...

import subprocess

command = "netsh wlan show networks mode=bssid".split()
output = subprocess.check_output(command).decode('ascii') # or you can pass the command hardcoded: ['netsh', 'wlan0', 'show', 'networks', 'mode=bssid']
for line in output.split('\n'):
    if 'SSID' in line:
        print(line, end="")
    elif 'Channel' in line:
        print(line, '\n')
For example... Since I do not use Windows at all, I can't try it.