How devu-62442/gramac-a-graph-based-malware-classification-mechanism works
Project type and purpose
• This is a standalone Python‐based CLI tool for offline graph‐based malware classification.
• It loads call‐graph files (.gml), compares them to a labeled dataset of Android malware families, and outputs the family name or “UNKNOWN/GOODWARE.”
File structure
• Top‐level script:
• MalwareFamily_Classifier.py – the entry point and orchestrator.
• Dataset folder:
• Contains .gml call-graph files for known malware families.
• Dataset/README.md explaining dataset structure.
• Configuration and CI:
• .github/workflows/codeql-analysis.yml for automated code scanning.
• _config.yml for site/theme config (likely for GitHub Pages docs).
• img folder:
• Documentation images and logos.
• README.md:
• Describes usage, dependencies (networkx, matplotlib, Python), and high‐level workflow.
README for additional insights
• Core library: networkx for graph creation and comparison.
• Data flow: input GML → graph parsing → sensitive API signature matching → graph similarity → classification result → CLI output.
Main components and interactions
a. Components
• CLI Interface
• Input Loader (GML reader)
• Graph Processor (networkx)
• Signature Extractor (sensitive API set)
• Graph Comparator / Classifier
• Dataset Repository (.gml files on disk)
• Output Module (console logger)
• External Services: none (local tool)
• CI Pipeline (GitHub Actions, CodeQL)
b. Relationships & data flow
1. User invokes MalwareFamily_Classifier.py via CLI.
2. CLI Interface parses arguments: path to target GML, dataset path.
3. Input Loader reads target .gml and dataset .gml files.
4. Graph Processor builds NetworkX graphs.
5. Signature Extractor identifies sensitive API nodes in each graph.
6. Classifier computes similarity metrics between target and dataset graphs.
7. Decision logic assigns malware family or “UNKNOWN.”
8. Output Module writes result to console.
9. CI Pipeline (GitHub Actions) runs static analysis on commits.
c. Architectural patterns & principles
• Modular pipeline: each stage (load, process, classify, output) is a separate logical unit.
• Single responsibility: script orchestrates but delegates graph logic to networkx and classifier functions.
• Data‐driven: behavior driven by dataset directory contents.
d. Key technologies
• Python 3.x
• NetworkX (graph structures & algorithms)
• Matplotlib (optional for graph visualization)
• GitHub Actions / CodeQL for CI
Detailed but not over-engineered
• Break the pipeline into as many discrete stages as makes sense for readability.
• File/system I/O, library calls, and CI integration.
• Avoid mixing implementation details (e.g., exact function names)—focus on logical components.