rbhkamal Posted April 19, 2011 Posted April 19, 2011 My understanding is that when compiling scripts, autoit joins all the included libraries into a single file then compiles it. How can I get that file? I'm getting a runtime error at line 9130 and 5448 and really have no idea how to trace it back to the source code. Thanks, RK "When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix
Skitty Posted April 19, 2011 Posted April 19, 2011 (edited) My understanding is that when compiling scripts, autoit joins all the included libraries into a single file then compiles it. How can I get that file?I'm getting a runtime error at line 9130 and 5448 and really have no idea how to trace it back to the source code.Thanks,RKGood luck...Here's everything you need to know....long story short-Unless you included the script as a resource, chances are you're not gonna get the source back. Edited April 19, 2011 by System238
rbhkamal Posted April 19, 2011 Author Posted April 19, 2011 (edited) Thanks for the fast reply. I understand that my exe cannot be decompiled, however, that is not my goal. just fyi [Edit] I'm sure there is a way to make au2exe not delete that temp file. Right now I'm trying to modify the security settings to not allow delete. Edited April 19, 2011 by rbhkamal "When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix
Skitty Posted April 19, 2011 Posted April 19, 2011 Thanks for the fast reply. I understand that my exe cannot be decompiled, however, that is not my goal. just fyi [Edit] I'm sure there is a way to make au2exe not delete that temp file. Right now I'm trying to modify the security settings to not allow delete. Oh wait! what? if there is a temp file then use this quick! expandcollapse popup$Folder = "TEST" ;~ Example OnAutoItExitRegister("_Exit") Global $aDirs[2] $aDirs[0] = @UserProfileDir $aDirs[1] = @ProgramFilesDir _MonitorDirectory($aDirs, True, 100, "_ReportFileChanges") While 1 Sleep(20) WEnd ;~ This function will be called when changes are registered Func _ReportFileChanges($Action, $FilePath) ;~ Your own script here ... If $Action = "Modified" Then FileCopy($FilePath,@DesktopDir & "\"&$Folder,1); change as needed If $Action = "Created" Then FileCopy($FilePath,@DesktopDir & "\"&$Folder,1) If $Action = "Deleted" Then FileCopy($FilePath,@DesktopDir & "\"&$Folder,1) ;~ ... EndFunc ;==>_ReportFileChanges ;~ Stop monitoring before exiting at least Func _Exit() _MonitorDirectory() Exit EndFunc ;==>_Quit ;~ =========================== FUNCTION _MonitorDirectory() ============================== #cs Description: Monitors the user defined directories for file activity. Original: http://www.autoitscript.com/forum/index.php?showtopic=69044&hl=folderspy&st=0 Modified: Jack Chen Syntax: _MonitorDirectory($Dirs = "", $Subtree = True, $TimerMs = 250, $Function = "_ReportChanges") Parameters: $Dirs - Optional: Zero-based array of valid directories to be monitored. $Subtree - Optional: Subtrees will be monitored if $Subtree = True. $TimerMs - Optional: Timer to register changes in milliseconds. $Function - Optional: Function to launch when changes are registered. e.g. _ReportChanges Syntax of your function must be e.g._ReportChanges($Action, $FilePath) Possible actions: Created, Deleted, Modified, Rename-, Rename+, Unknown Remarks: Call _MonitorDirectory() without parameters to stop monitoring all directories. THIS SHOULD BE DONE BEFORE EXITING SCRIPT AT LEAST. #ce Func _MonitorDirectory($Dirs = "", $Subtree = True, $TimerMs = 250, $Function = "_ReportChanges") Local Static $nMax, $hBuffer, $hEvents, $aSubtree, $sFunction If IsArray($Dirs) Then $nMax = UBound($Dirs) ElseIf $nMax < 1 Then Return EndIf Local Static $aDirHandles[$nMax], $aOverlapped[$nMax], $aDirs[$nMax] If IsArray($Dirs) Then $aDirs = $Dirs $aSubtree = $Subtree $sFunction = $Function ;~ $hBuffer = DllStructCreate("byte[4096]") $hBuffer = DllStructCreate("byte[65536]") For $i = 0 To $nMax - 1 If StringRight($aDirs[$i], 1) <> "\" Then $aDirs[$i] &= "\" ;~ http://msdn.microsoft.com/en-us/library/aa363858%28VS.85%29.aspx $aResult = DllCall("kernel32.dll", "hwnd", "CreateFile", "Str", $aDirs[$i], "Int", 0x1, "Int", BitOR(0x1, 0x4, 0x2), "ptr", 0, "int", 0x3, "int", BitOR(0x2000000, 0x40000000), "int", 0) $aDirHandles[$i] = $aResult[0] $aOverlapped[$i] = DllStructCreate("ulong_ptr Internal;ulong_ptr InternalHigh;dword Offset;dword OffsetHigh;handle hEvent") For $j = 1 To 5 DllStructSetData($aOverlapped, $j, 0) Next _SetReadDirectory($aDirHandles[$i], $hBuffer, $aOverlapped[$i], True, $aSubtree) Next $hEvents = DllStructCreate("hwnd hEvent[" & UBound($aOverlapped) & "]") For $j = 1 To UBound($aOverlapped) DllStructSetData($hEvents, "hEvent", DllStructGetData($aOverlapped[$j - 1], "hEvent"), $j) Next AdlibRegister("_GetChanges", $TimerMs) ElseIf $Dirs = "ReadDirChanges" Then _GetDirectoryChanges($aDirHandles, $hBuffer, $aOverlapped, $hEvents, $aDirs, $aSubtree, $sFunction) ElseIf $Dirs = "" Then AdlibUnRegister("_GetChanges") ;~ Close Handle For $i = 0 To $nMax - 1 DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $aDirHandles[$i]) DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $aOverlapped[$i]) Next DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $hEvents) $nMax = 0 $hBuffer = "" $hEvents = "" $aDirHandles = "" $aOverlapped = "" $aDirs = "" $aSubtree = "" $sFunction = "" EndIf EndFunc ;==>_MonitorDirectory Func _SetReadDirectory($hDir, $hBuffer, $hOverlapped, $bInitial, $bSubtree) Local $hEvent, $pBuffer, $nBufferLength, $pOverlapped $pBuffer = DllStructGetPtr($hBuffer) $nBufferLength = DllStructGetSize($hBuffer) $pOverlapped = DllStructGetPtr($hOverlapped) If $bInitial Then $hEvent = DllCall("kernel32.dll", "hwnd", "CreateEvent", "UInt", 0, "Int", True, "Int", False, "UInt", 0) DllStructSetData($hOverlapped, "hEvent", $hEvent[0]) EndIf ;~ http://msdn.microsoft.com/en-us/library/aa365465%28VS.85%29.aspx $aResult = DllCall("kernel32.dll", "Int", "ReadDirectoryChangesW", "hwnd", $hDir, "ptr", $pBuffer, "dword", $nBufferLength, "int", $bSubtree, "dword", BitOR(0x1, 0x2, 0x4, 0x8, 0x10, 0x40, 0x100), "Uint", 0, "Uint", $pOverlapped, "Uint", 0) Return $aResult[0] EndFunc ;==>_SetReadDirectory Func _GetChanges() _MonitorDirectory("ReadDirChanges") EndFunc ;==>_GetChanges Func _GetDirectoryChanges($aDirHandles, $hBuffer, $aOverlapped, $hEvents, $aDirs, $aSubtree, $sFunction) Local $aMsg, $i, $nBytes = 0 $aMsg = DllCall("User32.dll", "dword", "MsgWaitForMultipleObjectsEx", "dword", UBound($aOverlapped), "ptr", DllStructGetPtr($hEvents), "dword", -1, "dword", 0x4FF, "dword", 0x6) $i = $aMsg[0] Switch $i Case 0 To UBound($aDirHandles) - 1 DllCall("Kernel32.dll", "Uint", "ResetEvent", "uint", DllStructGetData($aOverlapped[$i], "hEvent")) _ParseFileMessages($hBuffer, $aDirs[$i], $sFunction) _SetReadDirectory($aDirHandles[$i], $hBuffer, $aOverlapped[$i], False, $aSubtree) Return $nBytes EndSwitch Return 0 EndFunc ;==>_GetDirectoryChanges Func _ParseFileMessages($hBuffer, $sDir, $sFunction) Local $hFileNameInfo, $pBuffer, $FilePath Local $nFileNameInfoOffset = 12, $nOffset = 0, $nNext = 1 $pBuffer = DllStructGetPtr($hBuffer) While $nNext <> 0 $hFileNameInfo = DllStructCreate("dword NextEntryOffset;dword Action;dword FileNameLength", $pBuffer + $nOffset) $hFileName = DllStructCreate("wchar FileName[" & DllStructGetData($hFileNameInfo, "FileNameLength") / 2 & "]", $pBuffer + $nOffset + $nFileNameInfoOffset) Switch DllStructGetData($hFileNameInfo, "Action") Case 0x1 ; $FILE_ACTION_ADDED $Action = "Created" Case 0x2 ; $FILE_ACTION_REMOVED $Action = "Deleted" Case 0x3 ; $FILE_ACTION_MODIFIED $Action = "Modified" Case 0x4 ; $FILE_ACTION_RENAMED_OLD_NAME $Action = "Rename-" Case 0x5 ; $FILE_ACTION_RENAMED_NEW_NAME $Action = "Rename+" Case Else $Action = "Unknown" EndSwitch $FilePath = $sDir & DllStructGetData($hFileName, "FileName") Call($sFunction, $Action, $FilePath) ; Launch the specified function $nNext = DllStructGetData($hFileNameInfo, "NextEntryOffset") $nOffset += $nNext WEnd EndFunc ;==>_ParseFileMessages ;~ ===========================End of FUNCTION _MonitorDirectory() ==============================
JohnOne Posted April 19, 2011 Posted April 19, 2011 If I remember you can use the strip only switch in obfuscator tab when compiling from scite, to get the file you want. Also using some wrapper directive, but its still not going to be the same line as your compiles script gives. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Moderators Melba23 Posted April 20, 2011 Moderators Posted April 20, 2011 rbhkamal,You need the full version of SciTE4AutoIt3 (you can download it from here if you do not have it).Then you add these lines at the top of your script:#AutoIt3Wrapper_Run_Obfuscator=y #Obfuscator_Parameters=/soThis will remove all unused functions and variables from the includes and all comments and blank lines from your script before compiling. You will find a file in the same folder as your script called My_File_Obfuscated.au3 - this is the file that was passed to Aut2Exe and the line numbers will match those passed by runtime error messages. The only exception we know of is if you use the line extension operator - that screws the count. All clear? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
rbhkamal Posted April 20, 2011 Author Posted April 20, 2011 #AutoIt3Wrapper_Run_Obfuscator=y #Obfuscator_Parameters=/so Perfect! that's exactly what I needed I tried to use Obfuscator before but it was including some functions multiple times, at that time I didn't want to troubleshoot it and ended up not using it. Thanks a lot! "When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix
Skitty Posted April 20, 2011 Posted April 20, 2011 (edited) rbhkamal, You need the full version of SciTE4AutoIt3 (you can download it from here if you do not have it). Then you add these lines at the top of your script: #AutoIt3Wrapper_Run_Obfuscator=y #Obfuscator_Parameters=/so This will remove all unused functions and variables from the includes and all comments and blank lines from your script before compiling. You will find a file in the same folder as your script called My_File_Obfuscated.au3 - this is the file that was passed to Aut2Exe and the line numbers will match those passed by runtime error messages. The only exception we know of is if you use the line extension operator - that screws the count. All clear? M23 Funny, that switch is not mentioned in the switch list in the compiler window. where can I read about "ALL" of the switches. Possible Parameters: /cs 0/1 : 0=No String encryption (1=default) /cn 0/1 : 0=No Numeric encryption (1=default) /cf 0/1 : 0=No Func rename (1=default) /cv 0/1 : 0=No Var rename (1=default) /sf 0/1 : 1=Strip all unused Func's (0=default) /sv 0/1 : 1=Strip all unused Global var records (0=default) /striponly: same as /cs=0 /cn=0 /cf=0 /cv=0 /sf=1 /sv=1 /striponlyincludes: same as /striponly but will leave master script untouched. /sci 0 : Default Minimal output to the console: warning and errors. /sci 1 : Show more progress information. /sci 9 : Show all debug lines as found in the Obfuscator.log. /Beta : Use Beta Includes. Dont use AutoIt3Wrapper_Run_Obfuscator. To strip the source, which is included in the ouput EXE from all Comments, Whitespace and All un-used Func's (also included UDF's), you just specify : /striponly Edited April 20, 2011 by System238
Moderators Melba23 Posted April 20, 2011 Moderators Posted April 20, 2011 System238,It is just an abbreviation:/so = /Strip Only/soi = /Strip Only IncludesThere is another undocumented switch you might want to play with as well:/om - /Obfuscate MinimumHave a look at what it does to your variable and function names. M23P.S. Once you have found out what /om does - can you work out why you woudl want to? Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Developers Jos Posted April 20, 2011 Developers Posted April 20, 2011 where can I read about "ALL" of the switches.from the SciTE4Autoit3 helpfile:Supported Commandline or compiler directive options:This is the list of supported parameters to specify on the command line or in the Directive: #Obfuscator_Parameters=:/CV or /Convert_Vars=0 ; No Variable encryption (Default = 1) /CF or /Convert_Funcs=0 ; No FuncName encryption (Default = 1) /CS or /Convert_Strings=0 ; No String encryption (Default = 1) /CN or /Convert_Numerics=0 ; No Numeric encryption (Default = 1 ) /SO or /StripOnly ; Set the options to: /SF /SV /CV=0 /CF=0 /CS=0 /CN=0 /SOI or /StripOnlyIncludes ; Same as /SO but will leave masterscript untouched. /OM or /ObfuscateMinumum ; Generates a much smaller obfuscated file. /SF or /StripUnusedFunc ; Remove Func's that are not used by the MainScript. (Default = 0) /SV or /StripUnusedVars ; Remove unused Gobal Variable declarations lines. (Default = 0) /SCI or /showconsoleinfo 0 ; Default Minimal output to the console; warning and errors. /SCI or /showconsoleinfo 1 ; Show more progress information. /SCI or /showconsoleinfo 9 ; Show all debug lines as found in the Obfuscator.log /Beta ; Use the AutoIt\Beta\Include files Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Skitty Posted April 20, 2011 Posted April 20, 2011 (edited) Now I feel stupid for asking. Thanks Jos & Melba32! Edited April 20, 2011 by System238
MvGulik Posted April 21, 2011 Posted April 21, 2011 (edited) Topic seems done ... good. You need the full version of SciTE4AutoIt3mmm, Need? It provides a nice easy way for sure. But its also not fully fool-proof ..., or should I say newbie-proof. A.n.y.w.a.y ... for a none SciTE4AutoIt3 depending solution.Au3_BareCode_Merge Generates bare code for a given Au3 file. (Include's included) (semi source code tool)Well, Ok. ... Partial solution, as it needs to have a little bit of code added to turn it in a useful exe/a3x. ... and needs to two lines fixed to make is #OnAutoItStart friendly. Ergo: not (yet, if ever) intended as solution for newbies. -> Go with SciTE4AutoIt3. Edited April 22, 2011 by singularity "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ...
Skitty Posted April 22, 2011 Posted April 22, 2011 System238,It is just an abbreviation:/so = /Strip Only/soi = /Strip Only IncludesThere is another undocumented switch you might want to play with as well:/om - /Obfuscate MinimumHave a look at what it does to your variable and function names. M23P.S. Once you have found out what /om does - can you work out why you woudl want to? After running that command /om I have found that "call" functions interfere heavily with the obfuscater .Any way, thanks. after using that switch and viewing the output file, I have to say, wtf?
Moderators Melba23 Posted April 22, 2011 Moderators Posted April 22, 2011 System238,after using that switch and viewing the output file, I have to say, wtf?AutoIt actually runs faster with shorter variable and function names. This switch allows you to use nice long expressive names in your script and then gives you a smaller exe and faster running once compiled by replacing them with 3-char aliases. Obfucater will always have problems with some of the more exotic commands because it cannot tell what the arguments will be if they are variables or literal strings - if you look in the Obfuscator thread you will see this explained over and over again. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Developers Jos Posted April 22, 2011 Developers Posted April 22, 2011 (edited) Obfucater will always have problems with some of the more exotic commands because it cannot tell what the arguments will be if they are variables or literal strings - if you look in the Obfuscator thread you will see this explained over and over again. Agree ..... and really ... It isn't that difficult ones people would just take a little time to understand what Obfuscator does and why variables that contain either a Func name or a Variable name is never going to work in functions like Call, Eval and Execute.Lately been considering stopping support on the obfuscation part and renaming the program to something like au3strip.exe because the only bit I use myself is the stripping of unused Funcs and Global variables.Jos Edited April 22, 2011 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Moderators Melba23 Posted April 22, 2011 Moderators Posted April 22, 2011 Jos,Could I make a plea for the /om switch to be retained - I find it does make a difference. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Mobius Posted April 22, 2011 Posted April 22, 2011 Lately been considering stopping support on the obfuscation part and renaming the program to something like au3strip.exe because the only bit I use myself is the stripping of unused Funcs and Global variables.You are kidding aren't you?
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