Skip to content

Commit

Permalink
Updating backend with necessary changes
Browse files Browse the repository at this point in the history
  • Loading branch information
phutelmyer committed Jan 2, 2024
1 parent 4ffa0cf commit 829f728
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ def create_app() -> Flask:
serve(TransLogger(main_app, setup_console_handler=False), host="0.0.0.0", port=8080)

# uncomment below for local flask app development with hot reloading
main_app.run(host="0.0.0.0", port=80, threaded=True)
# main_app.run(host="0.0.0.0", port=80, threaded=True)
7 changes: 4 additions & 3 deletions app/blueprints/strelka.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def submit_file(user: User) -> Tuple[Response, int]:
)
total_scanned += 1
else:
pass
scanned_file["enrichment"] = {"virustotal": -3}
except Exception as e:
logging.warning(
f"Could not process VirusTotal search with error: {e} "
Expand Down Expand Up @@ -215,6 +215,7 @@ def submit_file(user: User) -> Tuple[Response, int]:
response,
get_mimetypes(response),
get_yara_hits(response),
len(response),
get_scanners_run(response),
get_hashes(submitted_file),
list(insights),
Expand Down Expand Up @@ -510,8 +511,8 @@ def view(user: User) -> Tuple[Dict[str, any], int]:
"file_count": case(
[
(
FileSubmission.strelka_response != None,
func.json_array_length(FileSubmission.strelka_response.cast(JSON)),
FileSubmission.files_seen != None,
FileSubmission.files_seen,
)
],
else_=0,
Expand Down
2 changes: 1 addition & 1 deletion app/example.env
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ export VIRUSTOTAL_API_KEY=
export VIRUSTOTAL_API_LIMIT=

# Default Submission Exclusions
export DEFAULT_EXCLUDED_SUBMITTERS=["ExcludeUser"]
export DEFAULT_EXCLUDED_SUBMITTERS=["ExcludeUser"]
4 changes: 4 additions & 0 deletions app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class FileSubmission(db.Model):
strelka_response (dict): A dictionary containing the response from the Strelka scanner.
mime_types (list): A list of MIME types associated with the file.
yara_hits (list): A list of YARA rule IDs that matched the file.
files_seen (int): A count of files seen during analysis.
scanners_run (list): A list of scanners that were run on the file.
hashes (list): A list of hashes associated with the file.
submitted_from_ip (str): The IP address of the client that submitted the file.
Expand Down Expand Up @@ -46,6 +47,7 @@ class FileSubmission(db.Model):
strelka_response: dict = db.Column(db.JSON())
mime_types: list = db.Column(db.ARRAY(db.String(), dimensions=1))
yara_hits: list = db.Column(db.ARRAY(db.String(), dimensions=1))
files_seen: int = db.Column(db.Integer())
scanners_run: list = db.Column(db.ARRAY(db.String(), dimensions=1))
hashes: list = db.Column(db.ARRAY(db.String(), dimensions=2))
insights: list = db.Column(db.ARRAY(db.String(), dimensions=1))
Expand All @@ -72,6 +74,7 @@ def __init__(
strelka_response: dict,
mime_types: list,
yara_hits: list,
files_seen: int,
scanners_run: list,
hashes: list,
insights: list,
Expand All @@ -89,6 +92,7 @@ def __init__(
self.strelka_response = strelka_response
self.mime_types = mime_types
self.yara_hits = yara_hits
self.files_seen = files_seen
self.scanners_run = scanners_run
self.hashes = hashes
self.insights = insights
Expand Down

0 comments on commit 829f728

Please sign in to comment.