Skip to content

Commit

Permalink
Merge pull request #49 from redcanaryco/bug48
Browse files Browse the repository at this point in the history
fix for issue 48
  • Loading branch information
pmichaudrc committed Aug 4, 2021
2 parents a416159 + a9a4aa5 commit f86bfcb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
12 changes: 0 additions & 12 deletions common.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,6 @@ def __init__(self, product, profile):
self.product = product
self.profile = profile

def validate_input(self, query, hostname, username, days, minutes):
if hostname and 'hostname' in query:
click.echo('Cannot use --hostname with "hostname:" (in query)')
return False
elif username and 'username' in query:
click.echo('Cannot use --username with "username:" (in query)')
return False
elif days and minutes:
click.echo(f"Since both minutes and days are provided, the query will return all results from the previous {minutes} minutes")
return True
else:
return True

# Build the query based on the product that was chosen
def base_query(self, *args):
Expand Down
7 changes: 2 additions & 5 deletions surveyor.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,8 @@ def cli(ctx, prefix, hostname, profile, days, minutes, product, username, iocfil
#if --query run the query and write results to the csv
if query:
click.echo(f"Running Query: {query}")
if utils.validate_input(query, hostname, username):
results = utils.process_search(conn, query, base_query)
utils.write_csv(writer, results, query, "query")
else:
ctx.fail("Query and filters were incompatible. See above error.")
results = utils.process_search(conn, query, base_query)
utils.write_csv(writer, results, query, "query")

# if --deffile add file to list
elif deffile:
Expand Down

0 comments on commit f86bfcb

Please sign in to comment.