Skip to content

Instantly share code, notes, and snippets.

@kkung
Last active December 23, 2020 08:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kkung/f4a14e19d1c2e54b2706 to your computer and use it in GitHub Desktop.
Save kkung/f4a14e19d1c2e54b2706 to your computer and use it in GitHub Desktop.
더존 급여명세서 복호화
#!/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')
python duzon.py mail.html 890101
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment