@bolt-cli/cli 0.0.0-stage → 0.13.0
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/LICENSE +75 -0
- package/README.md +155 -2
- package/bin/bolt.js +21 -0
- package/lib/agent.js +361 -0
- package/lib/api.js +246 -0
- package/lib/bootstrap.js +292 -0
- package/lib/browser.js +152 -0
- package/lib/cancel.js +153 -0
- package/lib/checkpoints.js +67 -0
- package/lib/cli.js +2637 -0
- package/lib/completion.js +77 -0
- package/lib/config.js +80 -0
- package/lib/doctor.js +110 -0
- package/lib/export.js +77 -0
- package/lib/history.js +78 -0
- package/lib/memory.js +80 -0
- package/lib/output.js +88 -0
- package/lib/permissions.js +167 -0
- package/lib/present.js +181 -0
- package/lib/redact.js +56 -0
- package/lib/session.js +153 -0
- package/lib/toolparse.js +752 -0
- package/lib/tools.js +606 -0
- package/lib/ui.js +783 -0
- package/lib/updatecheck.js +114 -0
- package/lib/watch.js +698 -0
- package/package.json +36 -6
- package/templates/README.md +44 -0
- package/templates/aslr-offset-probe.sh +96 -0
- package/templates/crash-offset-pattern.sh +81 -0
package/package.json
CHANGED
|
@@ -1,6 +1,36 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@bolt-cli/cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@bolt-cli/cli",
|
|
3
|
+
"version": "0.13.0",
|
|
4
|
+
"description": "Bolt terminal CLI — authorized testing and tool-building from your terminal or VS Code.",
|
|
5
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
6
|
+
"type": "commonjs",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=18"
|
|
9
|
+
},
|
|
10
|
+
"bin": {
|
|
11
|
+
"bolt": "bin/bolt.js"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"bin/",
|
|
15
|
+
"lib/",
|
|
16
|
+
"templates/",
|
|
17
|
+
"README.md",
|
|
18
|
+
"LICENSE"
|
|
19
|
+
],
|
|
20
|
+
"keywords": [
|
|
21
|
+
"security",
|
|
22
|
+
"pentest",
|
|
23
|
+
"red-team",
|
|
24
|
+
"nmap",
|
|
25
|
+
"bolt"
|
|
26
|
+
],
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/WarrenMu/Beera-Cyber-new-.git",
|
|
30
|
+
"directory": "cli"
|
|
31
|
+
},
|
|
32
|
+
"homepage": "https://github.com/WarrenMu/Beera-Cyber-new-#readme",
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Bolt lab templates
|
|
2
|
+
|
|
3
|
+
Runnable runbooks for **authorized lab work only**. They ship with Bolt so the
|
|
4
|
+
agent and the operator have tested starting points instead of improvising from
|
|
5
|
+
memory. Everything here runs against binaries and machines **you own or have
|
|
6
|
+
explicit permission to test** — a local VM, a CTF box, a lab container.
|
|
7
|
+
|
|
8
|
+
**Authorization banner.** Each script prints an authorization notice on every
|
|
9
|
+
run. If you cannot honestly answer it, stop. Offensive work without
|
|
10
|
+
authorization is a crime regardless of skill; Bolt runs these because the
|
|
11
|
+
operator standing behind the approval gate confirms the scope, not because the
|
|
12
|
+
target doesn't matter.
|
|
13
|
+
|
|
14
|
+
They are deliberately dependency-light (bash + awk, `gcc` when noted) so they
|
|
15
|
+
run anywhere Bolt runs — including WSL on Windows, which is where Bolt routes
|
|
16
|
+
Linux tooling. Adapt them through the agent loop (`bolt run "adapt the ASLR
|
|
17
|
+
probe to sample my lab binary's heap" --tools`) rather than treating them as
|
|
18
|
+
finished exploits; they are instruments, not cannons.
|
|
19
|
+
|
|
20
|
+
## Contents
|
|
21
|
+
|
|
22
|
+
| Script | What it does |
|
|
23
|
+
|---|---|
|
|
24
|
+
| `aslr-offset-probe.sh` | Samples an address across runs of a lab binary, estimates the effective entropy in bits, and turns that into brute-force-attempt arithmetic (how many runs to land at 50% / 90% odds). Stdout or a raw run-command works. |
|
|
25
|
+
| `crash-offset-pattern.sh` | Generates the classic cyclic pattern (`Aa0Aa1…`) for EIP/RIP offset discovery and looks up the offset of a crashed value given as hex (little-endian) or ASCII. Period 20,280 — repeats are detected and labeled. |
|
|
26
|
+
|
|
27
|
+
## Typical lab session
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# 1. Fuzz the lab binary until it crashes, note the segfault value
|
|
31
|
+
dmesg | tail -3 # e.g. myapp[1234]: segfault at 41327a41
|
|
32
|
+
# 2. Find the offset into the pattern
|
|
33
|
+
./crash-offset-pattern.sh --offset 0x41327a41
|
|
34
|
+
# 3. See whether that offset is stable and what the return-address
|
|
35
|
+
# entropy actually is before plotting any control flow
|
|
36
|
+
./aslr-offset-probe.sh --cmd ./my-lab-server
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Hard rules
|
|
40
|
+
|
|
41
|
+
1. **Lab only.** Third-party systems, even "just to see," are out of scope.
|
|
42
|
+
2. Read the authorization notice every time. It is not decoration.
|
|
43
|
+
3. Changes you make through the agent loop still go through the normal tool
|
|
44
|
+
approval gate — writes need operator approval, and `bolt undo` can roll back.
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# aslr-offset-probe.sh — measure ASLR entropy on a LAB binary you own.
|
|
3
|
+
#
|
|
4
|
+
# AUTHORIZATION NOTICE
|
|
5
|
+
# --------------------
|
|
6
|
+
# Run this only against binaries, VMs, or containers you own or are
|
|
7
|
+
# explicitly authorized to test. Entropy measurement is reconnaissance for
|
|
8
|
+
# brute-force attacks against a randomized address; unauthorized use of the
|
|
9
|
+
# resulting arithmetic against third-party systems is a crime. Running this
|
|
10
|
+
# script asserts you have that authorization for the target below.
|
|
11
|
+
# --------------------
|
|
12
|
+
#
|
|
13
|
+
# What it does:
|
|
14
|
+
# 1. Runs a target N times, sampling an address printed to stdout.
|
|
15
|
+
# Without --cmd it builds a tiny demo binary (aslr-demo.c, compiled
|
|
16
|
+
# with gcc) that prints its own stack address.
|
|
17
|
+
# 2. Counts distinct values and estimates effective entropy in bits
|
|
18
|
+
# (log2 of distinct samples; a floor, since samples << search space).
|
|
19
|
+
# 3. Brute-force arithmetic: expected attempts to land the right base at
|
|
20
|
+
# 50% and 90% odds across the observed distinct range.
|
|
21
|
+
#
|
|
22
|
+
# Usage:
|
|
23
|
+
# ./aslr-offset-probe.sh # demo binary, 50 samples
|
|
24
|
+
# ./aslr-offset-probe.sh -n 200 # more samples
|
|
25
|
+
# ./aslr-offset-probe.sh --cmd ./my-server # sample ANY hex on stdout
|
|
26
|
+
# (e.g. it prints a pointer, or leaks one)
|
|
27
|
+
#
|
|
28
|
+
# Lab-only by design: a real chain needs per-target register/env modeling
|
|
29
|
+
# this script deliberately does not do.
|
|
30
|
+
set -u
|
|
31
|
+
N=50
|
|
32
|
+
CMD=""
|
|
33
|
+
while [ $# -gt 0 ]; do
|
|
34
|
+
case "$1" in
|
|
35
|
+
-n) N="$2"; shift 2 ;;
|
|
36
|
+
--cmd) CMD="$2"; shift 2 ;;
|
|
37
|
+
-h|--help) sed -n '2,32p' "$0"; exit 0 ;;
|
|
38
|
+
*) echo "unknown arg: $1" >&2; exit 2 ;;
|
|
39
|
+
esac
|
|
40
|
+
done
|
|
41
|
+
|
|
42
|
+
echo "[*] AUTHORIZATION NOTICE: lab targets you own / are authorized to test only."
|
|
43
|
+
echo "[*] samples: $N"
|
|
44
|
+
|
|
45
|
+
TMP="$(mktemp -d)"; trap 'rm -rf "$TMP"' EXIT
|
|
46
|
+
if [ -z "$CMD" ]; then
|
|
47
|
+
# Demo target: prints a stack address per run. Absolute counts vary by
|
|
48
|
+
# kernel/ABI (stack ASLR is commonly ~19-30 bits); this measures your box.
|
|
49
|
+
cat > "$TMP/demo.c" <<'EOF'
|
|
50
|
+
#include <stdio.h>
|
|
51
|
+
int main(void) { int x; printf("0x%lx\n", (unsigned long)(void*)&x); return 0; }
|
|
52
|
+
EOF
|
|
53
|
+
if ! command -v gcc >/dev/null 2>&1; then
|
|
54
|
+
echo "[!] gcc not found (install: sudo apt install -y build-essential) or pass --cmd" >&2
|
|
55
|
+
exit 1
|
|
56
|
+
fi
|
|
57
|
+
gcc -O0 -fno-stack-protector -o "$TMP/demo" "$TMP/demo.c"
|
|
58
|
+
CMD="$TMP/demo"
|
|
59
|
+
echo "[*] using built-in demo binary (pass --cmd to probe your own)"
|
|
60
|
+
fi
|
|
61
|
+
|
|
62
|
+
: > "$TMP/addrs"
|
|
63
|
+
i=0
|
|
64
|
+
while [ "$i" -lt "$N" ]; do
|
|
65
|
+
out="$(sh -c "$CMD" 2>&1)"
|
|
66
|
+
addr="$(printf '%s\n' "$out" | grep -oE '0x[0-9a-fA-F]{6,16}' | head -1)"
|
|
67
|
+
if [ -z "$addr" ]; then
|
|
68
|
+
echo "[!] no hex address in output: $out" >&2
|
|
69
|
+
exit 1
|
|
70
|
+
fi
|
|
71
|
+
# Store plain integers, not hex strings: awk's lexicographic compare would
|
|
72
|
+
# mis-order hex, and every stat below needs numeric compare.
|
|
73
|
+
printf '%d\n' "$addr" >> "$TMP/addrs"
|
|
74
|
+
i=$((i+1))
|
|
75
|
+
done
|
|
76
|
+
|
|
77
|
+
LC_ALL=C awk -v n="$N" '
|
|
78
|
+
{ v[NR]=$1; seen[$1]=1; if (NR==1) { min=$1; max=$1 } else { if ($1<min) min=$1; if ($1>max) max=$1 } }
|
|
79
|
+
END {
|
|
80
|
+
d = length(seen);
|
|
81
|
+
e = (d>1) ? log(d)/log(2) : 1; if (e<1) e=1;
|
|
82
|
+
space = exp(e*log(2)); # 2^e guessing space
|
|
83
|
+
per = 1/space; # hit odds per blind attempt
|
|
84
|
+
a50 = log(0.50)/log(1-per); # cumulative 50%: k = ln(1-0.5)/ln(1-p)
|
|
85
|
+
a90 = log(0.10)/log(1-per); # cumulative 90%: k = ln(1-0.9)/ln(1-p)
|
|
86
|
+
printf "[*] %d runs, %d distinct values\n", n, d;
|
|
87
|
+
printf "[*] range : 0x%x .. 0x%x (span ~ %d bits)\n", min, max, (min==max)?0:int(log(max-min)/log(2));
|
|
88
|
+
printf "[*] distinct-entropy : ~ %.1f bits (floor; true value >= this)\n", e;
|
|
89
|
+
printf "[*] guessing space : ~ %.0f possibilities\n", space;
|
|
90
|
+
printf "[*] per-attempt odds : ~ 1 in %.0f\n", space;
|
|
91
|
+
printf "[*] brute-force hits : 50%% by attempt ~ %.0f ; 90%% by attempt ~ %.0f\n", a50, a90;
|
|
92
|
+
print "[*] caveats: distinct-sample entropy underestimates when n << space;";
|
|
93
|
+
print " per-run address can also shift with PID/env size;";
|
|
94
|
+
print " no-exec and canary hardening are NOT modeled here";
|
|
95
|
+
}
|
|
96
|
+
' "$TMP/addrs"
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# crash-offset-pattern.sh — cyclic pattern generator + offset lookup (lab use).
|
|
3
|
+
#
|
|
4
|
+
# AUTHORIZATION NOTICE
|
|
5
|
+
# --------------------
|
|
6
|
+
# Offset discovery is for a crash you caused on a LAB BINARY you own or are
|
|
7
|
+
# authorized to test (your VM, your CTF box, your fuzzing container). Feeding
|
|
8
|
+
# this pattern to a third-party service without authorization is a crime.
|
|
9
|
+
# Running this script asserts that authorization. Lab-only by design.
|
|
10
|
+
# --------------------
|
|
11
|
+
#
|
|
12
|
+
# What it does (the Metasploit pattern_create/pattern_offset workflow, zero
|
|
13
|
+
# deps beyond bash+awk so it runs in WSL, muscle-memory compatible):
|
|
14
|
+
#
|
|
15
|
+
# ./crash-offset-pattern.sh --length 500 dump the cyclic pattern
|
|
16
|
+
# ./crash-offset-pattern.sh --length 600 > pat.bin
|
|
17
|
+
# cat pat.bin | ./my-lab-app it crashes; note EIP/RIP
|
|
18
|
+
# ./crash-offset-pattern.sh --offset 0x41327a41 resolve hex (little-endian)
|
|
19
|
+
# ./crash-offset-pattern.sh --offset A2z7 resolve ASCII fragment
|
|
20
|
+
#
|
|
21
|
+
# Alphabet is Upper+Lower+Digit in the classic Aa0 ordering; the pattern
|
|
22
|
+
# repeats after 26*26*10 characters (20,280). The script says so out loud
|
|
23
|
+
# when a requested length exceeds one period, so you never chase a phantom
|
|
24
|
+
# offset from the wrap-around.
|
|
25
|
+
set -u
|
|
26
|
+
LEN=0
|
|
27
|
+
OFF=""
|
|
28
|
+
frag=""
|
|
29
|
+
while [ $# -gt 0 ]; do
|
|
30
|
+
case "$1" in
|
|
31
|
+
--length|-l) LEN="$2"; shift 2 ;;
|
|
32
|
+
--offset|-o) OFF="$2"; shift 2 ;;
|
|
33
|
+
-h|--help) sed -n '2,26p' "$0"; exit 0 ;;
|
|
34
|
+
*) echo "unknown arg: $1" >&2; exit 2 ;;
|
|
35
|
+
esac
|
|
36
|
+
done
|
|
37
|
+
|
|
38
|
+
PERIOD=20280 # 26*26*10 one triple per position, distinct until wrap
|
|
39
|
+
|
|
40
|
+
if [ -n "$OFF" ]; then
|
|
41
|
+
# Resolve the query to an ASCII fragment: 4+ hex bytes -> little-endian
|
|
42
|
+
# bytes (what a register would hold), otherwise use it as-is.
|
|
43
|
+
frag=$(printf '%s' "$OFF" | tr -d ' ')
|
|
44
|
+
if printf '%s' "$frag" | grep -qE '^(0[xX])?[0-9a-fA-F]{8}$'; then
|
|
45
|
+
h="$(printf '%s' "$frag" | sed 's/^0[xX]//')"
|
|
46
|
+
# little-endian byte order: 41327a41 -> memory bytes 41 32 7a 41 -> "A2zA"
|
|
47
|
+
frag="$(printf '%s' "$h" | sed 's/\(..\)\(..\)\(..\)\(..\)/\4\3\2\1/' |\
|
|
48
|
+
sed 's/\([0-9a-fA-F][0-9a-fA-F]\)/\\\x\1/g' | xargs -0 printf)"
|
|
49
|
+
fi
|
|
50
|
+
echo "[*] AUTHORIZATION NOTICE: offset lookup for a lab crash you own/are authorized to test."
|
|
51
|
+
echo "[*] searching for fragment: $frag"
|
|
52
|
+
LEN=$((PERIOD + ${#frag} + 40)) # one full period + margin, wrap-safe search
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
[ "$LEN" -le 0 ] && { echo "nothing to do: pass --length N or --offset VALUE" >&2; exit 2; }
|
|
56
|
+
[ "$LEN" -gt "$PERIOD" ] && [ -z "$OFF" ] && \
|
|
57
|
+
echo "[!] length $LEN exceeds the 20,280-character period - the pattern wraps and offsets repeat" >&2
|
|
58
|
+
|
|
59
|
+
LC_ALL=C awk -v len="$LEN" -v frag="$frag" -v per="$PERIOD" '
|
|
60
|
+
BEGIN {
|
|
61
|
+
UP="ABCDEFGHIJKLMNOPQRSTUVWXYZ"; LO="abcdefghijklmnopqrstuvwxyz"; DI="0123456789";
|
|
62
|
+
out="";
|
|
63
|
+
for (t = 0; length(out) < len; t++) {
|
|
64
|
+
c1 = substr(UP, int(t/260)%26 + 1, 1);
|
|
65
|
+
c2 = substr(LO, int(t/10)%26 + 1, 1);
|
|
66
|
+
c3 = substr(DI, t%10 + 1, 1);
|
|
67
|
+
out = out c1 c2 c3;
|
|
68
|
+
}
|
|
69
|
+
if (frag == "") { printf "%s", substr(out, 1, len); exit 0 }
|
|
70
|
+
pos = index(out, frag);
|
|
71
|
+
if (pos == 0) {
|
|
72
|
+
printf "[!] fragment not found in one full period; re-check the value\n" > "/dev/stderr";
|
|
73
|
+
exit 1;
|
|
74
|
+
}
|
|
75
|
+
printf "[*] offset: %d (0x%x) first occurrence, 0-based\n", pos-1, pos-1;
|
|
76
|
+
if (pos + length(frag) - 1 > per)
|
|
77
|
+
printf "[!] note: match crosses the period boundary - treat with suspicion\n" > "/dev/stderr";
|
|
78
|
+
printf "[*] next bytes at that point: %s\n", substr(out, pos, 16);
|
|
79
|
+
printf "[*] build the exploit string: prefix %d filler bytes + your control value\n", pos-1;
|
|
80
|
+
}
|
|
81
|
+
' /dev/null
|