def WlanScan(hClientHandle, pInterfaceGuid, ssid=""):
"""
The WlanScan function requests a scan for available networks on the
indicated interface.
DWORD WINAPI WlanScan(
_In_ HANDLE hClientHandle,
_In_ const GUID *pInterfaceGuid,
_In_opt_ const PDOT11_SSID pDot11Ssid,
_In_opt_ const PWLAN_RAW_DATA pIeData,
_Reserved_ PVOID pReserved
);
"""
func_ref = wlanapi.WlanScan
func_ref.argtypes = [HANDLE,
POINTER(GUID),
POINTER(DOT11_SSID),
POINTER(WLAN_RAW_DATA),
c_void_p]
func_ref.restype = DWORD
if ssid:
length = len(ssid)
if length > DOT11_SSID_MAX_LENGTH:
raise Exception("SSIDs have a maximum length of 32 characters.")
# data = tuple(ord(char) for char in ssid)
data = ssid
dot11_ssid = byref(DOT11_SSID(length, data))
else:
dot11_ssid = None
# TODO: Support WLAN_RAW_DATA argument.
result = func_ref(hClientHandle,
byref(pInterfaceGuid),
dot11_ssid,
None,
None)
if result != ERROR_SUCCESS:
raise Exception("WlanScan failed.")
return result
评论列表
文章目录