Skip to content

SwezyDev/Triage-Fetch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›‘οΈ Triage-Fetch πŸ›‘οΈ


Leave a ⭐ if you like this Repository


πŸš€ Project Overview

Triage-Fetch is a malware intelligence automation tool that monitors the Triage API for newly detected malware samples. It automatically fetches detailed analysis reports, extracts key indicators, and delivers them to Telegram in real-time.

The application runs as a persistent listener, continuously polling Triage for new samples matching your configured criteria (malware families and/or tags), then processes and distributes analysis data through Telegram with structured reports and raw sample files.

Important

This tool requires valid Triage API credentials (Researcher License) and Telegram Bot credentials to function. Ensure you have proper authorization before using this tool.


✨ Features

  • πŸ” Automated Malware Monitoring β€” Continuously polls Triage API for new samples matching your filters.
  • πŸ“Š Comprehensive Analysis Extraction β€” Automatically pulls and extracts:
    • Malware family and type
    • SHA256 and file hashes
    • File size and metadata
    • Threat scores and classifications
    • YARA rules matches
    • C2 addresses and network indicators
    • Behavioral analysis results
  • πŸ“€ Telegram Integration β€” Sends formatted analysis reports directly to your Telegram:
    • Direct messages to personal chats
    • Group messages with forum topic support
    • HTML formatted reports with detailed metadata
  • πŸ’Ύ Local Report Storage β€” Automatically saves:
    • Plain text analysis reports
    • JSON configuration files with extracted data
    • XOR-encrypted malware samples (.malware extension)
  • 🎯 Flexible Filtering β€” Configure detection by:
    • Malware families (e.g., xworm, emotet, etc.)
    • Custom tags
    • Threat score thresholds
  • πŸ€– Bot Command Handler β€” Real-time Telegram commands:
    • /get <sample_id> β€” Fetch a specific sample on-demand
  • πŸ’Ύ Persistent Tracking β€” Automatically remembers processed samples:
    • Stores Malware Hashes in seen_hashes.db
    • Prevents reprocessing on restart
    • Resumes monitoring seamlessly after restarts
  • ⏱️ Configurable Polling β€” Adjust polling interval and max results per poll
  • 🎨 Beautiful CLI β€” Colored terminal output with timestamps and status indicators

🧭 How It Works

  1. Configuration: Set up your Triage API key, Telegram bot token, and filtering criteria in config.json
  2. Start Listener: Run python main.py
  3. The tool will:
    • Query the Triage API for samples matching your filters
    • Mark current samples as baseline (won't reprocess existing ones)
    • Enter monitoring mode, polling at your configured interval
    • Automatically process and report any new samples via Telegram
    • Handle incoming bot commands for on-demand analysis
  4. Receive Updates: Get notifications in your personal Telegram chat and/or group

βœ… Fully automated β€” runs continuously once configured.


🧰 Requirements

  • 🐍 Python 3.9+
  • πŸ“¦ Dependencies:
pip install requests colorama

βš™οΈ Configuration

Edit config.json to configure the application:

{
    "triage": {
        "api_key": "your_triage_api_key_here",
        "malware_family": ["xworm", "emotet"],
        "malware_tags": ["trojan", "ransomware"],
        "poll_interval": 30,
        "max_results": 50
    },
    "telegram": {
        "bot_token": "your_telegram_bot_token_here",
        "chat_id": "your_personal_chat_id",
        "group_id": "your_group_chat_id",
        "topic_id": "forum_topic_id_optional"
    }
}

Configuration Options:

  • api_key β€” Your Triage API authentication token
  • malware_family β€” Filter by malware family names (string or list)
  • malware_tags β€” Filter by tags (array)
  • poll_interval β€” Seconds between API polls (default: 30)
  • max_results β€” Maximum results per poll (default: 50)
  • bot_token β€” Your Telegram bot token (obtained from @BotFather)
  • chat_id β€” Your personal Telegram chat ID (optional, for direct messages)
  • group_id β€” Target group chat ID (optional, for group notifications)
  • topic_id β€” Forum/topic ID within group (optional, for threaded messages)

πŸ“ Repository Structure

β”œβ”€ fetcher/ βž” Core application modules
β”‚  β”œβ”€ banner.py βž” CLI banner and startup display
β”‚  β”œβ”€ bot.py βž” Telegram bot command handler (/get commands)
β”‚  β”œβ”€ config.py βž” Configuration file loader
β”‚  β”œβ”€ formatter.py βž” Data extraction and formatting utilities
β”‚  β”œβ”€ sniper.py βž” Automate something with the fetched C2s
β”‚  β”œβ”€ telegram.py βž” Telegram Bot API integration
β”‚  └─ triage.py βž” Triage API client (search, download, fetch)
β”œβ”€ scripts/ βž” Utility scripts for sample management
β”‚  β”œβ”€ decode_sample.py βž” Python Script to decode .malware files
β”‚  β”œβ”€ delete_db.bat βž” Windows batch script to delete the entire Seen Hashes Database
β”‚  β”œβ”€ delete_db.sh βž” Linux/macOS shell script to delete the entire Seen Hashes Database
β”‚  β”œβ”€ delete_reports.bat βž” Windows batch script to delete reports folder
β”‚  └─ delete_reports.sh βž” Linux/macOS shell script to delete reports folder
β”œβ”€ config.json βž” Configuration file (Triage API key, Telegram token, ...)
β”œβ”€ main.py βž” Main application logic and listener loop
β”œβ”€ LICENSE βž” MIT License file
└─ README.md βž” This file

πŸš€ Usage

1. Install Dependencies

pip install requests colorama

2. Configure Credentials

# Edit config.json with your:
# - Triage API key
# - Telegram bot token
# - Chat IDs for notifications
# - Fetch Configurations

3. Run the Application

python main.py

4. Telegram Commands

Once running, interact with your Telegram bot:

/get <sample_id>   # Fetch a specific sample on-demand

πŸ› οΈ Scripts & Utilities

The scripts/ folder contains helper utilities for managing reports and samples:

decode_sample.py

Decodes XOR-encrypted .malware files back to their original binary format.

Usage:

# Linux/macOS
python ./scripts/decode_sample.py "reports/xworm/abc123.../filename.malware"

# Windows
python .\scripts\decode_sample.py "reports\xworm\abc123...\filename.malware"

What it does:

  • Takes a .malware file as input
  • XOR-decodes it with key 0xAA (reverses the encryption applied during download)
  • Outputs the original binary file (without the .malware extension)
  • Example: filename.malware β†’ filename.exe

⚠️ Note: The decoded file is the actual malware binary. Handle with care in isolated environments.

delete_reports.sh / delete_reports.bat

Safely removes all downloaded reports and samples with confirmation prompt.

Usage:

# Linux/macOS
./scripts/delete_reports.sh

# Windows
.\scripts\delete_reports.bat

What it does:

  • Prompts for confirmation before deletion
  • Permanently deletes the entire reports/ folder and all contents
  • Useful for cleanup or starting fresh
  • Requires manual confirmation (Ctrl+C to cancel)

delete_db.sh / delete_db.bat

Safely delete your Seen Hashes Database with confirmation prompt.

Usage:

# Linux/macOS
./scripts/delete_db.sh

# Windows
.\scripts\delete_db.bat

What it does:

  • Prompts for confirmation before deletion
  • Permanently deletes the entire seen_hashes.db file
  • Useful for cleanup or starting fresh
  • Requires manual confirmation (Ctrl+C to cancel)

πŸ“‹ Data Output

The application creates a structured directory hierarchy for reports:

reports/
β”œβ”€ <malware_family>/
β”‚  β”œβ”€ <sha256>/
β”‚  β”‚  β”œβ”€ report.txt         βž” Plain text analysis report
β”‚  β”‚  β”œβ”€ config.json        βž” Extracted metadata (JSON)
β”‚  β”‚  └─ <filename>.malware βž” XOR-encrypted sample
β”‚  └─ <malware_family>/
β”‚     └─ ...

Each report includes:

  • Metadata: File info, hashes, threat scores
  • Detection: YARA rules, family classification
  • Network: C2 addresses, domains, IPs
  • Behavior: API calls, process analysis
  • Timestamps: Submission and analysis dates

πŸ“Ί Preview

Watch the demo


πŸ” Security Notes

  • βœ… The application XOR-encrypts downloaded samples with key 0xAA (prevents accidental execution)
  • πŸ”’ API keys are transmitted securely via HTTPS to Triage
  • πŸ“Œ Telegram tokens should be kept private and rotated if exposed

βš–οΈ License

Distributed under the MIT License. See LICENSE for more information.


πŸ“ Notes

  • This tool is designed for cybersecurity researchers and threat intelligence professionals
  • Only monitors publicly available malware analysis data from Triage
  • Respects Triage API rate limits and polling intervals
  • No data is stored or transmitted beyond your local system and configured Telegram chats

🚨 Disclaimer

This project is intended for legitimate cybersecurity research and threat intelligence purposes only. Users are responsible for compliance with all applicable laws and regulations. Unauthorized access to systems or excessive API usage is prohibited. The author assumes no liability for misuse of this tool.

About

A lightweight Telegram bot that monitors tria.ge for new malware submissions, extracts family, C2, and config data, and delivers structured reports with safely encoded samples to individuals or group topics.

Topics

Resources

License

Stars

Watchers

Forks

Contributors