Click here to Skip to main content
15,881,725 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm trying to learn some basics about creating antiviruses. I know that it needs a lot of time and experience to do so but as a beginner I came up with this idea and this question:

I thought about collecting a range of viruses to start, and read them in hex format. Since I already know that these files are viruses, I keep the read hex codes in a database.

Now I can scan a folder and read all files again in hex so if the content of one file matches with one of my stored hex codes then I can say it is a virus.

Now I'd like to know whether I can really judge a file like this and if so how can I really read a lot of files in hex and make comparisons in a way that doesn't take a lot of time ?
Posted
Comments
CHill60 7-Feb-13 5:32am    
Can't really comment with any authority but you could also have a look here http://www.codeproject.com/Questions/295195/building-anti-virus-software-with-Csharp
and here (mentions file scanning) http://www.codeproject.com/Questions/190853/How-to-create-an-antivirus-in-C

I think you actually mean binary comparisons, rather than hex. However, just scanning a file and comparing it with a known virus pattern will not guarantee that the file is also a virus. There are many other checks that need to be done, including checking for embedded code changes that may turn an innocent application into a virus or trojan. As you say in your second sentence this takes a lot of time and experience. You may like to go to some of the anti-virus providers' websites for further information.
 
Share this answer
 
Comments
Pete O'Hanlon 7-Feb-13 5:50am    
My 5.
Richard MacCutchan 7-Feb-13 6:01am    
Thanks.
The short answer is that you can't validate files like this. Effectively, your description just tells you that a file is identical to another - but this is too simplistic a test. A virus is typically a pattern, rather than a whole file, so it may attempt to infect any exe (for instance). This, of course, means that you would only find one exe file with this technique.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900