Wednesday, February 15, 2012

Simple Powershell Password Obfuscation

There is many ways to encrypt password in SHA1, MD5 or any other encrypter in powershell using .NET libraries.
This time, I only need a simple and fast obfuscation powershell encoder/decoder to avoid plain text password. I choose this simple solution:
I encode in decimal letter then I add 1
Ex: A = 41 (byte char in hexadecimal) = 65 (byte char in decimal)
obfuscation add 1 so obfuscation result = 65+1 = 66
obfuscation decoder sub 1 so 66-1 = 65 = A
((download scripts)

to encode
$strEncoded = ""
$strToEncode = "ABCD"
$strToEncode.ToCharArray() | Foreach { $strEncoded = $strEncoded + ([BYTE][CHAR]($_)+1)  + " " }
Write-Host $strEncoded

encode result:
66 67 68 69

to decode
$strDecoded = ""
$strToDecode = "66 67 68 69"
$strToDecode.Trim().Split(" ") | Foreach { $strDecoded = $strDecoded + [CHAR][BYTE](($_)-1) }
Write-Host $strDecoded 

decode result:
ABCD

Example of obfuscation encoder for your password
#
# Simple Password Obfuscation encoder
# 
# by Franck RICHARD 
# 2012 February
#

$strComputername = Read-Host "Enter Computername"
$username = Read-Host "Enter Username"
$password = read-host "Enter a Password"

# To encode password
$strToEncode = $password
$strEncoded = ""
$strToEncode.ToCharArray() | Foreach { $strEncoded = $strEncoded + ([BYTE][CHAR]($_)+1)  + " " }

$line = $strComputername + ";" + $username + ";" + $strEncoded
Write-Host $line

result with computer mycomputer, user myuser and password mypasswor;
Enter Computername: mycomputer
Enter Username: myuser
Enter a Password: mypassword
mycomputer;myuser;110 122 113 98 116 116 120 112 115 101


Example of obfuscation decoder for your password
you need a test file servers.txt using line generated above
mycomputer;myuser;110 122 113 98 116 116 120 112 115 101
mycomputer2;myuser2;111 102 120 113 98 116 116 120 112 115 101


#
# Simple Password Obfuscation decoder
# 
# by Franck RICHARD 
# 2012 February
#

$strContent = Get-Content servers.txt
Foreach ($strLine in $strContent) {
 $strInfos = $strLine.Trim().Split(";") 
 $strDecoded = ""
 $strToDecode = $strInfos[2]
 $strToDecode.Trim().Split(" ") | Foreach { $strDecoded = $strDecoded + [CHAR][BYTE](($_)-1) }
 Write-Host "Computername:" $strInfos[0] "User:" $strInfos[1] "Password:" $strDecoded
}

Thursday, January 12, 2012

HP SIM 6.3 browser security setting error

An error "Your browser's security settings for the zone it chose for this connection are not compatible with the HP SIM popup menu"

HP Systems Insight Manager v6.3 installation have been done on an Windows 2008 R2. So this is an internet explorer 8. (there are some troubles with internet explorer 9)
And Security options have been set to medium-low.














Same problem with Firefox










SIM63_hotfix_2011_Aug_win.exe have been installed also

Problem is solved with SIM63_hotfix_2011_Oct_win.exe (ftp://ftp.hp.com/pub/softlib2/software1/pubsw-windows/p1002362299/v73061)