Niveau wifi
Bonjour ,
je cherche sans y parvenir à récupérer dans un programme python le niveau de réception du signal wifi reçu sur mon pc sous windows 10 .
Merci d'avance pour toute piste ou toute expérience sur ce sujet .
Cordialement
je cherche sans y parvenir à récupérer dans un programme python le niveau de réception du signal wifi reçu sur mon pc sous windows 10 .
Merci d'avance pour toute piste ou toute expérience sur ce sujet .
Cordialement
Réponses
-
Tu devrais plutôt demander ça sur un forum de bidouilleurs.
Une recherche avec « python wifi windows » m’a amené là :
https://www.geeksforgeeks.org/how-to-connect-wifi-using-python/The real danger is not that computers will begin to think like men, but that men will begin to think like computers.
-- Harris, Sidney J. -
Merci nicolas.patrois .
Toutes mes recherches sur les forums de bidouilleurs ne m'ont pas avancé . On y trouve assez facilement comment se connecter au wifi alors que je suis déjà connecté mais je n'ai pas trouvé comment récupérer le niveau de réception .
Cependant le site que tu donnes est le plus clair de tous ceux que j'ai parcouru . Je vais voir ce que je peux en tirer .
Cordialement -
Bonsoir.
Si ce n'est pas indiscret, quel est le but de récupérer la force du signal ?
À bientôt.Cherche livres et objets du domaine mathématique :
Intégraphes, règles log et calculateurs électromécaniques.
-
Le but est tout simplement didactique : récupérer la force du signal wifi reçu et l'afficher sous forme d'un cercle coloré .
J'ai trouvé ceci sur le net mais il y a peut-être plus simplefrom ctypes import * from ctypes.wintypes import * from sys import exit def customresize(array, new_size): return (array._type_*new_size).from_address(addressof(array)) wlanapi = windll.LoadLibrary('wlanapi.dll') ERROR_SUCCESS = 0 class GUID(Structure): _fields_ = [ ('Data1', c_ulong), ('Data2', c_ushort), ('Data3', c_ushort), ('Data4', c_ubyte*8), ] WLAN_INTERFACE_STATE = c_uint (wlan_interface_state_not_ready, wlan_interface_state_connected, wlan_interface_state_ad_hoc_network_formed, wlan_interface_state_disconnecting, wlan_interface_state_disconnected, wlan_interface_state_associating, wlan_interface_state_discovering, wlan_interface_state_authenticating) = map(WLAN_INTERFACE_STATE, range(0, 8)) class WLAN_INTERFACE_INFO(Structure): _fields_ = [ ("InterfaceGuid", GUID), ("strInterfaceDescription", c_wchar * 256), ("isState", WLAN_INTERFACE_STATE) ] class WLAN_INTERFACE_INFO_LIST(Structure): _fields_ = [ ("NumberOfItems", DWORD), ("Index", DWORD), ("InterfaceInfo", WLAN_INTERFACE_INFO * 1) ] WLAN_MAX_PHY_TYPE_NUMBER = 0x8 DOT11_SSID_MAX_LENGTH = 32 WLAN_REASON_CODE = DWORD DOT11_BSS_TYPE = c_uint (dot11_BSS_type_infrastructure, dot11_BSS_type_independent, dot11_BSS_type_any) = map(DOT11_BSS_TYPE, range(1, 4)) DOT11_PHY_TYPE = c_uint dot11_phy_type_unknown = 0 dot11_phy_type_any = 0 dot11_phy_type_fhss = 1 dot11_phy_type_dsss = 2 dot11_phy_type_irbaseband = 3 dot11_phy_type_ofdm = 4 dot11_phy_type_hrdsss = 5 dot11_phy_type_erp = 6 dot11_phy_type_ht = 7 dot11_phy_type_IHV_start = 0x80000000 dot11_phy_type_IHV_end = 0xffffffff DOT11_AUTH_ALGORITHM = c_uint DOT11_AUTH_ALGO_80211_OPEN = 1 DOT11_AUTH_ALGO_80211_SHARED_KEY = 2 DOT11_AUTH_ALGO_WPA = 3 DOT11_AUTH_ALGO_WPA_PSK = 4 DOT11_AUTH_ALGO_WPA_NONE = 5 DOT11_AUTH_ALGO_RSNA = 6 DOT11_AUTH_ALGO_RSNA_PSK = 7 DOT11_AUTH_ALGO_IHV_START = 0x80000000 DOT11_AUTH_ALGO_IHV_END = 0xffffffff DOT11_CIPHER_ALGORITHM = c_uint DOT11_CIPHER_ALGO_NONE = 0x00 DOT11_CIPHER_ALGO_WEP40 = 0x01 DOT11_CIPHER_ALGO_TKIP = 0x02 DOT11_CIPHER_ALGO_CCMP = 0x04 DOT11_CIPHER_ALGO_WEP104 = 0x05 DOT11_CIPHER_ALGO_WPA_USE_GROUP = 0x100 DOT11_CIPHER_ALGO_RSN_USE_GROUP = 0x100 DOT11_CIPHER_ALGO_WEP = 0x101 DOT11_CIPHER_ALGO_IHV_START = 0x80000000 DOT11_CIPHER_ALGO_IHV_END = 0xffffffff WLAN_AVAILABLE_NETWORK_CONNECTED = 1 WLAN_AVAILABLE_NETWORK_HAS_PROFILE = 2 WLAN_AVAILABLE_NETWORK_INCLUDE_ALL_ADHOC_PROFILES = 0x00000001 WLAN_AVAILABLE_NETWORK_INCLUDE_ALL_MANUAL_HIDDEN_PROFILES = 0x00000002 class DOT11_SSID(Structure): _fields_ = [ ("SSIDLength", c_ulong), ("SSID", c_char * DOT11_SSID_MAX_LENGTH) ] class WLAN_AVAILABLE_NETWORK(Structure): _fields_ = [ ("ProfileName", c_wchar * 256), ("dot11Ssid", DOT11_SSID), ("dot11BssType", DOT11_BSS_TYPE), ("NumberOfBssids", c_ulong), ("NetworkConnectable", c_bool), ("wlanNotConnectableReason", WLAN_REASON_CODE), ("NumberOfPhyTypes", c_ulong), ("dot11PhyTypes", DOT11_PHY_TYPE * WLAN_MAX_PHY_TYPE_NUMBER), ("MorePhyTypes", c_bool), ("wlanSignalQuality", c_ulong), ("SecurityEnabled", c_bool), ("dot11DefaultAuthAlgorithm", DOT11_AUTH_ALGORITHM), ("dot11DefaultCipherAlgorithm", DOT11_CIPHER_ALGORITHM), ("Flags", DWORD), ("Reserved", DWORD) ] class WLAN_AVAILABLE_NETWORK_LIST(Structure): _fields_ = [ ("NumberOfItems", DWORD), ("Index", DWORD), ("Network", WLAN_AVAILABLE_NETWORK * 1) ] WlanOpenHandle = wlanapi.WlanOpenHandle WlanOpenHandle.argtypes = (DWORD, c_void_p, POINTER(DWORD), POINTER(HANDLE)) WlanOpenHandle.restype = DWORD WlanEnumInterfaces = wlanapi.WlanEnumInterfaces WlanEnumInterfaces.argtypes = (HANDLE, c_void_p, POINTER(POINTER(WLAN_INTERFACE_INFO_LIST))) WlanEnumInterfaces.restype = DWORD WlanGetAvailableNetworkList = wlanapi.WlanGetAvailableNetworkList WlanGetAvailableNetworkList.argtypes = (HANDLE, POINTER(GUID), DWORD, c_void_p, POINTER(POINTER(WLAN_AVAILABLE_NETWORK_LIST))) WlanGetAvailableNetworkList.restype = DWORD WlanFreeMemory = wlanapi.WlanFreeMemory WlanFreeMemory.argtypes = [c_void_p] if __name__ == '__main__': NegotiatedVersion = DWORD() ClientHandle = HANDLE() ret = WlanOpenHandle(1, None, byref(NegotiatedVersion), byref(ClientHandle)) if ret != ERROR_SUCCESS: exit(FormatError(ret)) # find all wireless network interfaces pInterfaceList = pointer(WLAN_INTERFACE_INFO_LIST()) ret = WlanEnumInterfaces(ClientHandle, None, byref(pInterfaceList)) if ret != ERROR_SUCCESS: exit(FormatError(ret)) try: ifaces = customresize(pInterfaceList.contents.InterfaceInfo, pInterfaceList.contents.NumberOfItems) # find each available network for each interface for iface in ifaces: print("Interface: {}".format(iface.strInterfaceDescription)) pAvailableNetworkList = pointer(WLAN_AVAILABLE_NETWORK_LIST()) ret = WlanGetAvailableNetworkList(ClientHandle, byref(iface.InterfaceGuid), 0, None, byref(pAvailableNetworkList)) if ret != ERROR_SUCCESS: exit(FormatError(ret)) try: avail_net_list = pAvailableNetworkList.contents networks = customresize(avail_net_list.Network, avail_net_list.NumberOfItems) for network in networks: print("SSID: {}, quality: {:2d}%".format( network.dot11Ssid.SSID[:network.dot11Ssid.SSIDLength].decode(), network.wlanSignalQuality)) finally: WlanFreeMemory(pAvailableNetworkList) finally: WlanFreeMemory(pInterfaceList)
Ca affiche l'identificateur de la box (SSID) et la qualité du signal en %
Connectez-vous ou Inscrivez-vous pour répondre.
Bonjour!
Catégories
- 165.6K Toutes les catégories
- 66 Collège/Lycée
- 22.2K Algèbre
- 37.7K Analyse
- 6.3K Arithmétique
- 61 Catégories et structures
- 1.1K Combinatoire et Graphes
- 13 Sciences des données
- 5.1K Concours et Examens
- 26 CultureMath
- 51 Enseignement à distance
- 2.9K Fondements et Logique
- 10.8K Géométrie
- 86 Géométrie différentielle
- 1.1K Histoire des Mathématiques
- 79 Informatique théorique
- 3.9K LaTeX
- 39K Les-mathématiques
- 3.5K Livres, articles, revues, (...)
- 2.7K Logiciels pour les mathématiques
- 30 Mathématiques et finance
- 342 Mathématiques et Physique
- 5K Mathématiques et Société
- 3.3K Pédagogie, enseignement, orientation
- 10.1K Probabilités, théorie de la mesure
- 806 Shtam
- 4.2K Statistiques
- 3.8K Topologie
- 1.4K Vie du Forum et de ses membres