コード例 #1
0
ファイル: SitemapScan.py プロジェクト: Conanjun/SiteMapScan
                                           
 Authors: Conan0xff Wha000tif Konakona
 Version: 1.0
 
 
 usage: SitemapScan <command>
 commands: 
    crawl                  run crawler
    scan                   run scanner
    util                   run utility
        ''')


if __name__ == '__main__':
    logo()
    if len(sys.argv) < 2:
        logo()
        sys.exit(1)

    elif sys.argv[1] == "crawl":
        Crawler(sys.argv[2:])
    elif sys.argv[1] == "scan":
        Scanner(sys.argv[2:])
    elif sys.argv[1] == "util":
        Util(sys.argv[2:])
    else:
        logo()
        sys.exit()

    sys.exit(0)
コード例 #2
0
ファイル: htcap.py プロジェクト: zumb08/htcap
    node_dir = os.path.join(getrealdir(__file__), 'core', 'nodejs')
    env_sep = ':' if sys.platform != "win32" else ';'
    os.environ["NODE_PATH"] = env_sep.join(
        [node_dir, os.path.join(node_dir, 'node_modules')])

    if len(sys.argv) < 2:
        usage()
        sys.exit(1)

    argvs = split_argv(sys.argv[1:])
    for argv in argvs:
        if argv[0] not in ('crawl', 'scan', 'util'):
            print("Command not found: %s" % argv[0])
            sys.exit(1)
    cr = None
    sc = None
    for argv in argvs:

        if argv[0] == "crawl":
            cr = Crawler(argv[1:])
        elif argv[0] == "scan":
            if sc:
                dbfile = sc.db_file
            else:
                dbfile = cr.db_file if cr else None
            sc = Scanner(argv[1:], dbfile)
        elif argv[0] == "util":
            dbfile = cr.db_file if cr else (sc.db_file if sc else None)
            Util(argv[1:], dbfile)
    sys.exit(0)