Guest User

XTC Lopex Tool

a guest
Oct 20th, 2022
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 7.21 KB | Cybersecurity | 0 0
  1. import os
  2. import sys
  3. import zlib
  4. import time
  5. import base64
  6. import marshal
  7. import py_compile
  8.  
  9. from os import system
  10.  
  11. def purpleblue(text):
  12.     system(""); faded = ""
  13.     red = 110
  14.     for line in text.splitlines():
  15.         faded += (f"\033[38;2;{red};0;255m{line}\033[0m\n")
  16.         if not red == 0:
  17.             red -= 15
  18.             if red < 0:
  19.                 red = 0
  20.     return faded
  21.  
  22. if sys.version_info[0]==2:
  23.     _input = "raw_input('%s')"
  24. elif sys.version_info[0]==3:
  25.     _input = "input('%s')"
  26. else:
  27.     sys.exit("\n Your Python Version is not Supported!")
  28.  
  29. # Encoding
  30. zlb = lambda in_ : zlib.compress(in_)
  31. b16 = lambda in_ : base64.b16encode(in_)
  32. b32 = lambda in_ : base64.b32encode(in_)
  33. b64 = lambda in_ : base64.b64encode(in_)
  34. mar = lambda in_ : marshal.dumps(compile(in_,'<x>','exec'))
  35. note = ""
  36.  
  37. def banner(): # Program Banner
  38.     print(purpleblue("""
  39.    
  40. ██╗      ██████╗ ██████╗ ███████╗██╗  ██╗
  41. ██║     ██╔═══██╗██╔══██╗██╔════╝╚██╗██╔╝
  42. ██║     ██║   ██║██████╔╝█████╗   ╚███╔╝
  43. ██║     ██║   ██║██╔═══╝ ██╔══╝   ██╔██╗
  44. ███████╗╚██████╔╝██║     ███████╗██╔╝ ██╗
  45. ╚══════╝ ╚═════╝ ╚═╝     ╚══════╝╚═╝  ╚═╝
  46.           Python Obfuscation                  
  47.              Made By tower Hacked by Hacker Bug
  48. """))
  49.  
  50. def menu(): # Program Menu
  51.     print(purpleblue("""
  52. [01] Encode Marshal
  53. [02] Encode Zlib
  54. [03] Encode Base16
  55. [04] Encode Base32
  56. [05] Encode Base64
  57. [06] Encode Zlib,Base16
  58. [07] Encode Zlib,Base32
  59. [08] Encode Zlib,Base64
  60. [09] Encode Marshal,Zlib
  61. [10] Encode Marshal,Base16
  62. [11] Encode Marshal,Base32
  63. [12] Encode Marshal,Base64
  64. [13] Encode Marshal,Zlib,B16      
  65. [14] Encode Marshal,Zlib,B32
  66. [15] Encode Marshal,Zlib,B64
  67. [16] Simple Encode
  68. [17] Exit
  69. """))
  70.  
  71. class FileSize: # Gets the File Size
  72.     def datas(self,z):
  73.         for x in ['Byte','KB','MB','GB']:
  74.             if z < 1024.0:
  75.                 return "%3.1f %s" % (z,x)
  76.             z /= 1024.0
  77.     def __init__(self,path):
  78.         if os.path.isfile(path):
  79.             dts = os.stat(path).st_size
  80.             print(" [-] Encoded File Size : %s\n" % self.datas(dts))
  81. # FileSize('rec.py')
  82.  
  83. # Encode Menu
  84. def Encode(option,data,output):
  85.     loop = int(eval(_input % " [-] Encode Count : "))
  86.     if option == 1:
  87.         xx = "mar(data.encode('utf8'))[::-1]"
  88.         heading = "_ = lambda __ : __import__('marshal').loads(__[::-1]);"
  89.     elif option == 2:
  90.         xx = "zlb(data.encode('utf8'))[::-1]"
  91.         heading = "_ = lambda __ : __import__('zlib').decompress(__[::-1]);"
  92.     elif option == 3:
  93.         xx = "b16(data.encode('utf8'))[::-1]"
  94.         heading = "_ = lambda __ : __import__('base64').b16decode(__[::-1]);"
  95.     elif option == 4:
  96.         xx = "b32(data.encode('utf8'))[::-1]"
  97.         heading = "_ = lambda __ : __import__('base64').b32decode(__[::-1]);"
  98.     elif option == 5:
  99.         xx = "b64(data.encode('utf8'))[::-1]"
  100.         heading = "_ = lambda __ : __import__('base64').b64decode(__[::-1]);"
  101.     elif option == 6:
  102.         xx = "b16(zlb(data.encode('utf8')))[::-1]"
  103.         heading = "_ = lambda __ : __import__('zlib').decompress(__import__('base64').b16decode(__[::-1]));"
  104.     elif option == 7:
  105.         xx = "b32(zlb(data.encode('utf8')))[::-1]"
  106.         heading = "_ = lambda __ : __import__('zlib').decompress(__import__('base64').b32decode(__[::-1]));"
  107.     elif option == 8:
  108.         xx = "b64(zlb(data.encode('utf8')))[::-1]"
  109.         heading = "_ = lambda __ : __import__('zlib').decompress(__import__('base64').b64decode(__[::-1]));"
  110.     elif option == 9:
  111.         xx = "zlb(mar(data.encode('utf8')))[::-1]"
  112.         heading = "_ = lambda __ : __import__('marshal').loads(__import__('zlib').decompress(__[::-1]));"
  113.     elif option == 10:
  114.         xx = "b16(mar(data.encode('utf8')))[::-1]"
  115.         heading = "_ = lambda __ : __import__('marshal').loads(__import__('base64').b16decode(__[::-1]));"
  116.     elif option == 11:
  117.         xx = "b32(mar(data.encode('utf8')))[::-1]"
  118.         heading = "_ = lambda __ : __import__('marshal').loads(__import__('base64').b32decode(__[::-1]));"
  119.     elif option == 12:
  120.         xx = "b64(mar(data.encode('utf8')))[::-1]"
  121.         heading = "_ = lambda __ : __import__('marshal').loads(__import__('base64').b64decode(__[::-1]));"
  122.     elif option == 13:
  123.         xx = "b16(zlb(mar(data.encode('utf8'))))[::-1]"
  124.         heading = "_ = lambda __ : __import__('marshal').loads(__import__('zlib').decompress(__import__('base64').b16decode(__[::-1])));"
  125.     elif option == 14:
  126.         xx = "b32(zlb(mar(data.encode('utf8'))))[::-1]"
  127.         heading = "_ = lambda __ : __import__('marshal').loads(__import__('zlib').decompress(__import__('base64').b32decode(__[::-1])));"
  128.     elif option == 15:
  129.         xx = "b64(zlb(mar(data.encode('utf8'))))[::-1]"
  130.         heading = "_ = lambda __ : __import__('marshal').loads(__import__('zlib').decompress(__import__('base64').b64decode(__[::-1])));"
  131.     else:
  132.         sys.exit("\n Invalid Option!")
  133.    
  134.     for x in range(loop):
  135.         try:
  136.             data = "exec((_)(%s))" % repr(eval(xx))
  137.         except TypeError as s:
  138.             sys.exit(" TypeError : " + str(s))
  139.     with open(output, 'w') as f:
  140.         f.write(note + heading + data)
  141.         f.close()
  142.  
  143. # Special Encode
  144. def SEncode(data,output):
  145.     for x in range(5):
  146.         method = repr(b64(zlb(mar(data.encode('utf8'))))[::-1])
  147.         data = "exec(__import__('marshal').loads(__import__('zlib').decompress(__import__('base64').b64decode(%s[::-1]))))" % method
  148.     z = []
  149.     for i in data:
  150.         z.append(ord(i))
  151.     sata = "_ = %s\nexec(''.join(chr(__) for __ in _))" % z
  152.     with open(output, 'w') as f:
  153.         f.write(note + "exec(str(chr(35)%s));" % '+chr(1)'*10000)
  154.         f.write(sata)
  155.         f.close()
  156.     py_compile.compile(output,output)
  157.  
  158. # Main Menu
  159. def MainMenu():
  160.     try:
  161.         os.system('clear') # os.system('cls')
  162.         banner()
  163.         menu()
  164.         try:
  165.             option = int(eval(_input % " [-] Option : "))
  166.         except ValueError:
  167.             sys.exit("\n Invalid Option !")
  168.        
  169.         if option > 0 and option <= 17:
  170.             if option == 17:
  171.                 sys.exit("\n Thanks For Using this Tool")
  172.             os.system('clear') # os.system('cls')
  173.             banner()
  174.         else:
  175.             sys.exit('\n Invalid Option !')
  176.         try:
  177.             file = eval(_input % " [-] File Name : ")
  178.             data = open(file).read()
  179.         except IOError:
  180.             sys.exit("\n File Not Found!")
  181.        
  182.         output = file.lower().replace('.py', '') + '_enc.py'
  183.         if option == 16:
  184.             SEncode(data,output)
  185.         else:
  186.             Encode(option,data,output)
  187.         print("\n [-] Successfully Encrypted %s" % file)
  188.         print(" [-] Saved as %s" % output)
  189.         FileSize(output)
  190.     except KeyboardInterrupt:
  191.         time.sleep(1)
  192.         sys.exit()
  193.  
  194. if __name__ == "__main__":
  195.     MainMenu()
Add Comment
Please, Sign In to add comment