Jump to content
Sign in to follow this  
rudi

A customer is asking to be able to get the source from .EXE

Recommended Posts

rudi

Hi.

For one of the customers, that I have to write quite a lot of scripting things I started to move all the old CMD versions to autoit.

The customers first reaction: "I can't read the script, when compiled. Forget it!" It's just one of my customers, but the one I work for quite a lot of my time...

What's the easiest way to *AUTOMATICALLY* add the program source to the compiled EXE, so that the full source (including includes) can be retrieved easyly, like it was offered with the decompiler for scripts written in Autoit Version 3.2.5.1 and prior?

I tried e.g.

#AutoIt3Wrapper_Res_File_Add=c:\temp\RetrieveSource.au3

When I use this with a invalid path, I get an error, so I assume, that the code was added to the exe.

1.) How to get the source back this way?

2.) I can't use "@ScriptFullPath" this way, it has to be a litteral full path (same as for FileInstall), and all the includes ("#include <someinclude.au3>") aren't included this way as well.

PS - @Developers:

Is there any way to add the source code plus all includes with the CURRENT compiler (or any other tool, or trick, or whatsoever) in a way, that the existing decompiler for Version 3.2.5.1 and older could get me back the full source code?

There are scripts, where I want to keep my code secret (at some level), no doubt.

But for quite a lot of small scripts I'd prefer to have an option to easyly add the full source in an easy recoverable way to the EXE. I don't want to carefully save the source for each and every QND minor task script...

Regards, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites
PsaltyDS

Hi.

For one of the customers, that I have to write quite a lot of scripting things I started to move all the old CMD versions to autoit.

The customers first reaction: "I can't read the script, when compiled. Forget it!" It's just one of my customers, but the one I work for quite a lot of my time...

What's the easiest way to *AUTOMATICALLY* add the program source to the compiled EXE, so that the full source (including includes) can be retrieved easyly, like it was offered with the decompiler for scripts written in Autoit Version 3.2.5.1 and prior?

I tried e.g.

#AutoIt3Wrapper_Res_File_Add=c:\temp\RetrieveSource.au3

When I use this with a invalid path, I get an error, so I assume, that the code was added to the exe.

1.) How to get the source back this way?

2.) I can't use "@ScriptFullPath" this way, it has to be a litteral full path (same as for FileInstall), and all the includes ("#include <someinclude.au3>") aren't included this way as well.

PS - @Developers:

Is there any way to add the source code plus all includes with the CURRENT compiler (or any other tool, or trick, or whatsoever) in a way, that the existing decompiler for Version 3.2.5.1 and older could get me back the full source code?

There are scripts, where I want to keep my code secret (at some level), no doubt.

But for quite a lot of small scripts I'd prefer to have an option to easyly add the full source in an easy recoverable way to the EXE. I don't want to carefully save the source for each and every QND minor task script...

Regards, Rudi.

You could put in a command line switch that triggered FileInstall():
If ($CmdLine[0] >= 1) And ($CmdLine[1] = "/source") Then _
    FileInstall("C:\MyDir\MySubDir\MyScript.au3", @ScriptDir & "\MyScript.au3")

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
rudi

Hi.

You could put in a command line switch that triggered FileInstall():

If ($CmdLine[0] >= 1) And ($CmdLine[1] = "/source") Then _
    FileInstall("C:\MyDir\MySubDir\MyScript.au3", @ScriptDir & "\MyScript.au3")

:)

Yes, of course. But with fileinstall() I *MUST* use a literal path.

So I will have to type it in each and every time.

This also will miss any used include files.

Therefor I'm searching for a comfortable, easy to use solution to "pack" all code lines + include files with the EXE.

Like this:

; include file: packcodewithexe.au3

func PackCodeWithExe()
; do whatever will pack the source + includes to the EXE
endfunc

Then, in the script that really doesn't need to hide it's code just call this function, done :lmao:

After that, use the old decompiler (or any other tool) to retrieve the code of this non-secret script.

Regards, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites
Jos

Just use

#AutoIt3Wrapper_Res_SaveSource=y

This will add the source for you to the program resources.

To retrieve it again you need to decompress the program with UPX after which you can view the source with Reshacker under RCDATA\999.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Melba23

rudi,

There is an AutoItWrapper directive #AutoIt3Wrapper_Res_SaveSource=y which puts the source into the exe. If you were to use Zedna's Resource UDF, you should be able to display it from within the exe.

I have checked and the source is definitely in the exe and visible with ResHacker (as long as you do not use upx).

Over to you,

M23

Edit: Jos, I have got to learn to type faster!

Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Jos

Edit: Jos, I have got to learn to type faster!

Shit happens... :)

I have checked and the source is definitely in the exe and visible with ResHacker (as long as you do not use upx).

You can use UPX if you want as long as you do a "UPX -d program.exe" to decompress it before trying to view it.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Valuater

I used this a few times...

; Command Line decompile to desktop
; Author Skruge

If $CMDLine[0] > 0 Then
      If $CMDLine[1] = "/decompile" Then GetSource()
  EndIf
  
; Main Code Here
  
  Func GetSource()
      FileInstall("MyScript.au3", @DesktopDir &  "\")
      Exit
  EndFunc;==>GetSource

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
Mobius

it is not necessary to upx -d the binary, packed resources can be manipulated with Zedna's resource udf no probs.

Although having your client simply decompress and then view the resources with a resource editor is the easiest method

for both them and you.

Edited by Mobius

Share this post


Link to post
Share on other sites
Melba23

Mobius,

You are quite correct, I was not clear enough in my post. You only need an non-packed exe if you wish to see the result in Reshacker - Zedna's UDF copes admirably with packed resources if you wanted to display during execution.

I must look more closely at Valuater's solution though - no need to have the exe actually "doing its thing" to get at the source. Perhaps with the addition of a read-only editbox.....

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
rudi

Hi Valuater.

FileInstall("MyScript.au3", @DesktopDir &  "\")
As stated above I want to avoid to have to change for every script the required literal string for the source of fileinstall :)

Regards, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites
rudi

Hi Jos.

Just use

#AutoIt3Wrapper_Res_SaveSource=y

This will add the source for you to the program resources.

To retrieve it again you need to decompress the program with UPX after which you can view the source with Reshacker under RCDATA\999.

As I'm reading your post I remember, that I've seen that one before :)

Doing a qick check it looks like this wrapper switch does NOT pack includes into the EXE, beside the main code?

Maybe there is another switch to also pack #include <someinclude.au3> code with the script? That would be useful for UDF includes and to proove, that the right version of includes is packed into the EXE?

I can find some posts citeing Zedna's Resource UDF, but not the UDF itself: Where to get it? Is it command line capable, e.g. to use one run() call to save the code to <scriptname>.au3?

Thanks, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites
Jos

Hi Jos.

As I'm reading your post I remember, that I've seen that one before :)

Doing a qick check it looks like this wrapper switch does NOT pack includes into the EXE, beside the main code?

Maybe there is another switch to also pack #include <someinclude.au3> code with the script? That would be useful for UDF includes and to proove, that the right version of includes is packed into the EXE?

Correct it doesn't do that at this moment, only the original base sourcecode.

It is doable because I have written and posted a scriptlet before that expands the script with all included files, but I am not sure if this is something many people would want/use.

Jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
trancexx

Correct it doesn't do that at this moment, only the original base sourcecode.

It is doable because I have written and posted a scriptlet before that expands the script with all included files, but I am not sure if this is something many people would want/use.

Jos

But he could run your obfuscator with /striponly parameter and compile obfuscated script with #AutoIt3Wrapper_Res_SaveSource=y

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
Jos

But he could run your obfuscator with /striponly parameter and compile obfuscated script with #AutoIt3Wrapper_Res_SaveSource=y

Yes, but did you try that and did it include the obfuscated script? :)

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
trancexx

Yes, but did you try that and did it include the obfuscated script? :lmao:

To compile the obfuscated script with #AutoIt3Wrapper_Res_SaveSource=y

You... teaser :)


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
Jos

To compile the obfuscated script with #AutoIt3Wrapper_Res_SaveSource=y

You... teaser :)

I started working on a new release of AutoIt3Wrapper that will drop support for ANSI OSes like win98 since Autoit3 stopped supporting that too.

I just made a small change to it that it will store the obfuscated source when you specify:

#AutoIt3Wrapper_Res_SaveSource=y
#AutoIt3Wrapper_Run_Obfuscator=y
#Obfuscator_Parameters=/so

Its available in the BETA download directory when you want to play with it... :lmao:

Jos

Edited by Jos
corrected typo

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
trancexx

I started working on a new release of AutoIt3Wrapper that will support ANSI OSes like win98 since Autoit3 stopped supporting that too.

I just made a small change to it that it will store the obfuscated source when you specify:

#AutoIt3Wrapper_Res_SaveSource=y
#AutoIt3Wrapper_Run_Obfuscator=n
#Obfuscator_Parameters=/so

Its available in the BETA download directory when you want to play with it... :)

Jos

Well, you obviously know my learning drill.

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
Melba23

Jos,

Are you going to keep that syntax? Because I find it most confusing:

#AutoIt3Wrapper_Res_SaveSource=y

#AutoIt3Wrapper_Run_Obfuscator=n

#Obfuscator_Parameters=/so

Will it still strip, despite the #AutoIt3Wrapper_Run_Obfuscator=n, or do you have to run Obfuscator again to get rid of the unused functions/constants?

Or am I missing something? (More than likely - it has been a long day!)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Jos

Jos,

Are you going to keep that syntax? Because I find it most confusing:

#AutoIt3Wrapper_Res_SaveSource=y

#AutoIt3Wrapper_Run_Obfuscator=n

#Obfuscator_Parameters=/so

Will it still strip, despite the #AutoIt3Wrapper_Run_Obfuscator=n, or do you have to run Obfuscator again to get rid of the unused functions/constants?

Or am I missing something? (More than likely - it has been a long day!)

M23

mmm... Same here I guess ...mucchhhh to long day...

Ofcourse that needs to be, but you knew that already:

#AutoIt3Wrapper_Res_SaveSource=y

#AutoIt3Wrapper_Run_Obfuscator=y

#Obfuscator_Parameters=/so

:)


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Melba23

Jos,

Thank you for that (wipes brow in relief!).

I look forward to playing with the beta!

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.