Exemplo n.º 1
0
Arquivo: cli.py Projeto: gamwe6/wifi
def add_command(args):
    scheme_class = Scheme.for_file(args.file)
    assert not scheme_class.find(
        args.interface, args.scheme), "That scheme has already been used"

    scheme = scheme_class.for_cell(
        *get_scheme_params(args.interface, args.scheme, args.ssid))
    scheme.save()
Exemplo n.º 2
0
def connect_command(args):
    scheme_class = Scheme.for_file(args.file)
    if args.adhoc:
        # ensure that we have the adhoc utility scheme
        try:
            adhoc_scheme = scheme_class(args.interface, 'adhoc')
            adhoc_scheme.save()
        except AssertionError:
            pass
        except IOError:
            assert False, "Can't write on {0!r}, do you have required privileges?".format(args.file)

        scheme = scheme_class.for_cell(*get_scheme_params(args.interface, 'adhoc', args.scheme))
    else:
        scheme = scheme_class.find(args.interface, args.scheme)
        assert scheme, "Couldn't find a scheme named {0!r}, did you mean to use -a?".format(args.scheme)

    try:
        scheme.activate()
    except ConnectionError:
        assert False, "Failed to connect to %s." % scheme.name
Exemplo n.º 3
0
Arquivo: cli.py Projeto: Evanito/wifi
def add_command(args):
    scheme_class = Scheme.for_file(args.file)
    assert not scheme_class.find(args.interface, args.scheme), "That scheme has already been used"

    scheme = scheme_class.for_cell(*get_scheme_params(args.interface, args.scheme, args.ssid))
    scheme.save()
Exemplo n.º 4
0
def show_command(args):
    scheme = Scheme.for_file(args.file).for_cell(*get_scheme_params(args.interface, args.scheme, args.ssid))
    print(scheme)
Exemplo n.º 5
0
def list_command(args):
    for scheme in Scheme.for_file(args.file).all():
        print(scheme.name)