Jump to content
Sign in to follow this  
MattyD

Native Wifi Functions

Recommended Posts

I am trying to use this v3.3a of this lib to automate dot1x authentication testing by a client; I am not clear how to pass the username/password in this case; Please note for the simple case I am not using any certificate. if somebody has a script developed in this regard can they please share it;

thanks

Chandra

hey mate,

you will probably have to edit the UDF as in post #54.

Then does this help?

#include <wifi33a.au3>

_Wlan_StartSession()

Local $Profile[3][6]
$Profile[0][0] = "MSCHAP"
$Profile[0][3] = "WPA2"
$Profile[0][4] = "AES"
$Profile[0][5] = "802.1x Enabled"
$Profile[1][0] = "PEAP"
$Profile[1][1] = "Fast Reconnect"
$Profile[1][2] = "No Quarantine Checks"
$Profile[1][3] = "Don't Require Cryptobinding"
$Profile[2][0] = "MSCHAP"
$Profile[2][1] = "Don't Use Win Logon"

Local $UserData[4]
$UserData[0] = "PEAP-MSCHAP"
$UserData[1] = "MyDomain"
$UserData[2] = "User"
$UserData[3] = "Password123"

_Wlan_SetProfile($Profile)
ConsoleWrite(@error & @CRLF)

_Wlan_SetProfileUserData($Profile[0][0], $UserData)
ConsoleWrite(@error & @CRLF)

Matt

Share this post


Link to post
Share on other sites

Hello again.

Just letting everyone know I havn't abandoned this project :)

After many months of on again - off again coding I have finally made the decision to go beta with the new-look native wifi UDF. Still have a way to go - but I think there is enough there to have a solid core to work on.

I would particularly like to extend a big thankyou to the authors of AutoItObject and the Named Pipes UDF for their fantastic work.

Anyway - until I release a full version I will try to keep updating the sourceforge page here.

Thankyou kindly for all your support - let me know what you think,

Cheers,

Matt

Edited by MattyD

Share this post


Link to post
Share on other sites

Have you looked at the new beta? trancexx who's one of the author of AutoItObject has added new native functions.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites

oh cool,

unfortunately I'm not sure this will help me in the way that I'm using it - Though I've only really scratched the surface with the way Objects work behind the scenes.

All I've done here is created a couple of classes to make things easier for the end user. i.e. instead of $asProfile[0][0] being the profile name as it was in the past, they can use $oProfile.Name. This really comes into its own once you start getting into EAP settings and such.

In other news, I have opened tracker on the sourceforge page for anyone who would like to or is willing to contribute. I take bugs reports, feature requests and even the odd kick in the right direction ;) By all means keep the posts rolling here as well. I'll also try post updates more frequently too.

4.-1.2 is out - Here we start to tackle the wireless hosted network in windows 7. how exciting :)

Documentation and tutorials are all improving from the fist upload too - but still a way go.

cheers all,

Matt

Share this post


Link to post
Share on other sites

one bug is in version 3.3:

the GUID part 4 is wrong. this is fixed in newer versions, but for smaler code i would like to use the old version, if you can help to find the bug.

EDIT: Sorry, was my own fault. There is no bug.

Edited by Raik

AutoIt-Syntaxsheme for Proton & Phase5 * Firefox Addons by me (resizable Textarea 0.1d) (docked JS-Console 0.1.1)

Share this post


Link to post
Share on other sites

Hey Raik,

No problems - I always appreciate feedback. As it turns out its a good thing to draw my attention this way anyhow.

In the later versions of autoit, changes in the hex() function have caused a few too many zeros to appear when using the pguidtostring function. The new v4 betas are affected as well because I basically reused the same code.

An updated beta with a couple more fixes and functions should probably be released within the week.

Talking about bugs and updates, I'm in two minds whether to do a major rollup of v3.3 at some stage or just let it die. Does anyone really want to hang on to the version 3 stuff? (or really detest the version 4 project with all its dependancies and such ;)).

let me know what you think,

Matt

Share this post


Link to post
Share on other sites

Hey folks,

Just a quick note to say 4.-1.3 is out. It's not a huge update, things have been hectic - but we are moving foward.

Modified and added a few Hosted Network functions.

Added a function to retrieve a list of BSSIDs and other related info (Just a short 3 year wait Andrew ;))

bug fixes

Enjoy

Share this post


Link to post
Share on other sites

Hey Guys,

I've been trying to use v4-1.3 to create a small script to simply add a MS-CHAP PEAP username and password to an existing wireless connection that is created through an unattend script on a computer image.

Trying:

#RequireAdmin ;So the $WLAN_PROFILE_GET_PLAINTEXT_KEY flag works (Win7 only) XP is always unencrypted.
#include <nativewifi.au3>
$fDebugWifi = True ;if using the #RequireAdmin directive, SciTE also needs to be running as admin to see any debug messages.
_Wlan_StartSession()
Local $Profile = "myexistingprofile"
Local $UserData[4]
$UserData[0] = "PEAP-MSCHAP"
$UserData[1] = "None"
$UserData[2] = "username"
$UserData[3] = "password"
Local $iaFlags = "1"
_Wlan_SetProfileUserData($profile, $UserData, $iaFlags)
ConsoleWrite(@error & @CRLF)

Always comes back with an API error saying the the network profile is corrupt.

Looking over the documentation and the tutorials it looks like the proper way for v4 to call this is to use a with statement against an object and then define the properties. Here's where I get in over my head, I have some experience doing vbscript/MS-CLI scripting, but no actual programming experience.

Anyway, I re-jigged what I had done so far and ended up with:

#include <nativewifi.au3>
#include <array.au3>
$fDebugWifi = True ;if using the #RequireAdmin directive, SciTE also needs to be running as admin to see any debug messages.
_Wlan_StartSession()
Local $fxml = "True"
Local $iaFlags = ""
Local $Profile = "myexistingprofile"
local $oProfile
With $oProfile
.BaseType = "PEAP"
.Type = "PEAP-MSCHAP"
.PEAP.MSCHAP.Domain = "None"
.PEAP.MSCHAP.Username = "username"
.PEAP.MSCHAP.Password = "password"
EndWith

_Wlan_SetProfileUserData($Profile, $oProfile)
ConsoleWrite(@error & @CRLF)

Now, as far as I know, the only issue with this is that I don't know how to create a variable as an object, or what object should be called into that variable since I don't actually want to edit any further parts, or create a new profile from scratch. Complicating this, I'm seeing a lot of threads around the internet researching the corrupt profile error with that API call and windows 7 x64, so at this point I'm not sure if I can even create that object that this is going to work for me.

The first code sample I had could very well be working, and I'm running into that API problem I mentioned as opposed to anything with the script.

I realize that this could be something that belongs in a general/newbie help forum, but I'm hoping that this is the right place since I need to get this specific UDF to perform these functions.

Thanks for any help that you can provide.

Share this post


Link to post
Share on other sites

Hey man, Sorry for the late reply - Iv'e had a week like you wouldn't believe.

To be honest, I havn't done much testing using 64bit, but if you just stick to x86 when compiling there shouldn't be a problem. Most of the time I have seen that corrupt profile message on forums and such is because they havn't been properly specified to begin with :)

Specifing the profile as an array is gone in version 4. The object should be created using _Wlan_CreateUserDataObject() like so.

#include "NativeWifi.au3"

Local $oProfile, $oUserData, $sReason
$fDebugWifi = True

_Wlan_StartSession()
$oProfile = _Wlan_CreateProfileObject()

With $oProfile
.Name = "Profile Name"
.SSID.Add("SSID")
.Type = "Infrastructure"
.Auth = "WPA2"
.Encr = "AES"
.OneX.Enabled = True
.EAP.BaseType = "PEAP"
.EAP.Type = "PEAP-MSCHAP"
.EAP.PEAP.MSCHAP.UseWinLogonCreds = False
EndWith

;ConsoleWrite(_Wlan_ConvertProfile($oProfile) & @CRLF) Displays the profile in XML format - This is what gets sent to the API
_Wlan_SetProfile($oProfile, $sReason)

$oUserData = _Wlan_CreateUserDataObject()
With $oUserData
.BaseType = "PEAP"
.Type = "PEAP-MSCHAP"
.PEAP.MSCHAP.Domain = "Domain" ;Leave this line out if you don't wish to specify a domain
.PEAP.MSCHAP.Username = "Username"
.PEAP.MSCHAP.Password = "Password"
EndWith

;ConsoleWrite(_Wlan_ConvertUserData($oUserData) & @CRLF)
_Wlan_SetProfileUserData("Profile Name", $oUserData)

Just make sure you have all the dependancies in your working folder.

(NativeWifi.au3, oLinkedList.au3, AutoItObject.au3, AutoItObject.dll)

Let me know how you go,

Cheers,

Matt

Edited by MattyD

Share this post


Link to post
Share on other sites

Hi MattyD,

Thank you very much for the help! I'll test this out on some PCs next week and let you know how it turns out. If all goes according to plan it'll help a lot with automating the rollout of some wireless workstations.

Thanks!

Share this post


Link to post
Share on other sites

Hey MattyD,

This worked perfectly in our image. Thank you very much.

I actually just clipped it down to:

#include "NativeWifi.au3"
Local $oUserData
$fDebugWifi = True

_Wlan_StartSession()

$oUserData = _Wlan_CreateUserDataObject()
With $oUserData
.BaseType = "PEAP"
.Type = "PEAP-MSCHAP"
.PEAP.MSCHAP.Domain = "Domain" ;Leave this line out if you don't wish to specify a domain
.PEAP.MSCHAP.Username = "Username"
.PEAP.MSCHAP.Password = "Password"
EndWith
;ConsoleWrite(_Wlan_ConvertUserData($oUserData) & @CRLF)
_Wlan_SetProfileUserData("Profile Name", $oUserData)

Since we had the wireless profile defined in the image itself.

Share this post


Link to post
Share on other sites

Hey again,

I spoke too soon. We decided to take the profile out of the image and setup an exe to call with sysprep instead. This would also give us a utility to repair broken profiles after the fact. We built that, started testing, and now we have noticied that when we apply the profile it doesn't save the EAP user/pass for all users, just the current user. The profile itself gets created for everyone but our prelogin is broken, and when we log in with a different local account than what ran the script it prompts for user/pass for the network.

Looking at the UDF documentation, the $iFlags on _wlan_setprofiledata should do exactly what I need, but I can't seem to get it work. Is the command looking for the $WLAN_SET_EAPHOST_DATA_ALL_USERS (0x01), or just the number value(ex, 1, or 0x01)? I've tried a couple combinations both with the flag value in the command, and store in and called as $iFlags, but it always seems to just take effect for the executing user.

Any ideas?

Thanks.

Share this post


Link to post
Share on other sites

Hey man,

$WLAN_SET_EAPHOST_DATA_ALL_USERS is a constant that is defined in the header with the value of 1. so these three lines all pass the same value to the function,

_Wlan_SetProfileUserData("Profile Name", $oUserData, $WLAN_SET_EAPHOST_DATA_ALL_USERS)
_Wlan_SetProfileUserData("Profile Name", $oUserData, 0x1)
_Wlan_SetProfileUserData("Profile Name", $oUserData, 1)

Im assuming you've probably called the function correctly so the next thing i'd try is to add the #RequireAdmin directive at the top of your script to see if that helps. For the record there is no msdn documentation saying you need admin rights to use the flag - but it seems like a reasonable thing to try.

Failing that, I would probably have a poke around the SSO parameters in the profile. Have you managed to get a working profile and credentials using the GUI? If we get that working automation should be easy.

I hope that gives you something to go on, If i get time I'll do some testing tomorrow and post something a bit more substantial

Good Luck,

Matt

Share this post


Link to post
Share on other sites

Hey MattyD,

Thanks for the clarification on the iFlags. I've had a chance for further testing today, so here's what I've found.

Creating a profile using this code:

#include "NativeWifi.au3"
#RequireAdmin

Local $oProfile, $oUserData, $sReason
$fDebugWifi = True

_Wlan_StartSession()
$oProfile = _Wlan_CreateProfileObject()

With $oProfile
.Name = "SSID"
.SSID.Add("SSID")
.Type = "Infrastructure"
.Auth = "WPA2"
.Encr = "AES"
.Options.NonBroadcast = True
.Options.ConnMode = "Automatic"
.OneX.Enabled = True
.OneX.AuthMode = "User"
.PMK.PreAuthEnabled = True
.PMK.CacheEnabled = True
.EAP.BaseType = "PEAP"
.EAP.Type = "PEAP-MSCHAP"
.EAP.PEAP.MSCHAP.UseWinLogonCreds = False
.EAP.PEAP.ServerValidation.NoUserPrompt = True
.EAP.PEAP.ServerValidation.Enabled = True
.EAP.PEAP.ServerValidation.ThumbPrints.Add("possible cert 1 thumbprint (we have two ACS appliances)")
.EAP.PEAP.ServerValidation.ThumbPrints.Add("possible cert 2 thumbprint (we have two ACS appliances)")
.EAP.PEAP.FastReconnect = True
EndWith

;ConsoleWrite(_Wlan_ConvertProfile($oProfile) & @CRLF) Displays the profile in XML format - This is what gets sent to the API
_Wlan_SetProfile($oProfile, $sReason, 0)

$oUserData = _Wlan_CreateUserDataObject()

With $oUserData
.BaseType = "PEAP"
.Type = "PEAP-MSCHAP"
.PEAP.MSCHAP.Username = "user"
.PEAP.MSCHAP.Password = "password"
EndWith

;ConsoleWrite(_Wlan_ConvertUserData($oUserData) & @CRLF)
_Wlan_SetProfileUserData("ACS_WLAN", $oUserData, 1)

Successfully creates a profile, that looks to be configured identical to the way I would do it in the GUI. It connects and works. Logging off the user that ran the script (compiled as an X86 exe with RequireAdministrator set for the execution level) and attempting to log into a domain account fails, no logon servers available (no network connection). Logging in as another local account gets prompts for the PEAP username and password, which when typed in, gets that profile to work. Logging off and back on as another local user produces the same prompts.

Performing the same configuration manually and saving the same username and password in the PEAP user authentication area works for all accounts, and prelogon.

I compared the profile XMLs that get created with winmerge, they were absolutely identical in terms of the way the settings look in the GUI but the way the settings are stored in the file appears a little different.

Nativewifi script:

<?xml version="1.0"?>
<WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1">
<name>ACS_WLAN</name>
<SSIDConfig>
<SSID>
<hex>removed</hex>
<name>removed</name>
</SSID>
<nonBroadcast>true</nonBroadcast>
</SSIDConfig>
<connectionType>ESS</connectionType>
<connectionMode>auto</connectionMode>
<MSM>
<security>
<authEncryption>
<authentication>WPA2</authentication>
<encryption>AES</encryption>
<useOneX>true</useOneX>
</authEncryption>
<PMKCacheMode>enabled</PMKCacheMode>
<preAuthMode>enabled</preAuthMode>
<OneX xmlns="http://www.microsoft.com/networking/OneX/v1">
<authMode>user</authMode>
<EAPConfig>
     <EapHostConfig xmlns="http://www.microsoft.com/provisioning/EapHostConfig" xmlns:eapCommon="http://www.microsoft.com/provisioning/EapCommon">
     <EapMethod>
     <eapCommon:Type>25</eapCommon:Type>
     <eapCommon:AuthorId>0</eapCommon:AuthorId>
     </EapMethod>
     <Config xmlns:baseEap="http://www.microsoft.com/provisioning/BaseEapConnectionPropertiesV1" xmlns:msPeap="http://www.microsoft.com/provisioning/MsPeapConnectionPropertiesV1" xmlns:eapTls="http://www.microsoft.com/provisioning/EapTlsConnectionPropertiesV1" xmlns:msChapV2="http://www.microsoft.com/provisioning/MsChapV2ConnectionPropertiesV1" xmlns:msPeapV2="http://www.microsoft.com/provisioning/MsPeapConnectionPropertiesV2" xmlns:eapTlsV2="http://www.microsoft.com/provisioning/EapTlsConnectionPropertiesV2">
     <baseEap:Eap>
     <baseEap:Type>25</baseEap:Type>
     <msPeap:EapType>
         <msPeap:ServerValidation>
         <msPeap:DisableUserPromptForServerValidation>true</msPeap:DisableUserPromptForServerValidation>
         <msPeap:TrustedRootCA> removed</msPeap:TrustedRootCA>
         <msPeap:TrustedRootCA> removed</msPeap:TrustedRootCA>
         </msPeap:ServerValidation>
         <msPeap:FastReconnect>true</msPeap:FastReconnect>
         <msPeap:InnerEapOptional>false</msPeap:InnerEapOptional>
         <baseEap:Eap>
         <baseEap:Type>26</baseEap:Type>
         <msChapV2:EapType>
         <msChapV2:UseWinLogonCredentials>false</msChapV2:UseWinLogonCredentials>
         </msChapV2:EapType>
         </baseEap:Eap>
         <msPeap:PeapExtensions>
         <msPeapV2:PerformServerValidation>true</msPeapV2:PerformServerValidation>
         </msPeap:PeapExtensions>
     </msPeap:EapType>
     </baseEap:Eap>
     </Config>
     </EapHostConfig>
</EAPConfig>
</OneX>
</security>
</MSM>
</WLANProfile>

Manual Profile:

<?xml version="1.0"?>
<WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1">
<name>ACS_WLAN</name>
<SSIDConfig>
<SSID>
<hex>removed</hex>
<name>removed</name>
</SSID>
<nonBroadcast>true</nonBroadcast>
</SSIDConfig>
<connectionType>ESS</connectionType>
<connectionMode>auto</connectionMode>
<autoSwitch>false</autoSwitch>
<MSM>
<security>
<authEncryption>
<authentication>WPA2</authentication>
<encryption>AES</encryption>
<useOneX>true</useOneX>
<FIPSMode xmlns="http://www.microsoft.com/networking/WLAN/profile/v2">false</FIPSMode>
</authEncryption>
<PMKCacheMode>enabled</PMKCacheMode>
<PMKCacheTTL>720</PMKCacheTTL>
<PMKCacheSize>128</PMKCacheSize>
<preAuthMode>enabled</preAuthMode>
<preAuthThrottle>3</preAuthThrottle>
<OneX xmlns="http://www.microsoft.com/networking/OneX/v1">
<cacheUserData>true</cacheUserData>
<authMode>user</authMode>
<EAPConfig><EapHostConfig xmlns="http://www.microsoft.com/provisioning/EapHostConfig"><EapMethod><Type xmlns="http://www.microsoft.com/provisioning/EapCommon">25</Type><VendorId xmlns="http://www.microsoft.com/provisioning/EapCommon">0</VendorId><VendorType xmlns="http://www.microsoft.com/provisioning/EapCommon">0</VendorType><AuthorId xmlns="http://www.microsoft.com/provisioning/EapCommon">0</AuthorId></EapMethod><Config xmlns="http://www.microsoft.com/provisioning/EapHostConfig"><Eap xmlns="http://www.microsoft.com/provisioning/BaseEapConnectionPropertiesV1"><Type>25</Type><EapType xmlns="http://www.microsoft.com/provisioning/MsPeapConnectionPropertiesV1"><ServerValidation><DisableUserPromptForServerValidation>true</DisableUserPromptForServerValidation><ServerNames></ServerNames><TrustedRootCA>Removed</TrustedRootCA></ServerValidation><FastReconnect>true</FastReconnect><InnerEapOptional>false</InnerEapOptional><Eap xmlns="http://www.microsoft.com/provisioning/BaseEapConnectionPropertiesV1"><Type>26</Type><EapType xmlns="http://www.microsoft.com/provisioning/MsChapV2ConnectionPropertiesV1"><UseWinLogonCredentials>false</UseWinLogonCredentials></EapType></Eap><EnableQuarantineChecks>false</EnableQuarantineChecks><RequireCryptoBinding>false</RequireCryptoBinding><PeapExtensions><PerformServerValidation xmlns="http://www.microsoft.com/provisioning/MsPeapConnectionPropertiesV2">true</PerformServerValidation><AcceptServerName xmlns="http://www.microsoft.com/provisioning/MsPeapConnectionPropertiesV2">false</AcceptServerName></PeapExtensions></EapType></Eap></Config></EapHostConfig></EAPConfig>
</OneX>
</security>
</MSM>
</WLANProfile>

Please note that I left some options, such as a couple under .PMK out because the script profile seemed to default to what I wanted when the options were turned on. I went for the path of least-resistance in terms of specifying options.

I'm 99% sure that the setuserprofiledata command works perfectly when the profile itself is created manually, I'm second guessing myself but I can half remember testing these scenarios. I guess that indicates an issue with the profile generation? On the other side, the profile works for all users once the PEAP username and password are entered manually, so that indicates that the profile works and the issue is where the userdata is being stored (per-user)?.

Just to test I recompiled the EXE as x64, there was no change in the behavior.

I don't know if you needed all that, but I wanted to make sure you have all the information I had in case it is necessary. I'm kinda stumped as to what I can try on my side, so if you need anything else from me, please let me know.

Thanks for all your work on NativeWifi, and the help you've been giving to everyone that asked you a question regarding it.

Regards.

Share this post


Link to post
Share on other sites

OK Cool,

The main difference I can see between the two profiles is the cacheUserData element (first one inside oneX) is missing in our generated one.

try adding .OneX.CacheUserData = True into the mix :)

Oh and thanks guys for your support - I appreciate it.

Thanks,

Matt

Share this post


Link to post
Share on other sites

Hey,

Added in .OneX.CacheUserData = True, there was no change. I added in a bunch of other settings that I wasn't declaring before because they were fine at default, just to see, didn't make any change.

Played around with this a bit and found that when I ran the autoit script it creates:

HKEY_CURRENT_USERSoftwareMicrosoftWlansvcUserDataProfiles{2AF0898C-0B41-4F72-8728-A54D089C2EC2}msmusername

in the registry, which makes sense since the credentials seem to be profile specific. When I save the credentials using the GUI, I get:

HKEY_LOCAL_MACHINESOFTWAREMicrosoftWlansvcUserDataProfiles{2AF0898C-0B41-4F72-8728-A54D089C2EC2}msmusername

created, which was not present in the registry previously. The msmusername has a binary key underneath it which appears to be the EAP userdata.

Thanks

Share this post


Link to post
Share on other sites

midvalley,

I had a quick play with this over the weekend, and didn't make much progress.

I'm thinking the profile is OK. You can set that profile generated by windows by doing this:

_Wlan_SetProfile(FileRead("My Profile.xml"), $sReason)

It didn't make any difference for me though.

I've double checked the back end of the _Wlan_SetProfileUserData function and all looks OK there too. I'm starting to think there may be a bug in the API (wouldn't be the first). Googling the WLAN_SET_EAPHOST_DATA_ALL_USERS flag returns jack all - which is always helpful.

That being said I couldn't get the creds in the HKLM hive even through the GUI - so it could be me. Perhaps I'll try another more up-to-date machine...

Cheers,

Matt

Share this post


Link to post
Share on other sites

Hey,

I've been using your example to use your funktion and is has worked brilliantly, thank you very much. How ever i have run in to an issue i wish someone knows how to get around. I have a pc that is a member of a differnt domain, trying to use this script to login to my domain. The example that i use is this:

#include "NativeWifi.au3"

Local $oProfile, $oUserData, $sReason
$fDebugWifi = True

_Wlan_StartSession()
$oProfile = _Wlan_CreateProfileObject()

With $oProfile
.Name = "Profile Name"
.SSID.Add("SSID")
.Type = "Infrastructure"
.Auth = "WPA2"
.Encr = "AES"
.OneX.Enabled = True
.EAP.BaseType = "PEAP"
.EAP.Type = "PEAP-MSCHAP"
.EAP.PEAP.MSCHAP.UseWinLogonCreds = False
EndWith

;ConsoleWrite(_Wlan_ConvertProfile($oProfile) & @CRLF) Displays the profile in XML format - This is what gets sent to the API
_Wlan_SetProfile($oProfile, $sReason)

$oUserData = _Wlan_CreateUserDataObject()
With $oUserData
.BaseType = "PEAP"
.Type = "PEAP-MSCHAP"
.PEAP.MSCHAP.Domain = "Domain" ;Leave this line out if you don't wish to specify a domain
.PEAP.MSCHAP.Username = "Username"
.PEAP.MSCHAP.Password = "Password"
EndWith

The username and password works just fine on a computer that is a part of the domain, or not in any domain.

The error i get is "!APIError @Ln[5303] _WinAPI_WlanSetProfileEapXmlUserData - Netværksforbindelseseprofilen er beskadiget."

and since that error is danish, here is a estimate translation of the error "The network profile is damaged"

I've tried to just add the domain to the username, but same error, also tried not making the initial setup of the wireless manually in windows so it only types in the username, password and domain, same error tho.

Does anyone have a good idea on how i can get around this?

Share this post


Link to post
Share on other sites

MattyD - wow, this may be just what i'm looking for! seems like a really ambitious project :)

i know very little about networking so my initial question is, could these WiFi functions work for communicating with the WiRC radio?

Posted ImagePosted Image

not sure what information you might need to determine that, but here are some specs...

• Discovery: WRCD receives broadcast UDP messages during discovery, and sends answer UDP

messages, the WRCD listens on the fixed 1984 UDP port for the discovery messages.

• Control and Config: The transmitters connect to a TCP socket of the WRCD and use this TCP

connection to login and configure the WiRC device. WRCD listens on the 1984 TCP port.

• Periodical Channel Data: One of the transmitters shall send channel data periodically using UDP

messages. The channel signals are generated by the WiRC device according to the fields of these

messages. During login WRCD sends in a message (WST) the UDP port number where the

periodical messages shall be sent by the transmitter.

• Periodical Status Data: The WRCD sends the current states of the WiRC device inputs and the

measured voltages periodically using UDP messages to the transmitters. During login the

transmitter shall send in a message (TL) the UDP port number where the transmitter status

messages are received.

• MJPEG stream: The WRCD uses an UDP based protocol to stream the images of the WiRC's

camera to the transmitters. The UDP port number where the stream is received by the transmitter

shall be sent in a message (STST) by the transmitter.

Posted Image

here's the full communication protocol doc (PDF)


FUNCTIONS: WinDock (dock window to screen edge) | EditCtrl_ToggleLineWrap (line/word wrap for AU3 edit control) | SendEX (yet another alternative to Send( ) ) | Spell Checker (Hunspell wrapper) | SentenceCase (capitalize first letter of sentences)

CODE SNIPPITS: Dynamic tab width (set tab control width according to window width)

Share this post


Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...