Skip to content
Back to search

Kunlun-M

KunLun-M — Open-source static code analysis for PHP, Nodejs/JavaScript, Python, Golang, Java and C/C++, with AST-based semantic scanning and one-click AI Agent integration (OpenClaw, Codex, Claude Code, Hermes, and more).

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today

Check it deeper on your machine

It has changed since its scan on 11 Nov 2026.

As a Claude Code plugin, install it and then ask Claude Code:

/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/LoRexxar/Kunlun-M with scanskillsafety

Or from a terminal, clone it and run it:

git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/LoRexxar/Kunlun-M'

It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/lorexxar--kunlun-m/badge.svg)](/listings/lorexxar--kunlun-m)

HTML

<a href="/listings/lorexxar--kunlun-m"><img src="/api/listings/lorexxar--kunlun-m/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

# 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

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 285 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. [中文](README.zh.md) | English
  2. # KunLun-M
  3. [![GitHub release](https://img.shields.io/github/release/LoRexxar/Kunlun-M/all.svg)](https://github.com/LoRexxar/Kunlun-M/releases)
  4. [![license](https://img.shields.io/github/license/LoRexxar/Kunlun-M.svg)](./LICENSE)
  5. ![Python 3.13](https://img.shields.io/badge/python-3.13-blue.svg)
  6. **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.
  7. - **14 languages**: PHP / JavaScript / TypeScript / Python / Java / Go / Ruby / Rust / C / C++ / C# / Kotlin / Lua / Solidity
  8. - **AST graph engine**: Builds a full program graph (call graph, data flow, AST structure) for taint tracking
  9. - **CLI / Console / Web** three modes
  10. - **Built-in AI Agent skill**: One-click integration with Codex / Claude Code / Hermes etc.
  11. ## Quick Start
  12. ```bash
  13. # Install
  14. git clone https://github.com/LoRexxar/Kunlun-M.git && cd Kunlun-M
  15. pip install -r requirements.txt
  16. cp Kunlun_M/settings.py.bak Kunlun_M/settings.py
  17. # Init database
  18. python kunlun.py init
  19. # Scan
  20. python kunlun.py scan -t /path/to/project
  21. # Scan with specific language
  22. python kunlun.py scan -t /path/to/project -lan php
  23. # Export HTML report
  24. python kunlun.py scan -t /path/to/project -f html -o report.html
  25. # Web dashboard
  26. python kunlun.py web -p 9999
  27. ```
  28. ## CLI Commands
  29. ```
  30. python kunlun.py <command> [args]
  31. ```
  32. ### Core Commands
  33. | Command | Description |
  34. |---------|-------------|
  35. | `init` | Initialize / migrate database |
  36. | `reset` | Reset database (clear scan data, TaintChain, legacy ResultFlow, workspace) |
  37. | `scan -t <target>` | Scan target (file, directory, or archive) |
  38. | `console` | Interactive console with graph REPL |
  39. | `web [-p 9999]` | Web dashboard with API |
  40. | `analyze` | AST graph secondary analysis |
  41. | `export-project -p <project>` | Export project to portable archive |
  42. | `import-project -f <archive>` | Import project from archive |
  43. | `export-neo4j -p <project>` | Export AST graph to Neo4j |
  44. ### Scan Parameters
  45. | Parameter | Description |
  46. |-----------|-------------|
  47. | `-t/--target` | Target file/directory (required) |
  48. | `-lan/--language` | Language (php/javascript/python/java/go/ruby/rust/c/cpp/csharp/kotlin/lua/solidity) |
  49. | `-r/--rule` | Specific rules (comma-separated CVI IDs, e.g. `1000,1001`) |
  50. | `-f/--format` | Output format: `csv` (default) / `json` / `md` / `html` / `xml` |
  51. | `-o/--output` | Output file path |
  52. | `-tp/--tamper` | Apply tamper (e.g. wordpress) |
  53. | `-b/--blackpath` | Exclude paths (e.g. `vendor,node_modules`) |
  54. | `--without-vendor` | Skip SCA (vendor vulnerability) scan |
  55. | `--no-cache` | Force rebuild graph (no cache) |
  56. | `-d/--debug` | Debug mode |
  57. ### Other Commands
  58. | Command | Description |
  59. |---------|-------------|
  60. | `export` | Export rules & tampers from database to files |
  61. | `generate rule` | Generate rule template file |
  62. | `generate tamper` | Generate tamper template file |
  63. | `show rule [-k <key>]` | Show rules (filter by language/key) |
  64. | `show tamper` | Show tampers |
  65. | `search vendor <name> <version>` | Search vendor vulnerabilities |
  66. | `plugin <name>` | Run plugin (`entrance_finder` / `php_unserialize_chain_tools`) |
  67. ## Console Mode
  68. Console mode provides an interactive REPL with graph traversal support:
  69. ```bash
  70. python kunlun.py console
  71. KunLun-M> scan
  72. KunLun-M(scan)> set target /path/to/project
  73. KunLun-M(scan)> run
  74. KunLun-M> load 42
  75. KunLun-M(result)> show vuls
  76. KunLun-M(result)> graph # Enter graph traversal REPL
  77. >>> g.function.main.ownout.count
  78. 14
  79. ```
  80. ### Graph Traversal REPL
  81. Inside the graph REPL, use `g` as the entry point for Joern-style graph queries:
  82. ```python
  83. >>> g.function # All function nodes
  84. >>> g.file.index # File named 'index'
  85. >>> g.identifier.session.dfg # Data flow from 'session'
  86. >>> g.function.main.ownout # AST children of main
  87. >>> g.identifier.input.uses # Functions using 'input'
  88. >>> g.function.exec.shortest_path # Shortest path to 'exec'
  89. ```
  90. See [docs/graph-traversal.md](./docs/graph-traversal.md) for the full API reference.
  91. ## Web Dashboard
  92. ```
  93. python kunlun.py web -p 9999
  94. ```
  95. Web mode includes:
  96. - **Dashboard**: Task management, project overview, scan results
  97. - **Graph Analysis**: Interactive Cytoscape.js graph visualization (4 layouts)
  98. - **API**: Token-authenticated REST API for automation
  99. ### Main API Endpoints
  100. ```
  101. POST /api/task/create Create scan task
  102. POST /api/task/create/start Create + auto-start scan
  103. GET /api/task/<task_id>/status Task status
  104. GET /api/task/list Task list
  105. GET /api/task/<task_id>/result Scan results
  106. GET /api/task/<task_id>/taintchain Taint chain data
  107. GET /api/rule/list Rule list
  108. GET /api/graph/query AST graph query
  109. GET /api/graph/subgraph Subgraph extraction (for visualization)
  110. GET /api/graph/chain_subgraph Taint chain subgraph
  111. GET /api/graph/node_vulns Node-associated vulnerabilities
  112. ```
  113. Configure `API_TOKEN` in `Kunlun_M/settings.py` for API authentication.
  114. ## Data Export & Import
  115. ### Project Archive
  116. Export a complete project (database records + graph files) as a portable `.tar.gz`:
  117. ```bash
  118. python kunlun.py export-project -p nodejs
  119. python kunlun.py import-project -f kunlun-export-nodejs-*.tar.gz [--force]
  120. ```
  121. ### Neo4j Graph Export
  122. Export AST graphs to Neo4j for advanced Cypher queries:
  123. ```bash
  124. python kunlun.py export-neo4j -p nodejs --clean
  125. python kunlun.py export-neo4j -s 42 --neo4j-uri bolt://host:7687
  126. ```
  127. See [docs/data-export.md](./docs/data-export.md) for full documentation.
  128. ## AI Agent Integration
  129. If you're using an AI Agent (Codex / Claude Code / Hermes etc.), send:
  130. > Download `https://github.com/LoRexxar/Kunlun-M.git` and load its skill (kunlun-m-general).
  131. The agent will auto-detect `skills/kunlun-m-general/` and follow the docs to initialize and scan.
  132. See [docs/skill_kunlunm_general.md](./docs/skill_kunlunm_general.md) for scripted workflows.
  133. ## Supported Languages
  134. | Language | Semantic Analysis | Graph Engine |
  135. |----------|:-:|:-:|
  136. | PHP | ✅ | ✅ |
  137. | JavaScript | ✅ | ✅ |
  138. | TypeScript | ✅ | ✅ |
  139. | Python | ✅ | ✅ |
  140. | Java | ✅ | ✅ |
  141. | Go | ✅ | ✅ |
  142. | Ruby | ✅ | ✅ |
  143. | Rust | ✅ | ✅ |
  144. | C | ✅ | ✅ |
  145. | C++ | ✅ | ✅ |
  146. | C# | ✅ | ✅ |
  147. | Kotlin | ✅ | ✅ |
  148. | Lua | ✅ | ✅ |
  149. | Solidity | Basic | — |
  150. ## Plugins
  151. ### PHP Deserialization Chain Finder
  152. Automatically discovers PHP deserialization chains and generates PoC files:
  153. ```bash
  154. python kunlun.py plugin php_unserialize_chain_tools -t /path/to/php/project
  155. ```
  156. ### Entrance Finder
  157. Quickly finds potential PHP entry pages in large codebases:
  158. ```bash
  159. python kunlun.py plugin entrance_finder -t /path/to/php/project -l 3
  160. ```
  161. ## Development
  162. ### Rule Development
  163. Rules follow the convention `rules/{language}/CVI_{id}.py`. See `rules/rule.template` for a template.
  164. ### Architecture
  165. ```
  166. core/
  167. ├── __init__.py CLI entry, subcommand dispatch
  168. ├── scanner.py Graph-based scan engine (build graph → taint analysis)
  169. ├── graph/
  170. │ ├── graph_pipeline.py AST → igraph graph builder
  171. │ ├── graph_query_builder.py 6 query methods (overview/file/function/trace/search/subgraph)
  172. │ ├── graph_io.py Graph persistence (GraphMLZ)
  173. │ ├── node_edge_schema.py 12 node types, 9 edge types
  174. │ └── workspace.py Scan workspace management
  175. ├── import_export.py Project archive export/import
  176. ├── neo4j_export.py igraph → Neo4j export
  177. ├── console.py Interactive console + graph REPL
  178. └── engine.py Thin re-export layer
  179. web/
  180. ├── index/ Models, dashboard pages
  181. ├── api/ REST API (session + token auth)
  182. └── dashboard/ Web UI (templates + controllers)
  183. ```
  184. ### Documentation
  185. - [docs/README.md](./docs/README.md) — Documentation index
  186. - [docs/cli.md](./docs/cli.md) — CLI detailed reference
  187. - [docs/architecture.md](./docs/architecture.md) — Architecture overview
  188. - [docs/ast-graph-structure.md](./docs/ast-graph-structure.md) — AST graph schema, branch constraints & guard system
  189. - [docs/data-export.md](./docs/data-export.md) — Export/import & Neo4j
  190. - [docs/graph-traversal.md](./docs/graph-traversal.md) — Graph traversal REPL
  191. - [docs/changelog.md](./docs/changelog.md) — Changelog
  192. ## Changelog
  193. [docs/changelog.md](./docs/changelog.md)
  194. ## Stargazers
  195. <div align=center><a href="https://github.com/LoRexxar/Kunlun-M"><img src="https://star-history.dera.page/svg?repos=LoRexxar/Kunlun-M&type=Timeline"></a></div>
  196. ## 404StarLink Project
  197. ![](https://github.com/knownsec/404StarLink-Project/raw/master/logo.png)
  198. KunLun-M is part of the [404Team StarLink Project](https://github.com/knownsec/404StarLink-Project).
  199. ## Contributors
  200. **Core Developer:**
  201. - [LoRexxar](https://github.com/LoRexxar)
  202. **Important Contributors:**
  203. - Vidar-Team [LuckC4t](https://github.com/LuckyC4t)
  204. - Dubhe [Sissel](https://github.com/boke1208)
  205. **Contributors:**
  206. - Dubhe [Sndav](https://github.com/Sndav), [#jax777](https://github.com/jax777), [lavon321](https://github.com/lavon321), [Raul1718](https://github.com/Raul1718), [akkuman](https://github.com/akkuman)
  207. ## License
  208. [MIT License](./LICENSE)

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.