Exemplo n.º 1
0
def run():
    options = Options()
    try:
        options.parseOptions()
    except usage.UsageError as error_message:
        print "%s: %s" % (sys.argv[0], error_message)
        print "%s: Try --help for usage details." % (sys.argv[0])
        sys.exit(1)

    if options['update-inputs'] or options['update-geoip']:
        print("WARNING: Passing command line arguments is deprecated")

    yield update.download_resources()
Exemplo n.º 2
0
def run():
    options = Options()
    try:
        options.parseOptions()
    except usage.UsageError as error_message:
        print "%s: %s" % (sys.argv[0], error_message)
        print "%s: Try --help for usage details." % (sys.argv[0])
        sys.exit(1)

    if options["update-inputs"] or options["update-geoip"]:
        print ("WARNING: Passing command line arguments is deprecated")

    yield update.download_resources()
Exemplo n.º 3
0
def run():
    options = Options()
    try:
        options.parseOptions()
    except usage.UsageError as error_message:
        print "%s: %s" % (sys.argv[0], error_message)
        print options
        sys.exit(1)

    if not resources_up_to_date():
        print("Resources for running ooniprobe are not up to date.")
        print("Will update them now.")
        yield download_resources()

    if not options['output']:
        options['output'] = os.getcwd()

    if not options['country-code']:
        try:
            options['country-code'] = yield get_user_country_code()
        except errors.ProbeIPUnknown:
            print "Could not determine your IP address."
            print "Check your internet connection or specify a country code with -c."
            sys.exit(4)

    if len(options['country-code']) != 2:
        print "%s: --country-code must be 2 characters" % sys.argv[0]
        sys.exit(2)

    if not os.path.isdir(options['output']):
        print "%s: %s is not a directory" % (sys.argv[0],
                                             options['output'])
        sys.exit(3)

    options['country-code'] = options['country-code'].lower()

    output_dir = os.path.abspath(options['output'])
    output_dir = os.path.join(output_dir,
                              "deck-%s" % options['country-code'])
    options['output'] = output_dir

    try:
        os.makedirs(options['output'])
    except OSError as exception:
        if exception.errno != errno.EEXIST:
            raise

    generate_deck(options)
Exemplo n.º 4
0
def run():
    options = Options()
    try:
        options.parseOptions()
    except usage.UsageError as error_message:
        print "%s: %s" % (sys.argv[0], error_message)
        print options
        sys.exit(1)

    if not resources_up_to_date():
        print("Resources for running ooniprobe are not up to date.")
        print("Will update them now.")
        yield download_resources()

    if not options['output']:
        options['output'] = os.getcwd()

    if not options['country-code']:
        try:
            options['country-code'] = yield get_user_country_code()
        except errors.ProbeIPUnknown:
            print "Could not determine your IP address."
            print "Check your internet connection or specify a country code with -c."
            sys.exit(4)

    if len(options['country-code']) != 2:
        print "%s: --country-code must be 2 characters" % sys.argv[0]
        sys.exit(2)

    if not os.path.isdir(options['output']):
        print "%s: %s is not a directory" % (sys.argv[0], options['output'])
        sys.exit(3)

    options['country-code'] = options['country-code'].lower()

    output_dir = os.path.abspath(options['output'])
    output_dir = os.path.join(output_dir, "deck-%s" % options['country-code'])
    options['output'] = output_dir

    try:
        os.makedirs(options['output'])
    except OSError as exception:
        if exception.errno != errno.EEXIST:
            raise

    generate_deck(options)