I have been asked to create a program that scans for a virus,detects the virus and removes it,it also has to scan the boot sector.I am very new to programming so this is a big task for me especially that i cannot find anything of any use to me, i am a beginner of java and c++ could anybody tell me how to attempt this or provive some information to me.

Dani AI

Generated

As pointed out, a full antivirus that reliably detects and removes real malware (and scans boot sectors) is a large, advanced project. For the practical route is to break the task into small, safe steps and build a demonstrator that proves concepts instead of trying to match commercial products.

Start with these components in order:

  • a simple file scanner that reads files and looks for a known byte sequence (a "signature");
  • a tiny signature store (text file or simple DB) and logging;
  • a safe "removal" step that quarantines (move/rename) rather than deleting or patching automatically;
  • read-only boot-sector scanning as an advanced optional step (requires admin/root and is platform-specific — MBR vs GPT/UEFI differences matter).

Language notes: Java can do file scanning easily but cannot access raw disks without native code. C++ is a better fit for raw disk reads on Windows/Linux, but that requires elevated privileges and careful platform APIs. For testing, always use a virtual machine and snapshots.

Example (very small C++ file-scan function — reads a file and checks for a signature):

#include <fstream>
#include <string>
#include <iterator>

bool containsSignature(const std::string& path, const std::string& sig) {
    std::ifstream in(path, std::ios::binary);
    if (!in) return false;
    std::string data((std::istreambuf_iterator<char>(in)),
                     std::istreambuf_iterator<char>());
    return data.find(sig) != std::string::npos;
}

Safety and scope: do not write to the MBR/EFI unless explicitly required and understood; reading raw devices needs admin rights (Windows "\\.\PhysicalDrive0", Unix "/dev/sda") and can brick systems. Use the EICAR test file or isolated VMs for detection tests. Clarify with the instructor whether detection-only is sufficient — removal and boot-sector work are advanced and risky. As and hinted, this looks like an assignment that should be scoped down for a beginner.

Recommended Answers

All 3 Replies

well call Dr. Norton, or contact McAfee, i m sure they know how to write such codes. :lol:

" i am a beginner of java and c++"
>>Problem. ---1

"I am very new to programming."
>>Bigger problem---2

" create a program that scans for a virus,detects the virus and removes it,it also has to scan the boot sector."
>>Huge problem

" this is a big task for me"
>>Mission Impossible!!

" how to attempt this"
>>After u have overcome problem no 1 and 2.

"I have been asked"
>>I would like to know who asked u...Just an honest interest

>>I would like to know who asked u...Just an honest interest

You would hope its a teacher and not just say... a family friend, since itd probably be a better investment to just buy some virus protection software :cheesy:

hmm, sounds awfully like that other guy who spammed the forums a few weeks ago with an almost identical question.
Was that guy banned or is this a classmate who found out a bit later he wouldn't get away with not doing his own homework?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.