...

View Full Version : Exe writing exe??



Dunna
11-29-2004, 12:36 PM
I have seen many exe's design an exe based on a users prefernces. I was wondering if anyone knows how to do this in vb or c++. Also, if anyone knows how to pack ocx's and dll's into one exe and remotely extracting them.

Horus Kol
11-29-2004, 01:47 PM
Originally Posted by Dunna
I have seen many exe's design an exe based on a users prefernces.

Where? I'd love to see this...

Polymorphic coding is difficult in compiled languages (like C++) because you need to include a compiler into the program...
Also, there are really only two reasons for polymorphic programming - 1. Interesting software research projects into Genetic Algorithms, and 2. virus and malware.



Originally Posted by Dunna
Also, if anyone knows how to pack ocx's and dll's into one exe and remotely extracting them.

By remotely extracting, do you mean without the knowledge of the client.

anyways, you can zip the files up together and then create a self-extracting zip file to deliver the product...

Dunna
11-29-2004, 05:07 PM
There is a packaging utility avaible called Fusion by bit-arts, but it costs 399$ which I'm not going to spend. This utility adds the ocx's and such right into the exe! I'm not sure how that works, but it says it "injects" them into it, whatever that means. Also, I have the packaging ability of a new executable in a few remote control utilities in my office (not sure of the names). There is a client and a server. The client allows you to select certain options for the server, you then click "Add" and it re-compiles or generates a server.exe file based on your selections. I'm not sure how it's done, but the client.exe has no compiler that comes with it, unless there is a compiler built right in... :confused:

Dr. Evil
11-29-2004, 06:30 PM
If the user preferences were only string changes, you could create an .exe with a string table resource and include it as a resource in the main program. The user would then enter the string changes he wants and all the main program would have to do is change the string table resource. Easier said than done though...

Dunna
11-29-2004, 10:23 PM
Could you explain how? I assume you are talking about C++ but if it's possible in VB please explain. If it's to complicated or to long just e-mail me at sdunns1222@yahoo.com

Dr. Evil
11-30-2004, 07:50 PM
I'm sorry to disappoint you, but I'm afraid I haven't the faintest idea on how to do such a thing in VB, nor do I know how to edit resources in an already compiled executable in C or VB. However, there is an open source compiler/editor called OpenWatcom located at http://downloads.openwatcom.org/ftp/source/ which you could look into.

Dunna
12-02-2004, 12:34 PM
I would download that file and check it out, however, it is 45 MG's! On a dial-up like I'm using that will take just a little while... ;)

Horus Kol
12-02-2004, 01:31 PM
There is a packaging utility avaible called Fusion by bit-arts, but it costs 399$ which I'm not going to spend. This utility adds the ocx's and such right into the exe! I'm not sure how that works, but it says it "injects" them into it, whatever that means. Also, I have the packaging ability of a new executable in a few remote control utilities in my office (not sure of the names).


oh, i think i see...

This won't help you with runtime changes - only at compilation... it won't remember a users settings once you "injected" the files - only what you put in before you distribute it.

scroots
12-02-2004, 06:09 PM
you could store the users preferences etc. in a file, then inject the update and read in the preferences.

scroots

paul6253
12-03-2004, 12:16 AM
I have seen many exe's design an exe based on a users prefernces. I was wondering if anyone knows how to do this in vb or c++. Also, if anyone knows how to pack ocx's and dll's into one exe and remotely extracting them.



I dunno man, whatever you wanna do it doesnt sound good.
"... exe's design an exe based on a users prefernces... "
ok you mean self-modifying code, or code which can *patch* itself at
runtime. NOT EASY -- you must understand assembly and opcodes.
plus loaded exe has 'sections' which arent contiguous and you have to
know about relocating object code and a whole lotta stuff
the packing thing...well you could have them encrypted then at run
unpack and execute,,,,um again need to know your machine

If I may ask...what the hell are you trying to do?
this sounds like some serious digital voodoo and if you
succeed you might wanna throw all pretences of portability
away...this is very architecture dependant code
good luck!

Dunna
12-03-2004, 05:34 PM
oh, i think i see...

This won't help you with runtime changes - only at compilation... it won't remember a users settings once you "injected" the files - only what you put in before you distribute it.

yah but that would mean I have the Fusion program on the user's computer who selects the prefernces. How else could I possibly "inject" the preferences back in?

Horus Kol
12-06-2004, 09:24 AM
You save the preferences in a file outside the program, which the program then reads on runtime...

Dunna
01-09-2005, 05:37 PM
Alright, I read in an article off Google that one way to do what I want to do is to right the users preferences on to the end of the file. When that file ran it would read the end of itself and know what to do. Now, my question: Does anyone know how to do that? Or even provide a different answer to my first question? Oh yeah, whoever was talking about the EXE being in continous segment's and modifying opcodes, I looked into that but the math was a little to much for me. I understand the concept however, and maybe if someone who understands the math could explain it to me or teach me how to add my own segment to the end of the file.... I know it's complicated but we have a lot of smart CF users.

Unit
01-13-2005, 07:13 PM
To write the settings in the exe file itself is bad programming and almost all virus software will treat this as a self modifying virus.

Another problem would be that this wont be able to run from read-only media like CD-ROM, or even from the hard drive if the user only has read-only permissions.

If you still need to do it regardless: You need to seek to the end of the exe file and start writing there. Before you write your settings, you need to write a unique marker like "uniqueXXXmarker" and then search for two words unique and marker seperated by XXX when reading back the data. You can't search for the whole string because if you do, the string will occur in the exe file itself in its string table. You need to use a marker in the first place since you would not know where the end of the original exe is after you write the data without a marker.

Mhtml
01-13-2005, 08:38 PM
Apart from this whole concept being pretty damn interesting, I do not see any reason for wanting such a solution. You see this sort of thing everyday when you download a setup executable file, I believe NSIS is open source so perhaps you can examine it's code to gain more insight. Dynamic linking has many different things going for it such as being able to upgrade your program's functions by just switching a file. Recompiling the whole executable would just be plain foolish if say you wanted to replace a dll that wa just a few kb worth and your executable was fairly large in respect to the location of the dll data. Besides resources are not just limited to your icons strings and bitmaps if I recall you can define your own custom resources.

But for VB I am unsure, it is an interpreted language. I believe that you can compile it but I don't think you are given such a level of control when it comes to the compilation as to decide exactly how it will work.

Dunna
01-14-2005, 12:47 PM
Thanks for the info, I will give it a try and repost. Also: The thing that gave me the original idea/question was I own a program called E-Surveiller which allows you to pick certain settings and clik a button which creates an executable. When you run the created executable it connects the computer it is run on to my laptop for surveillence. It is NOT a trojan, or at least I don't consider it one as it does not let you do anything except view the remote monitor and record keystrokes. It also allows you to generate an uninstaller. I was wondering how to do this. I will try the marker idea next.

Thanks again for the info, Dunna

JWizard
02-09-2005, 02:18 AM
Append a chunk of text to the end of the binary. TADDAA! I agree, recompiling for a few user preferences is silly. I'd use the size of the file as a marker for where to find the beginning of text, instead of looking through the whole thing to find it. Hmm..if it were only written in C running on Linux, you could get that information with a couple system calls, I'm sure VB gives you a 'bit' of convenience with stuff like that, it has to.

Dunna
02-12-2005, 02:01 PM
Excellent, that's works fine! :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum