Skip to content

Commit

Permalink
VT force_active_scans depends on job tlp
Browse files Browse the repository at this point in the history
Signed-off-by: 0ssigeno <[email protected]>
  • Loading branch information
0ssigeno committed Oct 26, 2023
1 parent bb0362e commit 514b15c
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# This file is a part of IntelOwl https://github.com/intelowlproject/IntelOwl
# See the file 'LICENSE' for copying permission.

from django.db import migrations


def migrate(apps, schema_editor):
Parameter = apps.get_model("api_app", "Parameter")
Parameter.objects.filter(
name="force_active_scan", python_module__module="vt.vt3_get.VirusTotalv3"
).delete()


def reverse_migrate(apps, schema_editor):
PythonModule = apps.get_model("api_app", "PythonModule")
AnalyzerConfig = apps.get_model("analyzers_manager", "AnalyzerConfig")
Parameter = apps.get_model("api_app", "Parameter")
pm = PythonModule.objects.get(
module="vt.vt3_get.VirusTotalv3",
base_path="api_app.analyzers_manager.observable_analyzers",
)
for config in AnalyzerConfig.objects.filter(python_module=pm):
Parameter.objects.create(
name="force_active_scan",
analyzer_config=config,
python_module=pm,
required=False,
type="bool",
is_secret=False,
description="Force active scan on virus total",
)


class Migration(migrations.Migration):
dependencies = [
(
"analyzers_manager",
"0045_yaraify_fix",
),
]

operations = [
migrations.RunPython(migrate, reverse_migrate),
]
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class VirusTotalv3AnalyzerMixin(BaseAnalyzerMixin, metaclass=abc.ABCMeta):
rescan_poll_distance: int
include_behaviour_summary: bool
include_sigma_analyses: bool
force_active_scan: bool = False
force_active_scan_if_old: bool
days_to_say_that_a_scan_is_old: int
relationships_to_request: list
Expand All @@ -43,6 +42,10 @@ def _get_relationship_limit(self, relationship):
limit = 40
return limit

def config(self):
super().config()
self.force_active_scan = self._job.tlp = self._job.TLP.CLEAR.value

def _vt_get_relationships(
self,
observable_name: str,
Expand Down

0 comments on commit 514b15c

Please sign in to comment.