Sycorax/main.py

50 lines
1.8 KiB
Python
Raw Permalink Normal View History

2024-07-18 17:43:55 +00:00
import argparse
import base64
import bz2
import random
import string
import zlib
def genshit():
letters = string.ascii_letters + string.digits + '_' * 10
result = ""
for _ in range(random.randint(30, 50)):
var_name = ''.join(random.choice(letters) for _ in range(random.randint(100, 150)))
var_value = ''.join(random.choice(letters) for _ in range(random.randint(100, 150)))
result += f"v_Sycorax{var_name} = 'Sycorax{var_value}'\n"
return result
def encodes(original,len):
letters = string.ascii_letters + string.digits + '_' * 10
for _ in range(len):
original_bytes = original.encode('utf-8')
originalenc = zlib.compress(base64.b64encode(original_bytes),5)
var_name = ''.join(random.choice(letters) for _ in range(random.randint(5, 15)))
original = f"import base64,zlib\nOBFUSCATED_BY_SYCORAX=True\n{var_name}=zlib.decompress({originalenc})\nexec(base64.b64decode({var_name}))"
return original
def main():
parser = argparse.ArgumentParser(description="Sycorax Obfuscator 1.0 | GPL 3.0")
parser.add_argument('-l', '--layers', type=int, required=True, help='Number of layers')
parser.add_argument('-i', '--input', type=str, required=True, help='Input file')
parser.add_argument('-o', '--output', type=str, help='Output file')
args = parser.parse_args()
with open(args.input, 'r') as file:
original_content = file.read()
print("Encoding")
encoded = encodes(original_content, args.layers)
print("Encoded Successfully.")
if args.output:
with open(args.output, 'w') as outfile:
outfile.write(encoded)
print("Written to file. Please ensure that you do not get an Invalid Decimal Literal error by running the obfuscated code.")
else:
print(encoded)
if __name__ == "__main__":
main()