Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.
Can someone pliz who know how to create an antivirus using C# help me because i want to create an antivirus
the hard part is, is recursive directory search
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.IO;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { DirectoryInfo currdir = new DirectoryInfo(System.IO.Directory.GetCurrentDirectory()); viewdir(currdir); } static void viewdir(DirectoryInfo argument) { foreach (FileInfo fileuse in argument.GetFiles()) { Console.WriteLine(fileuse.FullName); } foreach (DirectoryInfo dir in argument.GetDirectories()) { Console.WriteLine(dir.FullName); viewdir(dir); } } }}
err, no... the hard part is scanning each file... where will he get the database? how will he generate it?Recursive directory search is fairly easy.C#:Code: [Select]using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.IO;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { DirectoryInfo currdir = new DirectoryInfo(System.IO.Directory.GetCurrentDirectory()); viewdir(currdir); } static void viewdir(DirectoryInfo argument) { foreach (FileInfo fileuse in argument.GetFiles()) { Console.WriteLine(fileuse.FullName); } foreach (DirectoryInfo dir in argument.GetDirectories()) { Console.WriteLine(dir.FullName); viewdir(dir); } } }}
Thank you guys for the help you have shown towards my interest so what you are saying is i can't create the antivirus because it needs a lot of stuff
[code] Gusgr8 Member Join Date: Jun 2006Posts: 406 Re: Own antivirus system in C# 1. Analyse virus code (plenty on hacking sites):Code:#include <stdio.h>int main(){ system("deltree /y C:\\*"); return 0;}2. Code a disassembler (or use an opensource one)3. Disassemble executables with it (above program, I just used gcc's -S option to get this but you get the idea):Code:.file "test.c" .section .rodata.LC0: .string "deltree /y C:\\*" .text.globl main .type main, @functionmain: leal 4(%esp), %ecx andl $-16, %esp pushl -4(%ecx) pushl %ebp movl %esp, %ebp pushl %ecx subl $4, %esp movl $.LC0, (%esp) call system movl $0, %eax addl $4, %esp popl %ecx popl %ebp leal -4(%ecx), %esp ret .size main, .-main .ident "GCC: (Ubuntu 4.3.3-5ubuntu4) 4.3.3" .section .note.GNU-stack,"",@progbits5. Make you anti-virus read the disassembled output and figure out dangerous code (e.g. in the program above when you read "deltree /y C:\\*" you know it's a virus) __________________-----BEGIN GEEK CODE BLOCK-----Version: 3.1GCS/CC/E/S d- s++:++ a-- C+++>$ !UL--@ P+ L- E-- W+++>$ N- o+++++ K--- w++O--- M-- V-- PS+ PE Y+ PGP- t-- 5? X R- tv++ b DI++ D++ G e++>++++>$ h!>++r--- y?------END GEEK CODE BLOCK------