Exemple #1
0
def main():
    args = parse_args()
    authenticator = AuthClient(args.authorization_address, args.client_id,
                               args.client_secret)
    try:
        if not args.scopes:
            token_info = authenticator.fetch_token()
        else:
            token_info = authenticator.fetch_token(args.scopes)
        print("access token: {}".format(token_info.token))
    except APIException as err:
        print("{}: {}".format(err, err.long_description))
        exit(1)
Exemple #2
0
def get_scanner():
    authenticator = AuthClient(
        app.config["authorization_address"],
        app.config["client_id"],
        app.config["client_secret"],
    )
    return ScanClient(app.config["scanner_address"], authenticator)
Exemple #3
0
def scan_thread_initializer(
    authorization_address,
    scanning_address,
    client_id,
    client_secret,
):
    logging.debug("Initializing scanner thread")
    authenticator = AuthClient(authorization_address, client_id, client_secret)
    thread_ctx.scanner = ScanClient(scanning_address, authenticator)
Exemple #4
0
def main():
    args = parse_args()
    try:
        authenticator = AuthClient(args.authorization_address, args.client_id,
                                   args.client_secret)
        scanner = ScanClient(args.scanner_address, authenticator)
        pprint(scanner.scan_until_complete(args.file.read_bytes()))
    except APIException as err:
        print("{}: {}".format(err, err.long_description))
        exit(1)
Exemple #5
0
def main():
    args = parse_args()
    try:
        authenticator = AuthClient(args.authorization_address, args.client_id,
                                   args.client_secret)
        configurator = ConfigClient(args.management_address, authenticator)
        pprint(configurator.get(args.setting))
    except APIException as err:
        print("{}: {}".format(err, err.long_description))
        exit(1)
Exemple #6
0
def main():
    args = parse_args()
    address, port = args.server_address.split(":", 1)
    authenticator = AuthClient(args.authorization_address, args.client_id,
                               args.client_secret)
    scanner = ScanClient(args.scanner_address, authenticator)
    app.config.update(
        client_id=args.client_id,
        client_secret=args.client_secret,
        authorization_address=args.authorization_address,
        scanner_address=args.scanner_address,
    )
    app.run(host=address, port=int(port))