word_generater.py 440 B

123456789101112131415
  1. # conding: utf-8
  2. import base64
  3. import sys
  4. def decodestr(s):
  5. dns = s[5:].replace(s[-12:-4],'') + '=='
  6. return str(base64.b64decode(dns.encode('utf-8')),'utf-8')
  7. if __name__ == "__main__":
  8. if len(sys.argv) != 3:
  9. print("usage: word_generater.py [decodestr]/[encodestr] [string]")
  10. if sys.argv[1] == "decode" :
  11. print(decodestr(sys.argv[2]))
  12. if sys.argv[1] == "encode" :
  13. print(encodestr(sys.argv[2]))