Skip to content

Commit

Permalink
Backend support for running free analyzers. Partially solves intelowl…
Browse files Browse the repository at this point in the history
  • Loading branch information
devmrfitz committed Mar 11, 2022
1 parent ba2112e commit ed9e6c6
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ node_modules/
frontend/.env
frontend/public/env.js
/docker/.env.start.test
/.cache/
6 changes: 6 additions & 0 deletions api_app/analyzers_manager/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def filter_analyzers(serialized_data: Dict, warnings: List) -> List[str]:

# get values from serializer
analyzers_requested = serialized_data.get("analyzers_requested", [])
free_analyzers_only = serialized_data.get("free", False)
tlp = serialized_data.get("tlp", TLP.WHITE).upper()

# read config
Expand Down Expand Up @@ -93,6 +94,11 @@ def filter_analyzers(serialized_data: Dict, warnings: List) -> List[str]:
raise NotRunnableAnalyzer(
f"{a_name} won't be run because you filtered external analyzers."
)

if free_analyzers_only and len(config.secrets) > 0:
raise NotRunnableAnalyzer(
f"{a_name} won't be run because you filtered non-free analyzers."
)
except NotRunnableAnalyzer as e:
if run_all:
# in this case, they are not warnings but expected and wanted behavior
Expand Down
1 change: 1 addition & 0 deletions api_app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ class Meta:
)
file = models.FileField(blank=True, upload_to=file_directory_path)
tags = models.ManyToManyField(Tag, related_name="jobs", blank=True)
free = models.BooleanField(blank=False, default=False)

def __str__(self):
if self.is_sample:
Expand Down
1 change: 1 addition & 0 deletions api_app/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ class Meta:
"analyzers_requested",
"connectors_requested",
"tags_labels",
"free",
)

def validate(self, attrs: dict) -> dict:
Expand Down

0 comments on commit ed9e6c6

Please sign in to comment.