Skip to content

Commit fd852b7

Browse files
authored
refactor: remove Greynoise_Labs analyzer (#3648)
* refactor: remove Greynoise_Labs analyzer * chore: delete associated periodic tasks
1 parent a6a7246 commit fd852b7

4 files changed

Lines changed: 33 additions & 281 deletions

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Generated by Django 4.2.27 on 2026-04-10
2+
3+
from django.db import migrations
4+
5+
6+
def migrate(apps, schema_editor):
7+
PythonModule = apps.get_model("api_app", "PythonModule")
8+
PeriodicTask = apps.get_model("django_celery_beat", "PeriodicTask")
9+
pm = PythonModule.objects.filter(
10+
module="greynoise_labs.GreynoiseLabs",
11+
base_path="api_app.analyzers_manager.observable_analyzers",
12+
).first()
13+
if pm:
14+
task_ids = [getattr(pm, "update_task_id", None)]
15+
task_ids.extend(getattr(c, "health_check_task_id", None) for c in pm.analyzerconfigs.all())
16+
PeriodicTask.objects.filter(id__in=[t for t in task_ids if t]).delete()
17+
18+
pm.analyzerconfigs.all().delete()
19+
pm.delete()
20+
21+
22+
class Migration(migrations.Migration):
23+
dependencies = [
24+
("api_app", "0062_alter_parameter_python_module"),
25+
("analyzers_manager", "0189_update_capa_timeout"),
26+
("django_celery_beat", "0001_initial"),
27+
]
28+
29+
operations = [
30+
migrations.RunPython(migrate, migrations.RunPython.noop),
31+
]

api_app/analyzers_manager/observable_analyzers/greynoise_labs.py

Lines changed: 0 additions & 130 deletions
This file was deleted.

tests/api_app/analyzers_manager/unit_tests/observable_analyzers/test_greynoise_labs.py

Lines changed: 0 additions & 93 deletions
This file was deleted.

tests/test_crons.py

Lines changed: 2 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@
77

88
from api_app.analyzables_manager.models import Analyzable
99
from api_app.analyzers_manager.file_analyzers import quark_engine, yara_scan
10-
from api_app.analyzers_manager.models import AnalyzerConfig
1110
from api_app.analyzers_manager.observable_analyzers import (
1211
feodo_tracker,
13-
greynoise_labs,
1412
ja4_db,
1513
maxmind,
1614
phishing_army,
@@ -19,8 +17,8 @@
1917
tor_nodes_danmeuk,
2018
tweetfeeds,
2119
)
22-
from api_app.choices import Classification, PythonModuleBasePaths
23-
from api_app.models import Job, Parameter, PluginConfig, PythonModule
20+
from api_app.choices import Classification
21+
from api_app.models import Job
2422
from intel_owl.tasks import check_stuck_analysis, remove_old_jobs
2523

2624
from . import CustomTestCase, get_logger
@@ -306,57 +304,3 @@ def create_yara_file(path):
306304
mock_zipfile.return_value.extractall.side_effect = create_yara_file
307305
result = yara_scan.YaraScan.update()
308306
self.assertTrue(result)
309-
310-
@if_mock_connections(
311-
patch(
312-
"requests.post",
313-
return_value=MockUpResponse(
314-
{
315-
"data": {
316-
"topC2s": {
317-
"queryInfo": {
318-
"resultsAvailable": 1914,
319-
"resultsLimit": 191,
320-
},
321-
"c2s": [
322-
{
323-
"source_ip": "91.92.247.12",
324-
"c2_ips": ["103.245.236.120"],
325-
"c2_domains": [],
326-
"hits": 11608,
327-
},
328-
{
329-
"source_ip": "14.225.208.190",
330-
"c2_ips": ["14.225.213.142"],
331-
"c2_domains": [],
332-
"hits": 2091,
333-
"pervasiveness": 26,
334-
},
335-
{
336-
"source_ip": "157.10.53.101",
337-
"c2_ips": ["14.225.208.190"],
338-
"c2_domains": [],
339-
"hits": 1193,
340-
"pervasiveness": 23,
341-
},
342-
],
343-
},
344-
},
345-
},
346-
200,
347-
),
348-
)
349-
)
350-
def test_greynoise_labs_updater(self, mock_post=None):
351-
python_module = PythonModule.objects.get(
352-
base_path=PythonModuleBasePaths.ObservableAnalyzer.value,
353-
module="greynoise_labs.GreynoiseLabs",
354-
)
355-
PluginConfig.objects.create(
356-
value="test",
357-
parameter=Parameter.objects.get(python_module=python_module, is_secret=True, name="auth_token"),
358-
for_organization=False,
359-
owner=None,
360-
analyzer_config=AnalyzerConfig.objects.filter(python_module=python_module).first(),
361-
)
362-
self.assertTrue(greynoise_labs.GreynoiseLabs.update())

0 commit comments

Comments
 (0)