示例#1
0
 def do_loadsearched(self, arg):
     if not self.retLastSearch:
         bprint("[-] please make a search first.", "error")
         return
     batchablePocPaths = []
     unbatchablePocPaths = []
     for pocInfo in self.retLastSearch:
         pocId, name, rank, level, author, createDate, protocol, port, layer4Protocol, appName, vulType, desc, tag, batchable, path = (
             pocInfo
         )
         if batchable:
             batchablePocPaths.append(path)
         else:
             unbatchablePocPaths.append(path)
     if unbatchablePocPaths:
         bprintPrefix("These pocs in last search results are not batchable:", "warning")
         bprintPrefix(
             "They cannot be loaded in Storm mode, please load them " "singlely in the Shooter mode.", "warning"
         )
         for pocPath in unbatchablePocPaths:
             print "    %s" % os.path.basename(pocPath)
     if unbatchablePocPaths and batchablePocPaths:
         print
     if batchablePocPaths:
         bprintPrefix("These pocs in last search results are batchable:", "ok")
         bprintPrefix("They are going to be used to load Storm mode scan.", "ok")
         for pocPath in batchablePocPaths:
             print "    %s" % os.path.basename(pocPath)
         return batchablePocPaths
     else:
         bprintPrefix("None of the poc in last search result is batchable.", "warning")
         return None
示例#2
0
 def do_info(self, arg):
     """[*] View code information and usage."""
     if not arg.strip():
         bprintPrefix(self.nonWhiteMsg, "error")
         return
     if not arg.strip().startswith("poc"):
         pocName = "poc-" + arg.strip()
         if pocName.strip()[8] != "-":
             pocName = "poc-" + pocName[-8:-4] + "-" + pocName[-4:]
     else:
         pocName = arg.strip()
     pocInfo = self.database.searchPoc(pocId=pocName.strip().replace("_", "-"))
     if pocInfo is None:
         bprintPrefix("Cannot find poc %s in database." % arg, "error")
         return
     pocId, name, rank, level, author, createDate, protocol, port, layer4Protocol, appName, vulType, desc, tag, batchable, path = (
         pocInfo
     )
     if not path or not os.path.exists(path):
         bprintPrefix("Poc file %s not exists, perhaps you have't bought " "it.\n" % path, "error")
         return
     try:
         p = poc.Poc(path=os.path.join(POC_DIR, "%s.py" % pocName.strip().replace("-", "_")), batchable=batchable)
         mp = p.module.MyPoc(run_in_shell=False)
         mp._init_parser(do_parse=False)
         bprint("%s information:" % path, "ok")
         pprint2.pprint(mp.poc_info)
         print
         bprint("%s help:" % path, "ok")
         mp.base_parser.print_help()
         # return mp
     except Exception, err:
         bprintPrefix(err, "error")
示例#3
0
 def do_showloaded(self, arg):
     """[*] Show current loaded poc(s)"""
     if hasattr(self, "loadedPocs") and self.loadedPocs:
         if isinstance(self, (ShooterMenu, HunterMenu)):
             bprintPrefix("loaded poc: %s" % self.loadedPocs.poc_info.get("poc").get("id"), "ok")
         elif isinstance(self, StormMenu):
             bprintPrefix("loaded pocs: ", "ok")
             for pocPath in self.loadedPocs:
                 print "    %s" % os.path.basename(pocPath)
     else:
         bprint("[-] no poc has been loaded.", "error")
示例#4
0
 def do_showloaded(self, arg):
     '''[*] Show current loaded poc(s)'''
     if hasattr(self, 'loadedPocs') and self.loadedPocs:
         if isinstance(self, (ShooterMenu, HunterMenu)):
             bprintPrefix('loaded poc: %s' % \
                   self.loadedPocs.poc_info.get('poc').get('id'), 'ok')
         elif isinstance(self, StormMenu):
             bprintPrefix('loaded pocs: ', 'ok')
             for pocPath in self.loadedPocs:
                 print '    %s' % os.path.basename(pocPath)
     else:
         bprint('[-] no poc has been loaded.', 'error')
示例#5
0
 def preloop(self):
     num_count = str(self.database.countAll()[0])
     print banners.getBanner()
     bprint("%sn0tr00t security team\n" % (" " * 20), "warning")
     sys.stdout.write("Beehive Version: ")
     bprint(VERSION, "ok")
     sys.stdout.write("Exploits & Pocs: ")
     bprint(num_count, "ok")
     sys.stdout.write("Contact: ")
     bprint("*****@*****.**", "ok")
     sys.stdout.write("Forum: ")
     bprint("  http://buzz.beebeeto.com", "ok")
     print
示例#6
0
 def preloop(self):
     num_count = str(self.database.countAll()[0])
     print banners.getBanner()
     bprint('%sn0tr00t security team\n' % (' ' * 20), 'warning')
     sys.stdout.write('Beehive Version: ')
     bprint(VERSION, 'ok')
     sys.stdout.write('Exploits & Pocs: ')
     bprint(num_count, 'ok')
     sys.stdout.write('Contact: ')
     bprint('*****@*****.**', 'ok')
     sys.stdout.write('Forum: ')
     bprint('  http://buzz.beebeeto.com', 'ok')
     print
示例#7
0
 def do_info(self, arg):
     '''[*] View code information and usage.'''
     if not arg.strip():
         bprintPrefix(self.nonWhiteMsg, 'error')
         return
     if not arg.strip().startswith('poc'):
         pocName = 'poc-' + arg.strip()
         if pocName.strip()[8] != '-':
             pocName = 'poc-' + pocName[-8:-4] + '-' + pocName[-4:]
     else:
         pocName = arg.strip()
     pocInfo = self.database.searchPoc(
         pocId=pocName.strip().replace('_', '-'))
     if pocInfo is None:
         bprintPrefix('Cannot find poc %s in database.' % arg, 'error')
         return
     pocId, name, rank, level, author, createDate, protocol, port, \
         layer4Protocol, appName, vulType, desc, tag, batchable, \
         path = pocInfo
     if not path or not os.path.exists(path):
         bprintPrefix('Poc file %s not exists, perhaps you have\'t bought '\
               'it.\n' % path, 'error')
         return
     try:
         p = poc.Poc(path=os.path.join(POC_DIR, '%s.py' % \
                                       pocName.strip().replace('-', '_')),
                     batchable=batchable)
         mp = p.module.MyPoc(run_in_shell=False)
         mp._init_parser(do_parse=False)
         bprint('%s information:' % path, 'ok')
         pprint2.pprint(mp.poc_info)
         print
         bprint('%s help:' % path, 'ok')
         mp.base_parser.print_help()
         #return mp
     except Exception, err:
         bprintPrefix(err, 'error')
示例#8
0
 def do_loadsearched(self, arg):
     if not self.retLastSearch:
         bprint('[-] please make a search first.', 'error')
         return
     batchablePocPaths = []
     unbatchablePocPaths = []
     for pocInfo in self.retLastSearch:
         pocId, name, rank, level, author, createDate, protocol, port, \
             layer4Protocol, appName, vulType, desc, tag, batchable, \
             path = pocInfo
         if batchable:
             batchablePocPaths.append(path)
         else:
             unbatchablePocPaths.append(path)
     if unbatchablePocPaths:
         bprintPrefix(
             'These pocs in last search results are not batchable:',
             'warning')
         bprintPrefix('They cannot be loaded in Storm mode, please load them '\
               'singlely in the Shooter mode.', 'warning')
         for pocPath in unbatchablePocPaths:
             print '    %s' % os.path.basename(pocPath)
     if unbatchablePocPaths and batchablePocPaths:
         print
     if batchablePocPaths:
         bprintPrefix('These pocs in last search results are batchable:',
                      'ok')
         bprintPrefix('They are going to be used to load Storm mode scan.',
                      'ok')
         for pocPath in batchablePocPaths:
             print '    %s' % os.path.basename(pocPath)
         return batchablePocPaths
     else:
         bprintPrefix('None of the poc in last search result is batchable.',
                      'warning')
         return None
示例#9
0
        if opts.mode == "pocs":
            try:
                num_insert, num_all, num_err, err_list = self.database.updtDbFromPocs(pocDir=POC_DIR)
                print "[*] Scan local mode\n%s\nTotal: %s" % ("--" * 10, num_all)
            except Exception, err:
                bprintPrefix(err, "error")
        elif opts.mode == "json":
            try:
                num_insert, num_all, num_err, err_list = self.database.updtDbFromJson("./pocdb.json")
                print "[*] JSON import mode\n%s\nTotal: %s" % ("--" * 10, num_all)
            except Exception, err:
                bprintPrefix(err, "error")
        else:
            bprintPrefix("WTF!?", "warning")
            return
        bprint("Insert number: %s" % num_insert, "ok")
        bprint("Error number: %s" % num_err, "error")
        for i in err_list:
            print "    %s" % i

    def do_showloaded(self, arg):
        """[*] Show current loaded poc(s)"""
        if hasattr(self, "loadedPocs") and self.loadedPocs:
            if isinstance(self, (ShooterMenu, HunterMenu)):
                bprintPrefix("loaded poc: %s" % self.loadedPocs.poc_info.get("poc").get("id"), "ok")
            elif isinstance(self, StormMenu):
                bprintPrefix("loaded pocs: ", "ok")
                for pocPath in self.loadedPocs:
                    print "    %s" % os.path.basename(pocPath)
        else:
            bprint("[-] no poc has been loaded.", "error")
示例#10
0
                print '[*] Scan local mode\n%s\nTotal: %s' % ('--' * 10,
                                                              num_all)
            except Exception, err:
                bprintPrefix(err, 'error')
        elif opts.mode == 'json':
            try:
                num_insert, num_all, num_err, err_list = self.database.updtDbFromJson(
                    './pocdb.json')
                print '[*] JSON import mode\n%s\nTotal: %s' % ('--' * 10,
                                                               num_all)
            except Exception, err:
                bprintPrefix(err, 'error')
        else:
            bprintPrefix('WTF!?', 'warning')
            return
        bprint('Insert number: %s' % num_insert, 'ok')
        bprint('Error number: %s' % num_err, 'error')
        for i in err_list:
            print '    %s' % i

    def do_showloaded(self, arg):
        '''[*] Show current loaded poc(s)'''
        if hasattr(self, 'loadedPocs') and self.loadedPocs:
            if isinstance(self, (ShooterMenu, HunterMenu)):
                bprintPrefix('loaded poc: %s' % \
                      self.loadedPocs.poc_info.get('poc').get('id'), 'ok')
            elif isinstance(self, StormMenu):
                bprintPrefix('loaded pocs: ', 'ok')
                for pocPath in self.loadedPocs:
                    print '    %s' % os.path.basename(pocPath)
        else: