Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions api_app/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,14 @@ class LogEntryAdmin(admin.ModelAdmin):
list_filter = ["user", "action_flag", "action_time", "content_type"]
search_fields = ["user__username", "object_repr", "change_message"]

def has_delete_permission(self, request, obj=None):
@staticmethod
def has_delete_permission(request, obj=None):
return False

def has_add_permission(self, request):
@staticmethod
def has_add_permission(request):
return False

def has_change_permission(self, request, obj=None):
@staticmethod
def has_change_permission(request, obj=None):
return False
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from urllib.parse import urlparse

import requests
from faker import Faker
from lxml.etree import HTMLParser
from faker import Faker # skipcq: BAN-B410
from lxml.etree import HTMLParser # skipcq: BAN-B410
from lxml.html import document_fromstring
from requests import HTTPError, Response

Expand Down
4 changes: 4 additions & 0 deletions api_app/analyzers_manager/observable_analyzers/abuseipdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ class AbuseIPDB(ObservableAnalyzer):
max_reports: int
verbose: bool

@classmethod
def update(cls) -> bool:
pass

def run(self):
headers = {"Key": self._api_key_name, "Accept": "application/json"}
params_ = {
Expand Down
10 changes: 4 additions & 6 deletions api_app/analyzers_manager/observable_analyzers/crowdsec.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ def _update_data_model(self, data_model):
)

highest_total_score = max(
[
(
values["total"]
for key, values in self.report.report.get("scores", {}).items()
],
),
default=0,
)
if (
Expand All @@ -91,10 +91,8 @@ def _update_data_model(self, data_model):
)
elif 1 < highest_total_score <= 3:
highest_trust_score = max(
[
values["trust"]
for key, values in self.report.report.get("scores", {}).items()
]
values["trust"]
for key, values in self.report.report.get("scores", {}).items()
)
if highest_trust_score >= 4:
data_model.evaluation = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ class VirusTotalv3Intelligence(ObservableAnalyzer, VirusTotalv3AnalyzerMixin):
limit: int
order_by: str

@classmethod
def update(cls) -> bool:
pass

def run(self):
return self._vt_intelligence_search(
self.observable_name, self.limit, self.order_by
Expand Down
3 changes: 2 additions & 1 deletion api_app/serializers/elastic.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ class ElasticRequestSerializer(serializers.Serializer):
end_end_time = serializers.DateTimeField(required=False)
report = serializers.CharField(required=False)

def create(self, validated_data) -> ElasticRequest:
@staticmethod
def create(validated_data) -> ElasticRequest:
logger.debug(f"{validated_data=}")
return ElasticRequest(**validated_data)

Expand Down
3 changes: 2 additions & 1 deletion api_app/serializers/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,8 @@ def get_fields(self):
)
return super().get_fields()

def get_analyzers_data_model(self, instance: Job):
@staticmethod
def get_analyzers_data_model(instance: Job):
return instance.analyzerreports.get_data_models(instance).serialize()


Expand Down
4 changes: 4 additions & 0 deletions api_app/visualizers_manager/visualizers/sample_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@

class SampleDownload(Visualizer):

@classmethod
def update(cls) -> bool:
pass

@visualizable_error_handler_with_params("Download")
def _download_button(self):
# first attempt is download with VT
Expand Down
1 change: 1 addition & 0 deletions tests/api_app/test_mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def python_base_path(cls) -> PosixPath:
def update(cls) -> bool:
pass

@staticmethod
def run(self) -> dict:
return {}

Expand Down
Loading