rbhkamal Posted July 24, 2006 Share Posted July 24, 2006 (edited) I basically made this script to assign it to my mail button on my keyboard. If you have Gmail account and a "Mail" button on your keyboard you can use this (if your not using Outlook). Don't forget to compile first with beta... expandcollapse popup;#NoTrayIcon #include <IE.au3> #Include <String.au3> Global $UserName = False , $Password = False Global $O_IE_Elements , $O_IE_Element Global $O_IE Global $Save_File = @TempDir&"\"&"Gmail_Inbox_Opener.ini" Global $Encription_level = 2 Global $Shortening = 25 Global $timer_init If WinExists( 'Gmail_Inbox_Opener' ) Then Exit GUICreate( 'Gmail_Inbox_Opener' , 20 , 0 , 2 , 2 ) For $a = 0 to $CmdLine[0] If (StringInStr( $CmdLine[$a] , 'clear' )) or (StringInStr( $CmdLine[$a] , 'clean' )) Or (StringInStr( $CmdLine[$a] , 'uninstall' )) Or (StringInStr( $CmdLine[$a] , 'remove' )) Or (StringInStr( $CmdLine[$a] , 'delete' )) Then If Not FileExists( $Save_File ) Then MsgBox( 16 , 'Gmail Inbox Opener' , "Nothing to remove" ) Exit EndIf While 1 If FileDelete( $Save_File ) Then MsgBox( 64 , 'Gmail Inbox Opener' , StringUpper( $CmdLine[$a])&" is successfull." , 20 ) Exit Else If MsgBox( 5 + 16 , 'Gmail Inbox Opener' , StringUpper( $CmdLine[$a])&" failed. " ) <> 4 Then Exit EndIf EndIf WEnd ElseIf (StringInStr( $CmdLine[$a] , 'set' )) or (StringInStr( $CmdLine[$a] , 'edit' )) Then _SaveInfo() If @error Then MsgBox( 16 , 'Gmail Inbox Opener' , "Error while setting info. Error:"&@error ) Exit Else Exit EndIf ElseIf (StringInStr( $CmdLine[$a] , '?' )) or (StringInStr( $CmdLine[$a] , 'help' )) Then MsgBox( 0 , "Gmail Inbox Opener help" , "Parameters:" &@LF&@LF& _ "1- Clear: Deletes the saved info." &@LF& _ "2- Set : Allows you to overwrite your info." &@LF ) Exit EndIf Next If Not FileExists( $Save_File ) Then _SaveInfo() If @error Then Exit EndIf $timer_init = TimerInit() AdlibEnable( "TimeOut" , 100 ) $O_IE = _IECreate( "www.gmail.com" ) If @error Then showToolTip( "Error _IECreate(): "&@error ) $timer_init = TimerInit() Sleep( 4000 ) Exit EndIf $timer_init = TimerInit() _IELoadWait( $O_IE , 500 ) If @error Then showToolTip( "Error _IELoadWait(): "&@error ) $timer_init = TimerInit() Sleep( 4000 ) _IEQuit( $O_IE ) Exit EndIf $timer_init = TimerInit() ;Getting the form $O_form = _IEFormGetCollection( $O_IE , 0 ) If @error Then showToolTip( "Error _IEFormGetCollection(): "&@error ) $timer_init = TimerInit() Sleep( 4000 ) Exit EndIf $timer_init = TimerInit() ;;Setting the UserName $O_IE_Element = _IEFormElementGetObjByName( $O_form , 'Email' , 0 ) If @error Then showToolTip( "Error _IEFormElementGetObjByName(): "&@error ) $timer_init = TimerInit() Sleep( 4000 ) Exit EndIf $timer_init = TimerInit() _IEFormElementSetValue( $O_IE_Element , _GmailGetUserName() ) If Not @error Then $UserName = True EndIf ;;Setting the password $timer_init = TimerInit() $O_IE_Element = _IEFormElementGetObjByName( $O_form , 'passwd' , 0 ) If @error Then showToolTip( "Error _IEFormElementGetObjByName(): "&@error ) Sleep( 4000 ) Exit EndIf $timer_init = TimerInit() _IEFormElementSetValue( $O_IE_Element , _GmailGetpassword() ) If Not @error Then $Password = True EndIf $timer_init = TimerInit() ;Clicking Login If ($UserName =True) And ($Password = True) Then $O_IE_Element = _IEFormElementGetObjByName( $O_form , 'null' , 0 ) If @error Then showToolTip( "Error _IEFormElementGetObjByName(): "&@error ) $timer_init = TimerInit() Sleep( 4000 ) Exit EndIf _IEAction( $O_IE_Element , 'Click' ) Else $timer_init = TimerInit() showToolTip( "Error: Unable to set/locate info." ) Sleep( 4000 ) EndIf ;Done Exit ;++++++++++++++++++++++++++++++++++++++++++++++++ ;Functions ;++++++++++++++++++++++++++++++++++++++++++++++++ Func TimeOut() If TimerDiff( $timer_init ) > 15000 Then showToolTip( "Time out!" ) Sleep( 2000 ) Exit EndIf EndFunc Func showToolTip($P_inText , $P_title = "Gmail opener") $L_pos = MouseGetPos() ToolTip( $P_inText , $L_pos[0] , $L_pos[1] , $P_title , 3 , 1) sleep(4000) endfunc Func _SaveInfo() If Not FileExists( $Save_File ) Then FileOpen( $Save_File , 4 ) If @error Then MsgBox( 16 , "Gmail inbox opener" , "Unable to create the save file" ) Exit EndIf EndIf $L_UserName = InputBox( "Gmail Inbox Opener" , "Please enter the User Name of your Gmail account."&@LF&@LF& "Your info will be encrypted and safe." , '', '' , 200 , 170 ) If @error Or String( $L_UserName ) == '-1' Or String( $L_UserName ) == '0' Then SetError(1) Return EndIf IniWrite( $Save_File , "Login_info" , "UserName" , _StringEncrypt(1 , $L_UserName , _GetID() , $Encription_level )) $L_UserName = 0 $L_Password = InputBox( "Gmail Inbox Opener" , "Please enter the password of your Gmail account."&@LF&@LF& "Your info will be encrypted and safe." , '' , '$' , 200 , 170 ) If @error Or String( $L_Password ) == '-1' Or String( $L_Password ) == '0' Then SetError(1) Return EndIf IniWrite( $Save_File , "Login_info" , "Password" , _StringEncrypt(1 , $L_Password , _GetID()&'Gmail_Opener' , $Encription_level + 2 )) $L_Password = 0 SetError(0) Return EndFunc Func _GetID() Return _UniqueWoodID( @ComputerName , $Shortening ) EndFunc Func _GmailGetpassword() Return _StringEncrypt(0 , IniRead( $Save_File , "Login_info" , "Password" , '-1' ) , _GetID()&'Gmail_Opener' , $Encription_level + 2 ) EndFunc Func _GmailGetUserName() Return _StringEncrypt(0 , IniRead( $Save_File , "Login_info" , "UserName" , '-1' ) , _GetID() , $Encription_level ) EndFunc ;=============================================================================== ; ; _UniqueWoodID( $com, $no ) ; Description: Used to generate a nearly "unique" ID for a computer ; Parameter(s): [optional] $com : name of computer to generate ID for (default=localhost) ; [optional] $no : shortening value used to shorten id(default: 5) ; Requirement: AutoIt ; Return Value(s): The ID for the computer ; Author(s): Alexander "TechDude" Wood ; Note(s): Use the SAME shortening value every time you call this function. ; I feel that _UniqueWoodID2() is more unique than this ; ;=============================================================================== Func _UniqueWoodID( $com = "localhost", $no = 5 ) ;$time = TimerInit() $colItems = "" $objWMIService = ObjGet ("winmgmts:\\" & $com & "\root\CIMV2") $colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_Processor", "WQL", 0x10 + 0x20) If IsObj ($colItems) Then For $objItem In $colItems $Out1 = _StringEncrypt(1, $objItem.AddressWidth & $objItem.Architecture & $objItem.Caption, _ $objItem.ConfigManagerErrorCode & $objItem.ConfigManagerUserConfig & $objItem.DataWidth) $Out2 = _StringEncrypt(1, $objItem.Description & $objItem.DeviceID & $objItem.ExtClock, _ $objItem.Family & $objItem.InstallDate & $objItem.L2CacheSize) $Out3 = _StringEncrypt(1, $objItem.L2CacheSpeed & $objItem.Level & $objItem.Manufacturer, _ $objItem.MaxClockSpeed & $objItem.Name & $objItem.OtherFamilyDescription) $Out4 = _StringEncrypt(1, $objItem.PNPDeviceID & $objItem.ProcessorId & $objItem.ProcessorType, _ $objItem.Revision & $objItem.Role & $objItem.SocketDesignation) $Out5 = _StringEncrypt(1, $objItem.SystemCreationClassName & $objItem.SystemName & $objItem.UniqueId, _ $objItem.UpgradeMethod & $objItem.Version & $objItem.VoltageCaps) $Output = $Out1 & $Out2 & $Out3 & $Out4 & $Out5 & _WoodIDhelper2() $Output = _WoodIDhelper( $Output, $no ) ;MsgBox(0, "Unique Wood's ID", $Output) ;MsgBox(0, "Timer", TimerDiff( $time )) Return $Output ExitLoop;;Only want first match (will have more matches for multipule processor/multithreaded systems) Next Else MsgBox(0, "Unique Wood's ID - ERROR", "No WMI Objects Found for class: " & "Win32_Processor") Exit -1 Return EndIf EndFunc ;==>_UniqueWoodID ;=============================================================================== ; ; _UniqueWoodID2( $com, $no ) ; Description: Used to generate a nearly "unique" ID for a computer ; Parameter(s): [optional] $com : name of computer to generate ID for (default=localhost) ; [optional] $no : shortening value (default: 2 ) ; Requirement: AutoIt ; Return Value(s): The Wood's ID for the computer ; Author(s): Alexander "TechDude" Wood ; Note(s): Use the SAME shortening value every time you call this function. ; ;=============================================================================== Func _UniqueWoodID2( $com = "localhost", $no = 2 ) ;$time = TimerInit() $colItems = "" $objWMIService = ObjGet ("winmgmts:\\" & $com & "\root\CIMV2") $colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_Processor", "WQL", 0x10 + 0x20) If IsObj ($colItems) Then For $objItem In $colItems $Out1 = $objItem.AddressWidth & $objItem.Architecture & $objItem.Caption & _ $objItem.ConfigManagerErrorCode & $objItem.ConfigManagerUserConfig & $objItem.DataWidth $Out2 = $objItem.Description & $objItem.DeviceID & $objItem.ExtClock & _ $objItem.Family & $objItem.InstallDate & $objItem.L2CacheSize $Out3 = $objItem.L2CacheSpeed & $objItem.Level & $objItem.Manufacturer & _ $objItem.MaxClockSpeed & $objItem.Name & $objItem.OtherFamilyDescription $Out4 = $objItem.PNPDeviceID & $objItem.ProcessorId & $objItem.ProcessorType & _ $objItem.Revision & $objItem.Role & $objItem.SocketDesignation $Out5 = $objItem.SystemCreationClassName & $objItem.SystemName & $objItem.UniqueId & _ $objItem.UpgradeMethod & $objItem.Version & $objItem.VoltageCaps $Output = $Out1 & $Out2 & $Out3 & $Out4 & $Out5 & _WoodIDhelper2() $Output = _WoodIDhelper3( _WoodIDhelper( $Output, $no ) ) ;MsgBox(0, "Unique Wood's ID", $Output) ;MsgBox(0, "Timer", TimerDiff( $time )) Return $Output ExitLoop;;Only want first match (will have more matches for multipule processor/multithreaded systems) Next Else MsgBox(0, "Unique Wood's ID - ERROR", "No WMI Objects Found for class: " & "Win32_Processor") Exit -1 Return EndIf EndFunc ;==>_UniqueWoodID2 Func _WoodIDhelper( $str, $no=1 );;Used to shorten the string If ($no < 1) Or ($no == 1) then Return $str $str = StringSplit( $str, "" ) Local $ret = "" For $i = 1 to $str[0] Step $no $ret &= $str[$i] Next Return $ret EndFunc Func _WoodIDhelper2() Return FileGetTime( @HomeDrive & "\io.sys", 1, 1 ) & FileGetTime( @HomeDrive & "\recycler", 1, 1 ) & FileGetTime( @HomeDrive & "\LocalService\ntuser.ini", 1, 1 ) EndFunc Func _WoodIDhelper3($str) $str = StringSplit( $str, @TAB & " ,_()"& @CR & @LF ) Local $ret = "" For $i = 1 to $str[0] $ret &= $str[$i] Next Return StringUpper( $ret ) EndFunc Edited November 21, 2006 by rbhkamal "When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix Link to comment Share on other sites More sharing options...
nfwu Posted July 24, 2006 Share Posted July 24, 2006 If you want to make the calculation of the unique ID faster, the value from _WoodIDhelper2() will suffice. First time I saw somebody use these functions! #) TwitterOut of date stuff:Scripts: Sudoku Solver | Webserver | 3D library (Pure AutoIt) | Wood's GadgetsUDFs: _WoodUniqueID() | _DialogEditIni() | _Console*() | _GetIPConfigData() | _URLEncode/Decode() Link to comment Share on other sites More sharing options...
rbhkamal Posted July 24, 2006 Author Share Posted July 24, 2006 (edited) I was woundering is it possible for someone to break this script? If yes, how? Edited July 24, 2006 by rbhkamal "When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix Link to comment Share on other sites More sharing options...
Choch Posted July 24, 2006 Share Posted July 24, 2006 Nice work... I like.... Link to comment Share on other sites More sharing options...
nfwu Posted July 25, 2006 Share Posted July 25, 2006 (edited) You mean the encyption? Yes, if the person knows the Wood's ID of the computer, the encryption level and have this code then they can crack it using AutoIt. #) Edit: Assuming they know AutoIt in the first place. #) Edited July 25, 2006 by nfwu TwitterOut of date stuff:Scripts: Sudoku Solver | Webserver | 3D library (Pure AutoIt) | Wood's GadgetsUDFs: _WoodUniqueID() | _DialogEditIni() | _Console*() | _GetIPConfigData() | _URLEncode/Decode() Link to comment Share on other sites More sharing options...
rbhkamal Posted July 25, 2006 Author Share Posted July 25, 2006 (edited) You mean the encyption?Yes, if the person knows the Wood's ID of the computer, the encryption level and have this code then they can crack it using AutoIt.#)Edit: Assuming they know AutoIt in the first place.#)How hard it is for someone to use the _GmailGetUserName() or _GmailGetPassword() functions when the script is running?Is there a way to prevent a function form executing if the caller wasn't the script it self? Edited July 25, 2006 by rbhkamal "When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix Link to comment Share on other sites More sharing options...
nfwu Posted July 27, 2006 Share Posted July 27, 2006 Maybe encrypt it again with the hash value of the executable, or with a pesdo-unqiue generated value based on something involving the code. #) TwitterOut of date stuff:Scripts: Sudoku Solver | Webserver | 3D library (Pure AutoIt) | Wood's GadgetsUDFs: _WoodUniqueID() | _DialogEditIni() | _Console*() | _GetIPConfigData() | _URLEncode/Decode() Link to comment Share on other sites More sharing options...
rbhkamal Posted July 27, 2006 Author Share Posted July 27, 2006 (edited) Maybe encrypt it again with the hash value of the executable, or with a pesdo-unqiue generated value based on something involving the code.#)This is my first secured script; I'm still not familiar with pesdo-unqiue generated value.What is that? maybe I'll use it.RK Edited July 27, 2006 by rbhkamal "When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix Link to comment Share on other sites More sharing options...
nfwu Posted July 30, 2006 Share Posted July 30, 2006 Like the executable's MD5 hash for example. #) TwitterOut of date stuff:Scripts: Sudoku Solver | Webserver | 3D library (Pure AutoIt) | Wood's GadgetsUDFs: _WoodUniqueID() | _DialogEditIni() | _Console*() | _GetIPConfigData() | _URLEncode/Decode() Link to comment Share on other sites More sharing options...
rbhkamal Posted July 30, 2006 Author Share Posted July 30, 2006 Like the executable's MD5 hash for example.#)i c, thx RK "When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix 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