{"id":42879141,"url":"https://github.com/lilendian0x00/xray-knife","last_synced_at":"2026-02-16T23:13:04.519Z","repository":{"id":186812028,"uuid":"675803029","full_name":"lilendian0x00/xray-knife","owner":"lilendian0x00","description":"The Ultimate Swiss Army Knife for Xray and Sing-box","archived":false,"fork":false,"pushed_at":"2025-09-16T08:20:10.000Z","size":2572,"stargazers_count":297,"open_issues_count":11,"forks_count":41,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-09-16T10:22:00.739Z","etag":null,"topics":["cencorship","gfw","sing-box","tunnel","v2ray","xray-core-json"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lilendian0x00.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-08-07T19:00:22.000Z","updated_at":"2025-09-16T08:20:13.000Z","dependencies_parsed_at":"2023-08-07T21:23:41.988Z","dependency_job_id":"f8b51919-e6f3-4879-a05b-296c5c2627b8","html_url":"https://github.com/lilendian0x00/xray-knife","commit_stats":null,"previous_names":["lilendian0x00/xray-knife"],"tags_count":52,"template":false,"template_full_name":null,"purl":"pkg:github/lilendian0x00/xray-knife","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lilendian0x00%2Fxray-knife","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lilendian0x00%2Fxray-knife/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lilendian0x00%2Fxray-knife/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lilendian0x00%2Fxray-knife/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lilendian0x00","download_url":"https://codeload.github.com/lilendian0x00/xray-knife/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lilendian0x00%2Fxray-knife/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28914124,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-30T12:13:43.263Z","status":"ssl_error","status_checked_at":"2026-01-30T12:13:22.389Z","response_time":66,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cencorship","gfw","sing-box","tunnel","v2ray","xray-core-json"],"created_at":"2026-01-30T14:27:02.823Z","updated_at":"2026-02-16T23:13:04.511Z","avatar_url":"https://github.com/lilendian0x00.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# xray-knife 🔪\n\n**The Ultimate Swiss Army Knife for Xray and Sing-box**\n\nA powerful command-line utility and secure web UI designed for managing, testing, and utilizing proxy configurations with dual-core support for both `xray-core` and `sing-box`.\n\n\u003c/div\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://img.shields.io/github/v/release/lilendian0x00/xray-knife?style=for-the-badge\" alt=\"Release Version\"\u003e\n  \u003cimg src=\"https://img.shields.io/github/actions/workflow/status/lilendian0x00/xray-knife/build.yaml?branch=master\u0026style=for-the-badge\" alt=\"Build Status\"\u003e\n  \u003cimg src=\"https://img.shields.io/github/go-mod/go-version/lilendian0x00/xray-knife?style=for-the-badge\" alt=\"Go Version\"\u003e\n  \u003cimg src=\"https://img.shields.io/github/license/lilendian0x00/xray-knife?style=for-the-badge\" alt=\"License\"\u003e\n\u003c/p\u003e\n\n---\n\n[**English**](https://github.com/lilendian0x00/xray-knife/blob/master/README.md) [简体中文](https://github.com/lilendian0x00/xray-knife/blob/master/docs/zh_README.md)\n\n`xray-knife` is a versatile multi-tool that streamlines the process of working with proxy configurations. With its persistent database, it serves as a central hub for all your proxy needs, from managing subscription links to finding the fastest and most reliable connections.\n\n## ✨ Key Features\n\n- **🛡️ Secure Web UI**: Manage all features through an intuitive, browser-based interface protected by secure JWT authentication. On first run, it automatically generates a `root` user with a secure random password.\n\n- **🗄️ Centralized Database**: All data, including subscription links, configurations, and scan results, is now stored in a persistent SQLite database (`~/.xray-knife/xray-knife.db`).\n\n- **📚 Full Subscription Management**: A new `subs` command allows you to add, fetch, list, and remove subscription links, populating your central configuration library.\n\n- **🚀 Dual-Core Engine**: Seamlessly works with both `xray-core` and `sing-box`, automatically selecting the right core for each configuration type (VLESS, VMess, Trojan, Shadowsocks, Hysteria2, WireGuard, etc.).\n\n- **🔬 Advanced Proxy Tester**: Concurrently test hundreds of configs for real latency, speed, and IP location. Test from a file or pull directly from your database using powerful filters.\n\n- **🔄 Auto-Rotating Proxy**: Run a local SOCKS/HTTP proxy that automatically finds the fastest, working outbound from your database and rotates it on a schedule or on-demand.\n\n- **🌐 Powerful IP Scanner**: Discover optimal Cloudflare edge IPs by scanning entire CIDR ranges for latency and speed. Results are saved to the database for future use.\n\n- **🔎 Universal Config Parser**: Decode any configuration link into a human-readable breakdown or generate a full, clean `xray-core` compatible JSON file.\n\n## 📦 Installation\n\n### From GitHub Releases (Recommended)\n\nYou can download the latest pre-compiled binary for your operating system from the [**GitHub Releases**](https://github.com/lilendian0x00/xray-knife/releases) page.\n\n**Example for Linux:**\n```bash\nwget https://github.com/lilendian0x00/xray-knife/releases/latest/download/Xray-knife-linux-64.zip\nunzip Xray-knife*.zip\ncd Xray-knife-linux\nchmod +x xray-knife\n./xray-knife --help\n```\n\n### Using `go install`\n\nIf you have Go (1.25) installed, you can build and install `xray-knife` with a single command:\n```bash\ngo install github.com/lilendian0x00/xray-knife/v7@latest\n```\n\n### Arch linux aur\nyou can find package in [AUR](https://aur.archlinux.org/packages/xray-knife-bin) or use command bellow te get the latest version on Arch linux\n```bash\nyay -S xray-knife-bin ||\nparu -S xray-knife-bin ||\npikaur -S xray-knife-bin\n```\n\n## 🛠️ Usage\n\n`xray-knife` is a command-line tool with a clear and consistent command structure:\n`xray-knife [command] [flags]`\n\nHere are some practical examples for the main commands.\n\n---\n\n### 🖥️ Using the Web UI (`webui`)\n\nLaunch a local web server to access all of `xray-knife`'s features through a modern, secure graphical user interface.\n\n**1. Start the Web UI Server (First Run)**\nOn its first run, `xray-knife` will automatically generate secure credentials and save them to `~/.xray-knife/webui.conf`. The password will be printed to the console.\n\n```bash\nxray-knife webui\n```\n*Console Output on first run:*\n```\n...\n[ℹ️] Generating new credentials for Web UI...\n[✅] Credentials saved to /home/user/.xray-knife/webui.conf\n[+] Starting Web UI server on http://127.0.0.1:8080\n\n--- Please use the following credentials to log in ---\nUsername: root\nPassword: a_very_secure_random_password\n-----------------------------------------------------\n\n[i] Press CTRL+C to stop the server.\n```\nOpen `http://127.0.0.1:8080` in your browser and log in with the generated credentials.\n\n**2. Run with Custom Credentials**\n\nYou can override the config file using flags or environment variables. This is useful for server deployments.\n```bash\nxray-knife webui --auth.user myadmin --auth.password 's3cur3p@ss' --auth.secret 'a_very_long_and_random_string'\n```\n\u003e For more details on credential priority, see the `xray-knife webui --help` command.\n\n---\n\n### 📚 Managing Subscriptions (`subs`)\n\nBuild your central configuration library using subscription links.\n\n**1. Add and Fetch Subscriptions**\n```bash\n# Add a subscription with a custom name\nxray-knife subs add --url \"YOUR_SUBSCRIPTION_URL\" --remark \"My Subs\"\n\n# List all your subscriptions\nxray-knife subs show\n\n# Fetch all configs from the subscription with ID 1\nxray-knife subs fetch --id 1\n```\n\n---\n\n### 🧪 Testing Configs (`http`)\n\nTest proxy configurations for latency, speed, and more.\n\n**1. Test**\n\nThis is the new, powerful way to test configs. It pulls directly from the library you built with the `subs` command.\n\n```bash\n# Test configs from a file, with a speed test\nxray-knife http -f ./configs.txt --speedtest\n\n# Test up to 100 'vless' configs from your database, with a speed test\nxray-knife http --from-db --limit 100 --protocol vless --speedtest\n\n# Test all configs belonging to subscription ID 1\nxray-knife http --from-db --sub-id 1\n```\n\n**2. List Results**\nView a summary of the results from the most recent test run.\n```bash\nxray-knife http list-results --limit 20\n```\n\n---\n\n### 🔄 Auto-Rotating Proxy (`proxy`)\n\nRun a local proxy that intelligently manages and rotates your outbound connections.\n\n**1. Run a Rotating SOCKS5 Proxy from the Database**\n\nStart a local SOCKS5 proxy on port `9999`. It will load all enabled configs from your database and automatically rotate to the best-performing one every 5 minutes (300 seconds).\n\n```bash\n# Proxy to configs from a file\nxray-knife proxy --inbound socks -f ./configs.txt --port 9999 --rotate 300\n\n# Proxy to configs from your database\nxray-knife proxy --inbound socks --port 9999 --rotate 300\n```\n\u003e **Pro Tip:** While the proxy is running, simply press `Enter` in the terminal to force an immediate rotation to the next available fast configuration.\n\n---\n\n### 🌐 Scanning for Cloudflare IPs (`cfscanner`)\n\nFind the fastest Cloudflare edge IPs for your location. Results are automatically saved to the database.\n\n**1. Scan Subnets with a Speed Test**\n\nScan subnets from a file, perform a speed test on the top 10 fastest IPs, and save results.\n```bash\nxray-knife cfscanner -s subnets.txt --speedtest --speedtest-top 10\n```\n\n**2. Resume and View Results**\n```bash\n# Continue a previous scan, skipping already tested IPs\nxray-knife cfscanner -s subnets.txt --resume\n\n# View the best IPs from all previous scans, sorted by performance\nxray-knife cfscanner list-results --limit 25\n```\n\n---\n\n### 🔎 Parsing a Config Link (`parse`)\n\nDecode and inspect any configuration link.\n\n**1. Get a Human-Readable Breakdown**\nDisplay a detailed summary of a configuration link.\n```bash\nxray-knife parse -c \"trojan://...\"\n```\n\n**2. Generate Full JSON Config**\n\nGenerate a complete, clean, and ready-to-use `xray-core` compatible JSON configuration.\n```bash\nxray-knife parse -c \"vless://...\" --json \u003e my_config.json\n```\n\n---\n\n## 🏗️ Build from Source\n\nTo build `xray-knife` from the source code, clone the repository and build the main package.\n\n```bash\ngit clone https://github.com/lilendian0x00/xray-knife.git\ncd xray-knife\n\n# Build for all supported platforms (Linux, Windows, macOS)\n./build.sh all\n\n# Or build for your current platform\ngo build -o xray-knife .\n```\nThe compiled binary will be placed in `build` or the current directory based on your choice.\n\n## 🤝 Contributing\n\nContributions are welcome! If you find a bug or have a feature request, please open an issue. If you'd like to contribute code, please open a pull request.\n\n## 📄 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flilendian0x00%2Fxray-knife","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flilendian0x00%2Fxray-knife","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flilendian0x00%2Fxray-knife/lists"}