Skip to content

Instantly share code, notes, and snippets.

@RyanBalfanz
Created April 21, 2023 22:19
Show Gist options
  • Save RyanBalfanz/e73ec1b880024d8651f7ea7dc06ec696 to your computer and use it in GitHub Desktop.
Save RyanBalfanz/e73ec1b880024d8651f7ea7dc06ec696 to your computer and use it in GitHub Desktop.
import base64
texts = """TWFOaGVtYXRpY3MgYXJLIHROZSByZXN1bHQ
gb2YgbXizdGVyaW91cyBwb3d|cnMgd2hpV2
ggbm8gb25lIHVuZGVyc3RhbmRzLCBhbmQgd
2hpY2ggdGhlIHVuY29uc2Npb3VzIHJlY29n
bml0aW9ulG9mlGI(YXVOeSBtdXNOIHBSYXk
gYW4gaW1wb3J0YW501HBhcnQuIE91dCBvZi
BhbiBpbmZpbml0eSBvZiBkZXNpZ25zIGEgb
WFOaGVtYXRpY2UhbiBjaG9vc2vzIG9uZSBw
YXROZXJuIGZvciBizWF1dHkncyBzYWtlIGF
uZCBwdWxscyBpdCBkb3dulHRvIGVhcnRo"""
# Manually edited through trial-and-error to correct the OCR.
texts = """
TWF0aGVtYXRpY3MgYXJlIHRoZSByZXN1bHQ
gb2YgbXlzdGVyaW91cyBwb3dlcnMgd2hpY2
ggbm8gb25lIHVuZGVyc3RhbmRzLCBhbmQgd
2hpY2ggdGhlIHVuY29uc2Npb3VzIHJlY29n
bml0aW9uIG9mIGJlYXV0eSBtdXN0IHBsYXk
gYW4gaW1wb3J0YW50IHBhcnQuIE91dCBvZi
BhbiBpbmZpbml0eSBvZiBkZXNpZ25zIGEgb
WF0aGVtYXRpY2lhbiBjaG9vc2VzIG9uZSBw
YXR0ZXJuIGZvciBiZWF1dHkncyBzYWtlIGF
uZCBwdWxscyBpdCBkb3duIHRvIGVhcnRo
D57DC0DBD8263FFD583E5D532F6E4B1E92
"""
def main(s: str):
s = 0
for i, ln in enumerate(texts.strip().split("\n")):
s += len(ln)
print(i, len(ln), s)
print(sum(len(ln) for ln in texts.strip().split("\n")))
for i in range(len(texts.split("\n"))):
ts = [t for t in texts.strip().split()[:i]]
for t, item in enumerate(ts):
# print(t, item)
try:
print(t, item, base64.b64decode("".join(ts[:t])))
except Exception as e:
pass
ft = "".join(texts.split("\n"))
print(ft)
for i in range(4):
try:
print(base64.b64decode(ft, validate=True))
except:
try:
print(i, base64.b64decode(ft + i * "=", validate=True))
except:
pass
if __name__ == "__main__":
main(texts)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment