Page 1 of 1

How to make 1.exe extract main.exe and execute main.exe?

Posted: Mon Nov 20, 2017 8:20 am
by stmdbe2019
I have a main.exe which need to have argument like following to execute.

Code: Select all

C:\win\>main.exe www.client1.com licenseID1
osx$ ./main www.client1.com licenseID1
Is there anyway to make another 1.exe which holds main.exe. And when 1.exe is executed it extract the main.exe from it and pass the arguments?

Re: How to make 1.exe extract main.exe and execute main.exe?

Posted: Mon Nov 20, 2017 10:08 am
by Bitblazer
shamun wrote:I have a main.exe which need to have argument like following to execute.

Code: Select all

C:\win\>main.exe www.client1.com licenseID1
osx$ ./main www.client1.com licenseID1
Is there anyway to make another 1.exe which holds main.exe. And when 1.exe is executed it extract the main.exe from it and pass the arguments?
Include the main.exe (for example into a datasection), then write the included second exe to ${tmp}/main.exe and execute it with the passed arguments. Keywords are WriteData, DataSection, IncludeBinary, RunProgram and ExamineEnvironmentVariables. The Problem is that some trojans try the same and therefore antivirus software might pick that up - either due to behaviour (disguising a hidden executable/payload) or by disallowing execution from ${TMP} completely.

So this might create more problems than you want longterm. I wont go into a technical explanation of how this could be avoided on a public forum.

Re: How to make 1.exe extract main.exe and execute main.exe?

Posted: Mon Nov 20, 2017 10:18 am
by IdeasVacuum
Windows 10 itself will intercept the executable. Why would you need to do this anyway?

Re: How to make 1.exe extract main.exe and execute main.exe?

Posted: Mon Nov 20, 2017 10:26 am
by walbus
Bitplazer wrote:The Problem is that some trojans try the same...
Maybe you should explain exactly why you want to do that !
The construction of such things hurt PB

Re: How to make 1.exe extract main.exe and execute main.exe?

Posted: Mon Nov 20, 2017 11:18 am
by Dude
As mentioned, running exes from %TEMP% will probably get your app flagged by anti-virus apps, but lots of legit products do exactly that from %TEMP% anyway, so it's hard to say for sure. Is there any reason your app can't just have the other exe in the same folder as the main app, and run it from there? Or just extract and run it from there, instead of %TEMP%.

Re: How to make 1.exe extract main.exe and execute main.exe?

Posted: Mon Nov 20, 2017 2:19 pm
by stmdbe2019
Automatically at midnight PB compiler in server (Windows, OSX) compiles executable file per client (in database lets say i have 500 client, 500 times compiles, and it creates 500 .exe files) where clients are unlimited.

To minimise that logic, i wanted to make main.exe and use a wrapper 1.exe. Where 1.exe will be only released per client which will have small footprint and main.exe wont be compiled anymore which is large in size and code complex involved.

FYI.

- AGENT1 in call center is connected with a client over telephone (PSTN/ISDN/VOIP)
- CLIENT ask and grant the AGENT1. Can you see my desktop, what am i doing wrong?
- AGENT1 says sure, go to our: https://www.government.site.gov/AGENT1

- AGENT1 shared link has a PureBasic midnight compiled .exe and .dmg file available
- CLIENT execute that link and open the PureBasic compiled executable file

- AGENT1 now see the screen of CLIENT. PureBasic compiled execute file exit after 15 seconds and kills itself

- Session ends

(My project goal is: i need to minimise that above process with 1.exe holding main.exe inside 1.exe)

Re: How to make 1.exe extract main.exe and execute main.exe?

Posted: Mon Nov 20, 2017 5:34 pm
by Mijikai
Why not just rewrite 'main.exe' and add some basic configuration (file) capabilities ?
Or just have uniq request links for each client...

Re: How to make 1.exe extract main.exe and execute main.exe?

Posted: Tue Nov 21, 2017 10:40 am
by stmdbe2019
What do you mean by unique request URL?

- Suppose i have 500 rows, i make 500 .exe in server (disk space reserved)? Currently i am doing this because i had no choice
- Or you mean get argument via URL and then compile main.exe (one time only and distribute it, instead of keeping it 500 times) ?

Re: How to make 1.exe extract main.exe and execute main.exe?

Posted: Wed Dec 27, 2017 12:49 pm
by stmdbe2019