gcue Posted September 18, 2020 Share Posted September 18, 2020 (edited) Hello. See many examples of folks using this function Func _ValidUserPass($username, $computer, $password) Local $valid = True RunAs($username, $computer, $password, 0, @ComSpec & " /c echo test", @SystemDir, @SW_HIDE) If @error Then $valid = False Return $valid EndFunc ;==>_ValidUserPass Been working great for me for years - thanks to original poster (not sure who it was). I've seen an issue when password has the following characters "%%%" I've tried putting double quotes and single quotes around the password variable but no luck. Any other thoughts or ideas? Thanks in advance! Edited September 19, 2020 by gcue Link to comment Share on other sites More sharing options...
pseakins Posted September 19, 2020 Share Posted September 19, 2020 This sounds a bit like the issue of a DOS batch argument requiring the percent character to be escaped by adding an additional percent. Have you tried adding a leading "%" to every "%" in the arguments? Phil Seakins Link to comment Share on other sites More sharing options...
gcue Posted September 19, 2020 Author Share Posted September 19, 2020 i tried the following and it didnt work $password = stringreplace($password, "%", "%%") thanks for the suggestion - seemed promising. not sure what else to try Link to comment Share on other sites More sharing options...
jerem488 Posted September 19, 2020 Share Posted September 19, 2020 Func _ValidUserPass($username, $computer, $password) Local $valid = True RunAs($username, $computer, "'" & $password & "'", 0, @ComSpec & " /c echo test", @SystemDir, @SW_HIDE) $a_Password = StringSplit($password, "") For $i = 1 To $a_Password[0] If Asc($a_Password[$i]) = "&" Then ; Your code here EndIf Next If @error Then $valid = False Return $valid EndFunc ;==>_ValidUserPass Qui ose gagneWho Dares Win[left]CyberExploit[/left] Link to comment Share on other sites More sharing options...
Exit Posted September 19, 2020 Share Posted September 19, 2020 4 hours ago, gcue said: $password = stringreplace($password, "%", "^%")$password = stringreplace($password, "%", "%%") or perhaps $password = stringreplace($password, "%", "^%") App: Au3toCmd UDF: _SingleScript() Link to comment Share on other sites More sharing options...
pseakins Posted September 20, 2020 Share Posted September 20, 2020 17 hours ago, jerem488 said: If Asc($a_Password[$i]) = "&" Then This expression can never be true as the ASCII value of any character is always numeric. Also, if the value of @error is to be used to assign a value to a variable it should be assigned immediately after the function or statement that was used to set it. @error is somewhat dynamic and the value can change with every statement. You can't just arbitrarily grab its value and expect it to be representative of what you are testing. Phil Seakins Link to comment Share on other sites More sharing options...
gcue Posted September 21, 2020 Author Share Posted September 21, 2020 neither worked. i know dos uses % to declare a %variable% so i would have thought quotes would have been read differently. but single or double quotes didnt fix the issue Link to comment Share on other sites More sharing options...
seadoggie01 Posted September 21, 2020 Share Posted September 21, 2020 (edited) I don't have the ability to test this, so have you seen this issue elsewhere? It seems strange that the RunAs function would use the command line to run our programs internally. Are you sure you have the right password? (As stupid as it sounds, I've been there) Edited September 21, 2020 by seadoggie01 All my code provided is Public Domain... but it may not work. Use it, change it, break it, whatever you want. Spoiler My Humble Contributions:Personal Function Documentation - A personal HelpFile for your functionsAcro.au3 UDF - Automating Acrobat ProToDo Finder - Find #ToDo: lines in your scriptsUI-SimpleWrappers UDF - Use UI Automation more Simply-erKeePass UDF - Automate KeePass, a password managerInputBoxes - Simple Input boxes for various variable types Link to comment Share on other sites More sharing options...
gcue Posted September 21, 2020 Author Share Posted September 21, 2020 other passwords work fine. i do have the right password for sure seadoggie01 1 Link to comment Share on other sites More sharing options...
pseakins Posted September 21, 2020 Share Posted September 21, 2020 I would run tests to prove that it is the "%" causing the problem. Setup an account with a plain alphanumeric password and run a script that does work. Then add a single percent to the password and see what happens. You need a definitive pass/fail benchmark. If it fails you should change the position of the percent, beginning, middle, end to see if that changes anything. Phil Seakins Link to comment Share on other sites More sharing options...
gcue Posted September 21, 2020 Author Share Posted September 21, 2020 good idea ill try that - thanks! Link to comment Share on other sites More sharing options...
Atrax27 Posted September 21, 2020 Share Posted September 21, 2020 In some cases I've found {%}{%}{%} to work. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now