Skip to content

Latest commit

ย 

History

22 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Z-Sans Asset Breeding Engine

Z-Sans Logo

Z-Sans

๐Ÿ”ฅ "A Lightweight Automated Asset Collection System Powered by an Asset Breeding Engine"
License Python 3.9+ Version
English | ไธญๆ–‡ | Online Docs | Releases

๐Ÿ“– Documentation: The full user & developer documentation (User Guide, CLI Reference, Configuration Reference, Web Console, Plugin Development, Events, Architecture, and more) is available at https://sansjtw1.github.io/Z-Sans/docs/ โ€” with English and ็ฎ€ไฝ“ไธญๆ–‡ versions.

๐Ÿš€ Project Overview

Z-Sans is a cybersecurity tool built around an innovative Asset Breeding Engine that automates attack-surface discovery and mapping. Starting from a small set of seed assets (domains or URLs), Z-Sans systematically discovers and expands digital assets โ€” domains, IP addresses, URLs, ports, and JavaScript resources โ€” applying configurable breeding strategies to grow an asset graph, and then produces detailed reports (JSON, CSV, GraphML, HTML).

โœจ Key Features

  • Multi-Asset Discovery: Domains, IPs, URLs, ports, JS files, and their relationships
  • Concurrent Breeding: Multithreaded asset queue processing for faster scans
  • Configurable Strategies: priority_based, depth_first, breadth_first, time_based
  • Checkpoint & Resume: Save progress to a checkpoint, resume interrupted scans with --resume
  • Change Monitoring: --watch mode rescans on a schedule and reports asset changes via Webhook
  • Flexible Output: JSON, CSV, GraphML, and localized multi-tab HTML reports
  • Interactive Topology Map: Canvas-based asset graph with pan/zoom in the HTML report
  • Tool Integration: Subfinder, naabu, EHole, plus built-in lightweight resolvers
  • Plugin System: Event-driven plugin framework for custom reports, external intel, Webhook notifications, and more (see the Plugin Development Guide)
  • Internationalization: Built-in Chinese (zh_CN) and English (en) support
  • Modular Design: Core engine decoupled from tool implementations for easy extension

๐Ÿ› ๏ธ Project Structure

Z-Sans/
โ”œโ”€โ”€ assets/                 # External tool scripts (port scanner, DNS resolver, JSFinder, etc.)
โ”œโ”€โ”€ core/
โ”‚   โ”œโ”€โ”€ breeders/           # Asset breeding algorithms per asset type
โ”‚   โ”œโ”€โ”€ tools/              # Tool integrations and orchestrator
โ”‚   โ”œโ”€โ”€ i18n.py             # Internationalization
โ”‚   โ”œโ”€โ”€ output.py           # Report / format exporters
โ”‚   โ””โ”€โ”€ zsans_engine.py     # Core breeding engine, asset graph, priority queue
โ”œโ”€โ”€ i18n/                   # Locale resources (en / zh_CN)
โ”œโ”€โ”€ images/                 # Documentation images
โ”œโ”€โ”€ plugins/                # Plugin directory (event-driven extensions)
โ”œโ”€โ”€ templates/              # Config templates
โ”œโ”€โ”€ breeding-config.yaml    # Main configuration
โ”œโ”€โ”€ main.py                 # Entry point / CLI
โ”œโ”€โ”€ CHANGELOG.md            # v0.0.4 โ†’ v0.0.5 release notes
โ””โ”€โ”€ requirements.txt        # Python dependencies

๐Ÿงฉ Plugin System

Z-Sans ships with an event-driven plugin framework: drop any .py file into the plugins/ directory and it is auto-loaded, receiving scan-lifecycle events as they fire. Use it for custom reports, external threat intelligence (e.g. Shodan), vulnerability scanning, Webhook notifications, audit logging, and more.

  • Zero-config loading: .py files under plugins/ auto-register โ€” no main-program changes needed
  • 8 event hooks: on_scan_started / on_scan_completed / on_scan_stopped / on_asset_scanned / on_asset_discovered / on_asset_excluded / on_asset_eliminated / on_asset_failed
  • Unified output: plugin artifacts land in the same output/<timestamp>/ subdirectory as the main output
  • Management commands: --list-plugins to list loaded plugins, --plugin-info <name> for details
  • Config switch: disable individual plugins via plugins.disabled in breeding-config.yaml

See the Plugin Development Guide for the full authoring guide.

๐Ÿ’ก Installation

Requirements

  • Python 3.9+
  • OS: Windows / Linux / macOS

Steps

git clone https://github.com/sansjtw1/Z-Sans.git
cd Z-Sans
pip install -r requirements.txt

Optional: point subfinder / naabu / ehole paths under external_tools.paths in breeding-config.yaml.

๐Ÿ“‹ Usage

# Scan from a domain seed
python main.py -d example.com

# Scan from URL seeds
python main.py -u https://example.com

# Custom config and output dir
python main.py -c your-config.yaml -d example.com -o results

# Verbose logging
python main.py -d example.com -v

# Resume a previous interrupted scan
python main.py -d example.com --resume

# Continuous change monitoring (delta + webhook alerts)
python main.py -d example.com --watch

# Set max discovery depth
python main.py -d example.com --depth 4

# Start the web console (project browser, live task logs, config/plugin management)
python main.py --web

# Web console on a custom port
python main.py --web --port 9000

Command Line Options

-c, --config    Config file path (default: breeding-config.yaml)
-d, --domain    Add domain seed (repeatable)
-u, --url       Add URL seed (repeatable)
-o, --output    Output directory (default: output)
-v, --verbose   Verbose output
--init          Create a default config file
--version       Show version
--depth         Max discovery depth
--resume        Continue from the last checkpoint
--watch         Periodic rescan + change reporting + webhook push
--web           Start the web console (default port: 8050)
--port          Web console port
--list-plugins  List loaded plugins and exit
--plugin-info   Show details for a plugin by name

๐ŸŒ Web Console

The web console is a browser-based management interface for scan projects, live tasks, configuration, and plugins. It is served entirely by the standard library โ€” no separate frontend build or external CDN is required.

python main.py --web            # http://0.0.0.0:8050
python main.py --web --port 9000

Authentication

The web console is unauthenticated by default (binds to 127.0.0.1). Set the ZSANS_WEB_PASSWORD environment variable to require a password:

# Browser: a login page is shown; after login you get an HttpOnly session cookie
ZSANS_WEB_PASSWORD='your-secret' python main.py --web

# Third-party API clients: pass the password directly as a token,
# no login round-trip needed:
curl -H "Authorization: Bearer your-secret" http://127.0.0.1:8050/api/tasks
curl -H "X-API-Key: your-secret" http://127.0.0.1:8050/api/projects

When enabled, every endpoint requires authorization until you log in.

Features:

  • Project browser โ€” browse historical scan runs under output/, view the asset graph, analysis charts, and interactive topology
  • New scan task โ€” start scans from domain / URL / IP seeds with custom depth, strategy, and concurrency, all in a background thread
  • Live tasks โ€” real-time streaming logs (SSE), stop / rescan completed runs
  • Config editor โ€” view and edit breeding-config.yaml online with YAML validation
  • Plugin manager โ€” enable / disable plugins without restarting
  • Project compare โ€” diff two runs to find assets only present in either

web1 web2

๐Ÿ’ป Configuration

Main sections of breeding-config.yaml:

  • strategy โ€” breeding strategy: priority_based / depth_first / breadth_first / time_based
  • asset_scope โ€” restrict results to seed domains / IP ranges, include subdomains; seed_scope controls seed expansion: registrable (default, expand to the registrable domain via the bundled Public Suffix List โ€” www.example.com also covers example.com, while example.co.uk stays itself instead of matching any *.co.uk) or exact (no expansion, only the seed domain and its own subdomains)
  • concurrency.max_tasks โ€” number of parallel asset-processing workers
  • max_depth โ€” global breeding depth
  • asset_types โ€” per-type enable switches, depth limits, priorities, and tool toggles
  • resource_limits โ€” maximum counts per asset type
  • checkpoint โ€” enable/disable resume, save interval, checkpoint file path
  • monitoring โ€” --watch interval and Webhook URL for change alerts
  • output โ€” output dir, format toggles, keep eliminated assets, auto-open report
  • external_tools.paths โ€” paths to subfinder / naabu / ehole
  • language.default_language โ€” en or zh_CN
  • exclusions โ€” domains / IPs / URL keywords / regex patterns to skip
  • http โ€” timeout, retries, user-agent, SSL verification, proxy, redirects behavior

Example: Checkpoint & Monitoring

max_depth: 4
concurrency:
  max_tasks: 20

output:
  dir: output
  formats:
    json: true
    csv: true
    graphml: true
    html: true

checkpoint:
  enabled: true        # save progress periodically
  interval: 50         # every N assets processed
  file: null           # default: <output_dir>/<timestamp>/checkpoint.json

monitoring:
  enabled: false
  interval: 3600       # re-scan every hour
  webhook_url: null    # POST JSON change notifications when set

๐ŸŽฏ Output

Each scan writes to a timestamped subdirectory under output/, containing:

  • *.json โ€” full asset graph (format: json / graphml)
  • *_assets.csv / *_relations.csv โ€” assets and relations (for Excel-friendly)
  • *_graphml โ€” GraphML relationship graph
  • *_report.html โ€” interactive report with Overview, Topology, Active Assets, Eliminated, and Metrics tabs (filters, search and topology drag/zoom)

html-output

๐Ÿ“ƒ Disclaimer

Important: Use Z-Sans only on systems you are explicitly authorized to test. Operators must comply with all applicable laws and regulations; the developers assume no liability for misuse or any direct/indirect damage caused by the tool.

๐Ÿค Contributing

We welcome contributions. Please fork, branch, commit, and open a pull request. Spanish or Chinese improvements are appreciated.

๐Ÿ“ƒ License

MIT โ€” see LICENSE.

๐Ÿ“ž Contact

Email: sansjtw@163.com GitHub: https://github.com/sansjtw1 Telegram: https://t.me/sansjtw

About

Automated Asset Collection System Based on Asset Breeding Engine

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages