Modify

Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#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 Changed 16 years ago by Jos

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 Changed 16 years ago by Jos

  • Owner set to Jos
  • Status changed from new to accepted

comment:3 Changed 16 years ago by Valik

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 Changed 16 years ago by Jos

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 Changed 16 years ago by Valik

  • Version set to Other

comment:6 follow-up: Changed 16 years ago by Jos

  • Resolution set to Fixed
  • Status changed from accepted to closed

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

comment:7 in reply to: ↑ 6 Changed 16 years ago by Jos

Fixed in v 1.0.24.13 :)

comment:8 Changed 16 years ago by TicketCleanup

  • Milestone set to Future Release

Automatic ticket cleanup.

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The owner will remain Jos.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.