decaces

Create password variable and use raw send

7 posts in this topic

#1 ·  Posted

Hi!,

I am new to the forum and have been using autoit for a couple of weeks. (sorry in advance for any noob questions)

I have a script which does the following in multiple steps.

- create a wifi profile (PEAP)
- set prefered bandth to 5GHz (this is done by 2.exe on the end)

And last create a username and ask for the password (which are needed to login to peap, due to architecture reasons windows creds are not possible)

Now for the question, for some reason the password is not send in raw.
As the passwords are randomised they do include special chars like &#!^ ect

After some testing we discoverd it is not sending the special chars like # correctly.

I hope someone can show me in the right direction :)

 

Thanks in advance.

#include "NativeWifi.au3"

$CMD = "netsh wlan delete profile name=*"
RunWait(@ComSpec & " /c " & $CMD)

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

_Wlan_StartSession()
$oProfile = _Wlan_CreateProfileObject()

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

_Wlan_SetProfile($oProfile, $sReason)

$name=@Computername
$password = InputBox($name, "Enter the password", "", "*")


$oUserData = _Wlan_CreateUserDataObject()
With $oUserData
.BaseType = "PEAP"
.Type = "PEAP-MSCHAP"
.PEAP.MSCHAP.Username = ($name)
.PEAP.MSCHAP.Password = Send($password, 1)
EndWith

_Wlan_SetProfileUserData("********", $oUserData)

$Pref = "2.exe"
RunWait(@ComSpec & " /c " & $Pref)

 

Share this post


Link to post
Share on other sites



#2 ·  Posted

Send doesn't work this way. It is meant to send strings to a GUI. I would try:

.PEAP.MSCHAP.Password = $password

as you seem to use COM.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#3 ·  Posted

Thanks for the quick reply,

I have tried the suggestion with a password like  Welcome#1!

$name=@Computername
$password = InputBox($name, "Enter the password", "", "*")


$oUserData = _Wlan_CreateUserDataObject()
With $oUserData
.BaseType = "PEAP"
.Type = "PEAP-MSCHAP"
.PEAP.MSCHAP.Username = $name
.PEAP.MSCHAP.Password = $password

But unfortunately it still seems pass on the wrong password.

 

Share this post


Link to post
Share on other sites

#4 ·  Posted

You are sure that the system accepts passwords with special characters?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#5 ·  Posted

Another question: How do the _WLAN* functions return an error?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#6 ·  Posted

yes. when the password is given the script goes on. 

When it is done there should be a connection but instead windows is asking for additional credentials. (like: soper_fig08.jpg)

When they are entered in there directly it connects instantly.

Also when i reset the password to something like "Password1" or something without the # in this case and run the script again with that password it works fine.

unfortunately i dont have a error handeling. After entering the password it just goes on without checking if the creds work.
So i dont get a Error back.

ofcource i could reset al the passwords so that they dont have the blocking chars but that is a bit like giving up :)

 

Share this post


Link to post
Share on other sites

#7 ·  Posted

The UDF returns some error information. I would check it this way:

$sReturnValue = _Wlan_SetProfileUserData("********", $oUserData)
If @error Then MsgBox(0, "Error", "@error = " & @error & ", @extended = " & @extended & ", return value = " & $sReturnValue)

 


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

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