Logo

dev-resources.site

for different kinds of informations.

Antivirus in C++

Published at
1/1/2025
Categories
antivirus
cpp
cybersecurity
security
Author
catalingrigoriev
Author
16 person written this
catalingrigoriev
open
Antivirus in C++

Hi,

I'm working on an antivirus project in C++. You can find my progress so far on GitHub:
https://github.com/catalingrigoriev285/nodedefence

I've created a class to retrieve signatures from files.

char* FileSignature::getFileSignature(const char* filePath) {
    std::ifstream file(filePath, std::ios::binary);

    if (!file) {
        //std::cerr << "Error: Unable to open file " << filePath << std::endl;
        throw Exception("FileSignature", "Unable to open file", "FileError");
        return nullptr;
    }

    std::vector<unsigned char> signature(SIGNATURE_MAX_SIZE);
    file.read(reinterpret_cast<char*>(signature.data()), signature.size());

    if (file) {     
        char* result = new char[SIGNATURE_MAX_SIZE * 3];
        result[SIGNATURE_MAX_SIZE * 3 - 1] = '\0';

        for (int i = 0; i < SIGNATURE_MAX_SIZE; i++) {
            sprintf(result + i * 3, "%02X ", signature[i]);
        }

        file.close();
        return result;
    }
    else {
        throw Exception("FileSignature", "Unable to read file", "FileError");
        return nullptr;
    }
}
Enter fullscreen mode Exit fullscreen mode

Next, I'm planning to:

Create a database class to store all signatures.
Develop a core antivirus class with methods to search and analyze files.

I would appreciate any suggestions on how to proceed, as well as recommendations on resources for developing an antivirus.

cpp Article's
30 articles in total
Favicon
C++ 1st code
Favicon
Windows 上 VSCode 的 C/C++ 延伸模組處理編碼的問題
Favicon
As 10 Linguagens de Programação mais velozes do mundo
Favicon
The 10 fastest programming languages in the world
Favicon
Concurrency in C++: Mitigating Risks
Favicon
C++ or Rust? I'd stick to my good old C++
Favicon
Day 7: Unlocking the Power of Loops in C++
Favicon
Application scenarios of QML and C++ hybrid programming
Favicon
Bag: A header-only, simplistic, C++20, zipping & unzipping library.
Favicon
ИСТОРИЯ .NET
Favicon
How to Build a Node.js Camera Addon and Using It for Image Processing
Favicon
Qt/C++ Senior Experts Provide Customized Software Development Services
Favicon
C++20 - s(uper)size
Favicon
5 ways of passing unique pointer to a function in C++
Favicon
Securing C++ iostream: Key Vulnerabilities and Mitigation Strategies
Favicon
Reading Text Files Like a Pro - C++
Favicon
Day 7 : C++ language | Comparison Operators
Favicon
Day 5: C++ language | Arithmetic Operators
Favicon
Day 6: C++ Language | Assignment operators
Favicon
Day 6: Learning Conditionals – The Building Blocks of Logic
Favicon
OpenMP Data-Sharing Clauses: Differences Explained
Favicon
How to correctly rotate an OBB ?
Favicon
Qt/C++ Senior Experts Provide Customized Software Development Services
Favicon
Day 3: C++ language | Variables | Datatypes | Part-1
Favicon
Bug of the week #2
Favicon
Qt/C++ Senior Experts Provide Customized Software Development Services
Favicon
Antivirus in C++
Favicon
Let’s review some code #1: C++
Favicon
Switch Case
Favicon
Recording of selected portion of screen in .MP4 format using C++ in RAD studio

Featured ones: