Esempio n. 1
0
    parser.add_option(
        "-u",
        "--updateDB",
        action="store_true",
        help=
        "Pull latest DB files from blindelephant.sourceforge.net repo (Equivalent to svn update on blindelephant/dbs/). May require root if blindelephant was installed with root."
    )

    (options, args) = parser.parse_args()

    if options.list:
        print("Currently configured web apps:",
              len(list(wac.APP_CONFIG.keys())),
              file=wac.DEFAULT_LOGFILE)
        for app in sorted(wac.APP_CONFIG.keys()):
            pluginsDir = wac.getDbDir(app)
            plugins = os.listdir(pluginsDir) if os.access(pluginsDir,
                                                          os.F_OK) else []
            plugins = [p for p in plugins if p.endswith(wac.DB_EXTENSION)]
            print("%s with %d plugins" % (app, len(plugins)),
                  file=wac.DEFAULT_LOGFILE)
            for p in sorted(plugins):
                print(" -",
                      p[:-(len(wac.DB_EXTENSION))],
                      file=wac.DEFAULT_LOGFILE)
        quit()

    if options.updateDB:
        """Added at the request of backbox.org; pretty hacky. May formalize this in the future if there's demand"""
        import tempfile
        import urllib.request, urllib.parse, urllib.error
Esempio n. 2
0
    parser = OptionParser(usage=USAGE, epilog=EPILOGUE)
    parser.add_option("-p", "--pluginName", help="Fingerprint version of plugin (should apply to web app given in appname)")
    parser.add_option("-s", "--skip", action="store_true", help="Skip fingerprinting webpp, just fingerprint plugin")
    parser.add_option("-n", "--numProbes", type='int', help="Number of files to fetch (more may increase accuracy). Default: %default", default=15)
    parser.add_option("-w", "--winnow", action="store_true", help="If more than one version are returned, use winnowing to attempt to narrow it down (up to numProbes additional requests).")
    parser.add_option("-l", "--list", action="store_true", help="List supported webapps and plugins")
    parser.add_option("-u", "--updateDB", action="store_true", help="Pull latest DB files from blindelephant.sourceforge.net repo (Equivalent to svn update on blindelephant/dbs/). May require root if blindelephant was installed with root.")


    (options, args) = parser.parse_args()

    if options.list:
       print >> wac.DEFAULT_LOGFILE, "Currently configured web apps:", len(wac.APP_CONFIG.keys())
       for app in sorted(wac.APP_CONFIG.keys()):
           pluginsDir = wac.getDbDir(app)
           plugins = os.listdir(pluginsDir) if os.access(pluginsDir, os.F_OK) else []
           plugins = [p for p in plugins if p.endswith(wac.DB_EXTENSION)]
           print >> wac.DEFAULT_LOGFILE, "%s with %d plugins" % (app, len(plugins))
           for p in sorted(plugins):
               print >> wac.DEFAULT_LOGFILE, " -", p[:-(len(wac.DB_EXTENSION))]
       quit()
    
    if options.updateDB:
        """Added at the request of backbox.org; pretty hacky. May formalize this in the future if there's demand"""
        import tempfile
        import urllib
        import os
        import tarfile
        dbtar_url = "http://blindelephant.svn.sourceforge.net/viewvc/blindelephant/trunk/src/blindelephant/dbs/?view=tar"
        untar_dir = os.path.join(wac.getDbDir(), os.path.pardir); #so that dbs/ in tar overlays existing dbs/