#193624 - 2009-04-29 05:34 AM
Problem with Alt Characters
|
Pr0ph3t
Just in Town
Registered: 2007-01-05
Posts: 4
|
I am writing a script using Kix 4.60 to remotely gather incident response data for forensic analysis. When the user runs the script, they are prompted for local admin credentials on the target machine. The admin accounts in my environment are required to include alt characters in the password. It appears as though Kix is incorrectly interpreting the alt characters. For example, in the sample code below, if I enter a password of "abc123ê" where ê = <alt>136, Kix will show the value of $Pwd as "abc123^". Consequently, authentication fails due to invalid password. Anyone know how to accurately capture and pass alt characters? Is there a better way to do this via WMI?
Any assistance is greatly appreciated.
BREAK ON
CLS
DIM $Targ, $WSN, $UID, $Pwd
; Get IP Address of Target
$Targ = "192.168.1.1" ; In the real script I prompt for this and $WSN
; Get Workstation Name
$WSN = "XPLaptop"
; Get Credentials
?? "Enter the UserID of the Admin account" + @CRLF + "you wish to use for this operation: " Gets $UID
?? "Enter the Admin account password: " Gets $Pwd
?? "User ID: " + $UID ;$UID and $Pwd are only displayed for trouble shooting
?? "Password: " + $Pwd
; Get network info - This is an example of the type of command that I want to execute. Psexec.exe is a tool
; that allows me to run the command remotely.
;SHELL '%WINDIR%\SYSTEM32\cmd /C D:\IR\psexec.exe \\' + $Targ + ' -u ' + $WSN + '\' + $UID + ' -p ' + $Pwd + ' ipconfig /all'
EXIT
_________________________
"There is no spoon..."
|
|
Top
|
|
|
|
#193626 - 2009-04-29 11:23 AM
Re: Problem with Alt Characters
[Re: Pr0ph3t]
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
It's in the variable OK, it just isn't displaying very well.
Try setting ASCII on. See the following test script:
Break ON
$=SetOption("ASCII","ON")
Function DecodePass($PASS)
Dim $i
For $i=1 To Len($PASS)
" '"+SubStr($Pass,$i,1)+"' = "+Asc(SubStr($PASS,$i))+@CRLF
Next
EndFunction
Dim $Pass
"Enter Password: " GetS $PASS
While $PASS
"Password is:"+@CRLF
DecodePass($PASS)
@CRLF+"Enter Password: " GetS $PASS
Loop
|
|
Top
|
|
|
|
#193630 - 2009-04-29 04:07 PM
Re: Problem with Alt Characters
[Re: Richard H.]
|
Pr0ph3t
Just in Town
Registered: 2007-01-05
Posts: 4
|
Richard H. - Thanks for the information; setting ASCII-ON fixed the problem with storing Alt characters. However, now I appear to be having an issue with shell.
When I open a command prompt and manually run the following command it runs fine:
D:\IR\psexec.exe \\192.168.1.1 -u XPLaptop\Admin -p abc123ê ipconfig /all' But if I try to run the same command in a script using shell, then it fails authentication:
BREAK ON
CLS
$=SetOption("ASCII","ON")
DIM $Targ, $UID, $Pwd
$Targ = "192.168.1.1"
$UID = "XPLaptop\Admin"
$Pwd = "abc123ê"
SHELL '%WINDIR%\SYSTEM32\cmd /C D:\IR\psexec.exe \\' + $Targ + ' -u ' + $UID + ' -p ' + $Pwd + ' ipconfig /all'
EXIT Any ideas? Am I doing something wrong in my Shell syntax?
Thanks again for the help.
_________________________
"There is no spoon..."
|
|
Top
|
|
|
|
#193634 - 2009-04-29 05:09 PM
Re: Problem with Alt Characters
[Re: Allen]
|
Pr0ph3t
Just in Town
Registered: 2007-01-05
Posts: 4
|
Thanks for the response.
The error that I am getting is: "Login Failure: unknown user name or bad password"
I have verified that the user name and password that I am passing in the script are identical to those that I am using when I run the command manually.
_________________________
"There is no spoon..."
|
|
Top
|
|
|
|
#193640 - 2009-04-30 09:32 AM
Re: Problem with Alt Characters
[Re: Gargoyle]
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Try the command in the simplest form you can, for example:
BREAK ON
$=SetOption("ASCII","ON")
SHELL 'D:\IR\psexec.exe \\192.168.1.1 -u XPLaptop\Admin -p abc123'+Chr(136)+' ipconfig /all'
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 2220 anonymous users online.
|
|
|