Author Topic: Self replecation  (Read 1011 times)

0 Members and 1 Guest are viewing this topic.

Offline icon

  • Serf
  • *
  • Posts: 26
  • Cookies: 6
  • Ghost
    • View Profile
Self replecation
« on: May 20, 2014, 01:23:08 pm »
Hey guys,

So I've been looking into self replicating code. From what I've been looking at with just some Google searches, it seems to be very easy to simple script that is able to copy itself, but no real examples of making a fully functional program that isn't designed purely to self replicate.

I was wondering if you guys had some quick examples, or could otherwise point me in the right direction.

It's not for malware, by the way.

Thanks,

icon
De Oppresso Liber

Offline ReX

  • /dev/null
  • *
  • Posts: 8
  • Cookies: 1
    • View Profile
Re: Self replecation
« Reply #1 on: June 10, 2014, 12:09:39 am »
Not sure what it is your exactly looking for,
BUT!
Maybe [size=78%]http://hackthedark.blogspot.com/2012/06/create-self-replicating-virus-in-c.html[/size] this can be of assistance. And: http://stackoverflow.com/questions/12879612/self-replicating-self-compiling-code-c


Knowledge of c/c++ will be needed by the way. These are just examples and i dont encourage you to use the code which is on there, as the first one is for use with a virus.





A nice read :)


-ReX
« Last Edit: June 10, 2014, 12:15:26 am by ReX »

Offline Deque

  • P.I.N.N.
  • Global Moderator
  • Overlord
  • *
  • Posts: 1203
  • Cookies: 518
  • Programmer, Malware Analyst
    • View Profile
Re: Self replecation
« Reply #2 on: June 10, 2014, 09:11:31 am »
no real examples of making a fully functional program that isn't designed purely to self replicate.

What is the problem with adding the functions you need to the proof-of-concept-code?
I mean these examples are meant to demonstrate a concept with minimal effort and complexity, so you can understand it and apply it.

Try to think like a hacker. If you know how to program, you can solve this without external examples or tutorials.
What kind of program? Is is a machine code binary or bytecode or macro scripts or anything else?
How should the program replicate? Does it infect a host file?
If it infects a host file, you need good knowledge about the file type first.

Answer these questions and maybe we can help you further.

Offline ReX

  • /dev/null
  • *
  • Posts: 8
  • Cookies: 1
    • View Profile
Re: Self replecation
« Reply #3 on: June 10, 2014, 10:47:04 am »

He's after a none 'malware' related method,
And an example is what one wanted.


So the link i posted should be perfect if he knows the language,
If it was malware type methods he was after, I Would of gave him a simple exe infect,
Where the 'malware' would infect every exe which is accessible..
Never the less, ive posted below a small snippet which will copy the running pe file
too the windows & system directory, Nice and basic, and the method is used in most
Malware today




Code: [Select]
int replicate(){
    char Buffer[260],Windows[260],System32[MAX_PATH];   
    GetWindowsDirectory(Windows,sizeof(Windows));   
    GetModuleFileName(NULL,Buffer,MAX_PATH);   
    strcat(Windows,"\\");   
    strcat(Windows,"FileName.exe");     
    GetSystemDirectory(System32, sizeof(System32)); 
    strcat(System32,"\\");   
    strcat(System32, "FileName.exe");   
    return 0; 
}


Offline Deque

  • P.I.N.N.
  • Global Moderator
  • Overlord
  • *
  • Posts: 1203
  • Cookies: 518
  • Programmer, Malware Analyst
    • View Profile
Re: Self replecation
« Reply #4 on: June 10, 2014, 01:10:11 pm »
He's after a none 'malware' related method,
And an example is what one wanted.


So the link i posted should be perfect if he knows the language,
If it was malware type methods he was after, I Would of gave him a simple exe infect,
Where the 'malware' would infect every exe which is accessible..
Never the less, ive posted below a small snippet which will copy the running pe file
too the windows & system directory, Nice and basic, and the method is used in most
Malware today




Code: [Select]
int replicate(){
    char Buffer[260],Windows[260],System32[MAX_PATH];   
    GetWindowsDirectory(Windows,sizeof(Windows));   
    GetModuleFileName(NULL,Buffer,MAX_PATH);   
    strcat(Windows,"\\");   
    strcat(Windows,"FileName.exe");     
    GetSystemDirectory(System32, sizeof(System32)); 
    strcat(System32,"\\");   
    strcat(System32, "FileName.exe");   
    return 0; 
}

I didn't say anything about malware.
The methods do not differ, though. It always depends on how you use them.

I am also aware that icon wants examples. That doesn't mean that I will just guess what icon needs exactly, nor will I spoonfeed what icon can find out by himself (or herself).

Edit: Your example is useless. The replicated file will overwrite itself if it is run again.
« Last Edit: June 10, 2014, 01:16:36 pm by Deque »

Offline ReX

  • /dev/null
  • *
  • Posts: 8
  • Cookies: 1
    • View Profile
Re: Self replecation
« Reply #5 on: June 10, 2014, 03:45:09 pm »
Sorry did not read the topic properly. Must of been super tired. But thats no excuse eh :)

And yes your correct, And your answer is true,
I could of just shown him how to do it using simple random letters/numbers so the file each time its run will generate a defined file limit and what not,
But wanted to keep it simple Like your first reply was, :)

Hopefully though the small snippet will give him an idea of what he wants/needs to do.
This will not work with certain windows versions i believe, as you need administration rights and i dont want to go into detail on elevation when yeah.. lol
Afterall its like you said :D
Quote
That doesn't mean that i will just guess what icon needs exactly,now will i spoonfeed what icon can find out by himself (or herself)]/quote]

-Rex