KunLun-M — 用于 PHP、Nodejs/JavaScript、Python、Golang、Java 和 C/C++ 的开源静态代码分析工具,具有基于 AST 的语义扫描和一键启动 AI 代理
KunLun-M — 用于 PHP、Nodejs/JavaScript、Python、Golang、Java 和 C/C++ 的开源静态代码分析工具,具有基于 AST 的语义扫描和一键启动 AI 代理
中文 | English
KunLun-M(昆仑镜) is an open-source static code security analysis system. It builds an AST graph from source code and performs taint analysis to detect vulnerabilities.
# Install
git clone https://github.com/LoRexxar/Kunlun-M.git && cd Kunlun-M
pip install -r requirements.txt
cp Kunlun_M/settings.py.bak Kunlun_M/settings.py
# Init database
python kunlun.py init
# Scan
python kunlun.py scan -t /path/to/project
# Scan with specific language
python kunlun.py scan -t /path/to/project -lan php
# Export HTML report
python kunlun.py scan -t /path/to/project -f html -o report.html
# Web dashboard
python kunlun.py web -p 9999
python kunlun.py <command> [args]
init
Initialize / migrate database
reset
Reset database (clear scan data, TaintChain, legacy ResultFlow, workspace)
scan -t <target>
Scan target (file, directory, or archive)
console
Interactive console with graph REPL
web [-p 9999]
Web dashboard with API
analyze
AST graph secondary analysis
export-project -p <project>
Export project to portable archive
import-project -f <archive>
Import project from archive
export-neo4j -p <project>
Export AST graph to Neo4j
-t/--target
Target file/directory (required)
-lan/--language
Language (php/javascript/python/java/go/ruby/rust/c/cpp/csharp/kotlin/lua/solidity)
-r/--rule
Specific rules (comma-separated CVI IDs, e.g. 1000,1001)
-f/--format
Output format: csv (default) / json / md / html / xml
-o/--output
Output file path
-tp/--tamper
Apply tamper (e.g. wordpress)
-b/--blackpath
Exclude paths (e.g. vendor,node_modules)
--without-vendor
Skip SCA (vendor vulnerability) scan
--no-cache
Force rebuild graph (no cache)
-d/--debug
Debug mode
export
Export rules & tampers from database to files
generate rule
Generate rule template file
generate tamper
Generate tamper template file
show rule [-k <key>]
Show rules (filter by language/key)
show tamper
Show tampers
search vendor <name> <version>
Search vendor vulnerabilities
plugin <name>
Run plugin (entrance_finder / php_unserialize_chain_tools)
Console mode provides an interactive REPL with graph traversal support:
python kunlun.py console
KunLun-M> scan
KunLun-M(scan)> set target /path/to/project
KunLun-M(scan)> run
KunLun-M> load 42
KunLun-M(result)> show vuls
KunLun-M(result)> graph # Enter graph traversal REPL
>>> g.function.main.ownout.count
14
Inside the graph REPL, use g as the entry point for Joern-style graph queries:
>>> g.function # All function nodes
>>> g.file.index # File named 'index'
>>> g.identifier.session.dfg # Data flow from 'session'
>>> g.function.main.ownout # AST children of main
>>> g.identifier.input.uses # Functions using 'input'
>>> g.function.exec.shortest_path # Shortest path to 'exec'
See docs/graph-traversal.md for the full API reference.
python kunlun.py web -p 9999
Web mode includes:
…
Configure API_TOKEN in Kunlun_M/settings.py for API authentication.
Export a complete project (database records + graph files) as a portable .tar.gz:
python kunlun.py export-project -p nodejs
python kunlun.py import-project -f kunlun-export-nodejs-*.tar.gz [--force]
Export AST graphs to Neo4j for advanced Cypher queries:
python kunlun.py export-neo4j -p nodejs --clean
python kunlun.py export-neo4j -s 42 --neo4j-uri bolt://host:7687
See docs/data-export.md for full documentation.
If you're using an AI Agent (Codex / Claude Code / Hermes etc.), send:
Download
https://github.com/LoRexxar/Kunlun-M.gitand load its skill (kunlun-m-general).
The agent will auto-detect skills/kunlun-m-general/ and follow the docs to initialize and scan.
See docs/skill_kunlunm_general.md for scripted workflows.
Automatically discovers PHP deserialization chains and generates PoC files:
python kunlun.py plugin php_unserialize_chain_tools -t /path/to/php/project
Quickly finds potential PHP entry pages in large codebases:
python kunlun.py plugin entrance_finder -t /path/to/php/project -l 3
Rules follow the convention rules/{language}/CVI_{id}.py. See rules/rule.template for a template.
…
KunLun-M is part of the 404Team StarLink Project.
Core Developer:
Important Contributors:
Contributors:
暂无开放 Issues,或尚未同步最近议题。