Skip to content

Commit

Permalink
Bug fix, path to dir check
Browse files Browse the repository at this point in the history
  • Loading branch information
cccs-kevin committed Jun 9, 2021
1 parent ba5be81 commit 472bbf8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions assemblyline_incident_manager/al_incident_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@
@click.option("-t", "--is_test", is_flag=True, help="A flag that indicates that you're running a test.")
@click.option("--num_of_downloaders", default=1, type=click.INT, help="The number of threads that will be created to facilitate downloading the files.")
@click.option("--do_not_verify_ssl", is_flag=True, help="Verify SSL when creating and using the Assemblyline Client.")
def main(url: str, username: str, apikey: str, min_score: int, incident_num: str, download_path: str, upload_path, is_test: bool, num_of_downloaders: int, do_not_verify_ssl: bool):
def main(url: str, username: str, apikey: str, max_score: int, incident_num: str, download_path: str, upload_path, is_test: bool, num_of_downloaders: int, do_not_verify_ssl: bool):
"""
Example:
al-incident-downloader --url="https://<domain-of-Assemblyline-instance>" --username="<user-name>" --apikey="/path/to/file/containing/apikey" --incident_num=123 --min_score=100 --download_path=/path/to/where/you/want/downloads --upload_path=/path/from/where/files/were/uploaded/from
"""
# Here is the query that we will be using to retrieve all submission details
incident_num = prepare_query_value(incident_num)
prepared_upload_path = prepare_query_value(upload_path)
query = f"metadata.incident_number:\"{incident_num}\" AND max_score:<={min_score} AND metadata.filename:\"*{prepared_upload_path}*\""
query = f"metadata.incident_number:\"{incident_num}\" AND max_score:<={max_score} AND metadata.filename:\"*{prepared_upload_path}*\""

if is_test:
print_and_log(log, f"INFO,The query that you will make is: {query}.", logging.DEBUG)
Expand Down
5 changes: 5 additions & 0 deletions assemblyline_incident_manager/al_incident_submitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ def main(url: str, username: str, apikey: str, ttl: int, classification: str, se
# Setting the parameters
settings = _generate_settings(ttl, classification, service_selection, resubmit_dynamic, priority)

# Confirm that given path is to a directory
if not os.path.isdir(path):
print_and_log(log, f"INFO,Provided path {path} points to a file, but it should point to a directory.", logging.DEBUG)
return

if is_test:
# Create the Assemblyline Client
al_client = Client(log, url, username, apikey_val, do_not_verify_ssl).al_client
Expand Down

0 comments on commit 472bbf8

Please sign in to comment.