Skip to content

jery04/Border-Guard-Antivirus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

6 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Border Guard Antivirus ๐Ÿ›ก๏ธ๐Ÿ’ป๐Ÿ”

Border Guard Antivirus is a cyber-defense project inspired by a digital fantasy kingdom ๐Ÿฐ, where processes are creatures ๐Ÿงฌ, ports are gates ๐Ÿšช, and malware is an invading army ๐Ÿฆ โš”๏ธ. The system works as an active defense wall ๐Ÿงฑ that monitors, detects, and reports suspicious behavior in real time on Linux and UNIX environments ๐Ÿง.

This project blends operating systems concepts ๐Ÿง , concurrent programming with threads ๐Ÿงต, low-level networking ๐Ÿ“ก, file integrity analysis ๐Ÿ”, and a GTK visual control panel ๐Ÿ–ฅ๏ธ.

Mission: build a resilient, proactive, and educational security layer that detects anomalies before they become incidents ๐Ÿšจ.

Main Features โš™๏ธ๐Ÿ›ฐ๏ธ

  1. Border Patrol for files and mounted devices ๐Ÿ“๐Ÿงญ
  • Monitors mounted paths (focused on /media) in near real time ๐Ÿ‘€.
  • Builds and maintains a baseline of known files ๐Ÿงฑ.
  • Detects suspicious events such as:
    • file creation and deletion ๐Ÿ“„โž•๐Ÿ“„โž–
    • abnormal file growth ๐Ÿ“ˆ
    • extension changes ๐Ÿงช
    • permission changes ๐Ÿ”
    • ownership changes ๐Ÿ‘ค
    • replicated files ๐Ÿงฌ
  • Sends real-time alerts to the interface ๐Ÿ””.
  1. Process and resource sentinels ๐Ÿง ๐Ÿ“Š
  • Reads process telemetry from /proc ๐Ÿ“‚.
  • Tracks CPU and memory behavior over time ๐Ÿงฎ.
  • Detects sustained overuse and anomalous peaks ๐Ÿšจ.
  • Generates alerts and can terminate processes that exceed thresholds for too long โ›”.
  1. Local port defense scanner ๐Ÿ“ก๐Ÿ›œ
  • Scans local TCP ports on 127.0.0.1 ๐Ÿ”Œ.
  • Detects open ports and resolves service names when available ๐Ÿงพ.
  • Classifies ports as expected or potentially compromised โš ๏ธ.
  • Produces a live scan report for the GUI ๐Ÿ—’๏ธ.
  1. Control hall interface with GTK ๐Ÿ–ฅ๏ธ๐Ÿงฐ
  • Presents security data in dedicated windows ๐ŸชŸ.
  • Includes views for:
    • active process table ๐Ÿ“‹
    • process alerts ๐Ÿšจ
    • port scan alerts and report ๐Ÿ“ก
    • file integrity alerts ๐Ÿ“
  • Keeps monitoring modules active while the interface is running ๐Ÿ”„.

Runtime Architecture ๐Ÿงฉ๐Ÿงต

The application uses concurrent modules coordinated by mutexes ๐Ÿ”’:

  • Process thread ๐Ÿง :

    • reads /proc continuously and updates the internal process state.
  • File monitoring thread ๐Ÿ“:

    • runs recursive inotify watches and compares events against baseline data.
  • Port scanning thread ๐Ÿ“ก:

    • executes periodic scans and updates the shared report buffer.
  • GTK main thread ๐Ÿ–ฅ๏ธ:

    • handles dialogs, windows, rendering, and user interaction.

During shutdown, all threads are canceled and joined safely, shared resources are released, and mutexes are destroyed cleanly ๐Ÿงน.

Project Structure From Root ๐Ÿ—‚๏ธ๐Ÿ—๏ธ

  • .git/ ๐Ÿงฌ

    • Repository history, objects, refs, and version control metadata.
  • .gitignore ๐Ÿšซ

    • Rules for files that should not be committed.
  • .vscode/ ๐Ÿ› ๏ธ

    • Local workspace/editor settings and tooling metadata.
  • Interfaz.c ๐Ÿ–ฅ๏ธ

    • Main application entry point and GTK initialization.
    • Thread creation and lifecycle coordination.
    • GUI actions for process, file, and port alert visualization.
  • Prosesos.h ๐Ÿง 

    • Process monitoring logic based on Linux /proc.
    • CPU and memory threshold evaluation.
    • Alert generation and optional process termination.
  • List.h ๐Ÿ”—

    • Doubly linked list used as live process state storage.
    • Node creation, insertion, update, deletion, and cleanup operations.
  • Alert.h ๐Ÿšจ

    • Linked list for process alert events.
    • Stores process name, alert type, and timestamp.
  • guardian_frontera.h ๐Ÿ“๐Ÿ”

    • inotify-based file and directory monitoring.
    • Baseline management, SHA-256 hashing, watch mapping, and event analysis.
  • port_scanner.h ๐Ÿ“ก

    • Non-blocking localhost TCP scanner.
    • Suspicious port detection policy and GTK alert dispatch.
    • Shared report buffer and synchronization primitives.
  • README.md ๐Ÿ“˜

    • Technical and functional project documentation.

Technology Stack Explained ๐Ÿงฐ๐Ÿงช

This project is a combination of systems programming, security analysis, and GUI engineering. The stack is intentionally low-level to provide control, performance, and educational depth.

  1. Programming language and systems style ๐Ÿ’ป
  • C language is used for direct memory control, deterministic performance, and close interaction with operating system APIs.
  • The codebase follows a modular design where each header encapsulates a security domain.
  1. Operating system integration (Linux/UNIX) ๐Ÿง
  • /proc provides process metrics (CPU usage, memory footprint, process identity).
  • inotify provides real-time file system notifications for creation, deletion, modification, and metadata changes.
  • POSIX calls like stat, select, read, and kill support low-level monitoring and response behavior.
  1. Concurrency and synchronization ๐Ÿงต๐Ÿ”’
  • pthread is used to run process monitoring, file monitoring, and port scanning in parallel.
  • Mutexes protect shared structures such as process state and scan reports, preventing race conditions.
  • This model keeps the GUI responsive while security tasks run continuously.
  1. Networking and socket scanning ๐Ÿ“ก๐ŸŒ
  • TCP sockets are created in non-blocking mode for efficient scanning.
  • select and getsockopt are used to validate connection state without blocking the entire application.
  • Localhost scanning is used to detect exposed services and suspicious communication surfaces.
  1. Cryptography and integrity verification ๐Ÿ”๐Ÿงฌ
  • OpenSSL EVP and SHA-256 are used to fingerprint file contents.
  • Hash comparisons make it possible to detect real content changes, file replication, and integrity anomalies.
  1. Graphical layer and event loop ๐Ÿ–ฅ๏ธ๐ŸŽ›๏ธ
  • GTK provides windows, dialogs, tables, text views, and interaction components.
  • GLib utilities provide dynamic strings, memory helpers, and main-context callbacks for safe cross-thread UI notifications.
  • Security findings are surfaced visually through alert dialogs and report windows.
  1. Internal data models ๐Ÿงฑ๐Ÿ“š
  • A custom doubly linked list stores evolving process telemetry.
  • A dedicated alert list keeps chronological security notifications.
  • File baseline structures maintain file metadata snapshots for differential analysis.
  1. Security detection strategy ๐Ÿ›ก๏ธโš ๏ธ
  • Rule-based heuristics classify suspicious ports.
  • Resource threshold policies identify abusive processes.
  • Baseline-delta logic detects suspicious filesystem drift.

End-to-End Technical Flow ๐Ÿ”„๐Ÿ›ฐ๏ธ

  1. Startup initializes GTK, mutexes, and monitoring threads โš™๏ธ.
  2. Process monitor reads /proc and updates process telemetry continuously ๐Ÿ“Š.
  3. File monitor receives inotify events and compares against baseline hashes and metadata ๐Ÿ“.
  4. Port scanner runs periodic non-blocking scans and updates shared reports ๐Ÿ“ก.
  5. GUI thread presents alerts and live information to the user in dedicated windows ๐Ÿ–ฅ๏ธ.
  6. Shutdown sequence cancels threads, joins them safely, and frees all shared resources ๐Ÿงน.

How to Run ๐Ÿš€

This project is designed for Linux/UNIX environments because it depends on /proc and inotify.

  1. Install build dependencies (Ubuntu/Debian):
sudo apt update
sudo apt install -y build-essential pkg-config libgtk-3-dev libssl-dev libx11-dev
  1. Go to the project root and compile:
gcc Interfaz.c -o border_guard $(pkg-config --cflags --libs gtk+-3.0) -lssl -lcrypto -pthread
  1. Run the application:
./border_guard
  1. Optional (recommended for full monitoring permissions):
sudo ./border_guard

Quick notes:

  • The GUI opens with buttons for process, port, and file alerts.
  • File monitoring is oriented to mounted paths (especially /media).
  • If pkg-config cannot find GTK, verify libgtk-3-dev is installed.

Final Notes โœ…๐Ÿฐ

Border Guard Antivirus is both a functional defensive platform and a practical systems-security lab ๐Ÿงช. Its strength comes from combining process telemetry, filesystem integrity analysis, and network surface monitoring into one coordinated real-time application ๐Ÿ›ก๏ธ๐Ÿ“ก๐Ÿ“๐Ÿง .

About

๐Ÿ›ก๏ธ Border Guard Antivirus takes place in a realm of cyber-fantasy, where each process represents a creature and every port is a strategic point within the kingdom. This project blends knowledge of Operating Systems with concurrent programming, using execution threads to divide the tasks of patrolling and defending the UNIX system in real time.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages