i have been asked to write a program to detect 3 classes of virus and remove them in any language of my choice but i do not have an idea how to do this could some one please advise me!!!!

Dani AI

Generated

For : break the project into small, testable pieces—pick three distinct malware classes, design a detection method for each, and define a safe removal policy. was right that research comes first; focus on the artifacts each class reliably leaves behind (file-format changes, persistence entries, runtime/network behavior) rather than only on literal byte signatures.

Suggested classes and concrete approaches:

  • PE file infectors (Windows executables): detect by hashing, PE header inspection (entry-point/section changes, overlays) and comparing to a clean baseline. Libraries: hashlib, pefile. Removal: quarantine, then restore from a clean copy or repair the header/strip appended payload only when you can do so safely.

  • Macro/document viruses (Office): extract and analyze macros for obfuscation, AutoOpen/ThisDocument hooks, and suspicious APIs. Tools: oletools or OOXML readers. Removal: remove macros and save a macro-free document or replace with a clean template.

  • Runtime/backdoor (trojans/worms): detect by enumerating processes, services, autorun registry keys, scheduled tasks, and unusual outbound connections. Tools: psutil, netstat parsing, simple YARA-like rules. Removal: stop processes, remove persistence entries, quarantine binaries; isolate the host first.

Safe workflow and grading criteria: always work inside isolated VMs with snapshots, keep original files (do not overwrite), log every action, measure false positives/negatives with a test set (EICAR for safety or curated benign/malware sets if you have legal access), and implement a quarantine + restore path rather than immediate deletion. Document assumptions and limitations.

Minimal Python examples (hash + quarantine):

import hashlib
import shutil
import os

def sha256(path):
    h = hashlib.sha256()
    with open(path, 'rb') as f:
        for chunk in iter(lambda: f.read(8192), b''):
            h.update(chunk)
    return h.hexdigest()

def quarantine(path, qdir='quarantine'):
    os.makedirs(qdir, exist_ok=True)
    dest = os.path.join(qdir, os.path.basename(path))
    shutil.move(path, dest)
    return dest

Also see the DaniWeb thread pointed to for additional background reading. Legal/safety note: do not distribute live malware and follow institutional rules when handling samples.

Recommended Answers

All 2 Replies

Pick three random viruses and figure out a way to find them through their signatures. The first task is one of research.

i have been asked to write a program to detect 3 classes of virus and remove them in any language of my choice but i do not have an idea how to do this could some one please advise me!!!!

Take a look :)
here

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.