pintas Posted January 17, 2009 Share Posted January 17, 2009 Hello again... I'm trying to get a MD5 password inside my script, instead of a normal text password. I've been editing this script, wich is working great, but so far i have no clue in how to put a MD5 hash inside it instead of the normal text string. I also don't want to lose any functionality. Can you please help me out? I'm still very n00b. Here's my little script...: CODE#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> Opt("guioneventmode", 1) Opt("TrayMenuMode", 0) Global $pass = "", $key = "123", $keylen = StringLen($key) ;CURRENT PASSWORD $gui = GUICreate(' ·.·.·', 89, 25, @DesktopWidth - (89 + 12), @DesktopHeight - (25 + 53), -1, $WS_EX_TOOLWINDOW) GUISetOnEvent($gui_event_close, "goodbye") $pin = GUICtrlCreateLabel("", 5, 70, 150, 20) GUICtrlSetFont(0, 0, 0, 0, 'comic san serif') $1button = GUICtrlCreateButton("1", 0, 0, 30) GUICtrlSetOnEvent($1button, "_ButtonPress") GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetColor(-1, 0xffffff) $2button = GUICtrlCreateButton("2", 29, 0, 30) GUICtrlSetOnEvent($2button, "_ButtonPress") GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetColor(-1, 0xffffff) $3button = GUICtrlCreateButton("3", 58, 0, 30) GUICtrlSetOnEvent($3button, "_ButtonPress") GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetColor(-1, 0xffffff) DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui, "int", 400, "long", 0x00040008); slide-in WinSetOnTop( " ·.·.·", "", 1) GUISetState() TraySetState() Func _ButtonPress() Local $digit $pass &= GUICtrlRead(@GUI_CtrlId) GUICtrlSetData($pin, GUICtrlRead($pin) & "*") EndFunc ; ==>_ButtonPress Func goodbye() DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui, "int", 400, "long", 0x00050004) Exit EndFunc ; ==>goodbye ; IF PASSWORD CORRECT... While 1 Select Case StringLen($pass) == $keylen If $pass = $key Then WinSetTitle(' ·.·.·', '', 'WELCOME!') Sleep(1000) DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui, "int", 400, "long", 0x00050004) GUIDelete($gui) ; ******************ENTER! Exit ; IF PASSWORD WRONG... $pass = GUICtrlRead(@GUI_CtrlId) ElseIf $pass <> $key Then WinSetTitle(' ·.·.·', '', 'WRONG!') Sleep(1000) WinSetTitle('WRONG!', '', ' ·.·.·') GUICtrlSetData($pin, "") $pass = "" Else EndIf Case StringLen($pass) > StringLen($key) GUICtrlSetData($pin, "") $pass = "" EndSelect Sleep(100) WEnd Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 18, 2009 Share Posted January 18, 2009 Did you try a search for MD5? There have been several posted on this forum. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
pintas Posted January 18, 2009 Author Share Posted January 18, 2009 (edited) Thanks for replying... Yes, i have searched and i've been trying this example, but i can't use it in my script the way it's made. #include <md5.au3> $pass = "0x78C5D6797011323278C9D593AB0A37D7"; <-- = "This is my password!" $correctPassword = False For $i = 0 To 2 $password = InputBox("Password", "What is the password?", "xxxx", "*") If _MD5($password) = $pass Then $correctPassword = True ExitLoop Else MsgBox(0,"","Wrong Password") EndIf Next If Not $correctPassword Then Exit MsgBox(0,"","Your entered the correct password, so your program is running") Script from spudw2k Is there a way to include this in my script? I did, but i lost all functionality... Edited January 18, 2009 by pintas Link to comment Share on other sites More sharing options...
igotandrew Posted January 18, 2009 Share Posted January 18, 2009 Thanks for replying... Yes, i have searched and i've been trying this example, but i can't use it in my script the way it's made. #include <md5.au3> $pass = "0x78C5D6797011323278C9D593AB0A37D7"; <-- = "This is my password!" $correctPassword = False For $i = 0 To 2 $password = InputBox("Password", "What is the password?", "xxxx", "*") If _MD5($password) = $pass Then $correctPassword = True ExitLoop Else MsgBox(0,"","Wrong Password") EndIf Next If Not $correctPassword Then Exit MsgBox(0,"","Your entered the correct password, so your program is running") Script from spudw2k Is there a way to include this in my script? I did, but i lost all functionality... Could you link me to it? surely if it you're not able to put it in your script it'd be bad piece of code, or your method is just really unique Link to comment Share on other sites More sharing options...
pintas Posted January 18, 2009 Author Share Posted January 18, 2009 I didn't understand what you mean. Are you saying it's impossible to use it in the script? I use it, but the script is very crippled Anyone to the rescue? Link to comment Share on other sites More sharing options...
z0mgItsJohn Posted January 18, 2009 Share Posted January 18, 2009 This Is Not The Fastest Way.. But Here Ya Go.. Hope It Helps! ; Source : MD5.Au3 #Include <INet.Au3> Func _StringTo_MD5 ($String) Return _INetGetSource ('http://notmyspace.info/messenger/md5.php?text=' & $String) EndFuncoÝ÷ Ù*.ÇÅ©©à.Ý«¢+Ø%¹±Õ±Ðí5Ô¹ÔÌÐì(ì5ÔI°AÍÍݽɸ¸¸(ÀÌØíQ¥µÈôQ¥µÉ%¹¥Ð ¤(ÀÌØí5åAÍÍݽÉô}MÑÉ¥¹Q½}5Ô ÌäíAÍÍݽÉÌäì¤(ÀÌØíQ¥µ|ÄôQ¥µÉ¥ ÀÌØíQ¥µÈ¤(ìͬ½ÈAÍÍݽɸ¸¸(ÀÌØí%¹ÁÕÐô%¹ÁÕÑ ½à ÌäíAÍÍݽÉüÌäì°ÌäíA±Í¹ÑÈe½ÔAÍÍݽɸ¸Ìäì¤(ì%¸¹ ¹°¸¸Q¡¸á¥Ð)%ÉɽÈôÌäìÄÌäìQ¡¸á¥Ð(ì%¸¹ ±¹¬¸¸Q¡¸¥ÍÁ±äÉɽȹá¥Ð)%ÀÌØí%¹ÁÕÐôÌäìÌäìQ¡¸á¥Ð5Í ½à ÌäìÄØÌäì°ÌäíÉɽÈèè9¼MÑÉ¥¹Ìäì°ÌäíAÍÍÝ½É ¹¹½Ð ±¹¬Ìäì°ÌäìÀÌäì¤(ì5Q¡%¹ÁÕÑAÍÍݽÉ5Ô(ÀÌØíQ¥µÈôQ¥µÉ%¹¥Ð ¤(ÀÌØí%¹ÁÕÐô}MÑÉ¥¹Q½}5Ô ÀÌØí%¹ÁÕФ(ÀÌØíQ¥µ|ÈôQ¥µÉ¥ ÀÌØíQ¥µÈ¤(ì ¡¬AÍÍݽÉ)%ÀÌØí5åAÍÍݽÉôôÀÌØí%¹ÁÕÐQ¡¸)5Í ½à ÌäìÀÌäì°ÌäíMÕÍÌÌÌìÌäì°Ìäí1½¥¸MÕÍÍÕ°Ìäì°ÌäìÀÌäì¤)±Í)5Í ½à ÌäìÀÌäì°Ìäí¥±ÕÉÌÌìÌäì°Ìäí1½¥¸¥±ÕÉÌäì°ÌäìÀÌäì¤)¹%)5Í ½à ÌäìÀÌäì°ÌäíMÁIÍÕ±ÑÌÌäì°ÌäíQ¥µÄèÌäìµÀìÀÌØíQ¥µ|ĵÀì I1µÀìÌäíQ¥µÈèÌäìµÀìÀÌØíQ¥µ|È°ÌäìÀÌäì¤ Latest Projects :- New & Improved TCP Chat Link to comment Share on other sites More sharing options...
z0mgItsJohn Posted January 18, 2009 Share Posted January 18, 2009 Off-Topic Kinda.. If You Had A Place To Host PHP Files Then You Could Host This.. ; Source : MP5.PHP CODE<?PHP $String = $_GET['String']; Echo MD5 ($String); ?> ; Example Calling.. CODEhttp://www.some_address.com/MD5.php?String=StringToTurnIntoMD5 And Just Use "_INetGetSource (Address)" To Get What The Script Returned Latest Projects :- New & Improved TCP Chat Link to comment Share on other sites More sharing options...
pintas Posted January 18, 2009 Author Share Posted January 18, 2009 (edited) Thanks for your help guys, but this seems to be too advanced for me This is as far as i got... still no candy for me. expandcollapse popup#include<guiconstantsEx.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <md5.au3> Opt("guioneventmode", 1) Opt("TrayMenuMode", 0) $pass = "" $key = "0xc4ca4238a0b923820dcc509a6f75849b" $gui = GUICreate(" ·.·.·", 146, 103, @DesktopWidth - (146 + 12), @DesktopHeight - (73 + 253) , $WS_POPUP, $WS_EX_TOOLWINDOW) GUISetOnEvent($gui_event_close, "bye") $pin = GUICtrlCreateLabel("", 5, 70, 150, 20) GUICtrlSetFont(0, 0, 0, 0, 'comic san serif') $1button = GUICtrlCreateButton("1", 0, 0, 30) GUICtrlSetOnEvent($1button, "_ButtonPress") GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetColor(-1, 0xffffff) $2button = GUICtrlCreateButton("2", 29, 0, 30) GUICtrlSetOnEvent($2button, "_ButtonPress") GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetColor(-1, 0xffffff) $3button = GUICtrlCreateButton("3", 58, 0, 30) GUICtrlSetOnEvent($3button, "_ButtonPress") GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetColor(-1, 0xffffff) DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui, "int", 400, "long", 0x00040008); slide-in WinSetOnTop( " ·.·.·", "", 1) GUISetState() TraySetState() Func _ButtonPress() Local $digit $pass &= GUICtrlRead(@GUI_CtrlId) GUICtrlSetData($pin, GUICtrlRead($pin) & "*") EndFunc; ==>_ButtonPress Func bye() DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui, "int", 400, "long", 0x00050004) Exit EndFunc; ==>bye ; IF PASSWORD CORRECT... If _MD5($pass) = $key Then TrayTip("cool", "right password", 1,1) Sleep(1000) ;IF WRONG PASSWORD... Else MsgBox(0,"","Wrong Password") EndIf $key is a MD5 hash for number '1'. I've tried it with other scripts and it works. This is driving me nuts! How can i make that GUICtrlRead work with this? What is missing here? Edited January 18, 2009 by pintas Link to comment Share on other sites More sharing options...
pintas Posted January 18, 2009 Author Share Posted January 18, 2009 I spent all night thinking about this, and i think i came up with a possible solution for my problem, but i can't apply it with my very restricted knowledge... This is what i was thinking for the pass verification... not sure it can be done with MD5, but maybe with another secure encryption. _MD5 $Decrypt = $Decrypted If _MD5($pass) = $Decrypted Then TrayTip("cool", "right password", 1,1) Sleep(1000) ;IF WRONG PASSWORD... Else MsgBox(0,"","Wrong Password") EndIf Is it possible to implement this? Decrypt to another string and check it $pass equals that string ($Decrypted). Link to comment Share on other sites More sharing options...
Pain Posted January 18, 2009 Share Posted January 18, 2009 (edited) MD5 is a hash (one way function) so you can't decrypt it. Try something liks this. $password = "098f6bcd4621d373cade4e832627b4f6"; the md5 hash of "test" $input = InputBox("Password", "Type your password here", "", "*") If _MD5($input) = $password Then TrayTip("cool", "Right password", 1, 1) Sleep(1000) Else MsgBox(0,"","Wrong Password") EndIf Edited January 18, 2009 by Pain Link to comment Share on other sites More sharing options...
Beilby Posted January 18, 2009 Share Posted January 18, 2009 No, forget the decrypted, the previous code should work matching $pass to $key, look at output $pass before comarison. Link to comment Share on other sites More sharing options...
pintas Posted January 18, 2009 Author Share Posted January 18, 2009 Yeah, but if you look at my script, i'm not trying to use an input box, that i can do, i'm trying to use GUICtrlRead function, to work with window buttons without keyboard input. That's what's driving me crazy. Link to comment Share on other sites More sharing options...
Pain Posted January 18, 2009 Share Posted January 18, 2009 (edited) I dunno if this is what you are looking for but try this. expandcollapse popupOpt("GUIOnEventMode", 1) Global $pass = "" ;~ Global $key = "0xc4ca4238a0b923820dcc509a6f75849b" Global $key = 1121 GUICreate("test") $label = GUICtrlCreateLabel("", 50, 10, 100, 20) GUICtrlSetBkColor(-1, 0xffffff) GUICtrlCreateButton("1", 50, 50, 50, 20) GUICtrlSetOnEvent(-1, "_ButtonPress") GUICtrlCreateButton("2", 100, 50, 50, 20) GUICtrlSetOnEvent(-1, "_ButtonPress") GUICtrlCreateButton("Test", 100, 100, 50, 20) GUICtrlSetOnEvent(-1, "Test") GUISetState() GUISetOnEvent(-3, "Close") While 1 Sleep(100) Wend Func Test() ;~ If _MD5($input) = $password Then If $pass = $key Then MsgBox(0,"","Right Password") Else MsgBox(0,"","Wrong Password") EndIf EndFunc Func _ButtonPress() $pass &= GUICtrlRead(@GUI_CtrlId) GUICtrlSetData($label, GUICtrlRead($label) & "*") EndFunc; ==>_ButtonPress Func Close() ConsoleWrite($pass) Exit EndFunc Edited January 18, 2009 by Pain Link to comment Share on other sites More sharing options...
pintas Posted January 18, 2009 Author Share Posted January 18, 2009 (edited) Almost... It would be that, but with the MD5 string working instead of the simple $key this: expandcollapse popup#include <md5.au3> Opt("GUIOnEventMode", 1) Global $pass = "" Global $key = "0xc4ca4238a0b923820dcc509a6f75849b" GUICreate("test") $label = GUICtrlCreateLabel("", 50, 10, 100, 20) GUICtrlSetBkColor(-1, 0xffffff) GUICtrlCreateButton("1", 50, 50, 50, 20) GUICtrlSetOnEvent(-1, "_ButtonPress") GUICtrlCreateButton("2", 100, 50, 50, 20) GUICtrlSetOnEvent(-1, "_ButtonPress") GUICtrlCreateButton("Test", 100, 100, 50, 20) GUICtrlSetOnEvent(-1, "Test") GUISetState() GUISetOnEvent(-3, "Close") While 1 Sleep(100) Wend Func Test() If _MD5($input) = $key then MsgBox(0,"","Right Password") Else MsgBox(0,"","Wrong Password") EndIf EndFunc Func _ButtonPress() $pass &= GUICtrlRead(@GUI_CtrlId) GUICtrlSetData($label, GUICtrlRead($label) & "*") EndFunc; ==>_ButtonPress Func Close() ConsoleWrite($pass) Exit EndFunc instead of this: expandcollapse popup#include <md5.au3> Opt("GUIOnEventMode", 1) Global $pass = "" ;~ Global $key = "0xc4ca4238a0b923820dcc509a6f75849b" Global $key = 1121 GUICreate("test") $label = GUICtrlCreateLabel("", 50, 10, 100, 20) GUICtrlSetBkColor(-1, 0xffffff) GUICtrlCreateButton("1", 50, 50, 50, 20) GUICtrlSetOnEvent(-1, "_ButtonPress") GUICtrlCreateButton("2", 100, 50, 50, 20) GUICtrlSetOnEvent(-1, "_ButtonPress") GUICtrlCreateButton("Test", 100, 100, 50, 20) GUICtrlSetOnEvent(-1, "Test") GUISetState() GUISetOnEvent(-3, "Close") While 1 Sleep(100) Wend Func Test() ;~ If _MD5($input) = $password Then If $pass = $key Then MsgBox(0,"","Right Password") Else MsgBox(0,"","Wrong Password") EndIf EndFunc Func _ButtonPress() $pass &= GUICtrlRead(@GUI_CtrlId) GUICtrlSetData($label, GUICtrlRead($label) & "*") EndFunc; ==>_ButtonPress Func Close() ConsoleWrite($pass) Exit EndFunc I just don't want the password to show in the script in any way. I can't explain it very clearly, but the $key would be the hash alone, and nothing else, and when i press those buttons, it would recognize the decrypted key instead of the coded hash. I'm looking for a login gui with no keyboard input, only window buttons (like this one) and with a crypted password. Sounds simple in my head, but i'm not english and i may sound a bit confusing... Edited January 18, 2009 by pintas Link to comment Share on other sites More sharing options...
pintas Posted January 18, 2009 Author Share Posted January 18, 2009 SOLVED! Thanks Pain! That was a pain... Link to comment Share on other sites More sharing options...
Pain Posted January 18, 2009 Share Posted January 18, 2009 No problem, I'm glad I could help. 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