Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

How programms copy themselves into executable file

Hi, I wonder how can a program can copy himself (or just a small part of his code) into a new executable file, and how can I do it with using c#.
I know its possible
"copy himself into a new executable file". I am not quite sure I understand your question tbh.
https://docs.microsoft.com/en-us/windows.../pe-format

[Image: wOtOOxQ.png]
(Jan 13, 2022 05:30 PM)Romeos Wrote:  "copy himself into a new executable file". I am not quite sure I understand your question tbh.

Okay so I will take an example (not that I want to do but this is the best example I have).

I want to know how can a program (made in c#) can create an executable with some code inside, for example when we use a GUI rat, we have the builder and it can create the executable that we want to spread, so how the builder (wich is inside the program) can create a second .exe file with the code that we want inside ?
it depends, if you simply want to create a builder you can use codedom or you can also have a stub (inside resources or w/e) and edit the necessary parts using mono.cecil or dnlib
by binding data to the EOF of an executable and than patching the file image header or something to point to new breakpoint


or simply by using cmd

copy /b a.exe + b.exe = c.exe

if you use extension polygots its possable to differentiate 2 seperate exe's from 1 result if done right
[Image: lolj.png]
not a single person has the time for that scenario
(Jan 24, 2022 04:13 AM)Joseph Ducreux Wrote:  by binding data to the EOF of an executable and than patching the file image header or something to point to new breakpoint

I dont understand this

or simply by using cmd

copy /b a.exe + b.exe  = c.exe

(Jan 24, 2022 04:13 AM)Joseph Ducreux Wrote:  if you use extension polygots its possable to differentiate 2 seperate exe's from 1 result if done right

This isn't exaclty what I want, to infect a computer the only way I know to do it it's to download another file from web (wich is I think more spoted than just creation another .exe file from nothing (just by clicking on the main program))
(Jan 24, 2022 11:27 AM)indetectable Wrote:  I dont understand this

or simply by using cmd

copy /b a.exe + b.exe  = c.exe


This isn't exaclty what I want, to infect a computer the only way I know to do it it's to download another file from web (wich is I think more spoted than just creation another .exe file from nothing (just by clicking on the main program))

It is not ethical to infect another machine that you don't own or you don't have permission to access.

Regarding this quote, he is referring to append the additional information (configuration/settings/instructions in this context) to your stub (the executable you just created with the builder). Whenever the stub will get executed/launched, it will read the appended information.
(Jan 25, 2022 04:04 AM)Endorphins Wrote:  It is not ethical to infect another machine that you don't own or you don't have permission to access.

Nobody cares.

[Image: B37mjKj.png]
(Jan 25, 2022 07:30 AM)xHeaven Wrote:  Nobody cares.

law enforcements do 🙃

[Image: wOtOOxQ.png]
(Jan 25, 2022 08:06 AM)0x9F Wrote:  law enforcements do 🙃

Catch me if you can, then, bad boy.
This is still Hackforums, thinking and expecting that users will only infect PCs in their ownership is blatantly retarded and insanely naive.

[Image: B37mjKj.png]
If you're going to use C# then just access the compiler through CodeDOM, which is very noob-friendly.
yeb you can do it by reading self bytes and then use WriteAllBytes to write self to new directory
(Jan 25, 2022 08:43 AM)xHeaven Wrote:  Catch me if you can, then, bad boy.
This is still Hackforums, thinking and expecting that users will only infect PCs in their ownership is blatantly retarded and insanely naive.

i will catch you.

what a clown
(Jan 14, 2022 11:15 AM)Incog Wrote:  CodeDOM

https://docs.microsoft.com/en-us/dotnet/...ng-codedom

there is microsofts explanation of it, but I preferred unams as it was easier to read, idfk why
https://github.com/UnamSanctam/UnamDownl...der.cs#L30
For me theses are too complex, sorry..


Code
//here you would use replace on the string, and have anything inside the stub code written out like #thing# to prevent unwanted replacements
template = template.Replace("#thing#", "hello");

I dont understand this part, what should I do with #thing# and hello ??

Thanks


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C] by SIM-1866423Dec 12, 2018 09:56 AM 5 311 Dec 12, 2018 09:56 AM
Last Post: SIM-1866423
[C] by HitSweManDec 27, 2015 04:55 AM 4 156 Dec 27, 2015 04:55 AM
Last Post: HitSweMan
[C] by Hoodie+Dec 20, 2015 11:15 AM 5 176 Dec 20, 2015 11:15 AM
Last Post: Mouse❤️