Last active
December 23, 2020 08:19
-
-
Save kkung/f4a14e19d1c2e54b2706 to your computer and use it in GitHub Desktop.
더존 급여명세서 복호화
This file contains hidden or 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
#!/usr/bin/env python | |
import sys | |
import re | |
import urllib | |
ENC_BODY_PATTERN = re.compile(r'value=\'([^\'].*)\'') | |
def decrypt(name, key): | |
if len(key) != 6: | |
print('Unknown type key: ' + key) | |
sys.exit(1) | |
with open(name, 'r') as f: | |
body = f.read() | |
enc_body = ENC_BODY_PATTERN.findall(body) | |
if len(enc_body) != 1: | |
print('Unknown mail') | |
sys.exit(1) | |
enc_body = urllib.unquote(enc_body[0]).split(',') | |
return u''.join([unichr(int(e) + ord(key[i % len(key)])) for i, e in enumerate(enc_body)]) | |
if __name__ == '__main__': | |
print(decrypt(sys.argv[1], sys.argv[2])).encode('cp949', 'ignore') |
This file contains hidden or 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
python duzon.py mail.html 890101 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment