Skip to content
AshanVimodhPublic

About

ViperScan is a Python-based CLI tool for static malware analysis - file hashing, entropy checks, PE/ELF/Mach-O binary inspection, YARA rule scanning, suspicious string/IOC extraction, and VirusTotal lookups. More features and improvements are planned.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🐍 ViperScan

ViperScan is a Python-based command-line malware analysis tool designed for quick static analysis of suspicious files.

It combines local file analysis with optional YARA scanning and VirusTotal integration, providing useful information such as hashes, entropy, embedded indicators, binary metadata, and detection results directly from the terminal.

Current version: 0.1.1


✨ Features

πŸ”Ž Static File Analysis

ViperScan can analyse individual files or entire directories and collect:

  • File size and extension
  • MIME type
  • File format detection
  • File entropy
  • MD5 hash
  • SHA-1 hash
  • SHA-256 hash

Supported format detection currently includes:

  • PE / Windows executables
  • ELF / Linux executables
  • Mach-O / macOS binaries
  • ZIP archives
  • PDF files
  • Unknown/raw files

🧬 Binary Analysis

ViperScan performs additional analysis when a supported executable format is detected.

PE Files

  • Architecture detection
  • Windows subsystem information
  • Compilation timestamp
  • PE section analysis
  • Section entropy
  • Executable section detection
  • Imported DLLs and functions
  • Detection of interesting API imports
  • Basic packed-binary indicators

Interesting APIs include functions commonly seen during malware analysis such as:

VirtualAlloc, VirtualProtect, WriteProcessMemory, CreateRemoteThread, LoadLibrary, GetProcAddress, and others.

ELF Files

  • Architecture
  • ELF file type
  • Entry point
  • Interpreter
  • Linked libraries
  • Section information

Mach-O Files

  • CPU architecture
  • Mach-O file type
  • Loaded dynamic libraries
  • Runtime paths
  • Multi-architecture/FAT binary detection

πŸ“ String & IOC Extraction

ViperScan extracts ASCII and UTF-16 strings and searches them for potentially useful indicators.

Currently detected indicators include:

  • 🌐 URLs
  • πŸ“§ Email addresses
  • 🌍 IPv4 addresses
  • πŸͺŸ Windows Registry paths
  • ⚠️ Suspicious commands and API names

Examples of suspicious strings include:

powershell
cmd.exe
rundll32
regsvr32
CreateRemoteThread
VirtualAlloc
WriteProcessMemory
/bin/sh
/bin/bash

πŸ§ͺ YARA Support

ViperScan supports scanning files with custom YARA rules.

You can provide either:

  • A single .yar / .yara file
  • A directory containing multiple YARA rules

Example:

viperscan scan suspicious.exe --yara rules/

Or:

python -m viperscan scan suspicious.exe --yara rules/

YARA results include:

  • Rule name
  • Namespace
  • Tags
  • Rule metadata

YARA functionality requires yara-python.


🌐 VirusTotal Integration

ViperScan can query the VirusTotal API for a scanned file.

viperscan scan suspicious.exe --vt

By default, if the file's SHA-256 hash is not already known to VirusTotal, ViperScan uploads the entire file for analysis. To only ever send the file's hash and never upload the file, use --vt-hash-only:

viperscan scan suspicious.exe --vt-hash-only

This is useful for files larger than VirusTotal's public upload limit, which would otherwise fail to upload.

VirusTotal results can include:

  • Malicious detections
  • Suspicious detections
  • Undetected results
  • Harmless results
  • File type information

⚠️ Privacy Warning: Do not upload confidential, private, or sensitive files to VirusTotal. Files submitted to VirusTotal may be shared with security researchers and security vendors.

The current VirusTotal upload limit used by ViperScan is 32 MB.


πŸ“ Directory Scanning

ViperScan can scan an entire directory:

viperscan scan ./samples

Directory scanning is recursive by default.

Disable recursive scanning with:

viperscan scan ./samples --no-recursive

For detailed information about every file:

viperscan scan ./samples --verbose

#️⃣ Hashing

ViperScan also provides a standalone hashing command.

viperscan hash suspicious.exe

Example output:

MD5:    ...
SHA1:   ...
SHA256: ...

Directories can also be hashed:

viperscan hash ./samples

πŸ“Š Report Formats

ViperScan currently supports three output formats:

Text

viperscan scan suspicious.exe

JSON

viperscan scan suspicious.exe --format json

CSV

viperscan scan suspicious.exe --format csv

Results can also be written directly to a file:

viperscan scan suspicious.exe --format json --output report.json

πŸ“ File Size Limits

By default, ViperScan skips files larger than 32 MB.

A custom limit can be supplied using:

viperscan scan ./samples --max-size 50000000

The value can be a raw byte count, or use a size suffix:

  • k / m / g β€” kilobit / megabit / gigabit (SI, base 1000, Γ·8 for bytes)
  • K / M / G β€” kilobyte / megabyte / gigabyte (base 1024)
viperscan scan ./samples --max-size 50M

πŸ› οΈ Installation

Requirements

  • Python
  • Poetry
  • VirusTotal API key (optional)
  • yara-python (optional, required for YARA scanning)

Clone the repository:

git clone https://github.com/YOUR_USERNAME/ViperScan.git
cd ViperScan

Install dependencies:

poetry install

Enter the Poetry environment or run commands through Poetry:

poetry run viperscan --help

ViperScan can also be executed as a Python module:

poetry run python -m viperscan --help

πŸ”‘ VirusTotal API Setup

Create a .env file in the project directory:

VT_API_KEY=your_virustotal_api_key_here

ViperScan automatically loads the API key using python-dotenv.

Never commit your .env file or API key to GitHub.

Make sure .env is included in .gitignore.


πŸ’» Usage

General syntax:

viperscan COMMAND [OPTIONS]

Available commands:

scan    Scan and analyse a file or directory
hash    Calculate hashes for a file or directory

View help:

viperscan --help

Scan help:

viperscan scan --help

πŸš€ Example

Perform local static analysis with YARA and VirusTotal:

viperscan scan suspicious.exe --yara rules/ --vt

Perform the same scan but only send the file's hash (no upload):

viperscan scan suspicious.exe --yara rules/ --vt-hash-only

Generate a JSON report:

viperscan scan suspicious.exe --yara rules/ --vt --format json --output report.json

Scan an entire directory:

viperscan scan ./samples --yara rules/ --verbose

πŸ—‚οΈ Project Structure

viperscan/
β”œβ”€β”€ __init__.py
β”œβ”€β”€ __main__.py
β”œβ”€β”€ binary.py
β”œβ”€β”€ cli.py
β”œβ”€β”€ files.py
β”œβ”€β”€ hashing.py
β”œβ”€β”€ report.py
β”œβ”€β”€ scanner.py
β”œβ”€β”€ sizeparse.py
β”œβ”€β”€ strings.py
β”œβ”€β”€ vt.py
└── yara_scan.py

The project is separated into modules so additional malware-analysis capabilities can be added without making the CLI itself overly complex.


πŸ›£οΈ Planned Improvements

ViperScan is still under active development.

Potential future additions include:

  • Expanded static malware indicators
  • Improved packer detection
  • File reputation scoring
  • More detailed PE analysis
  • Improved YARA rule management
  • Configurable scanning profiles
  • Improved terminal output
  • Additional report formats
  • Batch VirusTotal handling
  • Detection scoring / risk classification

More updates will be added as the project develops.


⚠️ Disclaimer

ViperScan is intended for educational, research, and defensive cybersecurity purposes.

Always analyse suspicious files inside an appropriately isolated environment such as a virtual machine or malware-analysis sandbox.

The author is not responsible for misuse of this software.


πŸ“œ License

See the repository's LICENSE file for licensing information.


ViperScan v0.1.1 🐍 Simple static malware analysis from the command line.

About

ViperScan is a Python-based CLI tool for static malware analysis - file hashing, entropy checks, PE/ELF/Mach-O binary inspection, YARA rule scanning, suspicious string/IOC extraction, and VirusTotal lookups. More features and improvements are planned.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages