Created
December 29, 2020 20:42
-
-
Save suidroot/861668f1bb9669f1cae61d0a9f8d8a9e to your computer and use it in GitHub Desktop.
PDF Deflate Extractor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import zlib | |
pdf = open("Receipt.pdf", "rb").read() | |
stream = re.compile(b'.*?FlateDecode.*?stream(.*?)endstream', re.S) | |
counter = 0 | |
for s in re.findall(stream,pdf): | |
print("---------------------- " + str(counter) + "---------- ") | |
s = s.strip(b'\r\n') | |
try: | |
print(zlib.decompress(s).decode('UTF-8')) | |
print("") | |
except: | |
pass | |
counter +=1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment