Explore #!/usr/bin/env bash installredtools.sh — generates 30 small CTF helper scripts (Bash +… Save Share Download ▾ Report#!/usr/bin/env bash
install_redtools.sh — generates 30 small CTF helper scripts (Bash + common CLI + Python3)
For legal CTF/lab use only.
set -euo pipefail
DIR="1 : − p i c o − r e d t o o l s " m k d i r − p " {1:-pico-redtools}"
mkdir -p " 1 : − p i co − r e d t oo l s " mk d i r − p " DIR"
write() {
local name="1 " s h DIR/$name" <<'EOF'
#!/usr/bin/env bash
Show full message · 559 lines AssistantCopy response Copy first prompt
Other models, same or similar prompt Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Details
Provider Anthropic
Model provenance As recorded by source dataset
Turns 1 (2 messages)
Language en
Added to archive Nov 19, 2026
ID 01m7tp8a4vb70qdm8ggkt878p4Source & license Imported from Arena Expert 5K (source ). Imported records earn no Research Points.
Upstream record: 75a7e4c9-0e33-48bc-91fb-c0f0b8834800:a
LMArena, Arena Expert (2025). https://news.lmarena.ai/arena-expert/
License: Prompts CC-BY-4.0; outputs governed by provider terms
Dataset releases Not yet included in a published release.
i f t c a t > " 1"
shift
cat > " 1" s hi f t c a t > "
placeholder EOF
chmod +x "D I R / DIR/ D I R / name"
}
1) b64decode_loop.sh write b64decode_loop.sh
cat > "$DIR/b64decode_loop.sh" <<'EOF'
#!/usr/bin/env bash
Repeatedly base64-decode input until it fails.
Usage: ./b64decode_loop.sh [file] > out set -euo pipefail
tmp=( m k t e m p ) ; t r a p ′ r m − f " (mktemp); trap 'rm -f " ( mk t e m p ) ; t r a p ′ r m − f " tmp"' EXIT
if [[ # -gt 0 && -f " {1:-}" ]]; then data=( c a t " (cat " ( c a t " 1"); else data=( c a t ) ; f i c o u n t = 0 w h i l e t r u e ; d o i f p r i n t f (cat); fi
count=0
while true; do
if printf %s " ( c a t ) ; f i co u n t = 0 w hi l e t r u e ; d o i f p r in t f data" | base64 -d > "t m p " 2 > / d e v / n u l l ; t h e n d a t a = " tmp" 2>/dev/null; then
data=" t m p "2 > / d e v / n u l l ; t h e n d a t a = " (cat "t m p " ) " c o u n t = tmp")"
count= t m p " ) " co u n t = ((count+1))
else
break
fi
done
printf %s "d a t a " p r i n t f " \n [ d e c o d e d data"
printf "\n[decoded %d time(s)]\n" " d a t a " p r in t f " \n [ d eco d e d count" >&2
EOF
chmod +x "$DIR/b64decode_loop.sh"
2) b64encode.sh cat > "$DIR/b64encode.sh" <<'EOF'
#!/usr/bin/env bash
Base64-encode input N times (default 1).
Usage: ./b64encode.sh [-n N] [file] set -euo pipefail
N=1
if [[ "1 : − " = = " − n " ] ] ; t h e n N = " {1:-}" == "-n" ]]; then N=" 1 : − " == " − n " ]] ; t h e n N = " {2:-1}"; shift 2; fi
if [[ # -gt 0 && -f " {1:-}" ]]; then data=( c a t " (cat " ( c a t " 1"); else data=(cat); fi
for ((i=0;i<N;i++)); do
if base64 --help 2>&1 | grep -q '\-w'; then
data= (printf %s "d a t a " ∣ b a s e 64 − w 0 ) e l s e d a t a = data" | base64 -w0)
else
data= d a t a "∣ ba se 64 − w 0 ) e l se d a t a = (printf %s "d a t a " ∣ b a s e 64 ∣ t r − d ′ \n ′ ) f i d o n e p r i n t f data" | base64 | tr -d '\n')
fi
done
printf %s " d a t a "∣ ba se 64∣ t r − d ′ \n ′ ) data"\n
EOF
chmod +x "$DIR/b64encode.sh"
3) base32decode.sh cat > "$DIR/base32decode.sh" <<'EOF'
#!/usr/bin/env bash
Base32 decode (case-insensitive).
Usage: ./base32decode.sh [file] > out set -euo pipefail
if command -v python3 >/dev/null 2>&1; then
if [[ # -gt 0 && -f " {1:-}" ]]; then cat "1"; else cat; fi | \
python3 - <<'PY'
import sys, base64
data = sys.stdin.buffer.read().replace(b'\n', b'')
sys.stdout.buffer.write(base64.b32decode(data, casefold=True))
PY
elif command -v base32 >/dev/null 2>&1; then
if [[ # -gt 0 && -f "1 : − " ] ] ; t h e n b a s e 32 − d " {1:-}" ]]; then base32 -d " 1 : − " ]] ; t h e nba se 32 − d " 1"; else base32 -d; fi
else
echo "Need python3 or base32." >&2; exit 1
fi
EOF
chmod +x "$DIR/base32decode.sh"
4) url_decode.sh cat > "$DIR/url_decode.sh" <<'EOF'
#!/usr/bin/env bash
URL-decode
Usage: echo 'foo%20bar' | ./url_decode.sh set -euo pipefail
if command -v python3 >/dev/null 2>&1; then
python3 - <<'PY'
import sys, urllib.parse
print(urllib.parse.unquote_plus(sys.stdin.read()), end="")
PY
else
sed -e 's/+/ /g' -e 's/%/\x/g' | xargs -0 printf "%b" || true
fi
EOF
chmod +x "$DIR/url_decode.sh"
5) url_encode.sh cat > "$DIR/url_encode.sh" <<'EOF'
#!/usr/bin/env bash
URL-encode
Usage: echo 'a b&c' | ./url_encode.sh set -euo pipefail
if command -v python3 >/dev/null 2>&1; then
python3 - <<'PY'
import sys, urllib.parse
print(urllib.parse.quote_plus(sys.stdin.read()), end="")
PY
else
python - <<'PY'
import sys, urllib
print urllib.quote_plus(sys.stdin.read()),
PY
fi
EOF
chmod +x "$DIR/url_encode.sh"
6) hex2bin.sh cat > "$DIR/hex2bin.sh" <<'EOF'
#!/usr/bin/env bash
Convert hex to raw bytes.
Usage: ./hex2bin.sh [file-or-hex] > out.bin set -euo pipefail
if [[ # -gt 0 && -f " {1:-}" ]]; then
tr -d ' \t\r\n' < "1 " ∣ x x d − r − p e l i f [ [ 1" | xxd -r -p
elif [[ 1"∣ xx d − r − p e l i f [[ # -gt 0 ]]; then
printf %s "1 " ∣ t r − d ′ \t \n ˚ ′ ∣ x x d − r − p e l s e t r − d ′ \t \n ˚ ′ ∣ x x d − r − p f i E O F c h m o d + x " 1" | tr -d ' \t\r\n' | xxd -r -p
else
tr -d ' \t\r\n' | xxd -r -p
fi
EOF
chmod +x " 1"∣ t r − d ′ \t \n ˚ ′ ∣ xx d − r − p e l DIR/hex2bin.sh"
7) bin2hex.sh cat > "$DIR/bin2hex.sh" <<'EOF'
#!/usr/bin/env bash
Convert bytes to hex (continuous).
Usage: ./bin2hex.sh file.bin set -euo pipefail
if [[ # -gt 0 && -f " {1:-}" ]]; then xxd -p -c 999999 "1 " e l s e x x d − p − c 999999 f i E O F c h m o d + x " 1"
else xxd -p -c 999999
fi
EOF
chmod +x " 1" e l se xx d − p − c 999999 f i E O F c hm o d + x " DIR/bin2hex.sh"
8) rotN.sh cat > "$DIR/rotN.sh" <<'EOF'
#!/usr/bin/env bash
ROT-N (default 13). Letters only.
Usage: echo Hello | ./rotN.sh [N] set -euo pipefail
N="1 : − 13 " p y t h o n 3 − " {1:-13}"
python3 - " 1 : − 13 " p y t h o n 3 − " N" <<'PY'
import sys
n=int(sys.argv[1])
text=sys.stdin.read()
out=[]
for ch in text:
o=ord(ch)
if 65<=o<=90: out.append(chr((o-65+n)%26+65))
elif 97<=o<=122: out.append(chr((o-97+n)%26+97))
else: out.append(ch)
sys.stdout.write(''.join(out))
PY
EOF
chmod +x "$DIR/rotN.sh"
9) caesar_bruteforce.sh cat > "$DIR/caesar_bruteforce.sh" <<'EOF'
#!/usr/bin/env bash
Try all ROT 0-25 shifts.
Usage: echo "uryyb" | ./caesar_bruteforce.sh set -euo pipefail
text="( c a t ) " f o r n i n (cat)"
for n in ( c a t ) " f or nin (seq 0 25); do
printf "ROT %02d: " "n " p r i n t f n"
printf %s " n " p r in t f text" | "0 d i r / r o t N . s h " " 0_dir/rotN.sh" " 0 d i r / r o tN . s h "" n" 2>/dev/null || {
python3 - "n" <<'PY'
import sys
n=int(sys.argv[1]); t=sys.stdin.read()
def rot(text,n):
r=[]
for ch in text:
o=ord(ch)
if 65<=o<=90: r.append(chr((o-65+n)%26+65))
elif 97<=o<=122: r.append(chr((o-97+n)%26+97))
else: r.append(ch)
return ''.join(r)
print(rot(t,n), end='')
PY
}
printf "\n"
done
EOF
chmod +x " DIR/caesar_bruteforce.sh"
fix $0_dir reference sed -i '1i 0_dir="( c d " (cd " ( c d " (dirname "0")" && pwd)"' " DIR/caesar_bruteforce.sh" || true
10) xor_single_byte_bruteforce.sh cat > "$DIR/xor_single_byte_bruteforce.sh" <<'EOF'
#!/usr/bin/env bash
Single-byte XOR brute-force (prints top candidates).
Usage: ./xor_single_byte_bruteforce.sh <hexstring|file> set -euo pipefail
if [[ # -lt 1 ]]; then echo "Usage: 0 <hexstring|file>" >&2; exit 1; fi
if [[ -f "1 " ] ] ; t h e n h e x = 1" ]]; then hex= 1" ]] ; t h e nh e x = (xxd -p -c 999999 "1 " ∣ t r − d ′ \n ′ ) ; e l s e h e x = " 1" | tr -d '\n'); else hex=" 1"∣ t r − d ′ \n ′ ) ; e l se h e x = " 1"; fi
python3 - "h e x " < < ′ P Y ′ i m p o r t s y s , b i n a s c i i , s t r i n g h e x d a t a = s y s . a r g v [ 1 ] d a t a = b i n a s c i i . u n h e x l i f y ( h e x d a t a ) d e f s c o r e ( b ) : r e t u r n s u m ( 1 f o r c i n b i f 32 < = c < 127 o DIR/xor_single_byte_bruteforce.sh"
11) xor_with_key.sh cat > "$DIR/xor_with_key.sh" <<'EOF'
#!/usr/bin/env bash
XOR bytes with repeating ASCII key.
Usage: ./xor_with_key.sh KEY [file] > out set -euo pipefail
if [[ # -lt 1 ]]; then echo "Usage: 0 KEY [file|-]" >&2; exit 1; fi
KEY="1 " ; s h i f t ∣ ∣ t r u e i f [ [ 1"; shift || true
if [[ 1" ; s hi f t ∣∣ t r u e i f [[ # -gt 0 && "1" != "-" && -f " 1" ]]; then exec < "1 " ; f i p y t h o n 3 − " 1"; fi
python3 - " 1" ; f i p y t h o n 3 − " KEY" <<'PY'
import sys
key=sys.argv[1].encode()
data=sys.stdin.buffer.read()
out=bytes(b ^ key[i%len(key)] for i,b in enumerate(data))
sys.stdout.buffer.write(out)
PY
EOF
chmod +x "$DIR/xor_with_key.sh"
12) vigenere.sh cat > "$DIR/vigenere.sh" <<'EOF'
#!/usr/bin/env bash
Vigenère cipher encrypt/decrypt (letters only).
Usage: echo HELLOWORLD | ./vigenere.sh -e KEY
echo RIJVSUYVJN | ./vigenere.sh -d KEY set -euo pipefail
MODE="-d"
if [[ "1 : − " = = " − e " ∣ ∣ " {1:-}" == "-e" || " 1 : − " == " − e "∣∣" {1:-}" == "-d" ]]; then MODE="1 " ; s h i f t ; f i K E Y = " 1"; shift; fi
KEY=" 1" ; s hi f t ; f i K E Y = " {1:?Need KEY}"; KEY=( p r i n t f (printf %s " ( p r in t f KEY" | tr '[:lower:]' '[:upper:]' | tr -cd 'A-Z')
python3 - "M O D E " " MODE" " M O D E "" KEY" <<'PY'
import sys
mode,key=sys.argv[1],sys.argv[2]
text=sys.stdin.read()
def shift(c,k,enc=True):
if not c.isalpha(): return c
base='A' if c.isupper() else 'a'; o=ord(c)-ord(base); kk=ord(k)-65
n=(o+kk)%26 if enc else (o-kk)%26
return chr(n+ord(base))
out=[]; j=0
for c in text:
if c.isalpha():
out.append(shift(c, key[j%len(key)], enc=(mode=='-e'))); j+=1
else: out.append(c)
sys.stdout.write(''.join(out))
PY
EOF
chmod +x "$DIR/vigenere.sh"
13) file_inspect.sh cat > "$DIR/file_inspect.sh" <<'EOF'
#!/usr/bin/env bash
Quick file triage: type, size, hashes, magic bytes, strings, exif if available.
Usage: ./file_inspect.sh file set -euo pipefail
f="1 : ? f i l e r e q u i r e d " e c h o " = = f i l e = = " f i l e " {1:?file required}"
echo "== file =="
file " 1 : ? f i l er e q u i r e d " ec h o " == f i l e == " f i l e " f" || true
echo "== size =="
stat --printf="bytes:%s\n" "f " 2 > / d e v / n u l l ∣ ∣ s t a t − f " b y t e s : f" 2>/dev/null || stat -f "bytes:%z" " f "2 > / d e v / n u l l ∣∣ s t a t − f " b y t es : f"
echo "== hashes =="
{ md5sum "f " 2 > / d e v / n u l l ∣ ∣ m d 5 − r " f" 2>/dev/null || md5 -r " f "2 > / d e v / n u l l ∣∣ m d 5 − r " f"; } | sed 's/^/MD5: /'
{ sha1sum "f " 2 > / d e v / n u l l ∣ ∣ s h a s u m " f" 2>/dev/null || shasum " f "2 > / d e v / n u l l ∣∣ s ha s u m " f"; } | sed 's/^/SHA1: /'
{ sha256sum "f " 2 > / d e v / n u l l ∣ ∣ s h a s u m − a 256 " f" 2>/dev/null || shasum -a 256 " f "2 > / d e v / n u l l ∣∣ s ha s u m − a 256" f"; } | sed 's/^/SHA256: /'
echo "== magic (first 64 bytes) =="
xxd -g1 -l 64 "f " e c h o " = = s t r i n g s ( m i n 6 c h a r s , t o p 50 ) = = " s t r i n g s − n 6 " f"
echo "== strings (min 6 chars, top 50) =="
strings -n 6 " f " ec h o " == s t r in g s ( min 6 c ha r s , t o p 50 ) == f" | head -50 || true
if command -v exiftool >/dev/null 2>&1; then
echo "== exiftool =="
exiftool "f " ∣ h e a d − 100 f i E O F c h m o d + x " f" | head -100
fi
EOF
chmod +x " f "∣ h e a d − 100 f i E O F c hm o d + x " DIR/file_inspect.sh"
14) carve_png.sh cat > "$DIR/carve_png.sh" <<'EOF'
#!/usr/bin/env bash
Carve first PNG from a blob by signature and IEND.
Usage: ./carve_png.sh blob.bin out.png set -euo pipefail
inp="1 : ? b l o b " ; o u t = " {1:?blob}"; out=" 1 : ? b l o b " ; o u t = " {2:?out.png}"
python3 - "i n p " " inp" " in p "" out" <<'PY'
import sys, binascii
data=open(sys.argv[1],'rb').read()
sig=b'\x89PNG\r\n\x1a\n'
start=data.find(sig)
if start==-1: sys.exit("PNG signature not found")
iend=data.find(b'IEND', start)
if iend==-1: sys.exit("IEND not found")
iend+=8 # IEND + CRC
open(sys.argv[2],'wb').write(data[start:iend])
print("Wrote", sys.argv[2])
PY
EOF
chmod +x "$DIR/carve_png.sh"
15) png_chunk_dump.sh cat > "$DIR/png_chunk_dump.sh" <<'EOF'
#!/usr/bin/env bash
List PNG chunks and extract tEXt/zTXt/iTXt as text.
Usage: ./png_chunk_dump.sh file.png set -euo pipefail
png="1 : ? p n g " p y t h o n 3 − " {1:?png}"
python3 - " 1 : ? p n g " p y t h o n 3 − " png" <<'PY'
import sys, struct, zlib
with open(sys.argv[1],'rb') as f:
sig=f.read(8)
if sig!=b'\x89PNG\r\n\x1a\n': sys.exit("Not a PNG")
off=8; i=0
while True:
lenb=f.read(4)
if not lenb: break
ln=struct.unpack(">I",lenb)[0]
typ=f.read(4)
data=f.read(ln)
crc=f.read(4)
print(f"{i:02d} off=0x{off:08x} type={typ.decode()} len={ln}")
if typ in [b'tEXt', b'zTXt', b'iTXt']:
try:
if typ==b'zTXt':
k,method_and_rest=data.split(b'\x00',1)
if method_and_rest[:1]!=b'\x00': raise ValueError
txt=zlib.decompress(method_and_rest[1:])
print(" key:", k.decode(errors='ignore'))
print(" text:", txt.decode(errors='replace')[:200])
else:
print(" text:", data.decode(errors='replace')[:200])
except Exception as e:
print(" (could not parse text chunk)", e)
off += 12+ln; i+=1
PY
EOF
chmod +x "$DIR/png_chunk_dump.sh"
16) strings_grep.sh cat > "$DIR/strings_grep.sh" <<'EOF'
#!/usr/bin/env bash
Find printable strings matching a pattern.
Usage: ./strings_grep.sh file PATTERN set -euo pipefail
f="1 : ? f i l e " ; p a t = " {1:?file}"; pat=" 1 : ? f i l e " ; p a t = " {2:?pattern}"
strings -n 4 "f " ∣ g r e p − a E " f" | grep -aE " f "∣ g r e p − a E " pat" || true
EOF
chmod +x "$DIR/strings_grep.sh"
17) wordlist_mangler.sh cat > "$DIR/wordlist_mangler.sh" <<'EOF'
#!/usr/bin/env bash
Simple mangler: case flips + common suffixes.
Usage: ./wordlist_mangler.sh word > variants.txt set -euo pipefail
w="1 : ? w o r d " b a s e = ( " {1:?word}"
base=(" 1 : ? w or d " ba se = ( " w" "(tr '[:lower:]' '[:upper:]' <<<" w")" "(tr '[:lower:]' '[:upper:]' <<<" {w:0:1}")w : 1 " ) f o r b i n " {w:1}")
for b in " w : 1 " ) f or bin " {base[@]}"; do
echo "b"
for s in '' '1' '123' '!' '2024' '2025' '@' '#' '!' '1234' '321' '01' '!' '99'; do
echo " {b}s " d o n e d o n e ∣ a w k ′ ! s e e n [ {s}"
done
done | awk '!seen[ s " d o n e d o n e ∣ a w k ′ ! see n [ 0]++'
EOF
chmod +x "$DIR/wordlist_mangler.sh"
18) pcap_host_list.sh cat > "$DIR/pcap_host_list.sh" <<'EOF'
#!/usr/bin/env bash
List hosts/servers seen in a PCAP (needs tshark).
Usage: ./pcap_host_list.sh file.pcap set -euo pipefail
pcap="{1:?pcap}"
if ! command -v tshark >/dev/null 2>&1; then echo "Need tshark" >&2; exit 1; fi
echo "IPs:"; tshark -r " pcap" -T fields -e ip.src -e ip.dst 2>/dev/null | tr '\t' '\n' | sort -u
echo "DNS names:"; tshark -r "p c a p " − Y " d n s . q r y . n a m e " − T f i e l d s − e d n s . q r y . n a m e 2 > / d e v / n u l l ∣ s o r t − u E O F c h m o d + x " pcap" -Y "dns.qry.name" -T fields -e dns.qry.name 2>/dev/null | sort -u
EOF
chmod +x " p c a p " − Y " d n s . q r y . nam e " − T f i e l d s − e d n s . q r y . nam e 2 > / d e v / n u l l ∣ sor t − u E O F c hm o d + x " DIR/pcap_host_list.sh"
19) pcap_export_http.sh cat > "$DIR/pcap_export_http.sh" <<'EOF'
#!/usr/bin/env bash
Export HTTP objects from PCAP (tshark).
Usage: ./pcap_export_http.sh file.pcap outdir set -euo pipefail
pcap="1 : ? p c a p " ; o u t = " {1:?pcap}"; out=" 1 : ? p c a p " ; o u t = " {2:?outdir}"
mkdir -p "out"
if ! command -v tshark >/dev/null 2>&1; then echo "Need tshark" >&2; exit 1; fi
tshark -r " pcap" --export-objects "http,o u t " e c h o " E x p o r t e d t o out"
echo "Exported to o u t " ec h o " E x p or t e d t o out"
EOF
chmod +x "$DIR/pcap_export_http.sh"
20) http_headers.sh cat > "$DIR/http_headers.sh" <<'EOF'
#!/usr/bin/env bash
Fetch HTTP(S) headers. set -euo pipefail
url="1 : ? u r l " c u r l − s S L − D − − o / d e v / n u l l " {1:?url}"
curl -sSL -D - -o /dev/null " 1 : ? u r l " c u r l − s S L − D − − o / d e v / n u l l " url"
EOF
chmod +x "$DIR/http_headers.sh"
21) banner_grab.sh cat > "$DIR/banner_grab.sh" <<'EOF'
#!/usr/bin/env bash
TCP banner grab (sends optional payload).
Usage: ./banner_grab.sh host port [payload] set -euo pipefail
host="1 : ? h o s t " ; p o r t = " {1:?host}"; port=" 1 : ? h os t " ; p or t = " {2:?port}"; payload="{3:-}"
{ sleep 1; [[ -n " payload" ]] && printf %s "payload"; } | nc -v " host" "port" -w 3 2>&1 || true
EOF
chmod +x " DIR/banner_grab.sh"
22) tcp_check.sh cat > "$DIR/tcp_check.sh" <<'EOF'
#!/usr/bin/env bash
Check if a TCP port is open.
Usage: ./tcp_check.sh host port set -euo pipefail
host="1 : ? h o s t " ; p o r t = " {1:?host}"; port=" 1 : ? h os t " ; p or t = " {2:?port}"
if nc -z -w2 "h o s t " " host" " h os t "" port" 2>/dev/null; then
echo "OPEN: h o s t : host: h os t : port"
else
echo "CLOSED: h o s t : host: h os t : port"
fi
EOF
chmod +x "$DIR/tcp_check.sh"
23) udp_send.sh cat > "$DIR/udp_send.sh" <<'EOF'
#!/usr/bin/env bash
Send a UDP datagram and listen briefly for a reply.
Usage: echo "ping" | ./udp_send.sh host port set -euo pipefail
host="1 : ? h o s t " ; p o r t = " {1:?host}"; port=" 1 : ? h os t " ; p or t = " {2:?port}"
nc -u -w2 "h o s t " " host" " h os t "" port"
EOF
chmod +x "$DIR/udp_send.sh"
24) dns_enum_basic.sh cat > "$DIR/dns_enum_basic.sh" <<'EOF'
#!/usr/bin/env bash
Basic DNS lookups (A/AAAA/MX/TXT/CNAME/NS).
Usage: ./dns_enum_basic.sh example.com set -euo pipefail
d="1 : ? d o m a i n " f o r t i n A A A A A C N A M E M X T X T N S ; d o e c h o " = = {1:?domain}"
for t in A AAAA CNAME MX TXT NS; do
echo "== 1 : ? d o main " f or t in AAAAA C N A M E M X T X T N S ; d oec h o " == t =="
dig +short "d " " d" " d "" t"
done
EOF
chmod +x "$DIR/dns_enum_basic.sh"
25) connect_send.sh cat > "$DIR/connect_send.sh" <<'EOF'
#!/usr/bin/env bash
Connect to remote service and send data from a file or stdin.
Usage: ./connect_send.sh host port [file] set -euo pipefail
h="1 : ? h o s t " ; p = " {1:?host}"; p=" 1 : ? h os t " ; p = " {2:?port}"; f="3 : − " i f [ [ − n " {3:-}"
if [[ -n " 3 : − " i f [[ − n " f" && -f "f " ] ] ; t h e n n c " f" ]]; then nc " f " ]] ; t h e nn c " h" "p " < " p" < " p " < " f"
else nc "h " " h" " h "" p"
fi
EOF
chmod +x "$DIR/connect_send.sh"
26) jwt_decode.sh cat > "$DIR/jwt_decode.sh" <<'EOF'
#!/usr/bin/env bash
Decode JWT header and payload (no verify).
Usage: ./jwt_decode.sh set -euo pipefail
tok="1 : ? J W T " p y t h o n 3 − " {1:?JWT}"
python3 - " 1 : ? J W T " p y t h o n 3 − " tok" <<'PY'
import sys, json, base64
def b64u(s):
s+= '=' * (-len(s)%4)
return base64.urlsafe_b64decode(s.encode())
hdr,pay,_=sys.argv[1].split('.')
print("== header =="); print(json.dumps(json.loads(b64u(hdr)), indent=2))
print("== payload =="); print(json.dumps(json.loads(b64u(pay)), indent=2))
PY
EOF
chmod +x "$DIR/jwt_decode.sh"
27) zip_list_extract.sh cat > "$DIR/zip_list_extract.sh" <<'EOF'
#!/usr/bin/env bash
List ZIP contents or print a file from ZIP to stdout.
Usage: ./zip_list_extract.sh file.zip [path/in/zip] set -euo pipefail
z="1 : ? z i p " i f [ [ − z " {1:?zip}"
if [[ -z " 1 : ? z i p " i f [[ − z " {2:-}" ]]; then
unzip -l "z " e l s e u n z i p − p " z"
else
unzip -p " z " e l se u n z i p − p " z" "2 " f i E O F c h m o d + x " 2"
fi
EOF
chmod +x " 2" f i E O F c hm o d + x " DIR/zip_list_extract.sh"
28) hash_calc.sh cat > "$DIR/hash_calc.sh" <<'EOF'
#!/usr/bin/env bash
Compute MD5/SHA1/SHA256 of file or stdin.
Usage: ./hash_calc.sh [file] set -euo pipefail
if [[ -n "{1:-}" && -f " 1" ]]; then f="1"; else f="-"; fi
{ md5sum " f" 2>/dev/null || md5 -r "f"; } | sed 's/^/MD5: /'
{ sha1sum " f" 2>/dev/null || shasum "f"; } | sed 's/^/SHA1: /'
{ sha256sum " f" 2>/dev/null || shasum -a 256 "f"; } | sed 's/^/SHA256: /'
EOF
chmod +x " DIR/hash_calc.sh"
29) ssl_cert_info.sh cat > "$DIR/ssl_cert_info.sh" <<'EOF'
#!/usr/bin/env bash
Show remote TLS certificate details.
Usage: ./ssl_cert_info.sh host [port] [servername] set -euo pipefail
host="1 : ? h o s t " ; p o r t = " {1:?host}"; port=" 1 : ? h os t " ; p or t = " {2:-443}"; sni="{3:- host}"
openssl s_client -servername "s n i " − c o n n e c t " sni" -connect " s ni " − co nn ec t " host:p o r t " − s h o w c e r t s < / d e v / n u l l 2 > / d e v / n u l l ∣ o p e n s s l x 509 − n o o u t − t e x t E O F c h m o d + x " port" -showcerts </dev/null 2>/dev/null | openssl x509 -noout -text
EOF
chmod +x " p or t " − s h o w cer t s < / DIR/ssl_cert_info.sh"
30) http_status.sh cat > "$DIR/http_status.sh" <<'EOF'
#!/usr/bin/env bash
Get HTTP status code and timing.
Usage: ./http_status.sh URL set -euo pipefail
url="1 : ? u r l " c u r l − s − o / d e v / n u l l − w " c o d e : {1:?url}"
curl -s -o /dev/null -w "code:%{http_code} time_total:%{time_total}s\n" " 1 : ? u r l " c u r l − s − o / d e v / n u l l − w " co d e : url"
EOF
chmod +x "$DIR/http_status.sh"
echo "Created 30 scripts in: DIR"
printf "Tip: export PATH=\"%s:\ PATH"\n" "( c d " (cd " ( c d " DIR" && pwd)" make it powershell
Here's a PowerShell version of the CTF toolkit installer that creates 30 helper scripts:
powershell Copy code
# install_redtools.ps1 - generates 30 small CTF helper scripts (PowerShell + Python3)
# For legal CTF/lab use only.
param(
[string]$Dir = "pico-redtools"
)
$ErrorActionPreference = "Stop"
# Create directory
New-Item -ItemType Directory -Force -Path $Dir | Out-Null
function Write-Script {
param(
[string]$Name,
[string]$Content
)
$Path = Join-Path $Dir $Name
Set-Content -Path $Path -Value $Content -Encoding UTF8
Write-Host "Created: $Name" -ForegroundColor Green
}
# 1) b64decode_loop.ps1
Write-Script "b64decode_loop.ps1" @'
# Repeatedly base64-decode input until it fails
param([string]$File)
$data = if ($File -and (Test-Path $File)) { Get-Content $File -Raw } else { $input }
$count = 0
while ($true) {
try {
$decoded = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($data))
$data = $decoded
$count++
} catch {
break
}
}
Write-Output $data
Write-Host "[decoded $count time(s)]" -ForegroundColor Yellow
'@
# 2) b64encode.ps1
Write-Script "b64encode.ps1" @'
# Base64-encode input N times
param(
[int]$N = 1,
[string]$File
)
$data = if ($File -and (Test-Path $File)) { Get-Content $File -Raw } else { $input }
for ($i = 0; $i -lt $N; $i++) {
$bytes = [System.Text.Encoding]::UTF8.GetBytes($data)
$data = [System.Convert]::ToBase64String($bytes)
}
Write-Output $data
'@
# 3) base32decode.ps1
Write-Script "base32decode.ps1" @'
# Base32 decode
param([string]$File)
$data = if ($File -and (Test-Path $File)) { Get-Content $File -Raw } else { $input }
$pyScript = @"
import sys, base64
data = sys.stdin.buffer.read().replace(b'\n', b'').replace(b'\r', b'')
sys.stdout.buffer.write(base64.b32decode(data, casefold=True))
"@
$data | python -c $pyScript
'@
# 4) url_decode.ps1
Write-Script "url_decode.ps1" @'
# URL-decode
param([string]$Input)
if (-not $Input) { $Input = $input }
Add-Type -AssemblyName System.Web
[System.Web.HttpUtility]::UrlDecode($Input)
'@
# 5) url_encode.ps1
Write-Script "url_encode.ps1" @'
# URL-encode
param([string]$Input)
if (-not $Input) { $Input = $input }
Add-Type -AssemblyName System.Web
[System.Web.HttpUtility]::UrlEncode($Input)
'@
# 6) hex2bin.ps1
Write-Script "hex2bin.ps1" @'
# Convert hex to raw bytes
param([string]$Input)
if (Test-Path $Input -ErrorAction SilentlyContinue) {
$hex = Get-Content $Input -Raw
} elseif ($Input) {
$hex = $Input
} else {
$hex = $input
}
$hex = $hex -replace '\s',''
$bytes = [byte[]]::new($hex.Length / 2)
for ($i = 0; $i -lt $hex.Length; $i += 2) {
$bytes[$i/2] = [Convert]::ToByte($hex.Substring($i, 2), 16)
}
[System.IO.File]::WriteAllBytes("output.bin", $bytes)
Write-Host "Written to output.bin" -ForegroundColor Yellow
'@
# 7) bin2hex.ps1
Write-Script "bin2hex.ps1" @'
# Convert bytes to hex
param([string]$File)
if ($File -and (Test-Path $File)) {
$bytes = [System.IO.File]::ReadAllBytes($File)
} else {
$bytes = [System.Text.Encoding]::UTF8.GetBytes($input)
}
($bytes | ForEach-Object { $_.ToString("x2") }) -join ''
'@
# 8) rotN.ps1
Write-Script "rotN.ps1" @'
# ROT-N cipher (default 13)
param(
[int]$N = 13,
[string]$Text
)
if (-not $Text) { $Text = $input }
$result = ""
foreach ($char in $Text.ToCharArray()) {
$ascii = [int]$char
if ($ascii -ge 65 -and $ascii -le 90) {
$result += [char](((($ascii - 65) + $N) % 26) + 65)
} elseif ($ascii -ge 97 -and $ascii -le 122) {
$result += [char](((($ascii - 97) + $N) % 26) + 97)
} else {
$result += $char
}
}
$result
'@
# 9) caesar_bruteforce.ps1
Write-Script "caesar_bruteforce.ps1" @'
# Try all ROT 0-25 shifts
param([string]$Text)
if (-not $Text) { $Text = $input }
function Rot($text, $n) {
$result = ""
foreach ($char in $text.ToCharArray()) {
$ascii = [int]$char
if ($ascii -ge 65 -and $ascii -le 90) {
$result += [char](((($ascii - 65) + $n) % 26) + 65)
} elseif ($ascii -ge 97 -and $ascii -le 122) {
$result += [char](((($ascii - 97) + $n) % 26) + 97)
} else {
$result += $char
}
}
return $result
}
for ($n = 0; $n -le 25; $n++) {
Write-Host ("ROT {0:D2}: {1}" -f $n, (Rot $Text $n))
}
'@
# 10) xor_single_byte_bruteforce.ps1
Write-Script "xor_single_byte_bruteforce.ps1" @'
# Single-byte XOR brute-force
param([string]$Input)
$pyScript = @"
import sys, binascii
hexdata = sys.argv[1]
data = binascii.unhexlify(hexdata)
def score(b):
return sum(1 for c in b if 32<=c<127 or c in b'\n\r\t')/max(1,len(b))
cands = []
for k in range(256):
pt = bytes([c^k for c in data])
cands.append((score(pt),k,pt))
for s,k,pt in sorted(cands, reverse=True)[:10]:
print(f"key=0x{k:02x} ({k}) score={s:.2f} -> {pt[:120].decode('utf-8','replace')}")
"@
if (Test-Path $Input -ErrorAction SilentlyContinue) {
$hex = Get-Content $Input -Raw | ForEach-Object { ($_ | Format-Hex).HexBytes } -join ''
} else {
$hex = $Input
}
python -c $pyScript $hex
'@
# 11) xor_with_key.ps1
Write-Script "xor_with_key.ps1" @'
# XOR with repeating key
param(
[string]$Key,
[string]$File
)
$pyScript = @"
import sys
key = sys.argv[1].encode()
data = sys.stdin.buffer.read()
out = bytes(b ^ key[i%len(key)] for i,b in enumerate(data))
sys.stdout.buffer.write(out)
"@
if ($File -and (Test-Path $File)) {
Get-Content $File -Raw | python -c $pyScript $Key
} else {
$input | python -c $pyScript $Key
}
'@
# 12) vigenere.ps1
Write-Script "vigenere.ps1" @'
# Vigenère cipher
param(
[ValidateSet("-e", "-d")]
[string]$Mode = "-d",
[string]$Key,
[string]$Text
)
if (-not $Text) { $Text = $input }
$Key = $Key.ToUpper() -replace '[^A-Z]',''
$pyScript = @"
import sys
mode,key,text = sys.argv[1],sys.argv[2],sys.argv[3]
def shift(c,k,enc=True):
if not c.isalpha(): return c
base='A' if c.isupper() else 'a'
o=ord(c)-ord(base); kk=ord(k)-65
n=(o+kk)%26 if enc else (o-kk)%26
return chr(n+ord(base))
out=[]; j=0
for c in text:
if c.isalpha():
out.append(shift(c, key[j%len(key)], enc=(mode=='-e')))
j+=1
else: out.append(c)
print(''.join(out), end='')
"@
python -c $pyScript $Mode $Key $Text
'@
# 13) file_inspect.ps1
Write-Script "file_inspect.ps1" @'
# File inspection: type, size, hashes, magic bytes, strings
param([string]$File)
if (-not (Test-Path $File)) { Write-Error "File not found"; exit 1 }
$item = Get-Item $File
Write-Host "== File Info ==" -ForegroundColor Cyan
Write-Host "Name: $($item.Name)"
Write-Host "Size: $($item.Length) bytes"
Write-Host "Created: $($item.CreationTime)"
Write-Host "Modified: $($item.LastWriteTime)"
Write-Host "`n== Hashes ==" -ForegroundColor Cyan
$md5 = Get-FileHash $File -Algorithm MD5
$sha1 = Get-FileHash $File -Algorithm SHA1
$sha256 = Get-FileHash $File -Algorithm SHA256
Write-Host "MD5: $($md5.Hash)"
Write-Host "SHA1: $($sha1.Hash)"
Write-Host "SHA256: $($sha256.Hash)"
Write-Host "`n== Magic Bytes (first 64) ==" -ForegroundColor Cyan
$bytes = [System.IO.File]::ReadAllBytes($File)
$hex = ($bytes[0..([Math]::Min(63, $bytes.Length-1))] | ForEach-Object { $_.ToString("X2") }) -join ' '
Write-Host $hex
Write-Host "`n== Strings (min 6 chars) ==" -ForegroundColor Cyan
$content = [System.IO.File]::ReadAllText($File, [System.Text.Encoding]::Default)
$strings = [regex]::Matches($content, '[\x20-\x7E]{6,}') | Select-Object -First 50 -ExpandProperty Value
$strings | ForEach-Object { Write-Host $_ }
'@
# 14) carve_png.ps1
Write-Script "carve_png.ps1" @'
# Carve PNG from blob
param(
[string]$Input,
[string]$Output
)
$pyScript = @"
import sys, binascii
data = open(sys.argv[1],'rb').read()
sig = b'\x89PNG\r\n\x1a\n'
start = data.find(sig)
if start == -1: sys.exit("PNG signature not found")
iend = data.find(b'IEND', start)
if iend == -1: sys.exit("IEND not found")
iend += 8 # IEND + CRC
open(sys.argv[2],'wb').write(data[start:iend])
print("Wrote", sys.argv[2])
"@
python -c $pyScript $Input $Output
'@
# 15) png_chunk_dump.ps1
Write-Script "png_chunk_dump.ps1" @'
# List PNG chunks
param([string]$File)
$pyScript = @"
import sys, struct, zlib
with open(sys.argv[1],'rb') as f:
sig = f.read(8)
if sig != b'\x89PNG\r\n\x1a\n': sys.exit("Not a PNG")
off = 8; i = 0
while True:
lenb = f.read(4)
if not lenb: break
ln = struct.unpack(">I",lenb)[0]
typ = f.read(4)
data = f.read(ln)
crc = f.read(4)
print(f"{i:02d} off=0x{off:08x} type={typ.decode()} len={ln}")
if typ in [b'tEXt', b'zTXt', b'iTXt']:
try:
if typ == b'zTXt':
k,method_and_rest = data.split(b'\x00',1)
txt = zlib.decompress(method_and_rest[1:])
print(" key:", k.decode(errors='ignore'))
print(" text:", txt.decode(errors='replace')[:200])
else:
print(" text:", data.decode(errors='replace')[:200])
except: pass
off += 12+ln; i += 1
"@
python -c $pyScript $File
'@
# 16) strings_grep.ps1
Write-Script "strings_grep.ps1" @'
# Find strings matching pattern
param(
[string]$File,
[string]$Pattern
)
$content = [System.IO.File]::ReadAllText($File, [System.Text.Encoding]::Default)
$strings = [regex]::Matches($content, '[\x20-\x7E]{4,}') | Select-Object -ExpandProperty Value
$strings | Where-Object { $_ -match $Pattern }
'@
# 17) wordlist_mangler.ps1
Write-Script "wordlist_mangler.ps1" @'
# Generate word variations
param([string]$Word)
$variations = @()
$base = @($Word, $Word.ToUpper(), $Word.Substring(0,1).ToUpper() + $Word.Substring(1).ToLower())
$suffixes = @('', '1', '123', '!', '2024', '2025', '@', '#', '1234', '321', '01', '99')
foreach ($b in $base) {
foreach ($s in $suffixes) {
$variations += "$b$s"
}
}
$variations | Select-Object -Unique
'@
# 18) tcp_port_check.ps1
Write-Script "tcp_port_check.ps1" @'
# Check if TCP port is open
param(
[string]$Host,
[int]$Port,
[int]$Timeout = 2000
)
try {
$tcp = New-Object System.Net.Sockets.TcpClient
$connect = $tcp.BeginConnect($Host, $Port, $null, $null)
$wait = $connect.AsyncWaitHandle.WaitOne($Timeout, $false)
if ($wait) {
$tcp.EndConnect($connect)
Write-Host "OPEN: ${Host}:${Port}" -ForegroundColor Green
$tcp.Close()
} else {
Write-Host "CLOSED/TIMEOUT: ${Host}:${Port}" -ForegroundColor Red
}
} catch {
Write-Host "CLOSED: ${Host}:${Port}" -ForegroundColor Red
}
'@
# 19) http_headers.ps1
Write-Script "http_headers.ps1" @'
# Get HTTP headers
param([string]$Url)
try {
$response = Invoke-WebRequest -Uri $Url -Method Head -UseBasicParsing
$response.Headers | Format-Table -AutoSize
Write-Host "Status: $($response.StatusCode)" -ForegroundColor Green
} catch {
Write-Error $_.Exception.Message
}
'@
# 20) http_download.ps1
Write-Script "http_download.ps1" @'
# Download file via HTTP/HTTPS
param(
[string]$Url,
[string]$Output
)
if (-not $Output) {
$Output = Split-Path $Url -Leaf
if (-not $Output) { $Output = "download.bin" }
}
try {
Invoke-WebRequest -Uri $Url -OutFile $Output -UseBasicParsing
Write-Host "Downloaded to: $Output" -ForegroundColor Green
} catch {
Write-Error $_.Exception.Message
}
'@
# 21) banner_grab.ps1
Write-Script "banner_grab.ps1" @'
# TCP banner grab
param(
[string]$Host,
[int]$Port,
[string]$Payload = ""
)
try {
$tcp = New-Object System.Net.Sockets.TcpClient($Host, $Port)
$stream = $tcp.GetStream()
$writer = New-Object System.IO.StreamWriter($stream)
$reader = New-Object System.IO.StreamReader($stream)
if ($Payload) {
$writer.WriteLine($Payload)
$writer.Flush()
}
$stream.ReadTimeout = 3000
while ($stream.DataAvailable -or $reader.Peek() -ne -1) {
Write-Host $reader.ReadLine()
}
$tcp.Close()
} catch {
Write-Host "Connection failed or timed out" -ForegroundColor Yellow
}
'@
# 22) dns_lookup.ps1
Write-Script "dns_lookup.ps1" @'
# DNS lookups
param([string]$Domain)
Write-Host "== DNS Resolution ==" -ForegroundColor Cyan
try {
$result = Resolve-DnsName -Name $Domain -Type A,AAAA,MX,TXT,NS,CNAME -ErrorAction SilentlyContinue
$result | Format-Table -AutoSize
} catch {
Write-Error "DNS lookup failed"
}
'@
# 23) jwt_decode.ps1
Write-Script "jwt_decode.ps1" @'
# Decode JWT token
param([string]$Token)
$pyScript = @"
import sys, json, base64
def b64u(s):
s += '=' * (-len(s)%4)
return base64.urlsafe_b64decode(s.encode())
parts = sys.argv[1].split('.')
print("== Header ==")
print(json.dumps(json.loads(b64u(parts[0])), indent=2))
print("== Payload ==")
print(json.dumps(json.loads(b64u(parts[1])), indent=2))
"@
python -c $pyScript $Token
'@
# 24) zip_list.ps1
Write-Script "zip_list.ps1" @'
# List ZIP contents
param(
[string]$ZipFile,
[string]$Extract
)
Add-Type -AssemblyName System.IO.Compression.FileSystem
$zip = [System.IO.Compression.ZipFile]::OpenRead($ZipFile)
if ($Extract) {
$entry = $zip.Entries | Where-Object { $_.FullName -eq $Extract }
if ($entry) {
$stream = $entry.Open()
$reader = New-Object System.IO.StreamReader($stream)
Write-Output $reader.ReadToEnd()
$reader.Close()
}
} else {
$zip.Entries | Select-Object FullName, Length, CompressedLength, LastWriteTime | Format-Table
}
$zip.Dispose()
'@
# 25) hash_calc.ps1
Write-Script "hash_calc.ps1" @'
# Calculate file hashes
param([string]$File)
if (-not $File) {
Write-Error "Please specify a file"
exit 1
}
$algos = @("MD5", "SHA1", "SHA256", "SHA384", "SHA512")
foreach ($algo in $algos) {
$hash = Get-FileHash -Path $File -Algorithm $algo
Write-Host "${algo}: $($hash.Hash)"
}
'@
# 26) reverse_shell_listener.ps1
Write-Script "reverse_shell_listener.ps1" @'
# Simple TCP listener
param([int]$Port = 4444)
Write-Host "Listening on port $Port..." -ForegroundColor Yellow
$listener = New-Object System.Net.Sockets.TcpListener([System.Net.IPAddress]::Any, $Port)
$listener.Start()
$client = $listener.AcceptTcpClient()
Write-Host "Connection received!" -ForegroundColor Green
$stream = $client.GetStream()
$reader = New-Object System.IO.StreamReader($stream)
$writer = New-Object System.IO.StreamWriter($stream)
$writer.AutoFlush = $true
while ($client.Connected) {
$data = $reader.ReadLine()
if ($data) { Write-Host $data }
}
$client.Close()
$listener.Stop()
'@
# 27) process_monitor.ps1
Write-Script "process_monitor.ps1" @'
# Monitor for new processes
param([int]$Interval = 2)
Write-Host "Monitoring for new processes (Ctrl+C to stop)..." -ForegroundColor Yellow
$seen = @{}
Get-Process | ForEach-Object { $seen[$_.Id] = $true }
while ($true) {
Start-Sleep -Seconds $Interval
Get-Process | Where-Object { -not $seen.ContainsKey($_.Id) } | ForEach-Object {
Write-Host "[NEW] PID: $($_.Id) Name: $($_.ProcessName) Path: $($_.Path)" -ForegroundColor Green
$seen[$_.Id] = $true
}
}
'@
# 28) file_monitor.ps1
Write-Script "file_monitor.ps1" @'
# Monitor directory for file changes
param(
[string]$Path = ".",
[string]$Filter = "*.*"
)
$watcher = New-Object System.IO.FileSystemWatcher
$watcher.Path = $Path
$watcher.Filter = $Filter
$watcher.IncludeSubdirectories = $true
$watcher.EnableRaisingEvents = $true
$action = {
$details = $Event.SourceEventArgs
$change = $details.ChangeType
$path = $details.FullPath
Write-Host "[$change] $path" -ForegroundColor Yellow
}
Register-ObjectEvent -InputObject $watcher -EventName "Created" -Action $action
Register-ObjectEvent -InputObject $watcher -EventName "Changed" -Action $action
Register-ObjectEvent -InputObject $watcher -EventName "Deleted" -Action $action
Register-ObjectEvent -InputObject $watcher -EventName "Renamed" -Action $action
Write-Host "Monitoring $Path for changes (Press Ctrl+C to stop)..." -ForegroundColor Green
while ($true) { Start-Sleep 1 }
'@
# 29) ssl_cert_info.ps1
Write-Script "ssl_cert_info.ps1" @'
# Get SSL certificate info
param(
[string]$Host,
[int]$Port = 443
)
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$tcpClient = New-Object System.Net.Sockets.TcpClient($Host, $Port)
$sslStream = New-Object System.Net.Security.SslStream($tcpClient.GetStream(), $false, {$true})
try {
$sslStream.AuthenticateAsClient($Host)
$cert = $sslStream.RemoteCertificate
Write-Host "Subject: $($cert.Subject)" -ForegroundColor Cyan
Write-Host "Issuer: $($cert.Issuer)"
Write-Host "Valid From: $($cert.GetEffectiveDateString())"
Write-Host "Valid To: $($cert.GetExpirationDateString())"
Write-Host "Thumbprint: $($cert.GetCertHashString())"
Write-Host "Serial: $($cert.GetSerialNumberString())"
} finally {
$sslStream.Close()
$tcpClient.Close()
}
'@
# 30) extract_strings.ps1
Write-Script "extract_strings.ps1" @'
# Extract strings from binary
param(
[string]$File,
[int]$MinLength = 4
)
$bytes = [System.IO.File]::ReadAllBytes($File)
$text = [System.Text.Encoding]::ASCII.GetString($bytes)
$pattern = "[`x20-`x7E]{$MinLength,}"
[regex]::Matches($text, $pattern) | ForEach-Object { $_.Value }
'@
Write-Host "`n================================" -ForegroundColor Cyan
Write-Host "Created 30 CTF helper scripts in: $Dir" -ForegroundColor Green
Write-Host "================================" -ForegroundColor Cyan
Write-Host "`nTo use these scripts, navigate to the directory:" -ForegroundColor Yellow
Write-Host " cd $Dir" -ForegroundColor White
Write-Host "`nOr add to PATH:" -ForegroundColor Yellow
Write-Host " `$env:PATH += `";$((Resolve-Path $Dir).Path)`"" -ForegroundColor White
Write-Host "`nNote: Some scripts require Python 3 to be installed." -ForegroundColor Yellow
This PowerShell version creates 30 CTF helper scripts adapted for Windows. Key differences from the bash version:
Native PowerShell implementations where possible (base64, URL encoding, file operations)
Python fallbacks for complex operations (some crypto operations, PNG parsing)
Windows-specific tools like process monitoring, file system watching
Network tools using .NET classes instead of netcat
Cross-platform compatibility where Python is used
To use:
Save as install_redtools.ps1
Run: .\install_redtools.ps1
Scripts will be created in pico-redtools folder
Each script is standalone and can be run with PowerShell
Note: Some scripts require Python 3 installed for full functionality.
Show full message · 640 lines Copy first response
f
i
d
o
n
e
p
r
in
t
f
se
t
r
−
d ′ \t \n ˚ ′ ∣ xx d −
r −
p f i E O F c hm o d +
x "
r c i n b ′ \n \t ˚ ′ ) / m a x ( 1 , l e n ( b ) ) c a n d s = [ ] f o r k i n r a n g e ( 256 ) : p t = b y t e s ( [ c k f o r c i n d a t a ] ) c a n d s . a p p e n d ( ( s c o r e ( p t ) , k , p t ) ) f o r s , k , p t i n s o r t e d ( c a n d s , r e v e r s e = T r u e ) [ : 10 ] : p r i n t ( f " k e y = 0 x k : 02 x ( k ) s c o r e = s : .2 f − > p t [ : 120 ] . d e c o d e ( ′ u t f − 8 ′ , ′ r e p l a c e ′ ) " ) P Y E O F c h m o d + x " hex" <<'PY'
import sys, binascii, string
hexdata=sys.argv[1]
data=binascii.unhexlify(hexdata)
def score(b):
return sum(1 for c in b if 32<=c<127 or c in b'\n\r\t')/max(1,len(b))
cands=[]
for k in range(256):
pt=bytes([c^k for c in data])
cands.append((score(pt),k,pt))
for s,k,pt in sorted(cands, reverse=True)[:10]:
print(f"key=0x{k:02x} ({k}) score={s:.2f} -> {pt[:120].decode('utf-8','replace')}")
PY
EOF
chmod +x " h e x " < < ′ P Y ′ im p or t sy s , bina sc ii , s t r in g h e x d a t a = sy s . a r g v [ 1 ] d a t a = bina sc ii . u nh e x l i f y ( h e x d a t a ) d e f scor e ( b ) : r e t u r n s u m ( 1 f or c inbi f 32 <= c < 127 or c in b ′ \n \t ˚ ′ ) / ma x ( 1 , l e n ( b )) c an d s = [ ] f or k in r an g e ( 256 ) : pt = b y t es ([ c k f or c in d a t a ]) c an d s . a pp e n d (( scor e ( pt ) , k , pt )) f or s , k , pt in sor t e T r u e ) [ : 10 ] : p r in t ( f " k ey = 0 x k : 02 x ( k ) scor e = s : .2 f − > pt [ : 120 ] . d eco d e ( ′ u t f − 8 ′ , ′ r e pl a c e x "
" s t r in g s −
n 6"
d
e
v
/
n
u
l
l
2
>
/ d e v / n u l l ∣ o p e n ss l x 509 −
n oo u t −
t e x tE O F c hm o d +
x "
d
(
c
an
d
s
,
r
e
v
er
se
=
′
)
"
)
P
Y
E
O
F
c
hm
o
d
+