A worm?

A worm?

Post by xTractatorix on Sun Jun 17, 2012 10:59 am
([msg=67312]see A worm?[/msg])

So i have been told that i should learn C or C++, if i want to learn how to make a worm/algorithm. As i was advised im learning C as it is backwards compatible with C++, but i have a nagging question.. How will a C program interact with the computer like accesing/opening files on the computer, wouldnt that be a batch file? Ive looked up how to make a batch file using C, but am not finding anything usefull. Ive made a couple calculators, and number guessing games, and while they are fun to make im just not seeing how a C program will interact with the OS,how a worm would? Ive been making Console applications using C, is there some other type of program i should be maing like Win32 program? Anything would help, im just a little confused right now...
xTractatorix
Experienced User
Experienced User
 
Posts: 61
Joined: Sun May 13, 2012 8:42 am
Blog: View Blog (0)


Re: A worm?

Post by LoGiCaL__ on Sun Jun 17, 2012 1:06 pm
([msg=67315]see Re: A worm?[/msg])

xTractatorix wrote: How will a C program interact with the computer like accesing/opening files on the computer, wouldnt that be a batch file?


This may be a good place to start for file input or output: http://www.cplusplus.com/doc/tutorial/files/ However, if you're trying to open the files to run, you may want to google the system() function.
User avatar
LoGiCaL__
Addict
Addict
 
Posts: 1063
Joined: Sun May 30, 2010 12:33 pm
Blog: View Blog (0)


Re: A worm?

Post by shaqywacky on Sun Jun 17, 2012 1:38 pm
([msg=67318]see Re: A worm?[/msg])

how a C program will interact with the OS,how a worm would?

That's up to you to figure out. C or any other language is just a tool. You have to make it do what you want. I'm not sure what you mean by interact with the OS. You can have C use system calls(functions that the OS provides). This would be useful in hooking the keyboard(IE listening to all the keystrokes made by the user). I'm going to be honest. This is something that is going to take a while to learn. To make a real worm will take quite a bit of knowledge so it's not going to be obvious how to make one after learning C.

Creating an algorithm is easy. An algorithm is just a series of steps that complete a task. Technically a cook book is a bunch of algorithms to cook food. An example of a common algorithm(computer related) would be a sorting algorithm(bubble sort, selection sort, ect).

To give you an idea of what a VERY basic worm would do:
1. First it needs to do something. This is what the worm is here to do. I guess this could be optional if you just wanted it to spread itself and do nothing else.
2. It needs to spread itself. I'm no expert(or even novice for that matter) but I see two main ways to do this. Find a common exploit that is rarely patched and use that to spread(hard way). Or use people's stupidity to spread itself(easier way). This would be something similar to listening to all the keystrokes and waiting for something in the form of <letters>@<domain>. The the next thing typed is most likely a password. Use this information to email itself to the contacts of this email.

This is the bare minimum and it still would be a very large program. Another very necessary feature would be avoiding antivirus. This alone would be huge but probably very interesting to implement. There are probably a lot more to this but these could be questions to ask yourself "How would I do this?"

accesing/opening files on the computer, wouldnt that be a batch file?

I think you're a little confused about batch files. Batch is a completely different language than C. A batch file can manipulate files and a C program can manipulate files. Opening files in C is pretty easy(google).

I realize that this probably isn't what you're looking for but you need to realize that this isn't something that can be explained in a few paragraphs. You are asking good questions though. :)
shaqywacky
Experienced User
Experienced User
 
Posts: 85
Joined: Thu Jul 03, 2008 2:26 pm
Blog: View Blog (0)


Re: A worm?

Post by xTractatorix on Sun Jun 17, 2012 7:02 pm
([msg=67319]see Re: A worm?[/msg])

shaqywacky wrote:
I realize that this probably isn't what you're looking for but you need to realize that this isn't something that can be explained in a few paragraphs. You are asking good questions though. :)

Understood, but what type of program do i need to make to be able to interact with files on the computer. Right now im using CodeBlocks for my compiler, and it gives you a couple different options when creating a project, like console applications, Win32 program...What type of program do i need to access files o the computer :?:
xTractatorix
Experienced User
Experienced User
 
Posts: 61
Joined: Sun May 13, 2012 8:42 am
Blog: View Blog (0)


Re: A worm?

Post by shaqywacky on Sun Jun 17, 2012 8:45 pm
([msg=67324]see Re: A worm?[/msg])

Just a regular C program can do it. The win32/console application projects are(usually) just the IDE including some headers and setting up files for you. If you don't use them, it makes no difference(besides having to load those headers). They are all C programs. You don't NEED codeblocks or any other IDE to make a program. You just need a text editor(notepad, notepad2, notepad++, ect) and a compiler. I used MinGW on windows and it's alright, simple to install(except that you may have to set the PATH environmental variable to the MinGW directory).

The beginning of most programming books will explain all of this.

Then google "how to open files in C".
shaqywacky
Experienced User
Experienced User
 
Posts: 85
Joined: Thu Jul 03, 2008 2:26 pm
Blog: View Blog (0)


Re: A worm?

Post by MRFREE on Mon Jun 18, 2012 12:57 am
([msg=67326]see Re: A worm?[/msg])

C is a very big language to learn, If I may suggest try Python3, go to youtube and search for lec1 m.i.t 6.00 intro to computer science. Watch all the lectures and learn how to code,they use python for the lectures cause it is the strongest and simplest high end, General, Interpreted language.Check that out, and if I was you I would learn how to make a simple client server or a key-logger, or both combined as one of your first advanced programs. As you go along make it more advanced, If you choose to use python let me know if you need help, or even just a python buddy(<-- im so lonely)
~Mr.Free~
MRFREE
New User
New User
 
Posts: 17
Joined: Fri Jun 08, 2012 3:09 am
Blog: View Blog (0)



Return to C and C++

Who is online

Users browsing this forum: No registered users and 0 guests

cron