redblue-cli 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,724 @@
1
+ <div align="center">
2
+
3
+ # redblue
4
+
5
+ **The Ultimate Security Arsenal in a Single Binary**
6
+
7
+ [![Rust](https://img.shields.io/badge/rust-1.70%2B-orange.svg)](https://www.rust-lang.org)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
9
+ [![CI](https://github.com/forattini-dev/redblue/workflows/CI/badge.svg)](https://github.com/forattini-dev/redblue/actions/workflows/ci.yml)
10
+ [![GitHub release](https://img.shields.io/github/v/release/forattini-dev/redblue?include_prereleases&label=latest)](https://github.com/forattini-dev/redblue/releases)
11
+
12
+ *90+ security commands. 40+ protocols from scratch. Zero dependencies. 100% Rust.*
13
+
14
+ ```bash
15
+ curl -fsSL https://raw.githubusercontent.com/forattini-dev/redblue/main/install.sh | bash
16
+ ```
17
+
18
+ [**Documentation**](https://forattini-dev.github.io/redblue/) |
19
+ [Quick Start](#quick-start) |
20
+ [Install](#installation)
21
+
22
+ </div>
23
+
24
+ ---
25
+
26
+ ## What is redblue?
27
+
28
+ **redblue** replaces your entire security toolkit with a single, self-contained binary.
29
+
30
+ No installation scripts. No dependency chains. No version conflicts. Just download and execute.
31
+
32
+ Need JavaScript integration? The optional `redblue-cli` npm package wraps the same `rb` binary, supports `npx` and `npm exec`, and exposes a programmatic SDK for Node.js consumers.
33
+
34
+ Every network protocol is implemented **from scratch** using only Rust's standard library. DNS, HTTP/1.1, HTTP/2, TLS 1.2, TLS 1.3, Kerberos, SSH, LDAP, SMB, and 30+ more -- all built from first principles with only `libc` as a dependency.
35
+
36
+ ### At a Glance
37
+
38
+ | Metric | Value |
39
+ |--------|-------|
40
+ | Lines of Rust | 479,000+ |
41
+ | CLI commands | 90+ |
42
+ | Protocols from scratch | 40+ |
43
+ | Secret detection patterns | 180+ |
44
+ | Crypto primitives | 18+ |
45
+ | Runtime dependencies | 1 (`libc`) |
46
+
47
+ ---
48
+
49
+ ## Features
50
+
51
+ | Category | Capabilities |
52
+ |----------|-------------|
53
+ | **Network** | SYN/UDP/Stealth scanning, OS fingerprinting, service detection, traceroute, netcat, ping, health monitoring |
54
+ | **DNS** | Record lookup, zone transfer, DNS server with hijacking, DNS-over-HTTPS, DNS fingerprinting |
55
+ | **Recon** | Subdomain bruteforce/passive, WHOIS, RDAP, CT logs, Wayback, email/username OSINT, breach detection, IP intel, Google dorking |
56
+ | **Web** | Fuzzing (dir/vhost/param), CMS fingerprinting, crawling, DOM parsing, CSS selectors, HAR recording, .git scanner |
57
+ | **TLS** | Cipher enumeration, certificate audit, Heartbleed detection, OCSP check, CT log verification, JA3/JA3S fingerprinting |
58
+ | **Auth** | Credential testing (Basic/Digest/Form/SSH/FTP/SMTP), brute-force with rate limiting and lockout detection |
59
+ | **Exploit** | Privesc enumeration, lateral movement, persistence, reverse shells, browser exploitation, payload generation, CVE database |
60
+ | **Binary** | ELF/PE parsing, checksec, ROP gadget finder, shellcode generation, format string analysis, packing detection |
61
+ | **Password** | Hash cracking (dictionary/mask/hybrid), bcrypt, auto format detection, mutation rules |
62
+ | **Evasion** | Sandbox/VM detection, string obfuscation, anti-debugging, memory encryption, AMSI bypass, process injection, track covering |
63
+ | **Secrets** | 180+ patterns across cloud, DevOps, databases, AI/ML, payment, social media, private keys, generic tokens |
64
+ | **Vuln Intel** | CVE search (NVD/OSV), CISA KEV, Exploit-DB, MITRE ATT&CK mapping, IOC extraction, TAXII 2.1 client |
65
+ | **Proxy** | HTTP CONNECT, SOCKS5, transparent proxy, MITM TLS interception, interactive shell (k9s-style TUI) |
66
+ | **Agent** | C2 server/client with encrypted transports (HTTP/DNS/WebSocket), forward secrecy ratcheting, multi-agent crew |
67
+ | **Crypto** | File vault (AES-256-GCM), encoding/decoding, classical ciphers, CyberChef-style recipes, crypto analysis |
68
+ | **Storage** | RedDB: B-tree + graph + vector engine with SQL/Gremlin/Cypher/SPARQL queries, ACID transactions, WAL |
69
+ | **Memory** | Process memory scanner (Cheat Engine-style), value/pattern/AOB scanning, hex editor (Linux) |
70
+ | **Playbooks** | Automated pentest workflows with MITRE ATT&CK mapping, APT emulation, variable substitution |
71
+ | **Graph** | Attack path analysis, blast radius, lateral movement mapping, Mermaid diagram export |
72
+ | **MCP** | Model Context Protocol server for Claude AI integration with 18 tool modules and intelligent orchestration |
73
+ | **Code** | Static analysis, secrets scanning, dependency analysis, SARIF export |
74
+ | **Cloud** | Subdomain takeover detection, S3 bucket scanning, cloud service enumeration |
75
+ | **Scripting** | Built-in scripting engine for custom automation |
76
+ | **Report** | Pentest report generation from loot, findings, and attack graphs |
77
+
78
+ ---
79
+
80
+ ## Quick Start
81
+
82
+ ```bash
83
+ # Install (one command)
84
+ curl -fsSL https://raw.githubusercontent.com/forattini-dev/redblue/main/install.sh | bash
85
+
86
+ # Network reconnaissance
87
+ rb network ports scan 192.168.1.1 --preset common
88
+ rb network host discover 10.0.0.0/24
89
+ rb ping 8.8.8.8
90
+ rb nc 192.168.1.1 80
91
+
92
+ # DNS
93
+ rb dns record lookup example.com --type MX
94
+ rb dns-server start --hijack "*.evil.com=10.0.0.1"
95
+
96
+ # Subdomain enumeration
97
+ rb recon domain subdomains example.com --passive
98
+ rb recon domain subdomains example.com --resolve -o json
99
+ rb recon domain bruteforce example.com -w wordlists/subdomains.txt
100
+
101
+ # Web fuzzing & security
102
+ rb web fuzz http://example.com/FUZZ -w common.txt -fc 404
103
+ rb web asset security http://example.com
104
+ rb web asset crawl http://example.com --har crawl.har
105
+
106
+ # TLS audit
107
+ rb tls security audit example.com
108
+
109
+ # Vulnerability intelligence
110
+ rb intel vuln search nginx 1.18.0
111
+ rb intel vuln cve CVE-2021-44228
112
+ rb intel vuln kev --stats
113
+ rb intel mitre technique T1059
114
+
115
+ # Credential testing
116
+ rb auth test http://example.com/login -u users.txt -p pass.txt --type form
117
+
118
+ # Password cracking
119
+ rb password crack hashes.txt -w rockyou.txt --rules
120
+
121
+ # Secrets detection
122
+ rb code secrets scan . --git
123
+
124
+ # Exploitation (AUTHORIZED USE ONLY)
125
+ rb exploit privesc enumerate
126
+ rb exploit payload shell bash 10.0.0.1 4444
127
+
128
+ # Binary analysis
129
+ rb binary elf analyze /usr/bin/target
130
+ rb binary rop gadgets ./vulnerable_binary
131
+
132
+ # MITM proxy
133
+ rb proxy mitm --port 8080 --intercept
134
+
135
+ # Crypto vault
136
+ rb crypto vault encrypt secrets.txt
137
+ rb crypto recipe "base64_encode | hex_encode" "hello"
138
+
139
+ # Process memory (Linux)
140
+ rb memory scan --pid 1234 --value 42
141
+
142
+ # Playbooks
143
+ rb playbook run web-pentest --target example.com
144
+
145
+ # MCP server (for Claude AI)
146
+ rb mcp serve
147
+ ```
148
+
149
+ ### JavaScript / npm Quick Start
150
+
151
+ ```bash
152
+ # Run the wrapper without installing it globally
153
+ npx redblue-cli dns record lookup example.com --type MX
154
+ npm exec --package redblue-cli rb -- tls security audit github.com
155
+
156
+ # Install the wrapper in a project
157
+ npm install redblue-cli
158
+ npx rb network ports scan 192.168.1.1 --preset common
159
+ ```
160
+
161
+ ```js
162
+ const { createClient } = require('redblue-cli');
163
+
164
+ (async () => {
165
+ const rb = await createClient({
166
+ autoDownload: true,
167
+ targetDir: '.redblue/bin'
168
+ });
169
+
170
+ const records = await rb.dns.record.lookup({
171
+ target: 'example.com',
172
+ type: 'MX'
173
+ });
174
+
175
+ console.log(records);
176
+ })();
177
+ ```
178
+
179
+ ---
180
+
181
+ ## Protocols from Scratch
182
+
183
+ Every protocol is implemented from first principles -- no external crates, no wrappers.
184
+
185
+ | Category | Protocols |
186
+ |----------|-----------|
187
+ | **Web** | HTTP/1.1 (RFC 2616), HTTP/2 (RFC 7540) with HPACK/Huffman, HTTPS |
188
+ | **Security** | TLS 1.2 (RFC 5246) with ECDHE + AES-GCM + X.509 verification, TLS 1.3 key schedule |
189
+ | **Name Resolution** | DNS (RFC 1035), DoH (RFC 8484), WHOIS (RFC 3912), RDAP (RFC 7480) |
190
+ | **Authentication** | Kerberos 5 (RFC 4120) with PKINIT + S4U, SSH (RFC 4253) |
191
+ | **Directory** | LDAP (RFC 4511), SNMP (RFC 1157) |
192
+ | **File Transfer** | FTP (RFC 959), SMB/CIFS |
193
+ | **Mail** | SMTP (RFC 5321) |
194
+ | **Remote Access** | Telnet (RFC 854) |
195
+ | **Databases** | MySQL, PostgreSQL, MSSQL (TDS), MongoDB, Redis |
196
+ | **Network** | TCP, UDP, ICMP (RFC 792), raw sockets, packet crafting |
197
+ | **Encoding** | ASN.1/DER (RFC 2459), X.509 certificates, HAR 1.2, CSS selectors |
198
+
199
+ ### Cryptography (Pure Rust)
200
+
201
+ | Type | Implementations |
202
+ |------|----------------|
203
+ | **Hash** | SHA-256, SHA-384, SHA-512, SHA-1, MD5 |
204
+ | **Symmetric** | AES-128, AES-256-GCM, ChaCha20-Poly1305 |
205
+ | **Asymmetric** | RSA, ECDH, P-256 (NIST), X25519 |
206
+ | **Key Derivation** | PBKDF2, HKDF (RFC 5869), TLS PRF (1.0/1.1/1.2), TLS 1.3 key schedule |
207
+ | **MAC** | HMAC-SHA256, HMAC-SHA384, HMAC-SHA1, HMAC-MD5 |
208
+ | **Utility** | CSPRNG (OS-backed), UUID, Base64, Hex, BigInt arithmetic |
209
+
210
+ ---
211
+
212
+ ## Exploitation Framework
213
+
214
+ > **AUTHORIZED USE ONLY** -- pentesting, CTF, bug bounty, education, your own audits.
215
+
216
+ ```bash
217
+ # Privilege escalation enumeration
218
+ rb exploit privesc enumerate
219
+ rb exploit privesc suggest
220
+
221
+ # Reverse shells (encrypted, ICMP, HTTP, DNS, WebSocket)
222
+ rb exploit payload shell bash 10.0.0.1 4444
223
+ rb exploit payload shell python 10.0.0.1 4444 --encrypted
224
+
225
+ # Lateral movement
226
+ rb exploit lateral ssh-keys --target 10.0.0.0/24
227
+ rb exploit lateral pass-the-hash --hash NTLM_HASH
228
+
229
+ # Post-exploitation
230
+ rb exploit post-exploit enumerate
231
+ rb exploit persistence cron --command "rb agent connect"
232
+
233
+ # Browser exploitation
234
+ rb exploit-browser serve --port 8080
235
+ rb exploit-browser exec --id ZOMBIE_ID --script "document.cookie"
236
+
237
+ # CVE database
238
+ rb intel vuln cve CVE-2021-44228
239
+ ```
240
+
241
+ ---
242
+
243
+ ## MITM Proxy & Interactive Shell
244
+
245
+ Full man-in-the-middle proxy with a k9s-style TUI for real-time traffic inspection.
246
+
247
+ ```bash
248
+ # Start MITM proxy with TLS interception
249
+ rb proxy mitm --port 8080 --intercept
250
+
251
+ # SOCKS5 proxy
252
+ rb proxy socks5 --port 1080
253
+
254
+ # Transparent proxy (Linux, requires iptables)
255
+ rb proxy transparent --port 8080
256
+
257
+ # Interactive proxy shell
258
+ rb proxy shell --port 8080
259
+ ```
260
+
261
+ **Interactive shell features:**
262
+ - Real-time request/response streaming
263
+ - Intercept and modify requests on-the-fly
264
+ - History browsing, filtering, and replay
265
+ - Security header stripping for testing
266
+ - WebSocket upgrade support
267
+
268
+ ---
269
+
270
+ ## C2 Agent Framework
271
+
272
+ > **AUTHORIZED USE ONLY**
273
+
274
+ Lightweight C2 framework with encrypted communications and forward secrecy.
275
+
276
+ ```bash
277
+ # Start C2 server
278
+ rb agent server --port 4444
279
+
280
+ # Connect agent to server
281
+ rb agent connect --server 10.0.0.1:4444
282
+
283
+ # Interactive agent shell
284
+ rb agent shell
285
+ ```
286
+
287
+ **Features:**
288
+ - Multiple transports: HTTP/HTTPS, DNS covert channel, WebSocket
289
+ - Forward secrecy with key ratcheting
290
+ - Multi-agent crew coordination
291
+ - Custom encrypted protocol
292
+
293
+ ---
294
+
295
+ ## Binary Analysis
296
+
297
+ ```bash
298
+ # ELF analysis
299
+ rb binary elf analyze ./target_binary
300
+ rb binary elf checksec ./target_binary
301
+
302
+ # PE analysis
303
+ rb binary pe analyze ./target.exe
304
+
305
+ # ROP gadgets
306
+ rb binary rop gadgets ./vulnerable_binary
307
+
308
+ # Shellcode generation
309
+ rb binary shellcode generate --arch x86_64 --type reverse_shell
310
+ ```
311
+
312
+ ---
313
+
314
+ ## Evasion Suite
315
+
316
+ > **AUTHORIZED USE ONLY** -- for testing defenses and security controls.
317
+
318
+ 16 evasion techniques for testing security products:
319
+
320
+ ```bash
321
+ # Sandbox/VM detection
322
+ rb evasion sandbox detect
323
+
324
+ # String obfuscation
325
+ rb evasion obfuscate --input payload.bin
326
+
327
+ # Anti-debugging
328
+ rb evasion antidebug check
329
+
330
+ # Memory encryption
331
+ rb evasion memory encrypt --pid 1234
332
+
333
+ # Track covering
334
+ rb evasion tracks clear --logs --history
335
+ ```
336
+
337
+ ---
338
+
339
+ ## Password Cracking
340
+
341
+ ```bash
342
+ # Dictionary attack
343
+ rb password crack hashes.txt -w rockyou.txt
344
+
345
+ # Mask attack (hashcat-style)
346
+ rb password crack hashes.txt --mask "?u?l?l?l?d?d?d?d"
347
+
348
+ # Hybrid (dictionary + mask)
349
+ rb password crack hashes.txt -w words.txt --mask "?d?d?d"
350
+
351
+ # Auto-detect hash format
352
+ rb password crack auto hashes.txt
353
+ ```
354
+
355
+ Supports: MD5, SHA-1, SHA-256, SHA-512, bcrypt, NTLM, and more.
356
+
357
+ ---
358
+
359
+ ## Process Memory Scanner
360
+
361
+ Linux-only, Cheat Engine-style memory inspection:
362
+
363
+ ```bash
364
+ # Scan for a value
365
+ rb memory scan --pid 1234 --value 100
366
+
367
+ # Pattern/AOB scan
368
+ rb memory scan --pid 1234 --pattern "48 8B ?? ?? 89"
369
+
370
+ # Hex editor
371
+ rb hex view /path/to/binary
372
+ rb hex edit /path/to/file --offset 0x100
373
+ ```
374
+
375
+ ---
376
+
377
+ ## Vulnerability Intelligence
378
+
379
+ Aggregates data from multiple authoritative sources:
380
+
381
+ | Source | Description |
382
+ |--------|-------------|
383
+ | **NVD** | NIST National Vulnerability Database -- CVE details, CVSS scores, CPE matches |
384
+ | **OSV** | Open Source Vulnerabilities -- Package-specific vulns (npm, PyPI, Cargo) |
385
+ | **CISA KEV** | Known Exploited Vulnerabilities -- Actively exploited CVEs with deadlines |
386
+ | **Exploit-DB** | Public exploits, PoCs, Metasploit modules |
387
+ | **MITRE ATT&CK** | Tactics, techniques, and procedures mapping |
388
+
389
+ ```bash
390
+ rb intel vuln search nginx 1.18.0
391
+ rb intel vuln cve CVE-2021-44228
392
+ rb intel vuln kev --stats
393
+ rb intel vuln exploit "Apache Struts"
394
+ rb intel mitre technique T1059
395
+ rb intel ioc extract report.txt
396
+ rb intel taxii discover https://taxii.example.com
397
+ ```
398
+
399
+ ### Risk Score
400
+
401
+ ```
402
+ Risk = (CVSS x 10) + Exploit Bonus (+25) + KEV Bonus (+30) + Age Factor + Impact Modifier
403
+ ```
404
+
405
+ ---
406
+
407
+ ## Pentest Playbooks
408
+
409
+ Automated security assessment workflows with MITRE ATT&CK mapping:
410
+
411
+ ```bash
412
+ # List available playbooks
413
+ rb playbook list
414
+
415
+ # Run a web pentest playbook
416
+ rb playbook run web-pentest --target example.com
417
+
418
+ # Run APT emulation
419
+ rb playbook run apt29 --target 10.0.0.0/24
420
+
421
+ # Dry run
422
+ rb playbook run network-audit --target 10.0.0.1 --dry-run
423
+ ```
424
+
425
+ Playbooks support variable substitution, conditional execution, and action recording.
426
+
427
+ ---
428
+
429
+ ## MCP Server (Claude AI Integration)
430
+
431
+ redblue includes a full Model Context Protocol server enabling Claude to use all security tools:
432
+
433
+ ```bash
434
+ # Start MCP server
435
+ rb mcp serve
436
+ ```
437
+
438
+ **18 tool modules:** network, DNS, web, recon, TLS, crypto, binary, code, password, evasion, vulnerability, intelligence, file, wordlist, vector search, and auto-exploitation.
439
+
440
+ **10 prompt generators:** API security, attack planning, cloud security, compliance, container security, defense, mobile security, network security, recon guidance, threat modeling.
441
+
442
+ ---
443
+
444
+ ## Crypto Toolkit
445
+
446
+ Beyond the vault, redblue includes a full crypto toolkit:
447
+
448
+ ```bash
449
+ # File encryption vault (AES-256-GCM)
450
+ rb crypto vault encrypt secrets.txt
451
+ rb crypto vault decrypt secrets.vault
452
+
453
+ # Encoding/decoding
454
+ rb crypto codec base64 encode "hello world"
455
+ rb crypto codec hex decode "48656c6c6f"
456
+
457
+ # CyberChef-style recipes
458
+ rb crypto recipe "base64_encode | rot13 | hex_encode" "secret"
459
+
460
+ # Crypto analysis
461
+ rb crypto analysis entropy suspicious_file.bin
462
+
463
+ # Classical ciphers
464
+ rb crypto cipher caesar "hello" --shift 13
465
+ rb crypto cipher vigenere "hello" --key "secret"
466
+ ```
467
+
468
+ ---
469
+
470
+ ## RedDB: Unified Storage Engine
471
+
472
+ Multi-modal storage engine unifying relational tables, property graphs, and vector embeddings.
473
+
474
+ ### Architecture
475
+
476
+ ```
477
+ ┌─────────────────────────────────────────────────────────────┐
478
+ │ Query Layer │
479
+ │ SQL | Gremlin | Cypher | SPARQL | Natural Language │
480
+ ├─────────────────────────────────────────────────────────────┤
481
+ │ Security Queries | Multi-Mode Executor | RAG Engine │
482
+ ├─────────────────────────────────────────────────────────────┤
483
+ │ Result Cache | Materialized Views | Query Plan Cache │
484
+ ├─────────────────────────────────────────────────────────────┤
485
+ │ SIEVE Page Cache + Aggregation Cache │
486
+ ├─────────────────────────────────────────────────────────────┤
487
+ │ Tables (B-Tree) | Graphs (Adjacency) | Vectors (HNSW) │
488
+ ├─────────────────────────────────────────────────────────────┤
489
+ │ Page-Based Storage (4KB) + WAL + Encryption │
490
+ └─────────────────────────────────────────────────────────────┘
491
+ ```
492
+
493
+ ### Features
494
+
495
+ | Feature | Description |
496
+ |---------|-------------|
497
+ | **Storage modes** | B-Tree tables, adjacency graph, HNSW vectors |
498
+ | **Query languages** | SQL, Gremlin, Cypher, SPARQL, natural language |
499
+ | **Transactions** | ACID with MVCC snapshot isolation |
500
+ | **Durability** | Write-ahead logging |
501
+ | **Encryption** | At-rest encryption with keyring |
502
+ | **Caching** | SIEVE page cache, result cache, plan cache, aggregation cache |
503
+ | **Vector search** | HNSW + tiered quantization (binary + int8) |
504
+ | **Graph algorithms** | PageRank, betweenness centrality, Dijkstra, Louvain, cycle detection |
505
+ | **Import** | JSONL streaming, Parquet columnar |
506
+ | **SIMD** | Runtime-detected SSE/AVX/FMA for vector distance (26M+ ops/sec) |
507
+
508
+ ### Cross-Modal Queries
509
+
510
+ ```sql
511
+ -- Find hosts with critical CVEs reachable in 3 hops
512
+ SELECT h.hostname, c.cve_id, v.similarity_score
513
+ FROM hosts h
514
+ JOIN vulnerabilities v ON h.id = v.host_id
515
+ WHERE h.criticality > 8
516
+ AND VECTOR_SIMILARITY(e.embedding, $query) > 0.85
517
+ AND EXISTS (
518
+ SELECT 1 FROM attack_paths p WHERE p.target = h.id AND p.hops <= 3
519
+ )
520
+ ```
521
+
522
+ ---
523
+
524
+ ## CLI Architecture
525
+
526
+ ```
527
+ rb [domain] [resource] [verb] [target] [flags]
528
+ rb help
529
+ rb [domain] help
530
+ rb [target] # Magic scan -- auto-detect
531
+ rb shell [target] # Interactive TUI
532
+ ```
533
+
534
+ ### Domains
535
+
536
+ | Domain | Description | Example |
537
+ |--------|-------------|---------|
538
+ | `network` | Port scanning, host discovery, traceroute | `rb network ports scan 10.0.0.1` |
539
+ | `dns` | DNS queries, server, hijacking | `rb dns record lookup example.com` |
540
+ | `recon` | Subdomain enum, WHOIS, OSINT | `rb recon domain subdomains example.com` |
541
+ | `web` | Fuzzing, crawling, scraping, security | `rb web fuzz http://target/FUZZ` |
542
+ | `tls` | TLS audit, cipher analysis | `rb tls audit security example.com` |
543
+ | `auth` | Credential testing | `rb auth test http://target --type basic` |
544
+ | `exploit` | Privesc, lateral, persistence, payloads | `rb exploit privesc enumerate` |
545
+ | `binary` | ELF/PE analysis, ROP, shellcode | `rb binary elf checksec ./target` |
546
+ | `password` | Hash cracking | `rb password crack hashes.txt -w dict.txt` |
547
+ | `evasion` | Anti-analysis, obfuscation | `rb evasion sandbox detect` |
548
+ | `intel` | Vuln search, MITRE, IOC, TAXII | `rb intel vuln search nginx` |
549
+ | `proxy` | MITM, SOCKS5, transparent | `rb proxy mitm --port 8080` |
550
+ | `agent` | C2 server/client | `rb agent server --port 4444` |
551
+ | `crypto` | Vault, codecs, ciphers, recipes | `rb crypto vault encrypt file.txt` |
552
+ | `code` | Secrets scanning, analysis | `rb code secrets scan .` |
553
+ | `cloud` | Takeover detection, S3 scanning | `rb cloud takeover example.com` |
554
+ | `memory` | Process memory scanning | `rb memory scan --pid 1234` |
555
+ | `playbook` | Automated pentest workflows | `rb playbook run web-pentest` |
556
+ | `database` | RedDB operations | `rb database query "SELECT * FROM hosts"` |
557
+ | `mcp` | MCP server for Claude AI | `rb mcp serve` |
558
+ | `report` | Pentest report generation | `rb report generate --format pdf` |
559
+ | `loot` | Findings and credential management | `rb loot list` |
560
+ | `hex` | Hex editor | `rb hex view binary_file` |
561
+ | `nc` | Netcat | `rb nc 10.0.0.1 80` |
562
+ | `ping` | ICMP ping | `rb ping 8.8.8.8` |
563
+
564
+ ### Global Flags
565
+
566
+ ```bash
567
+ -h, --help # Context-aware help
568
+ --version # Show version
569
+ -o, --output # Format: text|json
570
+ --no-color # Disable colors
571
+ ```
572
+
573
+ ---
574
+
575
+ ## Installation
576
+
577
+ ### Quick Install
578
+
579
+ ```bash
580
+ # Latest stable release
581
+ curl -fsSL https://raw.githubusercontent.com/forattini-dev/redblue/main/install.sh | bash
582
+
583
+ # Pre-release (next channel)
584
+ curl -fsSL https://raw.githubusercontent.com/forattini-dev/redblue/main/install.sh | bash -s -- --channel next
585
+
586
+ # Specific version
587
+ curl -fsSL https://raw.githubusercontent.com/forattini-dev/redblue/main/install.sh | bash -s -- --version v0.1.0
588
+
589
+ # Custom directory
590
+ curl -fsSL https://raw.githubusercontent.com/forattini-dev/redblue/main/install.sh | bash -s -- --install-dir /usr/local/bin
591
+
592
+ # Static build (Alpine/Docker)
593
+ curl -fsSL https://raw.githubusercontent.com/forattini-dev/redblue/main/install.sh | bash -s -- --static
594
+ ```
595
+
596
+ **Supported Platforms:**
597
+ - Linux x86_64, aarch64 (ARM64), armv7
598
+ - macOS x86_64 (Intel), aarch64 (Apple Silicon)
599
+ - Windows x86_64
600
+
601
+ ### JavaScript / npm
602
+
603
+ The npm package is a wrapper and SDK. It does not bundle the release binary inside the package.
604
+
605
+ ```bash
606
+ # Add the wrapper to your project
607
+ npm install redblue-cli
608
+
609
+ # Run the CLI through the package name
610
+ npx redblue-cli dns record lookup example.com --type MX
611
+
612
+ # Run the rb bin exposed by the package without installing it globally
613
+ npm exec --package redblue-cli rb -- network ports scan 192.168.1.1 --preset common
614
+
615
+ # After local install, the package also exposes rb
616
+ npx rb dns record lookup example.com --type A
617
+ ```
618
+
619
+ ```js
620
+ const { createClient } = require('redblue-cli');
621
+
622
+ (async () => {
623
+ const rb = await createClient({
624
+ binaryPath: '/custom/path/rb'
625
+ });
626
+
627
+ const audit = await rb.tls.security.audit({
628
+ target: 'github.com',
629
+ ports: '443'
630
+ });
631
+
632
+ console.log(audit);
633
+ })();
634
+ ```
635
+
636
+ If you want the wrapper to manage the binary for you, use `autoDownload: true` with a `targetDir`.
637
+
638
+ > **Note:** the exact command `npx rb` works after `redblue-cli` is installed in the project or globally. For zero-install usage, prefer `npx redblue-cli ...` or `npm exec --package redblue-cli rb -- ...`.
639
+
640
+ ### Build from Source
641
+
642
+ ```bash
643
+ git clone https://github.com/forattini-dev/redblue
644
+ cd redblue && cargo build --release
645
+ ```
646
+
647
+ ---
648
+
649
+ ## Project Structure
650
+
651
+ ```
652
+ src/
653
+ cli/commands/ # 90+ CLI command implementations
654
+ protocols/ # 40+ protocols from scratch (DNS, HTTP, TLS, Kerberos, SSH, ...)
655
+ crypto/ # Pure Rust crypto (AES, ChaCha20, RSA, X25519, P-256, SHA, ...)
656
+ storage/ # RedDB: B-tree + graph + vector engine with SQL/Gremlin/Cypher
657
+ modules/
658
+ network/ # Port scanning, host discovery, traceroute, netcat
659
+ dns/ # DNS operations + DNS server with hijacking
660
+ recon/ # 24+ reconnaissance modules (subdomains, OSINT, breach, ...)
661
+ web/ # Fuzzing, CMS fingerprinting, crawling, DOM parsing
662
+ tls/ # TLS audit, Heartbleed, OCSP, cipher analysis
663
+ exploit/ # Privesc, lateral movement, persistence, payloads, browser exploit
664
+ binary/ # ELF/PE parsing, checksec, ROP gadgets, shellcode
665
+ password/ # Hash cracking (dictionary, mask, hybrid, bcrypt)
666
+ evasion/ # 16 anti-analysis techniques
667
+ proxy/ # MITM, SOCKS5, transparent proxy, interactive shell
668
+ collection/ # Browser credentials, screenshots
669
+ code/secrets/ # 180+ secret detection patterns
670
+ graph/ # Attack path analysis (ShadowGraph)
671
+ memory/ # Process memory scanner + hex editor
672
+ cloud/ # Subdomain takeover, S3 scanning
673
+ auth/ # Multi-protocol credential testing
674
+ monitor/ # Port/service health monitoring
675
+ scripting/ # Built-in scripting engine
676
+ report/ # Pentest report generation
677
+ ctf/ # CTF challenge generation
678
+ agent/ # C2 framework with encrypted transports
679
+ mcp/ # MCP server (18 tool modules, 10 prompt generators)
680
+ playbooks/ # Automated pentest workflows
681
+ intelligence/ # Assessment engine
682
+ ui/ # Terminal graphics (braille canvas, charts)
683
+ ```
684
+
685
+ ---
686
+
687
+ ## Security & Ethics
688
+
689
+ > **AUTHORIZED USE ONLY**
690
+
691
+ redblue is designed for:
692
+ - Authorized penetration testing
693
+ - CTF competitions
694
+ - Bug bounty programs (with scope approval)
695
+ - Your own security audits
696
+ - Education and research
697
+
698
+ **Always obtain written authorization before testing systems you don't own.**
699
+
700
+ ---
701
+
702
+ ## Documentation
703
+
704
+ Full documentation available at:
705
+
706
+ **[forattini-dev.github.io/redblue](https://forattini-dev.github.io/redblue/)**
707
+
708
+ - JS SDK guide: [docs/guides/javascript-sdk.md](docs/guides/javascript-sdk.md)
709
+
710
+ ```bash
711
+ cd docs && npx docsify-cli serve
712
+ ```
713
+
714
+ ---
715
+
716
+ <div align="center">
717
+
718
+ **[Documentation](https://forattini-dev.github.io/redblue/)** |
719
+ **[GitHub](https://github.com/forattini-dev/redblue)** |
720
+ **[Releases](https://github.com/forattini-dev/redblue/releases)**
721
+
722
+ *Made with Rust by security engineers, for security engineers*
723
+
724
+ </div>
package/package.json CHANGED
@@ -1,25 +1,30 @@
1
1
  {
2
2
  "name": "redblue-cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "JavaScript SDK wrapper for the redblue CLI",
5
5
  "type": "commonjs",
6
- "main": "./redblue-sdk.js",
6
+ "main": "./sdk/redblue-sdk.js",
7
+ "bin": {
8
+ "rb": "./sdk/redblue-sdk.js",
9
+ "redblue-cli": "./sdk/redblue-sdk.js"
10
+ },
7
11
  "exports": {
8
- ".": "./redblue-sdk.js"
12
+ ".": "./sdk/redblue-sdk.js"
9
13
  },
10
14
  "files": [
11
- "redblue-sdk.js"
15
+ "sdk/redblue-sdk.js"
12
16
  ],
13
17
  "engines": {
14
18
  "node": ">=20"
15
19
  },
20
+ "packageManager": "pnpm@9.15.0",
16
21
  "publishConfig": {
17
- "access": "public"
22
+ "access": "public",
23
+ "provenance": true
18
24
  },
19
25
  "repository": {
20
26
  "type": "git",
21
- "url": "git+https://github.com/forattini-dev/redblue.git",
22
- "directory": "sdk"
27
+ "url": "git+https://github.com/forattini-dev/redblue.git"
23
28
  },
24
29
  "bugs": {
25
30
  "url": "https://github.com/forattini-dev/redblue/issues"
@@ -35,10 +40,16 @@
35
40
  "ports"
36
41
  ],
37
42
  "license": "MIT",
43
+ "dependencies": {
44
+ "cli-args-parser": "^1.0.6"
45
+ },
38
46
  "scripts": {
39
- "build": "node --check redblue-sdk.js",
40
- "test": "node --test --test-reporter=spec test/*.test.js",
41
- "coverage": "node --test --experimental-test-coverage --test-reporter=spec --test-coverage-include=redblue-sdk.js --test-coverage-lines=100 --test-coverage-functions=100 --test-coverage-branches=100 test/*.test.js",
42
- "pack-check": "npm pack --dry-run"
47
+ "build": "node --check sdk/redblue-sdk.js",
48
+ "test": "node --test --test-reporter=spec sdk/test/*.test.js",
49
+ "coverage": "node scripts/check-sdk-coverage.js",
50
+ "pack-check": "npm pack --dry-run",
51
+ "prepublishOnly": "npm run build && npm run coverage && npm run pack-check",
52
+ "publish:npm": "npm publish --provenance",
53
+ "publish:npm:next": "npm publish --tag next --provenance"
43
54
  }
44
- }
55
+ }
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env node
1
2
  'use strict';
2
3
 
3
4
  const crypto = require('crypto');
@@ -6,9 +7,67 @@ const fsp = fs.promises;
6
7
  const https = require('https');
7
8
  const os = require('os');
8
9
  const path = require('path');
10
+ const { pathToFileURL } = require('url');
9
11
  const { execFile, spawn } = require('child_process');
10
12
 
11
13
  const DEFAULT_REPO = 'forattini-dev/redblue';
14
+ const LOCAL_CLI_ARGS_PARSER_PATH = path.resolve(
15
+ __dirname,
16
+ '../../../tetis/libs/cli-args-parser/dist/index.js'
17
+ );
18
+ const WRAPPER_OPTION_TYPES = Object.freeze({
19
+ 'asset-name': 'string',
20
+ 'auto-download': 'boolean',
21
+ 'binary-path': 'string',
22
+ channel: 'string',
23
+ download: 'boolean',
24
+ 'github-token': 'string',
25
+ 'no-verify': 'boolean',
26
+ repo: 'string',
27
+ 'sdk-help': 'boolean',
28
+ 'static-build': 'boolean',
29
+ 'target-dir': 'string',
30
+ version: 'string',
31
+ verify: 'boolean'
32
+ });
33
+ const WRAPPER_OPTION_SCHEMA = Object.freeze({
34
+ options: {
35
+ 'asset-name': {
36
+ type: 'string'
37
+ },
38
+ 'auto-download': {
39
+ type: 'boolean',
40
+ aliases: ['download']
41
+ },
42
+ 'binary-path': {
43
+ type: 'string'
44
+ },
45
+ channel: {
46
+ type: 'string'
47
+ },
48
+ 'github-token': {
49
+ type: 'string'
50
+ },
51
+ repo: {
52
+ type: 'string'
53
+ },
54
+ 'sdk-help': {
55
+ type: 'boolean'
56
+ },
57
+ 'static-build': {
58
+ type: 'boolean'
59
+ },
60
+ 'target-dir': {
61
+ type: 'string'
62
+ },
63
+ version: {
64
+ type: 'string'
65
+ },
66
+ verify: {
67
+ type: 'boolean'
68
+ }
69
+ }
70
+ });
12
71
 
13
72
  function getDefaultBinaryName(platform = process.platform) {
14
73
  return platform === 'win32' ? 'rb.exe' : 'rb';
@@ -313,6 +372,225 @@ function spawnBinary(binaryPath, args, options = {}) {
313
372
  });
314
373
  }
315
374
 
375
+ function toImportSpecifier(filePath) {
376
+ return pathToFileURL(path.resolve(filePath)).href;
377
+ }
378
+
379
+ function getParserCandidatePaths(runtime = {}) {
380
+ const env = runtime.env || process.env;
381
+ const localParserPath = runtime.localParserPath || LOCAL_CLI_ARGS_PARSER_PATH;
382
+ const candidates = [];
383
+ const seen = new Set();
384
+
385
+ function pushCandidate(specifier) {
386
+ if (!specifier || seen.has(specifier)) {
387
+ return;
388
+ }
389
+ seen.add(specifier);
390
+ candidates.push(specifier);
391
+ }
392
+
393
+ if (env.REDBLUE_CLI_ARGS_PARSER_PATH) {
394
+ pushCandidate(toImportSpecifier(env.REDBLUE_CLI_ARGS_PARSER_PATH));
395
+ }
396
+
397
+ pushCandidate('cli-args-parser');
398
+
399
+ if (localParserPath && exists(localParserPath)) {
400
+ pushCandidate(toImportSpecifier(localParserPath));
401
+ }
402
+
403
+ return candidates;
404
+ }
405
+
406
+ async function loadCliArgsParser(runtime = {}) {
407
+ if (runtime.parserModule) {
408
+ return runtime.parserModule;
409
+ }
410
+
411
+ const importModule =
412
+ runtime.importModule ||
413
+ (async function defaultImport(specifier) {
414
+ return import(specifier);
415
+ });
416
+
417
+ const candidates = Array.isArray(runtime.parserCandidates)
418
+ ? runtime.parserCandidates.slice()
419
+ : getParserCandidatePaths(runtime);
420
+ const failures = [];
421
+
422
+ for (const specifier of candidates) {
423
+ try {
424
+ return await importModule(specifier);
425
+ } catch (error) {
426
+ failures.push(`${specifier}: ${error.message}`);
427
+ }
428
+ }
429
+
430
+ /* node:coverage disable */
431
+ const failureSummary = failures.length > 0 ? failures.join('; ') : 'no candidates available';
432
+ /* node:coverage enable */
433
+ throw new Error(`Unable to load cli-args-parser. Tried: ${failureSummary}`);
434
+ }
435
+
436
+ function splitWrapperArgs(argv) {
437
+ const rawArgs = Array.isArray(argv) ? argv.slice() : [];
438
+ const wrapperArgs = [];
439
+ let index = 0;
440
+
441
+ while (index < rawArgs.length) {
442
+ const token = rawArgs[index];
443
+
444
+ if (token === '--') {
445
+ return {
446
+ wrapperArgs,
447
+ passthroughArgs: rawArgs.slice(index + 1),
448
+ usedDoubleDash: true
449
+ };
450
+ }
451
+
452
+ if (!token || !token.startsWith('--')) {
453
+ break;
454
+ }
455
+
456
+ const eqIndex = token.indexOf('=');
457
+ const optionName = token.slice(2, eqIndex === -1 ? undefined : eqIndex);
458
+ const optionType = WRAPPER_OPTION_TYPES[optionName];
459
+
460
+ if (!optionType) {
461
+ break;
462
+ }
463
+
464
+ wrapperArgs.push(token);
465
+ index += 1;
466
+
467
+ if (optionType === 'string' && eqIndex === -1 && index < rawArgs.length) {
468
+ wrapperArgs.push(rawArgs[index]);
469
+ index += 1;
470
+ }
471
+ }
472
+
473
+ return {
474
+ wrapperArgs,
475
+ passthroughArgs: rawArgs.slice(index),
476
+ usedDoubleDash: false
477
+ };
478
+ }
479
+
480
+ async function parseWrapperArgs(argv, runtime = {}) {
481
+ const rawArgs = Array.isArray(argv) ? argv.slice() : [];
482
+ const parserModule = await loadCliArgsParser(runtime);
483
+ const { createParser } = parserModule;
484
+
485
+ if (typeof createParser !== 'function') {
486
+ throw new Error('cli-args-parser does not export createParser');
487
+ }
488
+
489
+ const split = splitWrapperArgs(rawArgs);
490
+ const parser = createParser(WRAPPER_OPTION_SCHEMA);
491
+ const parsed = parser.parse(split.wrapperArgs);
492
+
493
+ if (Array.isArray(parsed.errors) && parsed.errors.length > 0) {
494
+ throw new Error(parsed.errors.join('; '));
495
+ }
496
+
497
+ const options = parsed.options || {};
498
+
499
+ return {
500
+ passthroughArgs: split.passthroughArgs,
501
+ rawArgs,
502
+ resolveOptions: {
503
+ assetName: options['asset-name'],
504
+ autoDownload: options['auto-download'] === true,
505
+ binaryPath: options['binary-path'],
506
+ channel: options.channel,
507
+ githubToken: options['github-token'],
508
+ repo: options.repo,
509
+ staticBuild: options['static-build'] === true,
510
+ targetDir: options['target-dir'],
511
+ verify: options.verify !== false,
512
+ version: options.version
513
+ },
514
+ usedDoubleDash: split.usedDoubleDash,
515
+ wrapperOptions: {
516
+ sdkHelp: options['sdk-help'] === true
517
+ }
518
+ };
519
+ }
520
+
521
+ function formatWrapperHelp() {
522
+ return [
523
+ 'redblue-cli wrapper',
524
+ '',
525
+ 'Usage:',
526
+ ' rb [wrapper options] [redblue args]',
527
+ ' npx redblue-cli [redblue args]',
528
+ ' npm exec --package redblue-cli rb -- [redblue args]',
529
+ '',
530
+ 'Wrapper options:',
531
+ ' --binary-path <path> Use an explicit redblue binary',
532
+ ' --target-dir <dir> Resolve or download the binary in this directory',
533
+ ' --auto-download Download the binary if it is missing',
534
+ ' --channel <name> Release channel for downloads (stable, latest, next)',
535
+ ' --version <tag> Pin a release version for downloads',
536
+ ' --asset-name <name> Override the release asset name',
537
+ ' --repo <owner/name> Override the GitHub repository',
538
+ ' --github-token <token> GitHub token for release downloads',
539
+ ' --static-build Prefer static Linux assets when available',
540
+ ' --no-verify Skip SHA256 verification on download',
541
+ ' --sdk-help Show this wrapper help',
542
+ '',
543
+ 'Notes:',
544
+ ' Wrapper options must come before the redblue command.',
545
+ ' The exact command "npx rb" only works when a package named "rb" exists or when this package is already installed and exposes the rb bin.',
546
+ ''
547
+ ].join('\n');
548
+ }
549
+
550
+ function waitForChild(child) {
551
+ return new Promise((resolve, reject) => {
552
+ child.on('error', reject);
553
+ /* node:coverage disable */
554
+ child.on('close', (code, signal) => {
555
+ if (signal) {
556
+ resolve(1);
557
+ return;
558
+ }
559
+ resolve(typeof code === 'number' ? code : 1);
560
+ });
561
+ /* node:coverage enable */
562
+ });
563
+ }
564
+
565
+ async function runCli(argv = process.argv.slice(2), runtime = {}) {
566
+ const stdout = runtime.stdout || process.stdout;
567
+ const stderr = runtime.stderr || process.stderr;
568
+
569
+ try {
570
+ const parsed = await parseWrapperArgs(argv, runtime);
571
+
572
+ if (parsed.wrapperOptions.sdkHelp) {
573
+ stdout.write(formatWrapperHelp());
574
+ return 0;
575
+ }
576
+
577
+ const binaryPath = await resolveBinary(parsed.resolveOptions);
578
+ /* node:coverage disable */
579
+ const spawnOptions = {
580
+ cwd: runtime.cwd || process.cwd(),
581
+ env: Object.assign({}, process.env, runtime.env || {}),
582
+ stdio: runtime.stdio || 'inherit'
583
+ };
584
+ /* node:coverage enable */
585
+ const child = spawnBinary(binaryPath, parsed.passthroughArgs, spawnOptions);
586
+
587
+ return waitForChild(child);
588
+ } catch (error) {
589
+ stderr.write(`redblue-cli: ${error.message}\n`);
590
+ return 1;
591
+ }
592
+ }
593
+
316
594
  async function getManifest(options = {}) {
317
595
  const binaryPath = await resolveBinary(options);
318
596
  const result = await execFilePromise(binaryPath, ['sdk', 'bridge', 'manifest'], options);
@@ -623,6 +901,7 @@ module.exports = {
623
901
  createClient,
624
902
  downloadBinary,
625
903
  getManifest,
904
+ runCli,
626
905
  resolveAssetName,
627
906
  resolveBinary
628
907
  };
@@ -636,20 +915,35 @@ module.exports._internal = {
636
915
  ensureObject,
637
916
  execFilePromise,
638
917
  exists,
918
+ formatWrapperHelp,
639
919
  findFlag,
920
+ getParserCandidatePaths,
640
921
  getDefaultBinaryName,
641
922
  getReleaseTag,
642
923
  invokeJson,
643
924
  invokeRaw,
644
925
  isExecutable,
645
926
  kebabToCamel,
927
+ loadCliArgsParser,
928
+ parseWrapperArgs,
646
929
  request,
647
930
  requestJson,
648
931
  requestText,
649
932
  resolveFromPath,
650
933
  sha256File,
934
+ splitWrapperArgs,
651
935
  spawnBinary,
936
+ toImportSpecifier,
937
+ waitForChild,
652
938
  verifyChecksum
653
939
  };
654
940
 
655
941
  module.exports.default = module.exports;
942
+
943
+ /* node:coverage disable */
944
+ if (require.main === module) {
945
+ runCli().then((code) => {
946
+ process.exitCode = code;
947
+ });
948
+ }
949
+ /* node:coverage enable */