5P4D3

TikTok Encoding

Jan 11th, 2021
838
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/python3
  2. import sys
  3. from textwrap import wrap
  4.  
  5. charot="64":"a","67":"b","66":"c","61":"d","60":"e","63":"f","62":"g","6d":"h","6c":"i","6f":"j","6e":"k","69":"l","68":"m","6b":"n","6a":"o","75":"p","74":"q","77":"r","76":"s","71":"t","70":"u","73":"v","72":"w","7d":"x","7c":"y","7f":"z","44":"A","47":"B","46":"C","41":"D","40":"E","43":"F","42":"G","4d":"H","4c":"I","4f":"J","4e":"K","49":"L","48":"M","4b":"N","4a":"O","55":"P","54":"Q","57":"R","56":"S","51":"T","50":"U","53":"V","52":"W","5d":"X","5c":"Y","5f":"Z","35":"0","34":"1","37":"2","36":"3","31":"4","30":"5","33":"6","32":"7","3d":"8","3c":"9","24":"!","26":"#","21":"$","20":"%","5b":"^","23":"&","2f":"*","2d":"(","2c":")","28":"-","5a":"_","38":"=","2e":"+","5e":"[","7e":"{","58":"]","78":"}","59":"\\","79":"|","3e":";","3f":":","22":"'","27":"\"","29":",","39":"<","2b":".","3b":">","2a":"/","3a":"?","45":"@"
  6.  
  7. def switcheroo(string):
  8.     one = list(string)
  9.     final = []
  10.     characters = {charot}
  11.     for loop in enumerate(one):
  12.         x = loop[1]
  13.         if x in characters:
  14.             final.append(str(characters[x]))
  15.         else:
  16.             final.append("_")
  17.     return "".join(final)
  18.  
  19. def decode(string):
  20.     final = []
  21.     characters = {charot}
  22.     one = wrap(string, 2)
  23.     for loop in enumerate(one):
  24.         y = loop[1]
  25.         if y in characters:
  26.             final.append(str(characters[y]))
  27.         else:
  28.             final.append("_")
  29.     return "".join(final)
  30.  
  31. def main():
  32.     if len(sys.argv) != 3:
  33.         print("Usage: %s encode <string>" %sys.argv[0])
  34.         print("Ex: %s testing" %sys.argv[0])
  35.         sys.exit(-1)
  36.     string = sys.argv[2]
  37.     if sys.argv[1] == "encode":
  38.         encode = switcheroo(string)
  39.         print("Tiktok Encoded: "+encode)
  40.     elif sys.argv[1] == "decode":
  41.         decodex = decode(string)
  42.         print("Tiktok Decoded: "+decodex)
  43.     else:
  44.         print("Wrong shit!")
  45.         sys.exit()
  46.  
  47. if __name__ == "__main__":
  48.     main()
RAW Paste Data