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.

Files changed (84) hide show
  1. secator/celery.py +160 -185
  2. secator/celery_utils.py +268 -0
  3. secator/cli.py +327 -106
  4. secator/config.py +27 -11
  5. secator/configs/workflows/host_recon.yaml +5 -3
  6. secator/configs/workflows/port_scan.yaml +7 -3
  7. secator/configs/workflows/url_bypass.yaml +10 -0
  8. secator/configs/workflows/url_vuln.yaml +1 -1
  9. secator/decorators.py +169 -92
  10. secator/definitions.py +10 -3
  11. secator/exporters/__init__.py +7 -5
  12. secator/exporters/console.py +10 -0
  13. secator/exporters/csv.py +27 -19
  14. secator/exporters/gdrive.py +16 -11
  15. secator/exporters/json.py +3 -1
  16. secator/exporters/table.py +30 -2
  17. secator/exporters/txt.py +20 -16
  18. secator/hooks/gcs.py +53 -0
  19. secator/hooks/mongodb.py +53 -27
  20. secator/output_types/__init__.py +29 -11
  21. secator/output_types/_base.py +11 -1
  22. secator/output_types/error.py +36 -0
  23. secator/output_types/exploit.py +1 -1
  24. secator/output_types/info.py +24 -0
  25. secator/output_types/ip.py +7 -0
  26. secator/output_types/port.py +8 -1
  27. secator/output_types/progress.py +5 -0
  28. secator/output_types/record.py +3 -1
  29. secator/output_types/stat.py +33 -0
  30. secator/output_types/tag.py +6 -4
  31. secator/output_types/url.py +6 -3
  32. secator/output_types/vulnerability.py +3 -2
  33. secator/output_types/warning.py +24 -0
  34. secator/report.py +55 -23
  35. secator/rich.py +44 -39
  36. secator/runners/_base.py +622 -635
  37. secator/runners/_helpers.py +5 -91
  38. secator/runners/celery.py +18 -0
  39. secator/runners/command.py +364 -211
  40. secator/runners/scan.py +8 -24
  41. secator/runners/task.py +21 -55
  42. secator/runners/workflow.py +41 -40
  43. secator/scans/__init__.py +28 -0
  44. secator/serializers/dataclass.py +6 -0
  45. secator/serializers/json.py +10 -5
  46. secator/serializers/regex.py +12 -4
  47. secator/tasks/_categories.py +5 -2
  48. secator/tasks/bbot.py +293 -0
  49. secator/tasks/bup.py +98 -0
  50. secator/tasks/cariddi.py +38 -49
  51. secator/tasks/dalfox.py +3 -0
  52. secator/tasks/dirsearch.py +12 -23
  53. secator/tasks/dnsx.py +49 -30
  54. secator/tasks/dnsxbrute.py +2 -0
  55. secator/tasks/feroxbuster.py +8 -17
  56. secator/tasks/ffuf.py +3 -2
  57. secator/tasks/fping.py +3 -3
  58. secator/tasks/gau.py +5 -0
  59. secator/tasks/gf.py +2 -2
  60. secator/tasks/gospider.py +4 -0
  61. secator/tasks/grype.py +9 -9
  62. secator/tasks/h8mail.py +31 -41
  63. secator/tasks/httpx.py +58 -21
  64. secator/tasks/katana.py +18 -22
  65. secator/tasks/maigret.py +26 -24
  66. secator/tasks/mapcidr.py +2 -3
  67. secator/tasks/msfconsole.py +4 -16
  68. secator/tasks/naabu.py +3 -1
  69. secator/tasks/nmap.py +50 -35
  70. secator/tasks/nuclei.py +9 -2
  71. secator/tasks/searchsploit.py +17 -9
  72. secator/tasks/subfinder.py +5 -1
  73. secator/tasks/wpscan.py +79 -93
  74. secator/template.py +61 -45
  75. secator/thread.py +24 -0
  76. secator/utils.py +330 -80
  77. secator/utils_test.py +48 -23
  78. secator/workflows/__init__.py +28 -0
  79. {secator-0.6.0.dist-info → secator-0.7.0.dist-info}/METADATA +11 -5
  80. secator-0.7.0.dist-info/RECORD +115 -0
  81. {secator-0.6.0.dist-info → secator-0.7.0.dist-info}/WHEEL +1 -1
  82. secator-0.6.0.dist-info/RECORD +0 -101
  83. {secator-0.6.0.dist-info → secator-0.7.0.dist-info}/entry_points.txt +0 -0
  84. {secator-0.6.0.dist-info → secator-0.7.0.dist-info}/licenses/LICENSE +0 -0
@@ -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, targets=[]):
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
- targets (list): Original targets.
12
+ inputs (list): Original inputs.
17
13
 
18
14
  Returns:
19
- tuple: targets, options.
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
- targets = deduplicate(values)
22
+ inputs = deduplicate(values)
27
23
  else:
28
24
  opts[key] = deduplicate(values)
29
- return targets, opts
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()