Jump to content

Search the Community

Showing results for tags 'a3x'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Location


WWW


Interests

Found 4 results

  1. Au3toCmd --- Avoid false positives Since many virus scanners sometimes prevent a "compiled autoit EXE" from being executed as "false positive", the "*.A3X" format is a suitable format to avoid this problem. In order to simplify this procedure, I wrote the Au3toCmd script. Here a *.Cmd file is generated from a *.Au3 file. The necessary files Autoit3.exe and *.A3x are added to the "*.Cmd" file as "alternate data streams". Now the Autoit Script can be called by clicking on the cmd file and the anti-virus scanners do not recognize the "false positive". If the short-term flashing of the CMD window bothers you, you can create a link that runs in a minimized window. Unfortunately, because of the "alternate data streams", this CMD file cannot be distributed via FTP or email. Only a USB stick or removable disk formatted with NTFS can be used. To solve this problem, Au3toCmd can be used to create a ZIP file that is email and FTP compatible. Only possible on Win10 due to Powershell 5.0 Expand this ZIP file on the target system and execute the "*.ADS.Run-me-first.cmd" script. The original CMD file is created again and the auxiliary files are deleted. Edit; The new version also accepts A3X and EXE files. This means that A3X and EXE files that have been compiled with special options can be used. As a side effect, other EXE files can also be included in the CMD file and therefore not detectable by virus scanners. Here the source of Au3toCmd.au3 ;============================================================================================================== ; Script Name: Au3toCmd.au3 ; Description: Creates a CMD file from any AU3/A3X/EXE file. ; The CMD file will contain the compiled version (A3X) of the AU3 input file ; and the AUTOIT3.EXE file as alternate data streams. ; Alternativly it will contain any EXE file. ; This avoids the problem with the false positives of the virus scanners. ; If the short-term flashing of the CMD window bothers you, ; create the shortcut on the desktop that runs in a minimized window. ; ; Syntax: Au3toCmd (input-file) ; Default: none ; Parameter: Name of an AU3/A3X/EXE file (optional) ; Requirement(s): When using Zip feature: Powershell 5.0 or higher (Windows 10 is ok) ; Example: Au3toCmd testfile.au3 ; ; Author: Exit ( http://www.autoitscript.com/forum/user/45639-exit ) ; SourceCode: http://www.autoitscript.com/forum/index.php?showtopic=201562 Version: 2020.02.25 ; COPYLEFT: © 2020 Freeware by "Exit" ; ALL WRONGS RESERVED ;============================================================================================================== #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include <File.au3> Global $rc, $sSourcepath, $sTargetpath, $sA3Dir, $aPathSplit, $sDrive, $sDir, $sFileName, $sExtension, $sIconPath, $iIconNumber = 0 Exit _Main() Func _Main() $sA3Dir = RegRead("HKLM\SOFTWARE\AutoIt V3\AutoIt", "InstallDir") If Not (FileExists($sA3Dir & "\autoit3.exe") And FileExists($sA3Dir & "\au3check.exe") And FileExists($sA3Dir & "\Aut2Exe\Aut2exe.exe")) Then Exit MsgBox(16 + 262144, Default, "Error: Autoit not installed on this system.", 0) _Sourcepath() $sTargetpath = $sDrive & $sDir & $sFileName & ".cmd" FileDelete($sTargetpath) FileDelete($sTargetpath & ".ADS.*") FileDelete($sTargetpath & ".ADS") FileWriteLine($sTargetpath, _ "@echo off & cls" & @CRLF & _ "rem @echo on & dir /R %~nx0 & pause" & @CRLF & _ "for /f ""delims="" %%F in ('dir /R %~nx0 ^| find /C ""$DATA"" ') do set mycount=%%F" & @CRLF & _ "if .%mycount% == .0 echo Invalid copy of %~nx0. No ADS found. & pause & goto :eof " & @CRLF & _ "if .%mycount% == .1 wmic process call create ""%~f0:prog %*"" " & @CRLF & _ "if .%mycount% == .2 wmic process call create ""%~f0:prog %~f0:a3x %*"" " & @CRLF & _ "rem End of script" & @CRLF) Switch $sExtension Case ".au3" If ShellExecuteWait($sA3Dir & "\au3check.exe", ' -q "' & $sSourcepath & '"') Then _ Exit MsgBox(16 + 262144, Default, "Error: Input file """ & $sSourcepath & """ has Errors.", 0) ShellExecuteWait($sA3Dir & "\Aut2Exe\Aut2exe.exe", "/In " & $sSourcepath & " /out " & $sTargetpath & ":a3x") FileCopy($sA3Dir & "\Autoit3.exe", $sTargetpath & ":prog") Case ".a3x" FileCopy($sSourcepath, $sTargetpath & ":a3x") FileCopy($sA3Dir & "\Autoit3.exe", $sTargetpath & ":prog") Case ".exe" FileCopy($sSourcepath, $sTargetpath & ":prog") EndSwitch If MsgBox(4 + 32 + 256 + 262144, Default, $sTargetpath & " created." & @LF & @LF & "Create a shortcut on the desktop?", 0) = 6 Then FileCreateShortcut($sTargetpath, @DesktopDir & "\" & $sFileName & ".lnk", $sDrive & $sDir, "", "", $sIconPath, "", $iIconNumber, 7) If MsgBox(4 + 32 + 256 + 262144, Default, $sTargetpath & " created." & @LF & @LF & "Create a portable ZIP file ?" & @LF & $sTargetpath & ".ADS.zip", 0) = 6 Then _CreateZip($sTargetpath) If MsgBox(4 + 32 + 256 + 262144, Default, "Run " & $sTargetpath & " ?", 0) = 6 Then ShellExecute($sTargetpath) EndFunc ;==>_Main Func _CreateZip($sTargetpath) Local $sRem = (StringRight($sSourcepath, 4) = ".exe") ? "rem " : "" FileDelete($sTargetpath & ".ADS.*") FileWriteLine($sTargetpath & ".ADS.Run-me-first.cmd", _ "%~d0 & cd %~dp0" & @CRLF & _ "set name1=%~n0" & @CRLF & _ "set name1=%name1:~0,-21%" & @CRLF & _ "set compare1=%cd% " & @CRLF & _ "set compare2=%compare1:AppData\Local\Temp=other% " & @CRLF & _ "if .%compare1%==.%compare2% goto :skip" & @CRLF & _ "echo off & cls " & @CRLF & _ "echo Please extract ALL files from ZIP file first and then run this CMD again. " & @CRLF & _ "Pause & goto :eof" & @CRLF & _ ":skip " & @CRLF & _ "ren %name1%.cmd.ADS.cmd %name1%.cmd" & @CRLF & _ $sRem & "type %name1%.cmd.ADS.a3x > %name1%.cmd:a3x" & @CRLF & _ $sRem & "del %name1%.cmd.ADS.a3x" & @CRLF & _ "type %name1%.cmd.ADS.prog > %name1%.cmd:prog" & @CRLF & _ "del %name1%.cmd.ADS.prog" & @CRLF & _ "move /Y %name1%.cmd .." & @CRLF & _ "cd .. " & @CRLF & _ "echo off & cls " & @CRLF & _ "echo ""%cd%\%name1%.cmd"" created. " & @CRLF & _ "pause " & @CRLF & _ "del .\%name1%.cmd.ADS.zip" & @CRLF & _ "rd /S /Q %name1%.cmd.ADS " & @CRLF & _ "rem End of script" & @CRLF) If Not $sRem Then FileWrite($sTargetpath & ".ADS.a3x", FileRead($sTargetpath & ":a3x")) FileWrite($sTargetpath & ".ADS.cmd", FileRead($sTargetpath)) FileWrite($sTargetpath & ".ADS.prog", FileRead($sTargetpath & ":prog")) ShellExecuteWait("Powershell", "Compress-Archive -Path " & $sTargetpath & ".ADS.* -Update -DestinationPath " & $sTargetpath & ".ADS.zip") If Not FileExists($sTargetpath & ".ADS.zip") Then MsgBox(64 + 262144, Default, "Zip file cannot be created because the software ""Powershell 5.0"" is not available." & @CRLF & "Install Powershell 5.0 or higher and try again.", 0) FileDelete($sTargetpath & ".ADS.a3x") FileDelete($sTargetpath & ".ADS.cmd") FileDelete($sTargetpath & ".ADS.prog") FileDelete($sTargetpath & ".ADS.Run-me-first.cmd") EndFunc ;==>_CreateZip Func _Sourcepath() If $cmdline[0] > 0 Then $sSourcepath = $cmdline[1] Select Case FileExists($sSourcepath) Case FileExists($sSourcepath & ".au3") $sSourcepath = $sSourcepath & ".au3" Case FileExists($sSourcepath & ".a3x") $sSourcepath = $sSourcepath & ".a3x" Case FileExists($sSourcepath & ".exe") $sSourcepath = $sSourcepath & ".exe" Case Else $sSourcepath = FileOpenDialog("Enter AU3/A3X/EXE Inputfile ", "", "Autoit Files(*.au3;*.a3x;*.exe)", 3) If @error Then Exit MsgBox(16 + 262144, Default, "Error: No Inputfile given", 0) EndSelect $sSourcepath = _PathFull($sSourcepath) $aPathSplit = _PathSplit($sSourcepath, $sDrive, $sDir, $sFileName, $sExtension) If DriveGetFileSystem($sDrive) <> "NTFS" Then Exit MsgBox(16 + 262144, Default, "Error: Input filesystem must be 'NTFS'", 0) If FileExists($sDrive & $sDir & $sFileName & ".exe") Then $sIconPath = $sDrive & $sDir & $sFileName & ".exe" If FileExists($sDrive & $sDir & $sFileName & ".ico") Then $sIconPath = $sDrive & $sDir & $sFileName & ".ico" EndFunc ;==>_Sourcepath ; End of Au3toCmd.au3 script The script can be called with a file name of an AU3 script as a parameter. If no name is entered, a query is made. Suggestions for improvement and bug reports are welcome.
  2. Local $sAxName Local $oMSComm $sAxName = "MSCOMMLib.MSComm.1" $oMSComm = ObjCreate($sAxName) MsgBox(0, Default, StringFormat("Name: %s, Obj %d, Err %d", $sAxName, IsObj($oMSComm), @error)) I'm talking to serial ports (for Arduino) using the MSComm object. It all runs fine from SciTE or .exe. If I compile to .a3x the object is not created. I could manage without .a3x but I like it because it compiles faster.
  3. Hi all, What is A3X output type in compile window ?. What is the speciality of that type ?. I can't find it in help file.
  4. A3X Script Extract With newer versions of AutoIT (v3.3.10.0+), the compiled script is no longer appended to files as an overlay, and instead is embedded as a binary resource. This leads my previous AutoIt-script detection UDF lacking. However, since that UDF (>PE File Overlay Extraction) was targeted towards overlays in general, its still a worthwhile tool to have. This UDF on the other hand is pretty specific - it lets you detect and optionally extract A3X scripts from a compiled executable. The method is rather straightforward - it looks for a resource type of RT_RCDATA with a resource name of "SCRIPT", and then extracts the binary, testing for the A3X signature along the way. The main UDF has two functions: _FileContainsScriptResource() _FileContainsA3XScript() The first of these functions is there only for checking if a resource with "SCRIPT" exists. Its main purpose is to report on possible embedded scripts. I made this a separate function primarily because of issues with compressed executables. Tools like UPX and MPRESS can compress the resources as well as the rest of the executable, so any detection of the A3X signature will fail in those circumstances. (Note that UPX and MPRESS don't compress overlay data, which is why the older Overlay-Extraction A3X-detection worked regardless) The second function will both check for and optionally return the A3X script resource as binary. It also does a signature check for verification. Anyway, here's an example of its usage. The main UDF is attached below. #include <_FileContainsA3XScript.au3> ; ======================================================================================================== ; <A3XScriptExtract.au3> ; ; Example of detecting AutoIt Scripts embedded as binary resources (in AutoIt v3.3.10.0+ exe's), and ; extracting them to .A3X files. ; ; This script can be invoked in interactive or command-line mode. ; Passing an executable as a parameter will extract an A3X resource, writing it out to ; an A3X file with the same base name as the executable. ; ; Uses <_FileContainsA3XScript.au3> functions ; ; Author: Ascend4nt ; ======================================================================================================== ; ---------------------- MAIN CODE ------------------------------- Local $sFile, $sLastDir, $sLastFile, $binA3X, $iErr, $nA3XSize ; Command-line parameter received? Simply do a direct A3X extraction If $CmdLine[0] Then $sFile = $CmdLine[1] If Not FileExists($sFile) Then Exit 1 $binA3X = _FileContainsA3XScript($sFile, True) If @error Then Exit @error $nA3XSize = @extended Local $nExt = StringInStr($sFile, '.', 0, -1) If $nExt Then $sFile = StringLeft($sFile, $nExt - 1) EndIf $sFile &= '.a3x' Exit Not FileWrite($sFile, $binA3X) EndIf ; No command-line parameters, query the user in interactive mode $sLastDir = @ScriptDir While 1 $sFile=FileOpenDialog("Select PE File To Look for Embedded A3X scripts In",$sLastDir,"PE Files (*.exe;*.dll;*.scr)|All Files (*.*)",3,$sLastFile) If @error Or $sFile="" Then Exit $sLastFile = StringMid($sFile, StringInStr($sFile, '\', 1, -1) + 1) $sLastDir = StringLeft($sFile, StringInStr($sFile, '\', 1, -1) - 1) ; Resource 'Script' check $bScriptResourceFound = _FileContainsScriptResource($sFile) ConsoleWrite("_FileContainsScriptResource() return: " & $bScriptResourceFound & ", @error = " & @error & ", @extended = " & @extended & @CRLF) ; Actual A3X script resource check. True to return the A3X script as binary $binA3X = _FileContainsA3XScript($sFile, True) $iErr = @error $nA3XSize = @extended ; No A3X script found? If $iErr Or $nA3XSize = 0 Then ConsoleWrite("Failed Return from _FileContainsA3XScript(), @error = " & $iErr & ", @extended = " & $nA3XSize & @CRLF) MsgBox(64, "No AutoIt A3X script resource Found", "AutoIt A3X script resource not Found!" & @CRLF & _ ($bScriptResourceFound ? "However, *A* script resource was found" : "No 'Script' resource found either") & @CRLF & _ "for '" & $sLastFile & "'") ContinueLoop EndIf ConsoleWrite("_FileContainsA3XScript() return type: " & VarGetType($binA3X) & ", value = " & (IsBinary($binA3X) ? "[A3X_Binary]" : $binA3X) & @CRLF) ConsoleWrite(@TAB & "@error = " & $iErr & ", @extended = " & $nA3XSize & @CRLF) Local $hFileOut = -1, $sOutFile, $iMsgBox, $bSuccess = 0 $iMsgBox = MsgBox(35, "A3X script resource found in " & $sLastFile, "A3X script resource found. File size: " & FileGetSize($sLastFile) & _ ", A3X script size: " & $nA3XSize & @CRLF & @CRLF & _ "Would you like to Extract and save A3X file?") If $iMsgBox = 6 Then ;~ If $nA3XSize > 134217728 Then ;~ MsgBox(48, "A3X script is too huge", "A3X script size is > 128MB, skipping..") ;~ ContinueLoop ;~ EndIf $sOutFile = FileSaveDialog("A3X script - SAVE: Choose a file to write A3X script data to (from " & $sLastFile&")", _ $sLastDir, "AutoIt Compiled Sript (*.a3x)|All (*.*)", 2 + 16) If @error Then ContinueLoop ; Simple check for extension - if none, add .a3x If StringInStr($sOutFile, '.') = 0 Then $sOutFile &= ".a3x" ; Else $hFileOut = FileOpen($sOutFile, 16 + 2) If $hFileOut <> - 1 Then $bSuccess = FileWrite($hFileOut, $binA3X) FileClose($hFileOut) EndIf Else ContinueLoop EndIf If $bSuccess Then ShellExecute(StringLeft($sOutFile,StringInStr($sOutFile,'\',1,-1)-1)) Else MsgBox(64, "Error Opening or writing to file", "Error opening, reading, or saving A3X file") EndIf WEnd Exit _FileContainsA3XScript.au3 *edit: Modified example: Now alternatively accepts a command-line parameter for automated script extraction
×
×
  • Create New...