Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.94 KB | None | 0 0
  1. import random
  2. import string
  3.  
  4. random.seed(3)
  5.  
  6. indent_counter = 0
  7.  
  8. global_val = 0
  9. def indent(func):
  10. def wrapper(*args):
  11. global indent_counter, global_val
  12.  
  13. out = func(*args)
  14. o = []
  15. current = random.randint(0,1000000000000000)
  16. global_val += current
  17. out = """try:
  18. {}
  19. raise CustomException({})
  20. except CustomException as e_{}:""".format(out, current, indent_counter)
  21. for line in out.split("\n"):
  22. o.append(" "*indent_counter + line)
  23. indent_counter+=1
  24. return "\n".join(o) + "\n"
  25.  
  26. return wrapper
  27.  
  28. @indent
  29. def real_sub_number(name, one, two):
  30. return """{} = {}-{}""".format(name, one, two, random.randint)
  31.  
  32. @indent
  33. def real_add_number(name, one, two):
  34. return """{} = {}+{}""".format(name, one, two)
  35.  
  36. @indent
  37. def real_new_number(name, number):
  38. return """{} = {}""".format(name, number)
  39.  
  40. @indent
  41. def real_xor_number(name, one, two):
  42. return """{} = {}^{}""".format(name, one, two)
  43.  
  44. @indent
  45. def print_var(var):
  46. return """print({})""".format(var)
  47.  
  48. def finish():
  49. global indent_counter
  50. return " " * indent_counter + "pass"
  51.  
  52. def just_indent(code):
  53. return " " * indent_counter + code + "\n"
  54.  
  55. def new_number(name, number):
  56. a = random.randint(0, number)
  57. b = random.randint(0, number)
  58. c = random.randint(0, number)
  59. d = random.randint(0, number)
  60. out = number-a+b-c+d
  61.  
  62. val_name = id_generator(10)
  63. a_name = id_generator(10)
  64. b_name = id_generator(10)
  65. c_name = id_generator(10)
  66. d_name = id_generator(10)
  67.  
  68. #print(a,b,c,d,out)
  69. t1 = real_new_number(val_name, out)
  70. t2 = real_add_number(a_name, val_name, a) + real_sub_number(b_name, a_name, b) + real_add_number(c_name, b_name, c) + real_sub_number(name, c_name, d)
  71. return t1+t2
  72.  
  73. def id_generator(size=6, chars=string.ascii_uppercase):
  74. return ''.join(random.choice(chars) for _ in range(size))
  75.  
  76. varz = [
  77. id_generator(10) for i in range(32)
  78. ]
  79. varz1 = [
  80. id_generator(10) for i in range(32)
  81. ]
  82.  
  83. code = [
  84. "from Crypto.Cipher import AES\n",
  85. "class CustomException(Exception):\n pass\n",
  86. "i=input()\n"
  87. ]
  88. for idx, var in enumerate(varz):
  89. val = random.randint(0, 256)
  90. open("vars", "a+").write(str(val)+"\n")
  91.  
  92. code.append(new_number(var, val))
  93. code.append(real_xor_number(varz1[idx], var, "ord(i[{}])".format(idx)))
  94. key = "".join(varz1)
  95. open("keys", "w").write(key)
  96.  
  97. code.append(just_indent("l=locals()"))
  98. code.append(just_indent("s=str(sum([int(str(l[x])) for x in l if x.startswith('e_')])**2)"))
  99. code.append(just_indent("out=AES.new(s[:32].encode('utf-8'), AES.MODE_CBC, b'\\x00'*16).encrypt(b''.join([bytes([x]) for x in [{}]])[:32])".format(",".join(varz1))))
  100.  
  101. #code.append(just_indent("print(out)"))
  102.  
  103. code.append(just_indent("if out==b'`X\\xd6n1\\xf1HKP\\x08/\\xf4D\\x89\\x1dP\\x99LSx\\x92\\x8f4\\xa3\\xb6\\xd1\\xb0 \\xd7\\xcb\\xfa\\x1f': print('yes')"))
  104. code.append(just_indent("else: print('no')"))
  105. code.append(finish())
  106.  
  107.  
  108.  
  109. out = "".join(code)
  110. print(out)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement