Modify

#118 closed Bug (Fixed)

Obfuscator (1.0.24.12) /striponly removing GUICreate()

Reported by: Bowmore Owned by: Jos
Milestone: Future Release Component: Other
Version: Other Severity:
Keywords: Obfuscator Cc:

Description

OS WinXP Pro Sp2
AutoIt 3.2.10.0 Beta 3.2.11.1

It would appear that Obfuscator when run with the /striponly parameter is being a little to agresive in what it strips. In the example below it is stripping out GUICreate() and GUICtrlCreateLabel()

Original script

#AutoIt3Wrapper_Au3Check_Stop_OnWarning=Y
#AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#AutoIt3Wrapper_Run_Obfuscator=Y
#Obfuscator_Parameters=/striponly
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Run_Debug_Mode=n
#EndRegion ### Set Options
#Region Includes
#include <File.au3>
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#EndRegion Includes
#Region Global Varaibles
Global $g_nMsg = 0
Global $sTitle = "Format RM ONYB Expanded"
Global $Gui_frmMainCaption = $sTitle & " - Version " & FileGetVersion(@ScriptFullPath)
Global $sData 
#EndRegion Global Varaibles
#Region ### START Koda GUI section ### Form=
Global $GUI_frmMain = GUICreate($Gui_frmMainCaption, 390, 103, 341, 156)
Global $GUI_lblFormat = GUICtrlCreateLabel("File to format:", 4, 4, 323, 17)
Global $GUI_edtFile = GUICtrlCreateInput("", 2, 20, 329, 21)
Global $GUI_btnBrowse = GUICtrlCreateButton("Browse", 336, 20, 50, 21, $BS_FLAT)
Global $GUI_btnRun = GUICtrlCreateButton("Run", 82, 56, 100, 30, $BS_FLAT)
Global $GUI_btnQuit = GUICtrlCreateButton("Quit", 214, 56, 100, 30, $BS_FLAT)
GUISetState(@SW_SHOW)
#EndRegion ### START Koda GUI section ### Form=
While 1
	$g_nMsg = GUIGetMsg()
	Switch $g_nMsg
		Case $GUI_EVENT_CLOSE
			Exit
		Case $GUI_btnBrowse
			$sData = FileOpenDialog("Select File To Format", "", "RM NYB files(*.c01)|Allfiles (*.*)", 1)
			GUICtrlSetData($GUI_edtFile, $sData)
		Case $GUI_btnRun
			_Run()
		Case $GUI_btnQuit
			Exit
	EndSwitch
WEnd
Exit
Func _Run()
	;Do Stuff
EndFunc   ;==>_Run

Obfuscated script output

Global Const $GUI_EVENT_CLOSE = -3
Global Const $BS_FLAT = 0x8000
Global $g_nMsg = 0
Global $sTitle = "Format RM ONYB Expanded"
Global $sData
Global $GUI_edtFile = GUICtrlCreateInput("something", 2, 20, 329, 21)
Global $GUI_btnBrowse = GUICtrlCreateButton("Browse", 336, 20, 50, 21, $BS_FLAT)
Global $GUI_btnRun = GUICtrlCreateButton("Run", 82, 56, 100, 30, $BS_FLAT)
Global $GUI_btnQuit = GUICtrlCreateButton("Quit", 214, 56, 100, 30, $BS_FLAT)
GUISetState(@SW_SHOW)
While 1
$g_nMsg = GUIGetMsg()
Switch $g_nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $GUI_btnBrowse
$sData = FileOpenDialog("Select File To Format", "", "RM NYB files(*.c01)|Allfiles (*.*)", 1)
GUICtrlSetData($GUI_edtFile, $sData)
Case $GUI_btnRun
_Run()
Case $GUI_btnQuit
Exit
EndSwitch
WEnd
Exit
Func _Run()
EndFunc
[/autoit]

Attachments (0)

Change History (8)

comment:1 by Jos, on Feb 15, 2008 at 1:58:54 PM

The reason that the lines are deleted is the fact that Obfuscator will remove all Global defined variables that are not use at all in the script. So the relation is the variable not the GUICtrlxxx() command.
Not sure what a good approach would be for this to fix this for the future. approach could be to only remove Global defined vars from Included files and skip the variable removal step for the source script code.
Will think about it for a bit to see what is best..

Jos

comment:2 by Jos, on Feb 15, 2008 at 1:59:16 PM

Owner: set to Jos
Status: newaccepted

comment:3 by Valik, on Feb 15, 2008 at 4:01:41 PM

Jos, can't you detect when a variable is being assigned via a function call and just skip stripping those? Or is your script currently not able to detect something like that?

comment:4 by Jos, on Feb 15, 2008 at 8:11:45 PM

That's an option too: What I do in the program is to build a table of all Variables and the number of times they are used in the first iteration of all records. In the second iteration, all lines that are starting with Global are processed and Variables are checked in the Table if its used or not.
At that stage a test can be added to avoid the skipping of the line.

comment:5 by Valik, on Feb 15, 2008 at 9:19:06 PM

Version: Other

comment:6 by Jos, on Feb 16, 2008 at 3:56:10 PM

Resolution: Fixed
Status: acceptedclosed

I added an extra test which will leave the global variables that are set to a Function value.
Fixed in v 1.0.24.12

in reply to:  6 comment:7 by Jos, on Feb 16, 2008 at 3:56:45 PM

Fixed in v 1.0.24.13 :)

comment:8 by TicketCleanup, on Feb 22, 2008 at 10:45:05 PM

Milestone: Future Release

Automatic ticket cleanup.

Modify Ticket

Action
as closed The owner will remain Jos.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.