Files
ext4recovery/test/gg.sh
2026-04-30 11:04:05 +00:00

42 lines
1.1 KiB
Bash

python3 -c "
targets = [
b'pterodactyl',
b'/var/lib/pterodactyl',
b'server.properties', # Minecraft
b'level.dat', # Minecraft world
b'bukkit.yml',
b'spigot.yml',
b'paper.yml',
b'eula.txt',
b'/var/lib/docker',
b'wings',
b'daemon.json',
]
with open('/dev/nbd0', 'rb') as f:
chunk = 128*1024*1024
offset = 0
limit = 100*1024*1024*1024 # first 100GB
found = {}
while offset < limit:
f.seek(offset)
data = f.read(chunk)
if not data: break
for target in targets:
pos = 0
while True:
idx = data.find(target, pos)
if idx < 0: break
abs_byte = offset + idx
if target not in found:
found[target] = []
found[target].append(abs_byte)
pos = idx + 1
offset += chunk
if offset % (2*1024*1024*1024) == 0:
print(f'Scanned {offset//1024//1024//1024}GB...',flush=True)
for t,locs in found.items():
print(f'{t.decode(\"latin1\")}: {len(locs)} hits, first at byte {locs[0]}')
" 2>&1