Advertisement
Guest User

pycompile

a guest
Jul 19th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.56 KB | None | 0 0
  1. import random, string, os
  2.  
  3. encryptedvariable = "program"
  4. encryptedstring = ""
  5.  
  6. def EncryptData(data, encryptdata, encryptvar):
  7.     global encryptedstring
  8.     global encryptedvariable
  9.  
  10.     if encryptdata == "True":
  11.         encryptedstring = "\\x" + "\\x".join("{0:x}".format(ord(data)) for data in data)
  12.     else:
  13.         print("Error encrypting data!")
  14.        
  15.     if encryptvar == "True":
  16.         number = random.randint(1, 1000)
  17.         length = random.randint(35, 50)
  18.        
  19.         def randomvar(length):
  20.             letters = ['I','i','l']
  21.             global encryptedvariable2
  22.             encryptedvariable2 = ''.join(random.choice(letters) for i in range(length))
  23.         randomvar(length)
  24.         encryptedvariable = encryptedvariable2 + str(number)
  25.  
  26.     filed = "compileddat.txt"
  27.        
  28.     if os.path.exists(filed):
  29.         os.remove(filed)
  30.  
  31.         file = open("compileddat.txt","w+")
  32.         file.write(encryptedvariable +" =("+"'"+ encryptedstring +"'"+ ")\nexec(" + encryptedvariable + ")")
  33.     else:
  34.         file = open("compileddat.txt","w+")
  35.         file.write(encryptedvariable +" =("+"'"+ encryptedstring +"'"+ ")\nexec(" + encryptedvariable + ")")
  36.  
  37. pythoncode = open("debugsource.txt","r")
  38. encryptvarcode = open("encryptvar.txt","r")
  39. encryptdatacode = open("encryptdata.txt","r")
  40.  
  41. indata = pythoncode.read()
  42. invarcode = encryptvarcode.read()
  43. indatacode = encryptdatacode.read()
  44.  
  45. userinput = (input(str(indata)))
  46. edata = (input(str(indatacode)))
  47. evar = (input(str(invarcode)))
  48.  
  49. EncryptData(userinput, "True", "True")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement