Search code examples
pythonnetwork-programmingwifi

Network channel Python


Hi guys I'm working on a network project as I'm a beginner i hope you can help me: I'd like to retrieve the channel my network is on using python like netsurveyor is giving a graph showing the channel our network is using I'd like to know how in python I can get the same infos. I've linked a screnshot of netsurveyor to show more ecxplicitly what I'm trying to do. netsurveyor example


Solution

  • Here is a way to retrieve the informations needed

    import subprocess
        available = subprocess.check_output('netsh wlan show network mode=bssid',stderr=subprocess.STDOUT,universal_newlines=True,shell=True)
    

    this command line give you the information needed : the output is like this:

    SSID 1 : Rezalitchderk Network type : Infrastructure Authentication : WPA2-Personal Encryption : CCMP BSSID 1 : 62:f1:89:7c:71:d1 Signal : 91%
    Radio type : 802.11n Channel : 11 Basic rates (Mbps) : 1 2 5.5 11 Other rates (Mbps) : 6 9 12 18 24 36 48 54

    SSID 2 : HUAWEI Mate 10 lite Network type : Infrastructure Authentication : WPA2-Personal Encryption : CCMP BSSID 1 : 1c:15:1f:3f:87:f9 Signal : 82%
    Radio type : 802.11n Channel : 11 Basic rates (Mbps) : 1 2 5.5 11 Other rates (Mbps) : 6 9 12 18 24 36 48 54