Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Error = true ??

$
0
0

My script

AutoIt         
    Opt("MouseCoordMode", 0)     Opt("PixelCoordMode", 0)     #include <Crypt.au3>     #include <ComboConstants.au3>     #include <ButtonConstants.au3>     #include <EditConstants.au3>     #include <GUIConstantsEx.au3>     #include <StaticConstants.au3>     #include <WindowsConstants.au3>     #include <Date.au3>     #include <file.au3>     HotKeySet("{PAUSE}", "Pause")     HotKeySet("{ESCAPE}", "Exite")     HotKeySet("{F1}", "Login1")     Global $Paused     Local $Password, $btn, $msg     Local $a1,$a2 ,$a3 ,$a4 ,$a5     Local $b1,$b2 ,$b3 ,$b4 ,$b5     MsgBox ( 0, "Merci", "Developpé par Jordane ****.")     $SettingsFile = @SCRIPTDIR & '\Settingstestcrypter.ini' ;Emplacement du fichier ini pour le script     $Login1  = IniRead ($SettingsFile, 'Login', 'Login1', "Corrigez le fichier ini svp")     $Pw1  = IniRead ($SettingsFile, 'Mot de passes', 'Pw1', "Corrigez le fichier ini svp")     $Password1 = Password()         $password = $Password1     $a1 = BinaryToString(_Crypt_DecryptData($Login1,$Password,$CALG_RC4))     $b1 = BinaryToString(_Crypt_DecryptData($Pw1,$Password,$CALG_RC4))     MsgBox(0,"Password et login cryptés","Login : " & $a1 & @crlf & "MDP : " & $b1)     $Password = ""     ;~ Verifier le mot de passe     $Password = Password()     ;~ L'outil decrypt les pw     ;exemples     MsgBox(0,"Password et login décrypté", "Login : " & Decryptage($a1, $Password) & @crlf &  "MDP : " & Decryptage ($b1, $Password))     ;~ Le programme attend     While (1)     Attendre ()     WEnd     ;~ Fonction activer par la pression des touche Configurer plus haut     Login1 ()     Pause ()     Exite ()     ;~ Verification du password de cryptage     Func Password ()         $hGUI = GUICreate("Entrez votre mot de passe svp", 200, 70, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, -1, 0x00000018)         $iPass = GUICtrlCreateInput("", 10, 5, 180, 20,0x0020)         GUICtrlSetState(-1, $GUI_DROPACCEPTED)         $btn = GUICtrlCreateButton("Ok", 20, 35, 60, 20)         GUISetState()         $msg = 0         While $msg <> $GUI_EVENT_CLOSE             $msg = GUIGetMsg()             Select                 Case $msg = $btn                     ExitLoop             EndSelect         WEnd         GUIDelete($hGUI)        Return GUICtrlRead($iPass) ;~     Attendre ()     EndFunc     Func Decryptage($bEncrypted, $sUserKey)         $bEncrypted = _Crypt_DecryptData($bEncrypted, $sUserKey, $CALG_RC4) ; Decrypt the data using the generic password string. The return value is a binary string.         Return BinaryToString($bEncrypted)     EndFunc     Func Attendre ()        While (1)         Sleep(1000)        WEnd     EndFunc     Func Login1 ()        Sleep (100)        Send (Decryptage ($a1, $Password))        Sleep (500)        Send ("{TAB}")        Sleep (500)        Send (Decryptage ($b1, $Password))        Sleep (100)     EndFunc     ;~ Touche Quitter     Func Exite ()         Exit     EndFunc     ;~ Touche Pause     Func Pause()         $Paused = NOT $Paused     While  $Paused             Sleep (500)     WEnd     EndFunc; => Pause()

My script for crypt a file (Help script's, need nothing else, so i use it only with 2 modified thing:  he is crypting only in RC4
and deletting the initial file)

AutoIt         
#include <Crypt.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> Local $bAlgorithm = $CALG_RC4 Local $sFilePath = "" GUICreate("File Encrypter", 425, 100) Local $iSourceInput = GUICtrlCreateInput("", 5, 5, 200, 20) Local $iSourceBrowse = GUICtrlCreateButton("...", 210, 5, 35, 20) Local $iDestinationInput = GUICtrlCreateInput("", 5, 30, 200, 20) Local $iDestinationBrowse = GUICtrlCreateButton("...", 210, 30, 35, 20) GUICtrlCreateLabel("Password:", 5, 60, 200, 20) Local $iPasswordInput = GUICtrlCreateInput("", 5, 75, 200, 20) Local $iCombo = GUICtrlCreateCombo("", 210, 75, 100, 20, $CBS_DROPDOWNLIST) GUICtrlSetData(-1, "RC4", "RC4") Local $iEncrypt = GUICtrlCreateButton("Encrypt", 355, 70, 65, 25) GUISetState(@SW_SHOW) While 1     Switch GUIGetMsg()         Case $GUI_EVENT_CLOSE             Exit         Case $iSourceBrowse             $sFilePath = FileOpenDialog("Select a file to encrypt.", "", "All files (*.*)") ; Select a file to encrypt.             If @error Then                 ContinueLoop             EndIf             GUICtrlSetData($iSourceInput, $sFilePath) ; Set the inputbox with the filepath.         Case $iDestinationBrowse             $sFilePath = FileSaveDialog("Save the file as ...", "", "All files (*.*)") ; Select a file to save the encrypted data to.             If @error Then                 ContinueLoop             EndIf             GUICtrlSetData($iDestinationInput, $sFilePath) ; Set the inputbox with the filepath.         Case $iCombo ; Check when the combobox is selected and retrieve the correct algorithm.             Switch GUICtrlRead($iCombo) ; Read the combobox selection.                 Case "3DES"                     $bAlgorithm = $CALG_3DES                 Case "AES (128bit)"                     If @OSVersion = "WIN_2000" Then                         MsgBox(16, "Error", "Sorry, this algorithm is not available on Windows 2000.") ; Show an error if the system is Windows 2000.                         ContinueLoop                     EndIf                     $bAlgorithm = $CALG_AES_128                 Case "AES (192bit)"                     If @OSVersion = "WIN_2000" Then                         MsgBox(16, "Error", "Sorry, this algorithm is not available on Windows 2000.")                         ContinueLoop                     EndIf                     $bAlgorithm = $CALG_AES_192                 Case "AES (256bit)"                     If @OSVersion = "WIN_2000" Then                         MsgBox(16, "Error", "Sorry, this algorithm is not available on Windows 2000.")                         ContinueLoop                     EndIf                     $bAlgorithm = $CALG_AES_256                 Case "DES"                     $bAlgorithm = $CALG_DES                 Case "RC2"                     $bAlgorithm = $CALG_RC2                 Case "RC4"                     $bAlgorithm = $CALG_RC4             EndSwitch         Case $iEncrypt             Local $sSourceRead = GUICtrlRead($iSourceInput) ; Read the source filepath input.             Local $sDestinationRead = GUICtrlRead($iDestinationInput) ; Read the destination filepath input.             Local $sPasswordRead = GUICtrlRead($iPasswordInput) ; Read the password input.             If StringStripWS($sSourceRead, 8) <> "" And StringStripWS($sDestinationRead, 8) <> "" And StringStripWS($sPasswordRead, 8) <> "" And FileExists($sSourceRead) Then ; Check there is a file available to encrypt and a password has been set.                 Local $iSuccess = _Crypt_EncryptFile($sSourceRead, $sDestinationRead, $sPasswordRead, $bAlgorithm) ; Encrypt the file.                 If $iSuccess Then                      MsgBox(0, "Success", "Operation succeeded.")                      FileDelete(@SCRIPTDIR & '\Settingstest.ini')                 Else                     Switch @error                         Case 1                             MsgBox(16, "Error", "Failed to create the key.")                         Case 2                             MsgBox(16, "Error", "Couldn't open the source file.")                         Case 3                             MsgBox(16, "Error", "Couldn't open the destination file.")                         Case 4 Or 5                             MsgBox(16, "Error", "Encryption error.")                     EndSwitch                 EndIf             Else                 MsgBox(16, "Error", "Please ensure the relevant information has been entered correctly.")             EndIf     EndSwitch WEnd

If you try it just name the destination file to : Settingstestcrypter.ini

 

and here is the original non crypted settings.ini

AutoIt         
;À modifier selon vos préférences [Login] ;Ici les logins desiré Login1=Test Login 1 Login2=Test Login 2 Login3=Test Login 3 Login4=Test Login 4 Login5=Test Login 5 [Mot de passes] Pw1=Test Password 1 Pw2=Test Password 2 Pw3=Test Password 3 Pw4=Test Password 4 Pw5=Test Password 5 ;1) Ne pas changer le nom du fichier ini ;2) Garder le fichier ini et l'exe dans le meme dossier ;4) Ne pas partager le fichier ini il contient vos mdp... ;========= TOUCHES =============== ;========= Escape = Quitter script ;========== Pause = Pause script ;============= F1 = ;============= F2 = ;============= F3 = ;============= F4 = ;============= F5 = ;Developpé par Jordane Guemara

I invite you if you wish to help me to try the script

 

My probleme now.... the crypted value is identic even if i change drasticaly the settings.ini value on :

Login1=aaaaaaaaa

Password1=bbbbbbbb

so i deduct the returned value is :

 

Error = true for both value in these line :

$Login1  = IniRead ($SettingsFile, 'Login', 'Login1', "Corrigez le fichier ini svp") $Pw1  = IniRead ($SettingsFile, 'Mot de passes', 'Pw1', "Corrigez le fichier ini svp")

Then the crypted and decrypted value =

Corrigez le fichier ini svp<TAB>Corrigez le fichier ini svp

(in english : Plz correct the ini file)

 

where is my mistake :o ?


Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>