Skip to content

Instantly share code, notes, and snippets.

@vale981
Last active August 24, 2020 11:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vale981/ba8f193ce739c59bf47cf5f1852b2b45 to your computer and use it in GitHub Desktop.
Save vale981/ba8f193ce739c59bf47cf5f1852b2b45 to your computer and use it in GitHub Desktop.
import sys
import re
import chardet
if len(sys.argv) < 2:
sys.exit(f"Usage: {sys.argv[0]} [file]")
with open(sys.argv[1], "rb") as f:
input_str = f.read()
encoding = chardet.detect(input_str)
matches = re.findall(
r"1 OBJE\n2 FORM jpg\n2 FILE (.*?)\n(?:2 _.*\n)+2 _PERSONALPHOTO Y",
input_str.decode(encoding["encoding"]),
)
print("\n".join(matches))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment