secator 0.16.2__py3-none-any.whl → 0.16.4__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 CHANGED
@@ -100,6 +100,8 @@ def update_state(celery_task, task, force=False):
100
100
  """Update task state to add metadata information."""
101
101
  if not IN_CELERY_WORKER_PROCESS:
102
102
  return
103
+ if task.no_live_updates:
104
+ return
103
105
  if not force and not should_update(CONFIG.runners.backend_update_frequency, task.last_updated_celery):
104
106
  return
105
107
  task.last_updated_celery = time()
@@ -212,19 +214,42 @@ def run_command(self, results, name, targets, opts={}):
212
214
  update_state(self, task)
213
215
  update_state(self, task, force=True)
214
216
 
217
+ if CONFIG.addons.mongodb.enabled:
218
+ return [r._uuid for r in task.results]
215
219
  return task.results
216
220
 
217
221
 
218
222
  @app.task
219
223
  def forward_results(results):
224
+ """Forward results to the next task (bridge task).
225
+
226
+ Args:
227
+ results (list): Results to forward.
228
+
229
+ Returns:
230
+ list: List of uuids.
231
+ """
220
232
  if isinstance(results, list):
221
233
  for ix, item in enumerate(results):
222
234
  if isinstance(item, dict) and 'results' in item:
223
235
  results[ix] = item['results']
224
236
  elif 'results' in results:
225
237
  results = results['results']
238
+
239
+ if IN_CELERY_WORKER_PROCESS:
240
+ console.print(Info(message=f'Deduplicating {len(results)} results'))
241
+
226
242
  results = flatten(results)
227
- results = deduplicate(results, attr='_uuid')
243
+ if CONFIG.addons.mongodb.enabled:
244
+ uuids = [r._uuid for r in results if hasattr(r, '_uuid')]
245
+ uuids.extend([r for r in results if isinstance(r, str)])
246
+ results = list(set(uuids))
247
+ else:
248
+ results = deduplicate(results, attr='_uuid')
249
+
250
+ if IN_CELERY_WORKER_PROCESS:
251
+ console.print(Info(message=f'Forwarded {len(results)} flattened and deduplicated results'))
252
+
228
253
  return results
229
254
 
230
255
 
@@ -240,10 +265,17 @@ def mark_runner_started(results, runner, enable_hooks=True):
240
265
  Returns:
241
266
  list: Runner results
242
267
  """
268
+ if IN_CELERY_WORKER_PROCESS:
269
+ console.print(Info(message=f'Runner {runner.unique_name} has started, running mark_started'))
243
270
  debug(f'Runner {runner.unique_name} has started, running mark_started', sub='celery')
244
271
  if results:
245
- runner.results = forward_results(results)
272
+ results = forward_results(results)
246
273
  runner.enable_hooks = enable_hooks
274
+ if CONFIG.addons.mongodb.enabled:
275
+ from secator.hooks.mongodb import get_results
276
+ results = get_results(results)
277
+ for item in results:
278
+ runner.add_result(item, print=False)
247
279
  runner.mark_started()
248
280
  return runner.results
249
281
 
@@ -260,9 +292,14 @@ def mark_runner_completed(results, runner, enable_hooks=True):
260
292
  Returns:
261
293
  list: Final results
262
294
  """
295
+ if IN_CELERY_WORKER_PROCESS:
296
+ console.print(Info(message=f'Runner {runner.unique_name} has finished, running mark_completed'))
263
297
  debug(f'Runner {runner.unique_name} has finished, running mark_completed', sub='celery')
264
298
  results = forward_results(results)
265
299
  runner.enable_hooks = enable_hooks
300
+ if CONFIG.addons.mongodb.enabled:
301
+ from secator.hooks.mongodb import get_results
302
+ results = get_results(results)
266
303
  for item in results:
267
304
  runner.add_result(item, print=False)
268
305
  runner.mark_completed()
@@ -9,7 +9,7 @@ input_types:
9
9
  options:
10
10
  crawlers:
11
11
  type: list
12
- help: Crawlers to use (katana, gospider)
12
+ help: Crawlers to use
13
13
  default: ['gau', 'katana']
14
14
  internal: True
15
15
 
@@ -36,17 +36,14 @@ tasks:
36
36
  description: Crawl URLs
37
37
  if: "'gospider' in opts.crawlers"
38
38
 
39
- cariddi:
40
- description: Hunt URLs patterns
41
- info: True
42
- secrets: True
43
- errors: True
44
- juicy_extensions: 1
45
- juicy_endpoints: True
46
- targets_:
47
- - target.name
48
- - url.url
49
- if: opts.hunt_patterns
39
+ cariddi:
40
+ description: Hunt URLs patterns
41
+ info: True
42
+ secrets: True
43
+ errors: True
44
+ juicy_extensions: 1
45
+ juicy_endpoints: True
46
+ if: opts.hunt_patterns
50
47
 
51
48
  httpx:
52
49
  description: Run HTTP probes on crawled URLs
secator/hooks/gcs.py CHANGED
@@ -11,7 +11,7 @@ from secator.utils import debug
11
11
 
12
12
  GCS_BUCKET_NAME = CONFIG.addons.gcs.bucket_name
13
13
  ITEMS_TO_SEND = {
14
- 'url': ['screenshot_path']
14
+ 'url': ['screenshot_path', 'stored_response_path']
15
15
  }
16
16
 
17
17
 
secator/hooks/mongodb.py CHANGED
@@ -6,7 +6,7 @@ from bson.objectid import ObjectId
6
6
  from celery import shared_task
7
7
 
8
8
  from secator.config import CONFIG
9
- from secator.output_types import FINDING_TYPES
9
+ from secator.output_types import OUTPUT_TYPES
10
10
  from secator.runners import Scan, Task, Workflow
11
11
  from secator.utils import debug, escape_mongodb_url
12
12
 
@@ -46,6 +46,28 @@ def get_runner_dbg(runner):
46
46
  }
47
47
 
48
48
 
49
+ def get_results(uuids):
50
+ """Get results from MongoDB based on a list of uuids.
51
+
52
+ Args:
53
+ uuids (list[str | Output]): List of uuids, but can also be a mix of uuids and output types.
54
+
55
+ Returns:
56
+ Generator of findings.
57
+ """
58
+ client = get_mongodb_client()
59
+ db = client.main
60
+ del_uuids = []
61
+ for r in uuids:
62
+ if isinstance(r, tuple(OUTPUT_TYPES)):
63
+ yield r
64
+ del_uuids.append(r)
65
+ uuids = [ObjectId(u) for u in uuids if u not in del_uuids and ObjectId.is_valid(u)]
66
+ for r in db.findings.find({'_id': {'$in': uuids}}):
67
+ finding = load_finding(r)
68
+ yield finding
69
+
70
+
49
71
  def update_runner(self):
50
72
  client = get_mongodb_client()
51
73
  db = client.main
@@ -78,7 +100,7 @@ def update_runner(self):
78
100
 
79
101
 
80
102
  def update_finding(self, item):
81
- if type(item) not in FINDING_TYPES:
103
+ if type(item) not in OUTPUT_TYPES:
82
104
  return item
83
105
  start_time = time.time()
84
106
  client = get_mongodb_client()
@@ -120,7 +142,7 @@ def find_duplicates(self):
120
142
  def load_finding(obj):
121
143
  finding_type = obj['_type']
122
144
  klass = None
123
- for otype in FINDING_TYPES:
145
+ for otype in OUTPUT_TYPES:
124
146
  if finding_type == otype.get_name():
125
147
  klass = otype
126
148
  item = klass.load(obj)
secator/runners/_base.py CHANGED
@@ -117,6 +117,7 @@ class Runner:
117
117
 
118
118
  # Runner process options
119
119
  self.no_poll = self.run_opts.get('no_poll', False)
120
+ self.no_live_updates = self.run_opts.get('no_live_updates', False)
120
121
  self.no_process = not self.run_opts.get('process', True)
121
122
  self.piped_input = self.run_opts.get('piped_input', False)
122
123
  self.piped_output = self.run_opts.get('piped_output', False)
@@ -177,6 +178,10 @@ class Runner:
177
178
 
178
179
  # Add prior results to runner results
179
180
  self.debug(f'adding {len(results)} prior results to runner', sub='init')
181
+ if CONFIG.addons.mongodb.enabled:
182
+ self.debug('adding prior results from MongoDB', sub='init')
183
+ from secator.hooks.mongodb import get_results
184
+ results = get_results(results)
180
185
  for result in results:
181
186
  self.add_result(result, print=False, output=False, hooks=False, queue=not self.has_parent)
182
187
 
@@ -188,8 +193,8 @@ class Runner:
188
193
  for target in targets:
189
194
  self.add_result(target, print=False, output=False)
190
195
 
191
- # Run extractors on results and targets
192
- self._run_extractors(results + targets)
196
+ # Run extractors on results
197
+ self._run_extractors()
193
198
  self.debug(f'inputs ({len(self.inputs)})', obj=self.inputs, sub='init')
194
199
  self.debug(f'run opts ({len(self.resolved_opts)})', obj=self.resolved_opts, sub='init')
195
200
  self.debug(f'print opts ({len(self.resolved_print_opts)})', obj=self.resolved_print_opts, sub='init')
@@ -429,12 +434,12 @@ class Runner:
429
434
  if error:
430
435
  self.add_result(error)
431
436
 
432
- def _run_extractors(self, results):
437
+ def _run_extractors(self):
433
438
  """Run extractors on results and targets."""
434
439
  self.debug('running extractors', sub='init')
435
440
  ctx = {'opts': DotMap(self.run_opts), 'targets': self.inputs, 'ancestor_id': self.ancestor_id}
436
441
  inputs, run_opts, errors = run_extractors(
437
- results,
442
+ self.results,
438
443
  self.run_opts,
439
444
  self.inputs,
440
445
  ctx=ctx,
secator/tasks/bup.py CHANGED
@@ -20,6 +20,7 @@ class bup(Http):
20
20
  output_types = [Url, Progress]
21
21
  tags = ['url', 'bypass']
22
22
  input_flag = '-u'
23
+ file_flag = '-R'
23
24
  json_flag = '--jsonl'
24
25
  opt_prefix = '--'
25
26
  opts = {
secator/tasks/dalfox.py CHANGED
@@ -25,9 +25,10 @@ class dalfox(VulnHttp):
25
25
  output_types = [Vulnerability, Url]
26
26
  tags = ['url', 'fuzz']
27
27
  input_flag = 'url'
28
+ input_chunk_size = 20
28
29
  file_flag = 'file'
29
30
  # input_chunk_size = 1
30
- json_flag = '--format json'
31
+ json_flag = '--format jsonl'
31
32
  version_flag = 'version'
32
33
  opt_prefix = '--'
33
34
  opt_key_map = {
@@ -65,11 +66,6 @@ class dalfox(VulnHttp):
65
66
  proxy_http = True
66
67
  profile = 'cpu'
67
68
 
68
- @staticmethod
69
- def on_line(self, line):
70
- line = line.rstrip(',')
71
- return line
72
-
73
69
  @staticmethod
74
70
  def on_json_loaded(self, item):
75
71
  if item.get('type', '') == 'V':
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: secator
3
- Version: 0.16.2
3
+ Version: 0.16.4
4
4
  Summary: The pentester's swiss knife.
5
5
  Project-URL: Homepage, https://github.com/freelabz/secator
6
6
  Project-URL: Issues, https://github.com/freelabz/secator/issues
@@ -1,6 +1,6 @@
1
1
  secator/.gitignore,sha256=da8MUc3hdb6Mo0WjZu2upn5uZMbXcBGvhdhTQ1L89HI,3093
2
2
  secator/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- secator/celery.py,sha256=9sdgWHg1AgIu_RrqWffjBLSVFL0cbS71n4pjhmnFYiM,10037
3
+ secator/celery.py,sha256=st9wpAwilYk5BCO18wscGt0vqQdCIP4Pynw_9RcvWec,11246
4
4
  secator/celery_signals.py,sha256=R4ZNBPKSxUvesGCvZ7MXoRkWNOTMS5hraZzjLh5sQ0o,4191
5
5
  secator/celery_utils.py,sha256=vhL5ZxXDn3ODvyVxMijKyUTJ1dOisMDjF_PhFUyOVSA,9451
6
6
  secator/cli.py,sha256=lzgttr8-Hib1X6bGi8PCOfX90incum7ZFR5x46cDZ34,60887
@@ -41,7 +41,7 @@ secator/configs/workflows/code_scan.yaml,sha256=7mJi7Z42tr6vGG2j2Xy-nl5arITk9Nyr
41
41
  secator/configs/workflows/host_recon.yaml,sha256=HKDAkBZXT3m5SzKovs8dJdJEn5uFHCVZq-0fFovZRKg,1571
42
42
  secator/configs/workflows/subdomain_recon.yaml,sha256=VOYcjYjHRRebe1TAYphh-zpSq8W5_q-6DDeMja2dlek,1896
43
43
  secator/configs/workflows/url_bypass.yaml,sha256=_uBzDhevJ2DOD9UkE25n7ZrmnjjfdU3lV3mnUudgdU0,180
44
- secator/configs/workflows/url_crawl.yaml,sha256=JqpTNw11NLsLCcHFHllTYSqQ9ingO1uwDoZ7c3YqxJI,1121
44
+ secator/configs/workflows/url_crawl.yaml,sha256=AFvYBXYZzZhFte40pjNG04hl9MDW9KXCMx9vPSkWUKs,1072
45
45
  secator/configs/workflows/url_dirsearch.yaml,sha256=_4TdMSVLt2lIbx8ucn0R04tkMUqhG2i-m3JxCofx4mo,670
46
46
  secator/configs/workflows/url_fuzz.yaml,sha256=a-ZvZrcPBaeVhRrxox8fq25SKMJflyAkKWLqJeC3xD4,911
47
47
  secator/configs/workflows/url_params_fuzz.yaml,sha256=ufGbW4GUtEZee0M1WPVo0w6ZCEH6xmuDO6VCjPaw8AQ,796
@@ -57,8 +57,8 @@ secator/exporters/json.py,sha256=1ZtDf8RksPO_V0zIvnwDUxMUb630DCElAMM8_RQvyAo,474
57
57
  secator/exporters/table.py,sha256=zYNmwNGEyB6dTJ1ATVkrv-AOuPjrW6tvk1_4naLQo8Q,1114
58
58
  secator/exporters/txt.py,sha256=t_FykaJOxs4UUlqiH4k6HCccEqYqc8e3iNZndL_CKPg,739
59
59
  secator/hooks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
60
- secator/hooks/gcs.py,sha256=MIhntyWYz9BZdTXhWl5JznaczSq1_7fl3TVqPufuTSo,1490
61
- secator/hooks/mongodb.py,sha256=5Rbmjd6JuLNH_1GgkumMX1TeuMuU88gzYxoDMkHh1OY,7638
60
+ secator/hooks/gcs.py,sha256=CNQmDWbwnIA1mDhzwO75P8907lAFd5-vA2sJVMbhAiY,1514
61
+ secator/hooks/mongodb.py,sha256=fCm_E1hxgSl9C6l4eGW8J-Jjstvbfy9daITWYcmNTe8,8198
62
62
  secator/output_types/__init__.py,sha256=CJcYy2_Ek-opKiBz4wFlDHQBTm3t0JVwZ4w_2Jxoeuw,1291
63
63
  secator/output_types/_base.py,sha256=9iBqPdtlfJBldBiuC729KamHHGbKhwo69P-2UNwz-3Q,2874
64
64
  secator/output_types/certificate.py,sha256=IXW3GN0JRmuDgoedr8NV8ccuRQOuoInNZWnAKL8zeqY,3040
@@ -79,7 +79,7 @@ secator/output_types/user_account.py,sha256=EvF3Ebg9eXS_-iDguU1dSHZ9wAsJimEJznDv
79
79
  secator/output_types/vulnerability.py,sha256=eWJDFCYf3sP5-hPKQT-4Kd5id9bJzTW2u-O_d_4P6EA,2849
80
80
  secator/output_types/warning.py,sha256=iy949Aj5OXJLWif7HFB5EvjcYrgKHAzIP9ffyLTV7LA,830
81
81
  secator/runners/__init__.py,sha256=EBbOk37vkBy9p8Hhrbi-2VtM_rTwQ3b-0ggTyiD22cE,290
82
- secator/runners/_base.py,sha256=ohSQE42HK4hZqKq1OBWW7C6Ygz0IiZRmiJITZOXB1sM,40445
82
+ secator/runners/_base.py,sha256=IkAQfPzz_kou5Pa82y-2Wmtp_lIudKMc9ix8_NP4370,40663
83
83
  secator/runners/_helpers.py,sha256=TeebZnpo4cp-9tpgPlDoFm_gmr00_CERAC1aOYhTzA4,6281
84
84
  secator/runners/celery.py,sha256=bqvDTTdoHiGRCt0FRvlgFHQ_nsjKMP5P0PzGbwfCj_0,425
85
85
  secator/runners/command.py,sha256=5fmwmqkUkomceLUSp2rtJvn_ydE2gI95rqS4WKWciYI,30200
@@ -95,9 +95,9 @@ secator/tasks/__init__.py,sha256=Op0O0Aa8c124AfDG-cEB9VLRsXZ1wXTpVrT3g-wxMNg,184
95
95
  secator/tasks/_categories.py,sha256=yns_5PBKStp6TJEeaYB6yFUjkFMmLh7LEuxcNcADNro,14962
96
96
  secator/tasks/arjun.py,sha256=WdRZtTCd2Ejbv5HlLS_FoWVKgGpMsR6RCDekV2kR788,3061
97
97
  secator/tasks/bbot.py,sha256=moIkwd52jCKaeg1v6Nv4Gfmd4GPObo9c9nwOzQvf-2M,9236
98
- secator/tasks/bup.py,sha256=bl5NzoPr_YLy9Ei7JU9CM0-bW9iZsuFe3Ft8KJjN9ws,3849
98
+ secator/tasks/bup.py,sha256=9IXsCqMdhOeZcCsQB2L4IJ3Kzm2oQKDE7mflGljm0lM,3867
99
99
  secator/tasks/cariddi.py,sha256=iT-2Aryw2PPrzPedc-N_E--DxKFz_gSrcJj4z5PGQf8,4142
100
- secator/tasks/dalfox.py,sha256=v-TI5B-PCZRe6dU9caQfGJPyAPSbRRCohdIlIFvNAq8,2551
100
+ secator/tasks/dalfox.py,sha256=DWz0VWBH5SU_AyHU36YC88vAEyJ1hXkKKKNXgQvwlrU,2493
101
101
  secator/tasks/dirsearch.py,sha256=_6xPZYpNsbwR4d9NFQw3NXxQKn5zyfO1lyrWzl5p7NY,2469
102
102
  secator/tasks/dnsx.py,sha256=2qNC-wSjS33geuHMOwuBapLwKEvWTlDgnmvM67ZSJVA,4220
103
103
  secator/tasks/feroxbuster.py,sha256=dz_DGw_CbVGw9AeFjtrAEQwoxDgKzYC-KT9VLwE5UlE,3022
@@ -125,8 +125,8 @@ secator/tasks/wafw00f.py,sha256=9CnV9F7ZrykO27F3PAb5HtwULDMYEKGSTbz-jh0kc2g,3189
125
125
  secator/tasks/wpprobe.py,sha256=1QPJ-7JvhL7LFvjUTAmqpH2Krp-Qmi079lonso16YPQ,3229
126
126
  secator/tasks/wpscan.py,sha256=dBkbG9EODHDUBAA8uNVULX4SdVgTCAi_F1T1oCfRbsI,5852
127
127
  secator/workflows/__init__.py,sha256=XOviyjSylZ4cuVmmQ76yuqZRdmvOEghqAnuw_4cLmfk,702
128
- secator-0.16.2.dist-info/METADATA,sha256=a4iplxAqNbPumdRuvA6D1AZFKsUQOQfVqwVnmdC80Wo,17253
129
- secator-0.16.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
130
- secator-0.16.2.dist-info/entry_points.txt,sha256=lPgsqqUXWgiuGSfKy-se5gHdQlAXIwS_A46NYq7Acic,44
131
- secator-0.16.2.dist-info/licenses/LICENSE,sha256=19W5Jsy4WTctNkqmZIqLRV1gTDOp01S3LDj9iSgWaJ0,2867
132
- secator-0.16.2.dist-info/RECORD,,
128
+ secator-0.16.4.dist-info/METADATA,sha256=E_R6VdalGxZysqe043SuT0M_897S8cT5kXhmwOSWLpY,17253
129
+ secator-0.16.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
130
+ secator-0.16.4.dist-info/entry_points.txt,sha256=lPgsqqUXWgiuGSfKy-se5gHdQlAXIwS_A46NYq7Acic,44
131
+ secator-0.16.4.dist-info/licenses/LICENSE,sha256=19W5Jsy4WTctNkqmZIqLRV1gTDOp01S3LDj9iSgWaJ0,2867
132
+ secator-0.16.4.dist-info/RECORD,,