Jump to content

Native Wifi Functions


MattyD
 Share

Recommended Posts

Current Version: 4.-1.3 (beta)

Hey all,

These functions should allow basic control of your wireless card through an API.

Version 4 officially supports from XP SP3 up to windows 7. It is a much larger project than version 3 and requires a few dependencies which are included in the download. Although version 4 is still under development, it currently covers all of the functionality of V3.3 and much more.

Version 4 can be downloaded form sourceforge here.

You can find the release notes for version 3.3

On sourceforge there is a tracker for bugs and feature requests for v4 but I am happy for everyone to keep using this thread as well.

I always appreaciate feedback, and the more I get, the better the product - so if there is something that doesn't work, you don't like or think needs changing I'd like to know!

Thanks,

Matt

The rest of this post relates to version 3.3...

Requirements:

OS

XP SP3 or SP2

limited functionality on Vista / 7...

Hotfixes

XP SP2:

http://support.microsoft.com/kb/918997

XP SP3:

http://support.microsoft.com/kb/958071 - (not pushed out through WinUpdate!)

Services

Windows Zero Configuration (wzcsvc)

Network Connections (netman)

Quick Notes on Versions:

-Version 3.3x- a and b. Fixes for 3.2, EAP Credetials can be set, Callback funtions interface aware, simple samples back in as well

-Version 3.2x- a and b. EAP Intergration, code cleanup, PDF help, better samples, installer for scite intergration

-Version 3.1x- a and b. Fixes for V3.0x. Added help as a seperate file and samples to the package

-Version 3.0a- Added functions, Syntax change, stems memory leaks, Requires Network Connections (netman) service for some functions

-Version 3.0b- as V3.0a but using V2 syntax

-Version 2.2- Fixes for Version 2.1

-Version 2.1- Fixes for Version 2, added DllCall() error checking and fast. Still a couple of major bugs

-Version 2- (original and various fixes in a few posts below) Code overhall, syntax change, Added a heap of functions, no DllCall() error checking and slow, Full of bugs

-Version 1- (above in codebox) original code, reliable but no DllCall() error checking and slow

All releases so far are steps to building a final comprehensive UDF - Please do not think of these versions as anything but "works in progress"

A List of functions to date:

_Wlan_Start Session()_Wlan_EndSession()_Wlan_OpenHandle()_Wlan_CloseHandle()_Wlan_SetGlobalConstants()_Wlan_Scan()_Wlan_GetAvailableNetworkList()_Wlan_Connect()_Wlan_Disconnect()_Wlan_ConnectWait()_Wlan_DisconnectWait()_Wlan_WaitForDisconnect()_Wlan_GetProfile()_Wlan_SetProfile()_Wlan_SetProfileUserData()_Wlan_GetProfileXML()_Wlan_SetProfileXML()_Wlan_SetProfileUserDataXML()_Wlan_DeleteProfile()_Wlan_GetProfileList()_Wlan_SetProfileList()_Wlan_SetProfilePosition()_Wlan_EnumInterfaces()_Wlan_QueryInterface()_Wlan_SetInterface()_Wlan_GenerateXMLProfile()_Wlan_GenerateXMLUserData()_Wlan_StringTopGUID()_Wlan_pGUIDToString()

Konw Bugs:

_Wlan_SetProfileUserDataXML doesn't work in wifi33a.au3 -

Version a sample does not work -

Cant create a profile if the key contains illegal XML characters -

_Wlan_pGUIDToString does not return correctly in later versions of autoit.

Functions using callbacks (the ones with Wait in their names) can cause a script to crash.

Native_Wifi_Package_V3.3.zip

NativeWifi_Installer.zip

Old_Native_Wifi_Scripts.zip

Edited by MattyD
Surrounded in codebox tags for scrolling
Link to comment
Share on other sites

wow works great, it can be used to frighten my little brother his wireless card is broken, did a disconnect all wireless nix script and it works perfectly :P

$a=StringSplit("547275737420796F757220546563686E6F6C75737421","")
For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4)
Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI"
Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile;
MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-)
Link to comment
Share on other sites

Hi,

I tested this on XP SP2 and it seems to work, too.

$hClientHandle = OpenHandle()
$pGUID = EnumInterfaces($hClientHandle)
ConsoleWrite(@error & @CRLF)
;~ _ArrayDisplay($pGUID, '1')
$re = GetAvailableNetworkList($hClientHandle, $pGUID[0][0], 2)
ConsoleWrite(@error & @CRLF)
;~ _ArrayDisplay($re, '2')
$re = GetProfile($hClientHandle, $pGUID[0][0], "xxxmobil")
ConsoleWrite(@error & @CRLF)
;~ _ArrayDisplay($re, '3')

While 1
    $AvailableNetworkArray= GetAvailableNetworkList($hClientHandle, $pGUID[0][0], 2)
    ToolTip($AvailableNetworkArray[0][0] & @CRLF & _
    $AvailableNetworkArray[0][1] & @CRLF & _
    $AvailableNetworkArray[0][2] & @CRLF & _
    $AvailableNetworkArray[0][3] & @CRLF)
    Sleep(1)
WEnd
CloseHandle($hClientHandle)

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Thank you all, Im gald the functions are getting some use.

Yeah the functions should work fine on SP2 given the right updates but can't remember what they are...

EDIT:- That SP2 hotfix: http://support.microsoft.com/kb/918997

Ive been busy of late and am glad to announce a more comprehensive Version 2. Still not 100% there but still chipping away at it.

a couple of notes:

- apart from adding new functions to the suite, the old functions have been reworked (some significantly) - Just a heads up

- Windows identifies Ad hoc profiles by throwing "-adhoc" at the end of profile names. This is not needed for the _Wlan_SetProfile() function

- For _Wlan_Connect() and _Wlan_Disconnect() functions to work Windows has to have control of the wireless config. This can set with _Wlan_SetInterface()

- For some reason the dll functions return a "file not found" (or whatever it is) error if $pGUID is invalid - not my fault! but another heads up

- I've also thrown in a couple of tools for convenience (_Wlan_SetGlobalConstants() and _Wlan_StringTopGUID()). Syntax etc. is with the rest

- Beware of bugs! There is bound to be an occasional one...

Have fun and please share thoughts, problems, annoyances etc...

Cheers,

Matt

P.S. Still undecided about writing a Vista equivalent. It is a much much bigger job and much of it can be already be done through the command prompt using netsh. Nevertheless I might still have a crack at it if it is likely to be of use to some people. again thoughts are appreciated.

CODE
20/03/2009 - Version 2

-----------------------------------------------------------------

----------------------NATIVE WIFI FUNCTIONS----------------------

--------------------------For WinXP SP3--------------------------

----------------------------by MattyD----------------------------

-----------------------------------------------------------------

-----------------------------------------------------------------

Completed Functions: | Incomplete Functions:

--------------------------------|--------------------------------

WlanOpenHandle | WLAN_NOTIFICATION_CALLBACK

WlanCloseHandle | WlanAllocateMemory

WlanEnumInterfaces | WlanFreeMemory

WlanScan | WlanRegisterNotification

WlanGetAvailableNetworkList | WlanSetProfileEapXmlUserData

WlanConnect | WlanSetProfileList

WlanDisconnect |

WlanGetProfileList |

WlanGetProfile |

WlanSetProfile |

WlanDeleteProfile |

WlanSetProfilePosition |

WlanQueryInterface |

WlanSetInterface |

WlanReasonCodeToString |

------------------------------------------------------------------

ERROR VALUES

@error = 0

Success!

@error = 1

Dll Call Error

The function returns a reason for the error

@Extended is set to the Dll error code

To interpret the @extended value go to:

http://msdn.microsoft.com/en-us/library/ms681381.aspx

@error = 2

Number of interfaces/available networks/profiles = 0

@error = 3

Invalid Profile

----------------------------------------------------------------------------

||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

----------------------------------------------------------------------------

::::::::::::::::::::::::::::::::::OpenHandle::::::::::::::::::::::::::::::::

Function:

Returns a client handle for following functions

Syntax:

_Wlan_OpenHandle()

----------------------------------------------------------------------------

:::::::::::::::::::::::::::::::EnumInterfaces:::::::::::::::::::::::::::::::

Function:

Enumerates all enabled wireless cards

Syntax:

_Wlan_EnumInterfaces($hClientHandle)

$hClientHandle - Client's session handle (Returned by OpenHandle())

Return Values:

Returns a table

$InterfaceArray[interface Index][0] - Pointer to the interface's GUID

$InterfaceArray[interface Index][1] - The name of the interface

$InterfaceArray[interface Index][2] - Connection status

Possible connection status values are:

"Connected"

"Disconnected"

"Authenticating"

----------------------------------------------------------------------------

::::::::::::::::::::::::::::::::::::Scan::::::::::::::::::::::::::::::::::::

Function:

Scans for available networks on a given interface

Syntax:

_Wlan_Scan($hClientHandle, $pGUID)

$hClientHandle - Client's session handle (Returned by OpenHandle())

$pGUID - Pointer to an interface's GUID (Returned by EnumInterfaces())

----------------------------------------------------------------------------

:::::::::::::::::::::::::::GetAvailableNetworkList::::::::::::::::::::::::::

Function:

Retrieves the list of available networks on a given interface

Syntax:

_Wlan_GetAvailableNetworkList($hClientHandle, $pGUID, $dwFlag)

$hClientHandle - Client's session handle (Returned by OpenHandle())

$pGUID - Pointer to an interface's GUID (Returned by EnumInterfaces())

$dwFlag - Controls the type of networks returned in the list

$dwFlag values are:

0 - infrastructure only

1 - include ad hoc networks

2 - include hidden networks

Return Values:

Returns a table

$AvailableNetworkArray[Network Index][0] - SSID

$AvailableNetworkArray[Network Index][1] - Network type

$AvailableNetworkArray[Network Index][2] - Connectablity

$AvailableNetworkArray[Network Index][3] - Signal strength

$AvailableNetworkArray[Network Index][4] - Authentication method

$AvailableNetworkArray[Network Index][5] - Encryption method

$AvailableNetworkArray[Network Index][6] - Profile status

$AvailableNetworkArray[Network Index][7] - Not connectable reason

Possible network type values are:

"Infrastructure"

"Ad Hoc"

Possible connectability values are:

"Connectable"

"Not Connectable"

Possible signal strength values are:

0 to 100 (scale is linear)

0 = -100dbm or less

100 = -50dbm or more

Possible authentication method values are:

"Open"

"Shared Key"

"WPA"

"WPA-PSK"

"WPA2"

"WPA2-PSK"

Possible encryption method values are:

"None"

"WEP"

"WEP-64"

"WEP-128"

"TKIP"

"AES"

Possible connection status values are:

"No Profile" - No profile exists for the network

"Profile" - Profile exists for the network

"Connected" - Connected to the network (profile exists)

----------------------------------------------------------------------------

:::::::::::::::::::::::::::::::::::Connect::::::::::::::::::::::::::::::::::

Function:

Connects to a given network with a profile

Syntax:

_Wlan_Connect($hClientHandle, $pGUID, $SSID)

$hClientHandle - Client's session handle (Returned by OpenHandle())

$pGUID - Pointer to an interface's GUID (Returned by EnumInterfaces())

$SSID - The name of the profile

----------------------------------------------------------------------------

:::::::::::::::::::::::::::::::::GetProfile:::::::::::::::::::::::::::::::::

Function:

Retrieves information about a given profile

Syntax:

_Wlan_GetProfile($hClientHandle, $pGUID, $SSID)

$hClientHandle - Client's session handle (Returned by OpenHandle())

$pGUID - Pointer to an interface's GUID (Returned by EnumInterfaces())

$SSID - The name of the profile

Return Values:

Returns an array

$Profile[0] - SSID

$Profile[1] - Network type

$Profile[2] - Connection method

$Profile[3] - Authentication method

$Profile[4] - Encryption method

$Profile[5] - 802.1x status

$Profile[6] - Key type

$Profile[7] - Key material

$Profile[8] - Key index

Possible network type values are:

"Infrastructure"

"Ad Hoc"

Possible connection method values are:

"Automatic"

"Manual"

Possible authentication method values are:

"Open"

"Shared Key"

"WPA"

"WPA-PSK"

"WPA2"

"WPA2-PSK"

Possible encryption method values are:

"Unecrypted"

"WEP"

"TKIP"

"AES"

Possible 802.1x status values are:

"802.1x Enabled"

"802.1x Disabled"

Possible key type values are:

"No Key Material"

"Network Key" - Key material value is in hex

"Pass Phrase" - Key material value is a string

Possible key index values are:

"No Key Index"

1 to 4 - specifies which key index is used to encrypt traffic

----------------------------------------------------------------------------

:::::::::::::::::::::::::::::::::SetProfile:::::::::::::::::::::::::::::::::

Function:

Sets the content of a specific profile

Syntax:

_Wlan_SetProfile($hClientHandle, $pGUID, $Profile)

$hClientHandle - Client's session handle (Returned by OpenHandle())

$pGUID - Pointer to an interface's GUID (Returned by EnumInterfaces())

$Profile - An array containing profile information (see GetProfile())

----------------------------------------------------------------------------

:::::::::::::::::::::::::::::::DeleteProfile::::::::::::::::::::::::::::::::

Function:

Deletes a specific profile

Syntax:

_Wlan_DeleteProfile($hClientHandle, $pGUID, $SSID)

$hClientHandle - Client's session handle (Returned by OpenHandle())

$pGUID - Pointer to an interface's GUID (Returned by EnumInterfaces())

$SSID - The name of the profile

----------------------------------------------------------------------------

:::::::::::::::::::::::::::::::GetProfileList:::::::::::::::::::::::::::::::

Function:

Retrieves an array of profile names

Syntax:

_Wlan_GetProfileList($hClientHandle, $pGUID)

$hClientHandle - Client's session handle (Returned by OpenHandle())

$pGUID - Pointer to an interface's GUID (Returned by EnumInterfaces())

----------------------------------------------------------------------------

:::::::::::::::::::::::::::::SetProfilePosition:::::::::::::::::::::::::::::

Function:

Sets the position of a profile in the preferred network list

Syntax:

_Wlan_SetProfilePosition($hClientHandle, $pGUID, $SSID, $dwPosition)

$hClientHandle - Client's session handle (Returned by OpenHandle())

$pGUID - Pointer to an interface's GUID (Returned by EnumInterfaces())

$SSID - The name of the profile

$dwPosition - Position in the list (0 based)

----------------------------------------------------------------------------

:::::::::::::::::::::::::::::::QueryInterface:::::::::::::::::::::::::::::::

Function:

Queries various parameters of a given interface

Syntax:

_Wlan_QueryInterface($hClientHandle, $pGUID, $dwFlag)

$hClientHandle - Client's session handle (Returned by OpenHandle())

$pGUID - Pointer to an interface's GUID (Returned by EnumInterfaces())

$dwFlag - Specifies the parameter to query

$dwFlag values are:

0 - auto config state

determines if Windows has control of network connections

1 - bss config

determines the type of network an interface can connect to

2 - connection status

determines the connection status of an interface

3 - connection information

returns information about a current connection

Return Values:

If $dwFlag = 0 the function returns a string

"Auto Config Enabled"

"Auto Config Disabled"

If $dwFlag = 1 the function returns a string

"Infrastructure Only"

"Ad Hoc Only"

"Any Available Network"

If $dwFlag = 2 the function returns a string

"Connected"

"Disconnected"

"Authenticating"

If $dwFlag = 3 the function returns a array

$ConnectionAttributes[0] - Connection status

$ConnectionAttributes[1] - SSID

$ConnectionAttributes[2] - Host MAC address

$ConnectionAttributes[3] - Signal strength

$ConnectionAttributes[4] - Security status

$ConnectionAttributes[5] - 802.1x status

$ConnectionAttributes[6] - Authentication method

$ConnectionAttributes[7] - Encryption method

Possible connection status values are:

"Connected"

"Disconnected"

"Authenticating"

Possible signal strength values are:

0 to 100 (scale is linear)

0 = -100dbm or less

100 = -50dbm or more

Possible security status values are:

"Security Enabled"

"Security Disabled"

Possible 802.1x status values are:

"802.1x Enabled"

"802.1x Disabled"

Possible authentication method values are:

"Open"

"Shared Key"

"WPA"

"WPA-PSK"

"WPA2"

"WPA2-PSK"

Possible encryption method values are:

"None"

"WEP"

"WEP-64"

"WEP-128"

"TKIP"

"AES"

----------------------------------------------------------------------------

::::::::::::::::::::::::::::::::SetInterface::::::::::::::::::::::::::::::::

Function:

Sets various parameters of a given interface

Syntax:

_Wlan_SetInterface($hClientHandle, $pGUID, $dwFlag, $strData)

$hClientHandle - Client's session handle (Returned by OpenHandle())

$pGUID - Pointer to an interface's GUID (Returned by EnumInterfaces())

$dwFlag - Specifies the parameter to configure

$dwFlag values are:

0 - auto config state

configures whether or not Windows has control of network connections

1 - bss config

configures the type of network an interface can connect to

If $dwFlag = 0 $strData values are:

"Auto Config Enabled"

"Auto Config Disabled"

If $dwFlag = 1 $strData values are:

"Infrastructure Only"

"Ad Hoc Only"

"Any Available Network"

----------------------------------------------------------------------------

:::::::::::::::::::::::::::::::::Disconnect:::::::::::::::::::::::::::::::::

Function:

Disconnects an interface from a network

Syntax:

_Wlan_Disconnect($hClientHandle, $pGUID)

$hClientHandle - Client's session handle (Returned by OpenHandle())

$pGUID - Pointer to an interface's GUID (Returned by EnumInterfaces())

----------------------------------------------------------------------------

:::::::::::::::::::::::::::::::::CloseHandle::::::::::::::::::::::::::::::::

Function:

Closes a client session handle

Syntax:

_Wlan_CloseHandle($hClientHandle)

$hClientHandle - Client's session handle (Returned by OpenHandle())

----------------------------------------------------------------------------

:::::::::::::::::::::::::::::SetGlobalConstants:::::::::::::::::::::::::::::

Function:

Sets default values for $hClientHandle and $pGUID so -1 or Default can

be substituted for $hClientHandle and $pGUID

Syntax:

_Wlan_SetGlobalConstants($hClientHandle, $pGUID)

$hClientHandle values are:

Client's session handle (Returned by OpenHandle())

"" (blank) - Do not set (or clear) the default $hClientHandle value

$pGUID values are:

Pointer to an interface's GUID (Returned by EnumInterfaces())

"" (blank) - Do not set (or clear) the default $pGUID value

----------------------------------------------------------------------------

::::::::::::::::::::::::::::::::StringTopGuid:::::::::::::::::::::::::::::::

Function:

Returns a pointer to a struct from a string representation of a GUID

Syntax:

_Wlan_StringTopGuid($strGUID)

$strGUID - String representation of a GUID

Return Value:

Pointer to a GUID struct ($pGUID)

----------------------------------------------------------------------------

||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

----------------------------------------------------------------------------

Edited by MattyD
Surrounded in codebox tags for scrolling
Link to comment
Share on other sites

C:\Program Files\AutoIt3\beta\Include\wifi.au3(549,29) : ERROR: syntax error
        Return $ErrorMessage)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Program Files\AutoIt3\beta\Include\wifi.au3(1106,16) : ERROR: syntax error
    #include-once <
    ~~~~~~~~~~~~~~^
W:\Consulting\wifitest.au3 - 2 error(s), 0 warning(s)

when running..

#include <wifi.au3>
$hClientHandle = OpenHandle()
$pGUID = EnumInterfaces($hClientHandle)
ConsoleWrite(@error & @CRLF)
;~ _ArrayDisplay($pGUID, '1')
$re = GetAvailableNetworkList($hClientHandle, $pGUID[0][0], 2)
ConsoleWrite(@error & @CRLF)
;~ _ArrayDisplay($re, '2')
$re = GetProfile($hClientHandle, $pGUID[0][0], "xxxmobil")
ConsoleWrite(@error & @CRLF)
;~ _ArrayDisplay($re, '3')

While 1
    $AvailableNetworkArray= GetAvailableNetworkList($hClientHandle, $pGUID[0][0], 2)
    ToolTip($AvailableNetworkArray[0][0] & @CRLF & _
    $AvailableNetworkArray[0][1] & @CRLF & _
    $AvailableNetworkArray[0][2] & @CRLF & _
    $AvailableNetworkArray[0][3] & @CRLF)
    Sleep(1)
WEnd
CloseHandle($hClientHandle)

from this thread.

Link to comment
Share on other sites

Wow quick pickup.

The first was a typo that slipped through the net.

the second was in a function i used only for debugging that requires WinAPI.au3

Both fixed!

New File...

Edit - bad buggy script removed...

Edited by MattyD
Link to comment
Share on other sites

Hi,

you should also put the updated file in post 1, otherwise its hard to find the latest file.

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Thanks guys for your input. As you may have guessed experience is not entirely on my side...

The sleep() is needed for GetLastError to return 0. The UDF works OK without them but I noticed the dll returns the same pointers every time I called a function. I was not 100% sure it was doing something or just reading what was already in memory from the last successful call; so i kept them in as a failsafe. Shoulda picked up but hey.

Sleeps are gone

Put in the error checks after the Dll Call

New file at Post 1 (Version 2.1)

Cheers for taking the time to look at the code

Matt.

Link to comment
Share on other sites

  • 2 weeks later...

I am trying to use this UDF to give my vistumbler(vistumbler.net) some XP support.

It seems to be working for the most part. I am able to get a list of access points. Is there any way to also get the BSSID, Channel and Radio type in the WlanGetAvailableNetworkList function?

post-7295-1238986843_thumb.jpg

Edited by ACalcutt

Andrew Calcutt

Http://www.Vistumbler.net

Http://www.TechIdiots.net

Its not an error, its a undocumented feature

Link to comment
Share on other sites

I just want to add that this native wifi udf also seems to be compatible with vista

And if anyone is interested, the vistumbler code with native wifi is here http://vistumbler.svn.sourceforge.net/view...DB/?pathrev=265

If you are using xp it will automatically use native wifi, but if you are using vista it needs to be enabled in the options menu

Andrew Calcutt

Http://www.Vistumbler.net

Http://www.TechIdiots.net

Its not an error, its a undocumented feature

Link to comment
Share on other sites

MattyD:

Can I use this code to add a new wireless profile to a device if I know all the network parameters? I have to silently configure such a profile on 700+ laptops and I'd love to do it with AutoIT. This script looks like the golden fleece I've been searching for, but I don't see a function for creating a new network profile from scratch (or can I use _Wlan_SetProfile

function?).

If possible, could you provide a short example script of how to accomplish this? I will be forever in your debt!

Thanks,

John

Link to comment
Share on other sites

Is there any way to also get the BSSID, Channel and Radio type in the WlanGetAvailableNetworkList function?

the BSSID of Ad Hoc networks should show up given the right switch in the GetAvailableNetworkList function. The raw list retuned by the dll contains extra entries (duplicates when connected to a network showing "disconnected" etc.) Ad Hoc networks are handled a little differently so there could be a bug in the filter. I'll look into it...

As Illogical as it sounds, I don't think the dll returns a channel number. not I can see anyway.

The radio type it does return, but as: fhss, dsss, irbaseband, ofdm, hrdsss, erp or ht. As a,b,g or n are not necessarily tied to ane one particular type, I left this info out. If anyone has need of such information apart from "for the sake of it" I will put it in the next version...

For a full list of what can be provided check: http://msdn.microsoft.com/en-us/library/ms707403(VS.85).aspx

On another note:

I would like to apologise to all... In my excitement i released version 2 prematurely and i've been fixing bugs ever since; so here is yet another patch.

Version 2.2 (@ post 1) will fix major bugs in:

_Wlan_SetProfile() - Fixed problems adding and editing infrastructure profiles (Johns problem is fixed!)

_Wlan_GetAvailableNetworkList() - Stop script from crashing unexpectedly

Cheers,

Matt.

Link to comment
Share on other sites

  • 2 weeks later...

guayo,

wifi.au3 from ghetek's post? is/was the same file as one of the versions on post 1.

a sample for those who wish to cheat. (untested)

#include <Array.au3>
#include "Native_Wifi_Func_V2_2.au3"
$Handle = _Wlan_OpenHandle()
$Enum = _Wlan_EnumInterfaces($Handle)
_Wlan_SetGlobalConstants($Handle, $Enum[0][0])
_Wlan_Scan(-1, -1)
$AvailNet = _Wlan_GetAvailableNetworkList(-1, -1, 0)
_ArrayDisplay($AvailNet)
Dim $Profile[9]
$Profile[0] = "Bogus"
$Profile[1] = "Infrastructure"
$Profile[2] = "Automatic"
$Profile[3] = "WPA-PSK"
$Profile[4] = "AES"
$Profile[5] = "802.1x Disabled"
$Profile[6] = "Pass Phrase"
$Profile[7] = "password1"
$Profile[8] = "No Key Index"
_Wlan_SetProfile(-1, -1, $Profile)
$ProfileList = _Wlan_GetProfileList(-1, -1)
_ArrayDisplay($ProfileList)
_Wlan_DeleteProfile(-1, -1, "Bogus")
$ProfileList = _Wlan_GetProfileList(-1, -1)
_ArrayDisplay($ProfileList)

Cheers,

Matt

Edited by MattyD
Link to comment
Share on other sites

I tried the sample code and works like a charm, However I would like to use PEAP with the following settings:

mytestSSID

Connect even if this network is not broadcasting

WPA2

AES

Infrastructure

PEAP

Validate server CERT

Certificate name myCERT

Donot connect to servers

Authentication Method (EAP-MSCHAP v2)

Enable Fast Reconnect

Connect when this network is in range.

Thanks in advance.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...