Leaderboard
Popular Content
Showing content with the highest reputation on 11/17/2022 in all areas
-
CodeCrypter enables you to encrypt scripts without placing the key inside the script. This is because this key is extracted from the user environment at runtime by, for example: password user query any macro (e.g., @username) any AutoIt function call any UDF call some permanent environment variable on a specific machine (and not created by your script) a server response a device response anything else you can think of, as long as it's not stored in the script any combination of the above You need several scripts to get this to work, and they are scattered over several threads, so here's a single bundle that contains them all (including a patched version of Ward's AES.au3; with many thanks to Ward for allowing me to include this script here): Latest version: 3.4 (3 Dec 2021): please follow this link. Note: if you experience issues under Win8/8.1 (as some users have reported), please upgrade to Win10 (or use Win7) if you can; as far as I can tell, the scripts in the bundle all work under Win7 & Win10 (and XP). Moreover, I have no access to a Win8 box, so these issues will not be fixed, at least not by yours truly. How the bits and pieces fit together: CodeCrypter is a front-end for the MCF UDF library (you need version 1.3 or later). Its thread is here: '?do=embed' frameborder='0' data-embedContent>> The MCF package (also contained in the CodeScannerCrypter bundle) contains MCF.au3 (the library itself) plus a little include file called MCFinclude.au3. The latter you have to include in any script you wish to encrypt. Any code preceding it will not be encrypted, any code following it will be encrypted. You define the dynamic key inside MCFinclude.au3, in the UDF: _MCFCC_Init(). From the same post you can download an MCF Tutorial which I heartily recommend, because encrypting a script requires a number of steps in the right order, namely: In MCFinclude.au3, define and/or choose your dynamic key(s) (skip this step = use default setting) include MCFinclude.au3 in your target script Run CodeScanner (version 2.3+) on your target script, with setting WriteMetaCode=True (see '?do=embed' frameborder='0' data-embedContent>>), then close CodeScanner. Start CodeCrypter press the Source button to load your target file enable Write MCF0 (tick the first option in Main Settings) Enable "Encrypt" (last option in the Main Settings) Go to the Tab Encrypt and set up the encryption the way you want (skip this = use default settings) Return to Main Tab and press "Run" if all goes well, a new script called MCF0test.au3 is created in the same directory as your target. It has no includes and no redundant parts. Please check that it works as normal. (see Remarks if not) It all sounds far more complicated than it is, really. Not convinced? Check out: a simple HowTo Guide: HowToCodeCrypt.pdf an updated and extended Q & A pdf (FAQ, also included in the bundle) to help you get started:CodeCrypterFAQ.pdf For additional explanations/examples in response to specific questions by forum members (how it works, what it can/cannot do), see elsewhere in this thread, notably: Simple analogy of how it works: post #53, second part General Explanation and HowTo: post #9, 51, 75, 185/187, 196, 207, 270, 280 (this gets a bit repetitive) BackTranslation: post #179 Obfuscation: post #36 (general), 49 (selective obfuscation) Specific features and fixes: post #3 (security), 84 (redefining the expected runtime response), 169 (Curl Enum fix), 185/187 (using license keys), 194 (replacing Ward's AES UDF with different encryption/decryption calls), 251 (AV detection issue), 262 (extract key contents to USB on different target machine prior to encryption) Limitations: post #26 (@error/@extended), 149 (FileInstall), 191 (AES.au3 on x64) Not recommended: post #46/249 (static encryption), 102 (programme logic error), 237 (parsing password via cmdline) Technical notes: BackTranslation is a test to check that the MetaCode translation worked. Skip it at your peril. It also turns your multi-include composite script into a single portable file without redundant parts (you can opt to leave the redundant parts in, if you want). CodeCrypter can also obfuscate (vars and UDF names) and replace strings, variable names and UDF names with anything else you provide, for example, for language translation). After CodeScanner separates your target's structure from its contents, CodeCrypter (actually MCF, under the hood) can change any part, and then generate a new script from whichever pieces you define. See the MCF Tutorial for more explanation and examples. Encryption currently relies on Ward's excellent AES UDF and TheXman's sophisticated CryptoNG bundle. You can replace these with any other algorithm you like (but this is not trivial to do: edit MCFinclude.au3 UDF _MCFCC(), and MCF.au3 UDF _EncryptEntry(), see post #194 in this thread). AES by Ward, and CryptoNG by TheXman are also included in the bundle (with many thanks to Ward and TheXman for graciously allowing me to republish their outstanding work). Going to lie down now... RT1 point
-
Using the AutoIt PowerShell Cmdlets
NoNameCode reacted to Jon for a topic
This is a quick start guide to using the AutoIt PowerShell Cmdlets. The best bits of AutoIt directly from PowerShell The files you need are as follows (get them from the zip file or the Program Files folder after installation): AutoItX.psd1AutoItX3.PowerShell.dllAutoItX3.Assembly.dllAutoItX3.dllAutoItX3_x64.dllTo use the Cmdlets open a PowerShell cmd prompt and enter: Import-Module .\AutoItX.psd1 Now you can get a list of available AutoIt Cmdlets by doing Get-Command *AU3*: PS> Get-Command *AU3* Name Category Module ---- -------- ------ Invoke-AU3MouseWheel Cmdlet AutoItX Move-AU3Mouse Cmdlet AutoItX Invoke-AU3MouseClickDrag Cmdlet AutoItX Get-AU3MouseCursor Cmdlet AutoItX Invoke-AU3MouseUp Cmdlet AutoItX Assert-AU3WinActive Cmdlet AutoItX Assert-AU3WinExists Cmdlet AutoItX Assert-AU3IsAdmin Cmdlet AutoItX Invoke-AU3Shutdown Cmdlet AutoItX Send-AU3ControlKey Cmdlet AutoItX Invoke-AU3MouseDown Cmdlet AutoItX Invoke-AU3MouseClick Cmdlet AutoItX Invoke-AU3ControlTreeView Cmdlet AutoItX Invoke-AU3ControlListView Cmdlet AutoItX Invoke-AU3ControlCommand Cmdlet AutoItX Invoke-AU3ControlClick Cmdlet AutoItX Move-AU3Control Cmdlet AutoItX Set-AU3ControlText Cmdlet AutoItX Show-AU3Control Cmdlet AutoItX Hide-AU3Control Cmdlet AutoItX Get-AU3ControlText Cmdlet AutoItX Get-AU3ControlFocus Cmdlet AutoItX Set-AU3ControlFocus Cmdlet AutoItX Disable-AU3Control Cmdlet AutoItX Enable-AU3Control Cmdlet AutoItX Get-AU3StatusbarText Cmdlet AutoItX Invoke-AU3RunAsWait Cmdlet AutoItX Invoke-AU3RunAs Cmdlet AutoItX Invoke-AU3RunWait Cmdlet AutoItX Invoke-AU3Run Cmdlet AutoItX Set-AU3Clip Cmdlet AutoItX Get-AU3Clip Cmdlet AutoItX Set-AU3WinTrans Cmdlet AutoItX Set-AU3WinTitle Cmdlet AutoItX Set-AU3WinState Cmdlet AutoItX Set-AU3WinOnTop Cmdlet AutoItX Move-AU3Win Cmdlet AutoItX Show-AU3WinMinimizeAllUndo Cmdlet AutoItX Show-AU3WinMinimizeAll Cmdlet AutoItX Get-AU3WinState Cmdlet AutoItX Get-AU3WinProcess Cmdlet AutoItX Get-AU3WinClassList Cmdlet AutoItX Get-AU3WinCaretPos Cmdlet AutoItX Get-AU3WinClientSize Cmdlet AutoItX Get-AU3ControlPos Cmdlet AutoItX Get-AU3ControlHandle Cmdlet AutoItX Get-AU3MousePos Cmdlet AutoItX Get-AU3WinPos Cmdlet AutoItX Get-AU3WinHandle Cmdlet AutoItX Get-AU3ErrorCode Cmdlet AutoItX Initialize-AU3 Cmdlet AutoItX Show-AU3WinActivate Cmdlet AutoItX Close-AU3Win Cmdlet AutoItX Wait-AU3WinClose Cmdlet AutoItX Wait-AU3WinNotActive Cmdlet AutoItX Set-AU3Option Cmdlet AutoItX Send-AU3Key Cmdlet AutoItX Wait-AU3Win Cmdlet AutoItX Wait-AU3WinActive Cmdlet AutoItX Get-AU3WinTitle Cmdlet AutoItX Get-AU3WinText Cmdlet AutoItX I’ll show how to use the Cmdlets using a simple example that will open notepad.exe and modify the edit window by setting the text and simulating some keystrokes. First create a blank PowerShell script called notepad_example.ps1 in the same folder as the AutoItX components above and open it for editing. Now we want to import the PowerShell module which is AutoItX.psd1. Enter the following in the script: Import-Module .\AutoItX.psd1 We want to run notepad.exe: Invoke-AU3Run -Program notepad.exe After notepad opens we want to wait for the notepad “Untitled -Notepad” window to appear. You might need to change the title for non-English versions of Windows: $notepadTitle = "Untitled - Notepad" Wait-AU3Win -Title $notepadTitle $winHandle = Get-AU3WinHandle -Title $notepadTitle Get-AU3WinHandle returns a native Win32 handle to the notepad window. We can use this handle in many other AutoIt functions and it uniquely identifies the window which is much more reliable than constantly using a windows title. If you have obtained a window handle using any other Win32 function you can use it with AutoIt. After obtaining the handle to the notepad window we want to ensure that the window is active and then get a handle to the Edit Control. Using the AU3Info.exe tool that comes with AutoIt we can find that the name of the edit control in notepad is Edit1. Show-AU3WinActivate -WinHandle $winHandle $controlHandle = Get-AU3ControlHandle -WinHandle $winhandle -Control "Edit1" Now that we have a handle to the edit control we can set text in two ways: Directly (Set-AU3Controltext) or with simulated keystrokes (Send-AU3ControlKey): Set-AU3ControlText -ControlHandle $controlHandle -NewText "Hello! This is being controlled by AutoIt and PowerShell!" -WinHandle $winHandle Send-AU3ControlKey -ControlHandle $controlHandle -Key "{ENTER}simulate key strokes - line 1" -WinHandle $winHandleNow let’s see what the entire script looks like: # Import the AutoIt PowerShell module Import-Module .\AutoItX.psd1 # Run notepad.exe Invoke-AU3Run -Program notepad.exe # Wait for an untitled notepad window and get the handle $notepadTitle = "Untitled - Notepad" Wait-AU3Win -Title $notepadTitle $winHandle = Get-AU3WinHandle -Title $notepadTitle # Activate the window Show-AU3WinActivate -WinHandle $winHandle # Get the handle of the notepad text control for reliable operations $controlHandle = Get-AU3ControlHandle -WinHandle $winhandle -Control "Edit1" # Change the edit control Set-AU3ControlText -ControlHandle $controlHandle -NewText "Hello! This is being controlled by AutoIt and PowerShell!" -WinHandle $winHandle # Send some keystrokes to the edit control Send-AU3ControlKey -ControlHandle $controlHandle -Key "{ENTER}simulate key strokes - line 1" -WinHandle $winHandle Send-AU3ControlKey -ControlHandle $controlHandle -Key "{ENTER}simulate key strokes - line 2" -WinHandle $winHandle Send-AU3ControlKey -ControlHandle $controlHandle -Key "{ENTER}{ENTER}" -WinHandle $winHandle This is how the notepad window should look if everything is working correctly:1 point -
Thanks.... should be fixed in the Latest upload.1 point
-
Uploaded an update of the Zip file with the following changes: Added indent correction when AutoComplete inserts {ENTER} Added indent correction for Continuation lines. Fixed issue with Current Scriptfile Variables not shown when they are an exact match. Jos1 point
-
OpenSSL Compliance - (Moved)
argumentum reacted to Radix for a topic
I'm writing a platform for non-Techies to interact with. I wrote the administrative programs in Golang and I need GUIs for common users who won't understand what the initialization vector is all about. It is for arbitrators and mediators in an arbitration chamber to exchange messages securely without really understanding cryptography. My madness. AutoIt Rules! Respect!1 point -
OpenSSL Compliance - (Moved)
argumentum reacted to Radix for a topic
It worked fine: You need to pass 3 arguments: InputFile, Output, 16-byte Key in ASCII, that need to be converted to Hex and the file will decrypt by: (pass abcdefghijuklmno) ; ==================================================== ; ============= Encryption Tool With CLI ============= ; ==================================================== ; AutoIt version: 3.3.12.0 ; Language: English ; Author: Pedro F. Albanese ; Modified: - ; ; ---------------------------------------------------------------------------- ; Script Start ; ---------------------------------------------------------------------------- #NoTrayIcon #include <Crypt.au3> #include <cmdline.au3> Global Const $KP_MODE = 4 Global Const $CRYPT_MODE_CBC = 2 _Crypt_Startup() If Not StringInStr($CmdLineRaw, "in") Or Not StringInStr($CmdLineRaw, "key") Or $CmdLineRaw == "" Then ConsoleWrite("Advanced Encryption Standard Tool - ALBANESE Research Lab " & Chr(184) & " 2016-2023" & @CRLF) ; ConsoleWrite("Usage: " & @ScriptName & " -e|d --in <file.ext> --out <output.ext> --key <key>" & @CRLF & @CRLF) ; ConsoleWrite("Commands: " & @CRLF) ; ConsoleWrite(" -e: Encrypt " & @CRLF) ; ConsoleWrite(" -d: Decrypt" & @CRLF & @CRLF) ; ConsoleWrite("Parameters: " & @CRLF) ; ConsoleWrite(" /in : Input file" & @CRLF) ; ConsoleWrite(" /out: Output file (Optional [*])" & @CRLF) ; ConsoleWrite(" /key: 128-bit key" & @CRLF & @CRLF) ; ConsoleWrite(" [*] If no output is specified, the input file will be overwritten." & @CRLF) ; Exit Else Local $file = _CmdLine_Get('in') Local $outfile = _CmdLine_Get('out') Local $key = _CmdLine_Get('key') EndIf If _CmdLine_KeyExists('out') Then Local $outfile = _CmdLine_Get('out') Else Local $outfile = $file EndIf If FileExists($file) Then If $CmdLine[0] > 1 And $CmdLine[1] == "-e" Or $CmdLine[1] == "-d" Then $full = FileRead($file) If $CmdLine[1] == "-e" Then _Crypt_Startup() $key = _Crypt_ImportKey($CALG_AES_128, $key) _Crypt_SetKeyParam($key, $KP_MODE, $CRYPT_MODE_CBC) FileOpen($outfile, 2) FileWrite($outfile, StringEncrypt(True, $full, $key)) ElseIf $CmdLine[1] == "-d" Then _Crypt_Startup() $key = _Crypt_ImportKey($CALG_AES_128, $psw) _Crypt_SetKeyParam($key, $KP_MODE, $CRYPT_MODE_CBC) FileOpen($outfile, 2) FileWrite($outfile, StringEncrypt(False, $full, $key)) EndIf EndIf Else ConsoleWrite("Error: """ & $file & """ not found." & @CRLF) ; EndIf Func StringEncrypt($bEncrypt, $sData, $sPassword) _Crypt_Startup() ; Start the Crypt library. Local $vReturn = '' If $bEncrypt Then ; If the flag is set to True then encrypt, otherwise decrypt. $vReturn = _Crypt_EncryptData($sData, $sPassword, $CALG_USERKEY) Else $vReturn = _Crypt_DecryptData($sData, $sPassword, $CALG_USERKEY) EndIf _Crypt_Shutdown() ; Shutdown the Crypt library. Return $vReturn EndFunc ;==>StringEncrypt Func _Crypt_ImportKey($iALG_ID, $sKey) Local Const $PLAINTEXTKEYBLOB = 0x8 ;The key is a session key. Local Const $CUR_BLOB_VERSION = 2 Local $bKey = Binary($sKey), $iKeyLen = BinaryLen($bKey) Local $tagPUBLICKEYBLOB = "struct; BYTE bType; BYTE bVersion; WORD reserved; dword aiKeyAlg; dword keysize; byte key[" & $iKeyLen & "]; endstruct;" Local $tBLOB = DllStructCreate($tagPUBLICKEYBLOB) DllStructSetData($tBLOB, "bType", $PLAINTEXTKEYBLOB) DllStructSetData($tBLOB, "bVersion", $CUR_BLOB_VERSION) DllStructSetData($tBLOB, "aiKeyAlg", $iALG_ID) DllStructSetData($tBLOB, "keysize", $iKeyLen) DllStructSetData($tBLOB, "key", Binary($bKey)) Local $aRet = DllCall(__Crypt_DllHandle(), "bool", "CryptImportKey", "handle", __Crypt_Context(), "ptr", DllStructGetPtr($tBLOB), "dword", DllStructGetSize($tBLOB), "ptr", 0, "dword", 0, "ptr*", 0) If @error Then Return SetError(2, @error) Return SetError(Not $aRet[0], 0, $aRet[6]) EndFunc ;==>_Crypt_ImportKey Func _Crypt_SetKeyParam($hKey, $iParam, $vData, $iFlags = 0, $sDataType = Default) If Not $sDataType Or $sDataType = Default Then $sDataType = "ptr" Local $aRet = DllCall(__Crypt_DllHandle(), "bool", "CryptSetKeyParam", "handle", $hKey, "dword", $iParam, $sDataType, $vData, "dword", $iFlags) If @error Then Return SetError(2, @error) Return SetError(Not $aRet[0], 0, $aRet[0]) EndFunc ;==>_Crypt_SetKeyParam Compatible w/ FireFox's* PHP code: <?php $block=mcrypt_get_block_size('rijndael-128', 'cbc'); $key='abcdefghijuklmno'; $str='hello world!'; //zero to PKCS7 padding $pad=$block-(strlen($str)%$block); $str.=str_repeat(chr($pad), $pad); $s=mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $str, MCRYPT_MODE_CBC); echo 'Encrypted: '.base64_encode($s); ?> Also with OpenSSL-PHP: Result Decrypted: <?php $pass = 'abcdefghijuklmno'; $method = 'aes-128-cbc'; $iv = "0000000000000000"; print (openssl_decrypt("iisRzInRXH0GNGzCtDPeHg==", $method, $pass, false, $iv)); ?> <BR> Result Encrypted: <?php $pass = 'abcdefghijuklmno'; $method = 'aes-128-cbc'; $iv = "0000000000000000"; print (openssl_encrypt("SECRET MESSAGE", $method, $pass, false, $iv)); ?> So decrypt: $ openssl enc -d -aes-128-cbc -K 6162636465666768696a756b6c6d6e6f -iv 00 < output.ext Thanks for the tips, but I intend to write just a program in pure Autoit that is compatible with PHP and OpenSSL; I hope it can be useful for someone. SecurityKit_AutoIt-OpenSSL.zip1 point -
F1 in Scite when script unsaved ?
Xandy reacted to pixelsearch for a topic
@Jos Hello While typing a new AutoIt script in Scite-Lite, when I need explanations about a keyword, F1 never opens the AutoIt help file when the script is unsaved. I just read your answer concerning this matter in this thread from 2019, where you explained this behavior. I also found a post from 2009 where user eltorro indicated a possible way to have F1 working on unsaved scripts. In his own words : If you want it to open [i.e. AutoIt help file] you can open SciTE user property file and add the following lines : command.help.*=$(autoit3dir)\Autoit3Help.exe $(CurrentWord) command.help.subsystem.*=2 I just tested this and added these 2 lines in my SciTEUser.properties file, it works fine now. That's all, I just wanted to let you know this, in case you have comments to share about this way of solving it. Thanks ! PS: If it may help, I use Scite only for .au3 files1 point -
True, but that means that the AutoIt3 helpfile will be opened for ALL languages, which is not something I would want. EG: test.lua really should open the lua help.1 point
-
Were done with this resurrection of old threads.0 points