secator 0.6.0__py3-none-any.whl → 0.7.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of secator might be problematic. Click here for more details.
- secator/celery.py +160 -185
- secator/celery_utils.py +268 -0
- secator/cli.py +327 -106
- secator/config.py +27 -11
- secator/configs/workflows/host_recon.yaml +5 -3
- secator/configs/workflows/port_scan.yaml +7 -3
- secator/configs/workflows/url_bypass.yaml +10 -0
- secator/configs/workflows/url_vuln.yaml +1 -1
- secator/decorators.py +169 -92
- secator/definitions.py +10 -3
- secator/exporters/__init__.py +7 -5
- secator/exporters/console.py +10 -0
- secator/exporters/csv.py +27 -19
- secator/exporters/gdrive.py +16 -11
- secator/exporters/json.py +3 -1
- secator/exporters/table.py +30 -2
- secator/exporters/txt.py +20 -16
- secator/hooks/gcs.py +53 -0
- secator/hooks/mongodb.py +53 -27
- secator/output_types/__init__.py +29 -11
- secator/output_types/_base.py +11 -1
- secator/output_types/error.py +36 -0
- secator/output_types/exploit.py +1 -1
- secator/output_types/info.py +24 -0
- secator/output_types/ip.py +7 -0
- secator/output_types/port.py +8 -1
- secator/output_types/progress.py +5 -0
- secator/output_types/record.py +3 -1
- secator/output_types/stat.py +33 -0
- secator/output_types/tag.py +6 -4
- secator/output_types/url.py +6 -3
- secator/output_types/vulnerability.py +3 -2
- secator/output_types/warning.py +24 -0
- secator/report.py +55 -23
- secator/rich.py +44 -39
- secator/runners/_base.py +622 -635
- secator/runners/_helpers.py +5 -91
- secator/runners/celery.py +18 -0
- secator/runners/command.py +364 -211
- secator/runners/scan.py +8 -24
- secator/runners/task.py +21 -55
- secator/runners/workflow.py +41 -40
- secator/scans/__init__.py +28 -0
- secator/serializers/dataclass.py +6 -0
- secator/serializers/json.py +10 -5
- secator/serializers/regex.py +12 -4
- secator/tasks/_categories.py +5 -2
- secator/tasks/bbot.py +293 -0
- secator/tasks/bup.py +98 -0
- secator/tasks/cariddi.py +38 -49
- secator/tasks/dalfox.py +3 -0
- secator/tasks/dirsearch.py +12 -23
- secator/tasks/dnsx.py +49 -30
- secator/tasks/dnsxbrute.py +2 -0
- secator/tasks/feroxbuster.py +8 -17
- secator/tasks/ffuf.py +3 -2
- secator/tasks/fping.py +3 -3
- secator/tasks/gau.py +5 -0
- secator/tasks/gf.py +2 -2
- secator/tasks/gospider.py +4 -0
- secator/tasks/grype.py +9 -9
- secator/tasks/h8mail.py +31 -41
- secator/tasks/httpx.py +58 -21
- secator/tasks/katana.py +18 -22
- secator/tasks/maigret.py +26 -24
- secator/tasks/mapcidr.py +2 -3
- secator/tasks/msfconsole.py +4 -16
- secator/tasks/naabu.py +3 -1
- secator/tasks/nmap.py +50 -35
- secator/tasks/nuclei.py +9 -2
- secator/tasks/searchsploit.py +17 -9
- secator/tasks/subfinder.py +5 -1
- secator/tasks/wpscan.py +79 -93
- secator/template.py +61 -45
- secator/thread.py +24 -0
- secator/utils.py +330 -80
- secator/utils_test.py +48 -23
- secator/workflows/__init__.py +28 -0
- {secator-0.6.0.dist-info → secator-0.7.0.dist-info}/METADATA +11 -5
- secator-0.7.0.dist-info/RECORD +115 -0
- {secator-0.6.0.dist-info → secator-0.7.0.dist-info}/WHEEL +1 -1
- secator-0.6.0.dist-info/RECORD +0 -101
- {secator-0.6.0.dist-info → secator-0.7.0.dist-info}/entry_points.txt +0 -0
- {secator-0.6.0.dist-info → secator-0.7.0.dist-info}/licenses/LICENSE +0 -0
secator/runners/_helpers.py
CHANGED
|
@@ -1,32 +1,28 @@
|
|
|
1
1
|
import os
|
|
2
2
|
|
|
3
|
-
import kombu
|
|
4
|
-
import kombu.exceptions
|
|
5
|
-
|
|
6
3
|
from secator.utils import deduplicate
|
|
7
|
-
from secator.rich import console
|
|
8
4
|
|
|
9
5
|
|
|
10
|
-
def run_extractors(results, opts,
|
|
6
|
+
def run_extractors(results, opts, inputs=[]):
|
|
11
7
|
"""Run extractors and merge extracted values with option dict.
|
|
12
8
|
|
|
13
9
|
Args:
|
|
14
10
|
results (list): List of results.
|
|
15
11
|
opts (dict): Options.
|
|
16
|
-
|
|
12
|
+
inputs (list): Original inputs.
|
|
17
13
|
|
|
18
14
|
Returns:
|
|
19
|
-
tuple:
|
|
15
|
+
tuple: inputs, options.
|
|
20
16
|
"""
|
|
21
17
|
extractors = {k: v for k, v in opts.items() if k.endswith('_')}
|
|
22
18
|
for key, val in extractors.items():
|
|
23
19
|
key = key.rstrip('_')
|
|
24
20
|
values = extract_from_results(results, val)
|
|
25
21
|
if key == 'targets':
|
|
26
|
-
|
|
22
|
+
inputs = deduplicate(values)
|
|
27
23
|
else:
|
|
28
24
|
opts[key] = deduplicate(values)
|
|
29
|
-
return
|
|
25
|
+
return inputs, opts
|
|
30
26
|
|
|
31
27
|
|
|
32
28
|
def extract_from_results(results, extractors):
|
|
@@ -73,88 +69,6 @@ def process_extractor(results, extractor, ctx={}):
|
|
|
73
69
|
return items
|
|
74
70
|
|
|
75
71
|
|
|
76
|
-
def get_task_ids(result, ids=[]):
|
|
77
|
-
"""Get all Celery task ids recursively.
|
|
78
|
-
|
|
79
|
-
Args:
|
|
80
|
-
result (Union[AsyncResult, GroupResult]): Celery result object.
|
|
81
|
-
ids (list): List of ids.
|
|
82
|
-
"""
|
|
83
|
-
from celery.result import AsyncResult, GroupResult
|
|
84
|
-
if result is None:
|
|
85
|
-
return
|
|
86
|
-
|
|
87
|
-
try:
|
|
88
|
-
if isinstance(result, GroupResult):
|
|
89
|
-
get_task_ids(result.parent, ids=ids)
|
|
90
|
-
|
|
91
|
-
elif isinstance(result, AsyncResult):
|
|
92
|
-
if result.id not in ids:
|
|
93
|
-
ids.append(result.id)
|
|
94
|
-
|
|
95
|
-
if hasattr(result, 'children') and result.children:
|
|
96
|
-
for child in result.children:
|
|
97
|
-
get_task_ids(child, ids=ids)
|
|
98
|
-
|
|
99
|
-
# Browse parent
|
|
100
|
-
if hasattr(result, 'parent') and result.parent:
|
|
101
|
-
get_task_ids(result.parent, ids=ids)
|
|
102
|
-
except kombu.exceptions.DecodeError as e:
|
|
103
|
-
console.print(f'[bold red]{str(e)}. Aborting get_task_ids.[/]')
|
|
104
|
-
return
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
def get_task_data(task_id):
|
|
108
|
-
"""Get task info.
|
|
109
|
-
|
|
110
|
-
Args:
|
|
111
|
-
task_id (str): Celery task id.
|
|
112
|
-
|
|
113
|
-
Returns:
|
|
114
|
-
dict: Task info (id, name, state, results, chunk_info, count, error, ready).
|
|
115
|
-
"""
|
|
116
|
-
from celery.result import AsyncResult
|
|
117
|
-
res = AsyncResult(task_id)
|
|
118
|
-
if not res:
|
|
119
|
-
return
|
|
120
|
-
try:
|
|
121
|
-
args = res.args
|
|
122
|
-
info = res.info
|
|
123
|
-
state = res.state
|
|
124
|
-
except kombu.exceptions.DecodeError as e:
|
|
125
|
-
console.print(f'[bold red]{str(e)}. Aborting get_task_data.[/]')
|
|
126
|
-
return
|
|
127
|
-
if not (args and len(args) > 1):
|
|
128
|
-
return
|
|
129
|
-
task_name = args[1]
|
|
130
|
-
data = {
|
|
131
|
-
'id': task_id,
|
|
132
|
-
'name': task_name,
|
|
133
|
-
'state': state,
|
|
134
|
-
'chunk_info': '',
|
|
135
|
-
'count': 0,
|
|
136
|
-
'error': None,
|
|
137
|
-
'ready': False,
|
|
138
|
-
'descr': '',
|
|
139
|
-
'progress': 0,
|
|
140
|
-
'results': []
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
# Set ready flag
|
|
144
|
-
if state in ['FAILURE', 'SUCCESS', 'REVOKED']:
|
|
145
|
-
data['ready'] = True
|
|
146
|
-
|
|
147
|
-
# Set task data
|
|
148
|
-
if info and not isinstance(info, list):
|
|
149
|
-
data.update(info)
|
|
150
|
-
chunk = data.get('chunk')
|
|
151
|
-
chunk_count = data.get('chunk_count')
|
|
152
|
-
if chunk and chunk_count:
|
|
153
|
-
data['chunk_info'] = f'{chunk}/{chunk_count}'
|
|
154
|
-
data['descr'] = data.pop('description', '')
|
|
155
|
-
return data
|
|
156
|
-
|
|
157
|
-
|
|
158
72
|
def get_task_folder_id(path):
|
|
159
73
|
names = []
|
|
160
74
|
if not os.path.exists(path):
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from secator.celery_utils import CeleryData
|
|
2
|
+
from secator.runners import Runner
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class Celery(Runner):
|
|
6
|
+
def yielder(self):
|
|
7
|
+
if not self.celery_result:
|
|
8
|
+
result = self.build_celery_workflow()
|
|
9
|
+
if self.sync:
|
|
10
|
+
yield from result.apply().get()
|
|
11
|
+
yield from CeleryData.iter_results(
|
|
12
|
+
self.celery_result,
|
|
13
|
+
ids_map=self.celery_ids_map,
|
|
14
|
+
print_remote_info=False
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
def error_handler(self, e):
|
|
18
|
+
self.stop_celery_tasks()
|