Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@pass_api_client
@click.pass_context
@handle_exceptions
def filter(context, api_client, api_key, input_file, output_file, noise_only):
"""Filter the noise from a log file, stdin, etc."""
if input_file is None:
if sys.stdin.isatty():
output = [
context.command.get_usage(context),
(
"Error: at least one text file must be passed "
"either through the -i/--input_file option or through a shell pipe."
),
]
click.echo("\n\n".join(output))
context.exit(-1)
else:
@pass_api_client
@click.pass_context
@handle_exceptions
def interesting(context, api_client, api_key, input_file, ip_address):
"""Report one or more IP addresses as "interesting"."""
ip_addresses = get_ip_addresses(context, input_file, ip_address)
results = [
api_client.interesting(ip_address=ip_address) for ip_address in ip_addresses
]
return results
@pass_api_client
@echo_result
@click.pass_context
@handle_exceptions
def analyze(
context, api_client, api_key, input_file, output_file, output_format, verbose
):
"""Analyze the IP addresses in a log file, stdin, etc."""
if input_file is None:
if sys.stdin.isatty():
output = [
context.command.get_usage(context),
(
"Error: at least one text file must be passed "
"either through the -i/--input_file option or through a shell pipe."
),
]