Ejemplo n.º 1
0
def main():
    """
    Main function of w9scan when running from command line.
    """
    checkEnvironment()  # 检测环境
    setPaths(modulePath())  # 为一些目录和文件设置了绝对路径

    parser = argparse.ArgumentParser(description="w9scan scanner")
    parser.add_argument("--update", help="update w9scan", action="store_true")
    parser.add_argument("--guide", help="w9scan to guide", action="store_true")
    parser.add_argument(
        "--banner", help="output the banner", action="store_true")
    parser.add_argument("-u", help="url")
    parser.add_argument("-p", "--plugin", help="plugins")
    parser.add_argument("-s", "--search", help="find infomation of plugin")
    parser.add_argument("--debug", help="output debug info",
                        action="store_true", default=False)
    args = parser.parse_args()

    if IS_WIN:
        winowsColorInit()
    Banner()

    try:
        configFileParser(os.path.join(paths.w9scan_ROOT_PATH, "config.conf"))
        initOption(args)
        pluginScan()
        webScan()

    except ToolkitMissingPrivileges, e:
        logger.error(e)
        systemQuit(EXIT_STATUS.ERROR_EXIT)
Ejemplo n.º 2
0
def main():
    #主函数

    checkEnvironment()  #检测环境
    setPaths(modulePath())  #初始化一些绝对路径,参数为根目录

    #参数设置
    args = parser()

    if IS_WIN == 'win32':  #win 初始化
        winowsColorInit()
    #Banner()

    try:
        configFileParser(os.path.join(paths.Ajatar_ROOT_PATH,
                                      "config.conf"))  #配置文件参数处理
        initOption(args)  #初始化参数
        #pluginScan() #插件函数
        webScan()  #扫描函数
    except Exception as e:
        raise e
Ejemplo n.º 3
0
def main():
    checkEnvironment()  #检测环境
    common.setPaths(modulePath())  # 为一些目录和文件设置了绝对路径

    #目标url,一些参数设置
    parser = argparse.ArgumentParser(description="Ajatar scan must a url")
    parser.add_argument("-u", "--url", help="url")
    args = parser.parse_args()
    root = args.url
    #root = "http://www.imufe.edu.cn/"

    #判断是否为Windows
    if IS_WIN:
        #Windows界面颜色
        windowsColorInit()
    #Banner()

    try:
        configFileParser(os.path.join(paths.Ajatar_ROOT_PATH, "config.conf"))
        #线程数
        threadNum = initOption(args)
    except Exception as e:
        raise e

    #拆解url 得到netloc
    domain = common.Ajurlparse(root)
    #输出报告对象
    output = outputer.outputer()

    # CDN Check
    print "CDN check...."
    iscdn = True
    try:
        msg, iscdn = fun_until.checkCDN(root)
        #获取数据生成报告
        output.add("cdn", msg)
        #build html
        output.build_html(domain)
        print msg
    except:
        print "[Error]:CDN check error"

    if iscdn:
        #IP Ports Scan
        #获取ip
        ip = common.gethostbyname(root)
        print "IP:", ip
        print "Start Port Scan:"
        #ip端口扫描
        pp = PortScan.PortScan(ip)
        pp.work()
        output.build_html(domain)

    # DIR Fuzz
    dd = webdir.webdir(root, threadNum)
    dd.work()
    dd.output()
    output.build_html(domain)

    #webcms
    ww = webcms.webcms(root, threadNum)
    ww.run()
    output.build_html(domain)

    #spider
    Aj = SpiderMain(root, threadNum)
    Aj.craw()