Security Footage
Perform digital forensics on a network capture to recover footage from a camera. - ben, timtaylor and congon4tor
Last updated
Was this helpful?
Perform digital forensics on a network capture to recover footage from a camera. - ben, timtaylor and congon4tor
Last updated
Was this helpful?
Was this helpful?
import os
import re
from pathlib import Path
# Create output directory
output_dir = Path("frames")
output_dir.mkdir(exist_ok=True)
# Read the raw file
with open("raw", "r") as f:
data = f.read().lower() # lowercase for consistency with regex
# Extract all JPEG hex strings (FFD8...FFD9)
pattern = re.compile(r'ffd8.*?ffd9', re.DOTALL)
matches = pattern.findall(data)
print(f"[+] Found {len(matches)} JPEG(s).")
# Decode and save each one
for i, hex_str in enumerate(matches):
try:
img_data = bytes.fromhex(hex_str)
with open(output_dir / f"image_{i:03}.jpg", "wb") as img_file:
img_file.write(img_data)
except Exception as e:
print(f"[-] Failed to write image {i}: {e}")
print(f"[+] Images saved to '{output_dir}/'")
python3 recover_frames.pyfrom PIL import Image
from pathlib import Path
# Folder with extracted JPGs
input_dir = Path("frames")
output_gif = "compiled.gif"
# Skip every N images
frame_step = 5 # adjust this to skip more or fewer frames
duration = 100 # ms per frame (make smaller = faster)
# Load every Nth .jpg image
image_paths = sorted(input_dir.glob("*.jpg"))[::frame_step]
images = [Image.open(img_path).convert("RGB") for img_path in image_paths]
if images:
images[0].save(
output_gif,
save_all=True,
append_images=images[1:],
duration=duration,
loop=0
)
print(f"[+] GIF saved as '{output_gif}' with {len(images)} frames")
else:
print("[-] No JPEG images found in 'frames/'")
python3 compilegif.py