コード例 #1
0
ファイル: workplugin.py プロジェクト: JacobJacob/BkScanner
def Work():
    redis = RedisWork()
    portcrackplugin_manager = PortCrackPlugin()
    portcrackplugin_manager.loadPlugins()
    portcrackplugins = portcrackplugin_manager.getPlugins()
    taskid = 0

    while True:
        print '------   port crack -------'
        port_json = redis.getvulInfo(PORTCRACK_KEY)
        if port_json is not None:
            try:
                portinfo = eval(port_json)
                print portinfo
                taskid = portinfo['taskid']
                for portcrackplugin in portcrackplugins:
                    portcrackplugin.execute_run(portinfo['ip'], portinfo['port'], taskid)
                time.sleep(0.5)
            except Exception,e:
                continue
        else:
            time.sleep(300) #等待5分钟后结束所有线程
            for portcrackplugin in portcrackplugins:
                portcrackplugin.async_deal_into_db(taskid)
            break
コード例 #2
0
ファイル: workplugin.py プロジェクト: JacobJacob/BkScanner
def Work():
    redis = RedisWork()
    sysvulplugin_manager = SystemVulPlugin()
    sysvulplugin_manager.loadPlugins()
    sysvulplugins = sysvulplugin_manager.getPlugins()
    taskid = 0

    while True:
        sysvul_json = redis.getvulInfo(SYSVUL_KEY)
        if sysvul_json is not None:
            try:
                sysvulinfo = eval(sysvul_json)
                taskid = sysvulinfo['taskid']
                for sysvulplugin in sysvulplugins:
                    sysvulplugin.execute_run(sysvulinfo['ip'], sysvulinfo['port'], taskid)
            except:
                continue
        else:
            time.sleep(300)
            for sysvulplugin in sysvulplugins:
                sysvulplugin.wait_for_complete(taskid)
            break

    logger.info('[SystemVul exit] systemvul scan over, exit!')
    #扫描完成
    sys.exit()
コード例 #3
0
ファイル: workplugin.py プロジェクト: z3r023/BkScanner
def Work():
    redis = RedisWork()
    sysvulplugin_manager = SystemVulPlugin()
    sysvulplugin_manager.loadPlugins()
    sysvulplugins = sysvulplugin_manager.getPlugins()
    taskid = 0

    while True:
        sysvul_json = redis.getvulInfo(SYSVUL_KEY)
        if sysvul_json is not None:
            try:
                sysvulinfo = eval(sysvul_json)
                taskid = sysvulinfo['taskid']
                for sysvulplugin in sysvulplugins:
                    sysvulplugin.execute_run(sysvulinfo['ip'],
                                             sysvulinfo['port'], taskid)
            except:
                continue
        else:
            time.sleep(300)
            for sysvulplugin in sysvulplugins:
                sysvulplugin.wait_for_complete(taskid)
            break

    logger.info('[SystemVul exit] systemvul scan over, exit!')
    #扫描完成
    sys.exit()
コード例 #4
0
def Work(taskid):
    redis = RedisWork()
    webappplugin_manager = WebPathPlugin()
    webappplugin_manager.loadPlugins()
    webappplugins = webappplugin_manager.getPlugins()

    while True:
        webapp_json = redis.getvulInfo(WEBAPP_KEY)
        if webapp_json is not None:
            try:
                webappinfo = eval(webapp_json)
                for webappplugin in webappplugins:
                    webappplugin.execute_run(webappinfo['ip'],
                                             webappinfo['port'], taskid)
            except:
                continue
        else:
            time.sleep(300)
            for webappplugin in webappplugins:
                webappplugin.wait_for_complete(taskid)
            break

    #send email webpath scan over!
    #扫描完成
    sys.exit()
コード例 #5
0
ファイル: workplugin.py プロジェクト: blackye/BkScanner
def Work():
    redis = RedisWork()
    webplugin_manager = WebPathPlugin()
    webplugin_manager.loadPlugins()
    webplugins = webplugin_manager.getPlugins()
    taskid = 0

    while True:
        web_json = redis.getvulInfo(WEBSCAN_KEY)
        if web_json is not None:
            try:
                webinfo = eval(web_json)
                print webinfo
                taskid = webinfo["taskid"]
                for webplugin in webplugins:
                    webplugin.execute_run(
                        ip=webinfo["ip"], port=webinfo["port"], bdomain=webinfo["type"], taskid=taskid
                    )
            except Exception, e:
                print str(e)
                continue
        else:
            logger.info("[webscan empty]webpath redis empty!")
            time.sleep(300)
            for webplugin in webplugins:
                webplugin.wait_for_complete(0, taskid)
            break
        time.sleep(0.2)
コード例 #6
0
ファイル: controller.py プロジェクト: z3r023/BkScanner
def run_portscan_plugin():
    '''
    端口扫描插件
    :return:
    '''
    desc = 'scan_info'
    consumer = ActiveMQConsumer()
    consumer.receivemsg(desc)
    #redis
    rediswork = RedisWork()

    portscan_plugin = PortScanPluginController(rediswork)  #端口扫描

    while True:
        try:
            message = consumer.listener.msg_que.get(block = False)
            scan_json = json.loads(message)
            if scan_json['type'] == DOMAIN_TYPE[0]:
                print scan_json['url']
                rediswork.pushvulInfo(keyname = WEBSCAN_KEY, ip = scan_json['url'], port = 80, taskid = scan_json['taskid'], type = DOMAIN_TYPE[0])
            elif scan_json['type'] == DOMAIN_TYPE[1]:
                print scan_json['ip']
                portscan_plugin.push_ip(ip = scan_json['ip'], taskid = scan_json['taskid'])
        except Exception,e:
            if portscan_plugin.get_ip_cnt() > 0:
                break
            #logger.error(str(e))

        time.sleep(0.1)
コード例 #7
0
ファイル: workplugin.py プロジェクト: z3r023/BkScanner
def Work():
    redis = RedisWork()
    portcrackplugin_manager = PortCrackPlugin()
    portcrackplugin_manager.loadPlugins()
    portcrackplugins = portcrackplugin_manager.getPlugins()
    taskid = 0

    while True:
        print '------   port crack -------'
        port_json = redis.getvulInfo(PORTCRACK_KEY)
        if port_json is not None:
            try:
                portinfo = eval(port_json)
                print portinfo
                taskid = portinfo['taskid']
                for portcrackplugin in portcrackplugins:
                    portcrackplugin.execute_run(portinfo['ip'],
                                                portinfo['port'], taskid)
                time.sleep(0.5)
            except Exception, e:
                continue
        else:
            time.sleep(300)  #等待5分钟后结束所有线程
            for portcrackplugin in portcrackplugins:
                portcrackplugin.async_deal_into_db(taskid)
            break
コード例 #8
0
ファイル: workplugin.py プロジェクト: z3r023/BkScanner
def Work():
    redis = RedisWork()
    webplugin_manager = WebPathPlugin()
    webplugin_manager.loadPlugins()
    webplugins = webplugin_manager.getPlugins()
    taskid = 0

    while True:
        web_json = redis.getvulInfo(WEBSCAN_KEY)
        if web_json is not None:
            try:
                webinfo = eval(web_json)
                print webinfo
                taskid = webinfo['taskid']
                for webplugin in webplugins:
                    webplugin.execute_run(ip=webinfo['ip'],
                                          port=webinfo['port'],
                                          bdomain=webinfo['type'],
                                          taskid=taskid)
            except Exception, e:
                print str(e)
                continue
        else:
            logger.info('[webscan empty]webpath redis empty!')
            time.sleep(300)
            for webplugin in webplugins:
                webplugin.wait_for_complete(0, taskid)
            break
        time.sleep(0.2)
コード例 #9
0
ファイル: workplugin.py プロジェクト: JacobJacob/BkScanner
def Work(taskid):
    redis = RedisWork()
    webappplugin_manager = WebPathPlugin()
    webappplugin_manager.loadPlugins()
    webappplugins = webappplugin_manager.getPlugins()

    while True:
        webapp_json = redis.getvulInfo(WEBAPP_KEY)
        if webapp_json is not None:
            try:
                webappinfo = eval(webapp_json)
                for webappplugin in webappplugins:
                    webappplugin.execute_run(webappinfo['ip'], webappinfo['port'], taskid)
            except:
                continue
        else:
            time.sleep(300)
            for webappplugin in webappplugins:
                webappplugin.wait_for_complete(taskid)
            break

    #send email webpath scan over!
    #扫描完成
    sys.exit()