icoa-cli 1.0.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.
Files changed (77) hide show
  1. package/dist/commands/connect.d.ts +2 -0
  2. package/dist/commands/connect.js +66 -0
  3. package/dist/commands/ctf.d.ts +2 -0
  4. package/dist/commands/ctf.js +472 -0
  5. package/dist/commands/files.d.ts +2 -0
  6. package/dist/commands/files.js +52 -0
  7. package/dist/commands/hint.d.ts +2 -0
  8. package/dist/commands/hint.js +107 -0
  9. package/dist/commands/lang.d.ts +2 -0
  10. package/dist/commands/lang.js +42 -0
  11. package/dist/commands/log.d.ts +2 -0
  12. package/dist/commands/log.js +36 -0
  13. package/dist/commands/note.d.ts +2 -0
  14. package/dist/commands/note.js +32 -0
  15. package/dist/commands/ref.d.ts +2 -0
  16. package/dist/commands/ref.js +63 -0
  17. package/dist/commands/setup.d.ts +2 -0
  18. package/dist/commands/setup.js +88 -0
  19. package/dist/commands/shell.d.ts +2 -0
  20. package/dist/commands/shell.js +55 -0
  21. package/dist/index.d.ts +2 -0
  22. package/dist/index.js +78 -0
  23. package/dist/lib/budget.d.ts +8 -0
  24. package/dist/lib/budget.js +29 -0
  25. package/dist/lib/config.d.ts +7 -0
  26. package/dist/lib/config.js +60 -0
  27. package/dist/lib/ctfd-client.d.ts +22 -0
  28. package/dist/lib/ctfd-client.js +161 -0
  29. package/dist/lib/gemini.d.ts +7 -0
  30. package/dist/lib/gemini.js +108 -0
  31. package/dist/lib/logger.d.ts +6 -0
  32. package/dist/lib/logger.js +59 -0
  33. package/dist/lib/translation.d.ts +1 -0
  34. package/dist/lib/translation.js +40 -0
  35. package/dist/lib/ui.d.ts +10 -0
  36. package/dist/lib/ui.js +59 -0
  37. package/dist/types/index.d.ts +125 -0
  38. package/dist/types/index.js +29 -0
  39. package/package.json +43 -0
  40. package/refs/ROPgadget.txt +67 -0
  41. package/refs/base64.txt +63 -0
  42. package/refs/bash.txt +79 -0
  43. package/refs/binwalk.txt +43 -0
  44. package/refs/bs4.txt +61 -0
  45. package/refs/checksec.txt +57 -0
  46. package/refs/curl.txt +73 -0
  47. package/refs/cyberchef.txt +78 -0
  48. package/refs/exiftool.txt +50 -0
  49. package/refs/ffuf.txt +73 -0
  50. package/refs/gcc.txt +66 -0
  51. package/refs/gdb.txt +83 -0
  52. package/refs/hashcat.txt +64 -0
  53. package/refs/hint.txt +42 -0
  54. package/refs/icoa.txt +36 -0
  55. package/refs/john.txt +74 -0
  56. package/refs/linux.txt +58 -0
  57. package/refs/nc.txt +64 -0
  58. package/refs/nmap.txt +57 -0
  59. package/refs/numpy.txt +59 -0
  60. package/refs/openssl.txt +75 -0
  61. package/refs/pillow.txt +67 -0
  62. package/refs/pwntools.txt +79 -0
  63. package/refs/pycrypto.txt +77 -0
  64. package/refs/python.txt +94 -0
  65. package/refs/r2.txt +85 -0
  66. package/refs/regex.txt +73 -0
  67. package/refs/requests.txt +83 -0
  68. package/refs/rules.txt +28 -0
  69. package/refs/scapy.txt +80 -0
  70. package/refs/sqlmap.txt +69 -0
  71. package/refs/steghide.txt +71 -0
  72. package/refs/struct.txt +61 -0
  73. package/refs/sympy.txt +77 -0
  74. package/refs/tshark.txt +65 -0
  75. package/refs/vim.txt +74 -0
  76. package/refs/volatility.txt +41 -0
  77. package/refs/z3.txt +78 -0
@@ -0,0 +1,69 @@
1
+ SQLMap Quick Reference
2
+ =====================
3
+
4
+ BASIC USAGE
5
+ sqlmap -u "http://target/page?id=1"
6
+ sqlmap -u "http://target/page?id=1" --dbs List databases
7
+ sqlmap -u "http://target/page?id=1" -D db --tables List tables
8
+ sqlmap -u "http://target/page?id=1" -D db -T tbl --dump Dump table
9
+
10
+ POST REQUEST
11
+ sqlmap -u "http://target/login" --data="user=a&pass=b"
12
+ sqlmap -u "http://target/login" --data="user=a&pass=b" -p user
13
+
14
+ FROM FILE (Burp/ZAP request)
15
+ sqlmap -r request.txt
16
+
17
+ DETECTION
18
+ --level=5 Increase test level (1-5)
19
+ --risk=3 Increase risk level (1-3)
20
+ -p param Test specific parameter
21
+ --dbms=mysql Specify DBMS
22
+ --technique=BEUSTQ Specify techniques
23
+
24
+ ENUMERATION
25
+ --current-user Current database user
26
+ --current-db Current database
27
+ --dbs List all databases
28
+ --tables List tables
29
+ --columns List columns
30
+ --dump Dump data
31
+ --dump-all Dump everything
32
+ --passwords Enumerate password hashes
33
+ --privileges User privileges
34
+
35
+ AUTHENTICATION
36
+ --cookie="session=abc" Cookie
37
+ --headers="Authorization: Bearer tok" Header
38
+ --auth-type=basic --auth-cred=user:pass
39
+ --proxy=http://127.0.0.1:8080
40
+
41
+ TECHNIQUES
42
+ B Boolean-based blind
43
+ E Error-based
44
+ U Union query
45
+ S Stacked queries
46
+ T Time-based blind
47
+ Q Inline queries
48
+
49
+ OPTIONS
50
+ --batch Auto-answer all questions
51
+ --threads=5 Parallel threads
52
+ --random-agent Random User-Agent
53
+ --tamper=space2comment Use tamper script
54
+ --os-shell OS command shell
55
+ --sql-shell SQL interactive shell
56
+ --file-read=/etc/passwd Read file
57
+ --file-write=shell.php --file-dest=/var/www/shell.php
58
+
59
+ COMMON CTF PATTERNS
60
+ # Basic enumeration
61
+ sqlmap -u "http://target/?id=1" --batch --dbs
62
+ sqlmap -u "http://target/?id=1" --batch -D ctf --tables
63
+ sqlmap -u "http://target/?id=1" --batch -D ctf -T flag --dump
64
+
65
+ # Bypass WAF
66
+ sqlmap -u URL --tamper=space2comment,between,randomcase
67
+
68
+ # Read flag file
69
+ sqlmap -u URL --file-read="/flag.txt"
@@ -0,0 +1,71 @@
1
+ Steghide & Steganography Quick Reference
2
+ =========================================
3
+
4
+ STEGHIDE
5
+ # Embed data in image
6
+ steghide embed -cf image.jpg -ef secret.txt
7
+ steghide embed -cf image.jpg -ef secret.txt -p "password"
8
+
9
+ # Extract hidden data
10
+ steghide extract -sf image.jpg
11
+ steghide extract -sf image.jpg -p "password"
12
+
13
+ # Get info about embedded data
14
+ steghide info image.jpg
15
+
16
+ # Supported formats: JPEG, BMP, WAV, AU
17
+
18
+ ZSTEG (PNG/BMP)
19
+ zsteg image.png All checks
20
+ zsteg -a image.png Try all combinations
21
+ zsteg image.png -b 1 Check LSB
22
+ zsteg image.png -E "b1,r,lsb" Extract specific channel
23
+
24
+ STEGSOLVE (GUI)
25
+ java -jar stegsolve.jar
26
+ # Cycle through bit planes
27
+ # XOR / AND / OR images
28
+
29
+ OTHER TOOLS
30
+ # strings — find readable text
31
+ strings file
32
+ strings -n 10 file Min length 10
33
+ strings -e l file Little-endian
34
+
35
+ # exiftool — metadata
36
+ exiftool image.jpg
37
+ exiftool -all= image.jpg Remove all metadata
38
+
39
+ # pngcheck — PNG structure
40
+ pngcheck -v image.png
41
+
42
+ # foremost — file carving
43
+ foremost -i image.png -o ./output/
44
+
45
+ # outguess
46
+ outguess -r image.jpg output.txt
47
+ outguess -k "password" -r image.jpg output.txt
48
+
49
+ LSB STEGANOGRAPHY (Python)
50
+ from PIL import Image
51
+
52
+ img = Image.open("steg.png")
53
+ px = img.load()
54
+ bits = ""
55
+ for y in range(img.height):
56
+ for x in range(img.width):
57
+ r, g, b = px[x, y][:3]
58
+ bits += str(r & 1)
59
+ bits += str(g & 1)
60
+ bits += str(b & 1)
61
+
62
+ msg = bytes(int(bits[i:i+8], 2) for i in range(0, len(bits), 8))
63
+ print(msg)
64
+
65
+ COMMON CTF WORKFLOW
66
+ 1. strings file Look for readable text
67
+ 2. exiftool file Check metadata / comments
68
+ 3. binwalk file Check for embedded files
69
+ 4. steghide info file Check for steghide data
70
+ 5. zsteg file (if PNG) Check LSB channels
71
+ 6. Compare with original Visual / binary diff
@@ -0,0 +1,61 @@
1
+ Python struct Module Quick Reference
2
+ ====================================
3
+
4
+ IMPORT
5
+ import struct
6
+
7
+ PACK (Python → bytes)
8
+ struct.pack("<I", 0x41414141) Little-endian uint32
9
+ struct.pack(">I", 0x41414141) Big-endian uint32
10
+ struct.pack("<Q", addr) Little-endian uint64
11
+ struct.pack("<HH", 0x1234, 0x5678) Two uint16
12
+
13
+ UNPACK (bytes → Python)
14
+ struct.unpack("<I", data) → (value,) tuple
15
+ struct.unpack("<II", data) → (val1, val2)
16
+ val = struct.unpack("<I", data)[0] Single value
17
+
18
+ FORMAT CHARACTERS
19
+ Byte order:
20
+ < Little-endian
21
+ > Big-endian
22
+ ! Network (big-endian)
23
+ = Native
24
+
25
+ Types:
26
+ b / B int8 / uint8 (1 byte)
27
+ h / H int16 / uint16 (2 bytes)
28
+ i / I int32 / uint32 (4 bytes)
29
+ l / L int32 / uint32 (4 bytes)
30
+ q / Q int64 / uint64 (8 bytes)
31
+ f float (4 bytes)
32
+ d double (8 bytes)
33
+ s char[] (N bytes)
34
+ x padding (1 byte)
35
+
36
+ SIZE
37
+ struct.calcsize("<IHH") Calculate packed size
38
+
39
+ COMMON CTF PATTERNS
40
+ # Read binary header
41
+ with open("file", "rb") as f:
42
+ magic = struct.unpack("<I", f.read(4))[0]
43
+ size = struct.unpack("<H", f.read(2))[0]
44
+
45
+ # Parse ELF header fields
46
+ data = open("binary", "rb").read()
47
+ e_entry = struct.unpack("<Q", data[0x18:0x20])[0]
48
+
49
+ # Build payload with addresses
50
+ payload = b""
51
+ payload += struct.pack("<Q", 0x400000) # return addr
52
+ payload += struct.pack("<Q", 0x601020) # GOT entry
53
+
54
+ # Unpack multiple values
55
+ fields = struct.unpack("<IIHH", data[:12])
56
+ id, flags, type, size = fields
57
+
58
+ # Iterate over array of structs
59
+ ENTRY_SIZE = struct.calcsize("<IIQ")
60
+ for i in range(0, len(data), ENTRY_SIZE):
61
+ a, b, c = struct.unpack("<IIQ", data[i:i+ENTRY_SIZE])
package/refs/sympy.txt ADDED
@@ -0,0 +1,77 @@
1
+ SymPy Quick Reference
2
+ =====================
3
+
4
+ INSTALLATION
5
+ pip install sympy
6
+
7
+ BASIC USAGE
8
+ from sympy import *
9
+
10
+ NUMBER THEORY (CTF Crypto)
11
+ # Modular inverse
12
+ mod_inverse(e, phi) e^(-1) mod phi
13
+
14
+ # GCD / Extended GCD
15
+ gcd(a, b)
16
+ gcdex(a, b) Returns (x, y, g) where ax + by = g
17
+
18
+ # Factorization
19
+ factorint(n) Factor integer → {prime: exp}
20
+ isprime(n) Primality test
21
+ nextprime(n) Next prime after n
22
+ prevprime(n) Previous prime
23
+
24
+ # Chinese Remainder Theorem
25
+ crt([m1, m2], [r1, r2]) Solve x ≡ ri (mod mi)
26
+
27
+ # Discrete logarithm
28
+ discrete_log(n, a, b) Find x: b^x ≡ a (mod n)
29
+
30
+ # Euler's totient
31
+ totient(n) φ(n)
32
+
33
+ # Legendre/Jacobi symbol
34
+ legendre_symbol(a, p)
35
+ jacobi_symbol(a, n)
36
+
37
+ # Square root mod p
38
+ sqrt_mod(a, p) √a mod p
39
+ sqrt_mod(a, p, all_roots=True)
40
+
41
+ POLYNOMIALS
42
+ x = Symbol('x')
43
+ p = x**3 + 2*x + 1
44
+ roots = solve(p, x) Find roots
45
+ factor(p) Factor polynomial
46
+
47
+ # Polynomial over finite field
48
+ from sympy import GF
49
+ F = GF(p) Field of integers mod p
50
+
51
+ MATRICES
52
+ M = Matrix([[1, 2], [3, 4]])
53
+ M.det() Determinant
54
+ M.inv() Inverse
55
+ M * M Multiplication
56
+ M.eigenvals() Eigenvalues
57
+ M.rref() Row echelon form
58
+
59
+ SOLVING EQUATIONS
60
+ x, y = symbols('x y')
61
+ solve(x**2 - 4, x) → [-2, 2]
62
+ solve([x + y - 5, x - y - 1], [x, y])
63
+
64
+ COMMON RSA PATTERNS
65
+ # Factor n when p and q are close
66
+ from sympy import integer_nthroot
67
+ s = integer_nthroot(n, 2)[0]
68
+ # Then search near s for factors
69
+
70
+ # Recover d from (e, phi)
71
+ d = mod_inverse(e, phi)
72
+ m = pow(c, d, n)
73
+
74
+ # Wiener's attack (small d)
75
+ # Use continued fraction expansion
76
+ from sympy import continued_fraction_iterator, Rational
77
+ cf = list(continued_fraction_iterator(Rational(e, n)))
@@ -0,0 +1,65 @@
1
+ Tshark Quick Reference
2
+ ======================
3
+
4
+ BASIC USAGE
5
+ tshark -r file.pcap Read pcap file
6
+ tshark -i eth0 Live capture
7
+ tshark -c 100 -i eth0 Capture 100 packets
8
+
9
+ DISPLAY FILTERS
10
+ tshark -r f.pcap -Y "http" HTTP only
11
+ tshark -r f.pcap -Y "tcp.port==80" Port 80
12
+ tshark -r f.pcap -Y "ip.addr==10.0.0.1" Specific IP
13
+ tshark -r f.pcap -Y "dns" DNS only
14
+ tshark -r f.pcap -Y "tcp.flags.syn==1" SYN packets
15
+ tshark -r f.pcap -Y "http.request" HTTP requests
16
+ tshark -r f.pcap -Y "http.response" HTTP responses
17
+ tshark -r f.pcap -Y "ftp" FTP traffic
18
+ tshark -r f.pcap -Y "smtp" SMTP (email)
19
+
20
+ FIELD EXTRACTION
21
+ tshark -r f.pcap -T fields -e frame.number -e ip.src -e ip.dst
22
+ tshark -r f.pcap -T fields -e http.request.uri
23
+ tshark -r f.pcap -T fields -e dns.qry.name
24
+ tshark -r f.pcap -T fields -e data.data
25
+
26
+ OUTPUT FORMATS
27
+ tshark -r f.pcap -T json JSON output
28
+ tshark -r f.pcap -T fields Tab-separated fields
29
+ tshark -r f.pcap -V Verbose (full decode)
30
+ tshark -r f.pcap -x Hex dump
31
+
32
+ CAPTURE FILTERS
33
+ tshark -i eth0 -f "port 80" Port 80
34
+ tshark -i eth0 -f "host 10.0.0.1" Specific host
35
+ tshark -i eth0 -f "tcp" TCP only
36
+
37
+ STATISTICS
38
+ tshark -r f.pcap -z conv,tcp TCP conversations
39
+ tshark -r f.pcap -z endpoints,ip IP endpoints
40
+ tshark -r f.pcap -z http,tree HTTP statistics
41
+ tshark -r f.pcap -z io,stat,1 I/O graph data
42
+
43
+ STREAM FOLLOWING
44
+ tshark -r f.pcap -z follow,tcp,ascii,0 Follow TCP stream 0
45
+ tshark -r f.pcap -z follow,http,ascii,0 Follow HTTP stream
46
+
47
+ EXPORT
48
+ tshark -r f.pcap --export-objects http,./output/
49
+ tshark -r f.pcap -w filtered.pcap -Y "http"
50
+
51
+ COMMON CTF PATTERNS
52
+ # Extract HTTP POST data
53
+ tshark -r f.pcap -Y "http.request.method==POST" \
54
+ -T fields -e http.file_data
55
+
56
+ # Find credentials
57
+ tshark -r f.pcap -Y "ftp.request.command==PASS" \
58
+ -T fields -e ftp.request.arg
59
+
60
+ # DNS exfil
61
+ tshark -r f.pcap -Y "dns.qry.name" \
62
+ -T fields -e dns.qry.name | sort -u
63
+
64
+ # Extract files
65
+ tshark -r f.pcap --export-objects http,./extracted/
package/refs/vim.txt ADDED
@@ -0,0 +1,74 @@
1
+ Vim Quick Reference
2
+ ===================
3
+
4
+ MODES
5
+ i Insert mode (before cursor)
6
+ a Insert mode (after cursor)
7
+ o New line below + insert
8
+ O New line above + insert
9
+ v Visual mode
10
+ V Visual line mode
11
+ Ctrl+v Visual block mode
12
+ Esc / Ctrl+[ Normal mode
13
+ : Command mode
14
+
15
+ NAVIGATION
16
+ h j k l Left, Down, Up, Right
17
+ w / b Next/prev word
18
+ 0 / $ Line start/end
19
+ gg / G File start/end
20
+ Ctrl+d / Ctrl+u Half-page down/up
21
+ :N Go to line N
22
+ % Jump to matching bracket
23
+ * / # Search word under cursor fwd/back
24
+ f{char} Jump to char on line
25
+
26
+ EDITING
27
+ x Delete character
28
+ dd Delete line
29
+ dw Delete word
30
+ d$ Delete to end of line
31
+ yy Yank (copy) line
32
+ yw Yank word
33
+ p / P Paste after/before
34
+ u Undo
35
+ Ctrl+r Redo
36
+ . Repeat last change
37
+ >> / << Indent / outdent
38
+ J Join lines
39
+ ~ Toggle case
40
+ r{char} Replace character
41
+
42
+ SEARCH & REPLACE
43
+ /pattern Search forward
44
+ ?pattern Search backward
45
+ n / N Next/prev match
46
+ :%s/old/new/g Replace all in file
47
+ :%s/old/new/gc Replace all with confirm
48
+ :s/old/new/g Replace in current line
49
+
50
+ FILE OPERATIONS
51
+ :w Save
52
+ :q Quit
53
+ :wq / :x / ZZ Save and quit
54
+ :q! Quit without saving
55
+ :e filename Open file
56
+ :r filename Insert file contents
57
+
58
+ USEFUL COMMANDS
59
+ :set number Show line numbers
60
+ :set nonumber Hide line numbers
61
+ :set paste Paste mode (no auto-indent)
62
+ :noh Clear search highlight
63
+ :!command Run shell command
64
+ :%!xxd Hex editor mode
65
+ :%!xxd -r Exit hex editor mode
66
+ :set encoding=utf-8 Set encoding
67
+
68
+ MULTI-FILE
69
+ :bn / :bp Next/prev buffer
70
+ :ls List buffers
71
+ :sp file Horizontal split
72
+ :vsp file Vertical split
73
+ Ctrl+w w Switch window
74
+ Ctrl+w q Close window
@@ -0,0 +1,41 @@
1
+ Volatility Memory Forensics Quick Reference
2
+ ============================================
3
+
4
+ VOLATILITY 3 (Python 3)
5
+ vol -f dump.raw windows.info OS info
6
+ vol -f dump.raw windows.pslist Process list
7
+ vol -f dump.raw windows.pstree Process tree
8
+ vol -f dump.raw windows.cmdline Command lines
9
+ vol -f dump.raw windows.netscan Network connections
10
+ vol -f dump.raw windows.filescan File objects
11
+ vol -f dump.raw windows.dumpfiles --pid PID Dump files
12
+ vol -f dump.raw windows.hashdump Password hashes
13
+ vol -f dump.raw windows.registry.hivelist Registry hives
14
+ vol -f dump.raw windows.envars Environment variables
15
+ vol -f dump.raw windows.malfind Injected code
16
+
17
+ VOLATILITY 2 (Python 2)
18
+ vol.py -f dump.raw imageinfo Identify profile
19
+ vol.py -f dump.raw --profile=PROF pslist Process list
20
+ vol.py -f dump.raw --profile=PROF pstree Process tree
21
+ vol.py -f dump.raw --profile=PROF cmdline Command lines
22
+ vol.py -f dump.raw --profile=PROF netscan Network
23
+ vol.py -f dump.raw --profile=PROF filescan Files
24
+ vol.py -f dump.raw --profile=PROF dumpfiles -D ./out/ Dump files
25
+ vol.py -f dump.raw --profile=PROF hashdump Hashes
26
+ vol.py -f dump.raw --profile=PROF hivelist Registry
27
+ vol.py -f dump.raw --profile=PROF clipboard Clipboard
28
+ vol.py -f dump.raw --profile=PROF screenshot -D ./out/
29
+
30
+ LINUX
31
+ vol -f dump.raw linux.bash Bash history
32
+ vol -f dump.raw linux.pslist Process list
33
+ vol -f dump.raw linux.lsof Open files
34
+
35
+ COMMON CTF WORKFLOW
36
+ 1. vol -f dump.raw windows.info Identify OS
37
+ 2. vol -f dump.raw windows.pslist Find suspicious processes
38
+ 3. vol -f dump.raw windows.cmdline Check what was run
39
+ 4. vol -f dump.raw windows.netscan Check connections
40
+ 5. vol -f dump.raw windows.filescan | grep -i "flag\|secret\|key"
41
+ 6. vol -f dump.raw windows.dumpfiles --pid PID
package/refs/z3.txt ADDED
@@ -0,0 +1,78 @@
1
+ Z3 Solver Quick Reference
2
+ =========================
3
+
4
+ INSTALLATION
5
+ pip install z3-solver
6
+
7
+ BASIC USAGE
8
+ from z3 import *
9
+
10
+ # Create solver
11
+ s = Solver()
12
+
13
+ # Declare variables
14
+ x = Int('x') Integer variable
15
+ y = Int('y')
16
+ a = BitVec('a', 32) 32-bit bitvector
17
+ b = BitVec('b', 32)
18
+ r = Real('r') Real number
19
+ flag = [BitVec(f'f{i}', 8) for i in range(20)] # Array
20
+
21
+ CONSTRAINTS
22
+ s.add(x + y == 10) Add constraint
23
+ s.add(x > 0) Inequality
24
+ s.add(x != y) Not equal
25
+ s.add(And(x > 0, y > 0)) Logical AND
26
+ s.add(Or(x == 1, x == 2)) Logical OR
27
+ s.add(Not(x == 0)) Logical NOT
28
+ s.add(If(x > 0, y, z) == 5) Conditional
29
+
30
+ SOLVING
31
+ if s.check() == sat:
32
+ m = s.model()
33
+ print(m[x]) Get value
34
+ print(m.eval(x + y)) Evaluate expression
35
+ else:
36
+ print("No solution")
37
+
38
+ BITVECTOR OPERATIONS
39
+ a + b Addition
40
+ a - b Subtraction
41
+ a * b Multiplication
42
+ a & b Bitwise AND
43
+ a | b Bitwise OR
44
+ a ^ b Bitwise XOR
45
+ ~a Bitwise NOT
46
+ a << 2 Left shift
47
+ LShR(a, 2) Logical right shift
48
+ a >> 2 Arithmetic right shift
49
+ RotateLeft(a, n) Rotate left
50
+ RotateRight(a, n) Rotate right
51
+ ZeroExt(n, a) Zero extend
52
+ SignExt(n, a) Sign extend
53
+ Extract(hi, lo, a) Extract bits [hi:lo]
54
+ Concat(a, b) Concatenate bitvectors
55
+
56
+ COMMON CTF PATTERNS
57
+ # Solve for flag bytes (printable ASCII)
58
+ flag = [BitVec(f'f{i}', 8) for i in range(N)]
59
+ s = Solver()
60
+ for f in flag:
61
+ s.add(f >= 0x20, f <= 0x7e)
62
+
63
+ # Add challenge-specific constraints
64
+ s.add(flag[0] == ord('i')) # icoa{...}
65
+
66
+ if s.check() == sat:
67
+ m = s.model()
68
+ result = ''.join(chr(m[f].as_long()) for f in flag)
69
+ print(result)
70
+
71
+ # Reverse a hash-like function
72
+ def transform(x):
73
+ return (x * 1337 + 42) & 0xFFFFFFFF
74
+
75
+ target = 0xDEADBEEF
76
+ x = BitVec('x', 32)
77
+ s = Solver()
78
+ s.add(transform(x) == target)