bbot 2.4.2.6590rc0__py3-none-any.whl → 2.4.2.6596rc0__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 bbot might be problematic. Click here for more details.

bbot/__init__.py CHANGED
@@ -1,5 +1,5 @@
1
1
  # version placeholder (replaced by poetry-dynamic-versioning)
2
- __version__ = "v2.4.2.6590rc"
2
+ __version__ = "v2.4.2.6596rc"
3
3
 
4
4
  from .scanner import Scanner, Preset
5
5
 
@@ -1,4 +1,5 @@
1
1
  description: Discover web parameters and lightly fuzz them, limited to just GET-based xss vulnerabilities. This is an example of a custom lightfuzz preset, selectively enabling a single lightfuzz module.
2
+
2
3
  modules:
3
4
  - httpx
4
5
  - lightfuzz
@@ -6,6 +6,7 @@ from bbot.errors import *
6
6
  log = logging.getLogger("bbot.presets.path")
7
7
 
8
8
  DEFAULT_PRESET_PATH = Path(__file__).parent.parent.parent / "presets"
9
+ DEFAULT_PRESET_PATH = DEFAULT_PRESET_PATH.expanduser().resolve()
9
10
 
10
11
 
11
12
  class PresetPath:
@@ -17,7 +18,7 @@ class PresetPath:
17
18
  self.paths = [DEFAULT_PRESET_PATH]
18
19
 
19
20
  def find(self, filename):
20
- filename_path = Path(filename).resolve()
21
+ filename_path = Path(filename).expanduser().resolve()
21
22
  extension = filename_path.suffix.lower()
22
23
  file_candidates = set()
23
24
  extension_candidates = {".yaml", ".yml"}
@@ -29,16 +30,12 @@ class PresetPath:
29
30
  file_candidates.add(f"{filename_path.stem}{ext}")
30
31
  file_candidates = sorted(file_candidates)
31
32
  file_candidates_str = ",".join([str(s) for s in file_candidates])
32
- paths_to_search = self.paths
33
33
  if "/" in str(filename):
34
- if filename_path.parent not in paths_to_search:
35
- paths_to_search.append(filename_path.parent)
36
- log.debug(
37
- f"Searching for preset in {[str(p) for p in paths_to_search]}, file candidates: {file_candidates_str}"
38
- )
39
- for path in paths_to_search:
34
+ self.add_path(filename_path.parent)
35
+ log.debug(f"Searching for {file_candidates_str} in {[str(p) for p in self.paths]}")
36
+ for path in self.paths:
40
37
  for candidate in file_candidates:
41
- for file in path.rglob(candidate):
38
+ for file in path.rglob(f"**/{candidate}"):
42
39
  if file.is_file():
43
40
  log.verbose(f'Found preset matching "{filename}" at {file}')
44
41
  self.add_path(file.parent)
@@ -51,14 +48,19 @@ class PresetPath:
51
48
  return ":".join([str(s) for s in self.paths])
52
49
 
53
50
  def add_path(self, path):
54
- path = Path(path).resolve()
51
+ path = Path(path).expanduser().resolve()
52
+ # skip if already in paths
55
53
  if path in self.paths:
56
54
  return
55
+ # skip if path is a subdirectory of any path in paths
57
56
  if any(path.is_relative_to(p) for p in self.paths):
58
57
  return
58
+ # skip if path is not a directory
59
59
  if not path.is_dir():
60
60
  log.debug(f'Path "{path.resolve()}" is not a directory')
61
61
  return
62
+ # preemptively remove any paths that are subdirectories of the new path
63
+ self.paths = [p for p in self.paths if not p.is_relative_to(path)]
62
64
  self.paths.append(path)
63
65
 
64
66
  def __iter__(self):
@@ -308,7 +308,7 @@ class Preset(metaclass=BasePreset):
308
308
 
309
309
  @property
310
310
  def preset_dir(self):
311
- return self.bbot_home / "presets"
311
+ return (self.bbot_home / "presets").expanduser().resolve()
312
312
 
313
313
  @property
314
314
  def default_output_modules(self):
@@ -413,30 +413,32 @@ class Preset(metaclass=BasePreset):
413
413
  self.log_debug("Getting baked")
414
414
  # create a copy of self
415
415
  baked_preset = copy(self)
416
- baked_preset.scan = scan
416
+
417
417
  # copy core
418
418
  baked_preset.core = self.core.copy()
419
- # copy module loader
420
- baked_preset._module_loader = self.module_loader.copy()
421
- # prepare os environment
422
- os_environ = baked_preset.environ.prepare()
423
- # find and replace preloaded modules with os environ
424
- # this is different from the config variable substitution because it modifies
425
- # the preloaded modules, i.e. their ansible playbooks
426
- baked_preset.module_loader.find_and_replace(**os_environ)
427
- # update os environ
428
- os.environ.clear()
429
- os.environ.update(os_environ)
430
419
 
431
- # validate flags, config options
432
- baked_preset.validate()
420
+ if scan is not None:
421
+ baked_preset.scan = scan
422
+ # copy module loader
423
+ baked_preset._module_loader = self.module_loader.copy()
424
+ # prepare os environment
425
+ os_environ = baked_preset.environ.prepare()
426
+ # find and replace preloaded modules with os environ
427
+ # this is different from the config variable substitution because it modifies
428
+ # the preloaded modules, i.e. their ansible playbooks
429
+ baked_preset.module_loader.find_and_replace(**os_environ)
430
+ # update os environ
431
+ os.environ.clear()
432
+ os.environ.update(os_environ)
433
+
434
+ # assign baked preset to our scan
435
+ scan.preset = baked_preset
433
436
 
434
437
  # validate log level options
435
438
  baked_preset.apply_log_level(apply_core=scan is not None)
436
439
 
437
- # assign baked preset to our scan
438
- if scan is not None:
439
- scan.preset = baked_preset
440
+ # validate flags, config options
441
+ baked_preset.validate()
440
442
 
441
443
  # now that our requirements / exclusions are validated, we can start enabling modules
442
444
  # enable scan modules
@@ -483,15 +485,19 @@ class Preset(metaclass=BasePreset):
483
485
  from bbot.scanner.target import BBOTTarget
484
486
 
485
487
  baked_preset._target = BBOTTarget(
486
- *list(self._seeds), whitelist=self._whitelist, blacklist=self._blacklist, strict_scope=self.strict_scope
488
+ *list(self._seeds),
489
+ whitelist=self._whitelist,
490
+ blacklist=self._blacklist,
491
+ strict_scope=self.strict_scope,
487
492
  )
488
493
 
489
- # evaluate conditions
490
- if baked_preset.conditions:
491
- from .conditions import ConditionEvaluator
494
+ if scan is not None:
495
+ # evaluate conditions
496
+ if baked_preset.conditions:
497
+ from .conditions import ConditionEvaluator
492
498
 
493
- evaluator = ConditionEvaluator(baked_preset)
494
- evaluator.evaluate()
499
+ evaluator = ConditionEvaluator(baked_preset)
500
+ evaluator.evaluate()
495
501
 
496
502
  self._baked = True
497
503
  return baked_preset
@@ -562,6 +568,12 @@ class Preset(metaclass=BasePreset):
562
568
  return self.scope_config.get("strict", False)
563
569
 
564
570
  def apply_log_level(self, apply_core=False):
571
+ """
572
+ Apply the log level to the preset.
573
+
574
+ Args:
575
+ apply_core (bool, optional): If True, apply the log level to the core logger.
576
+ """
565
577
  # silent takes precedence
566
578
  if self.silent:
567
579
  self.verbose = False
@@ -920,20 +932,17 @@ class Preset(metaclass=BasePreset):
920
932
  """
921
933
  Recursively find all the presets and return them as a dictionary
922
934
  """
923
- preset_dir = self.preset_dir
924
- home_dir = Path.home()
925
-
926
935
  # first, add local preset dir to PRESET_PATH
927
936
  PRESET_PATH.add_path(self.preset_dir)
928
937
 
929
938
  # ensure local preset directory exists
930
- mkdir(preset_dir)
939
+ mkdir(self.preset_dir)
931
940
 
932
941
  global DEFAULT_PRESETS
933
942
  if DEFAULT_PRESETS is None:
934
943
  presets = {}
935
- for ext in ("yml", "yaml"):
936
- for preset_path in PRESET_PATH:
944
+ for preset_path in PRESET_PATH:
945
+ for ext in ("yml", "yaml"):
937
946
  # for every yaml file
938
947
  for original_filename in preset_path.rglob(f"**/*.{ext}"):
939
948
  # not including symlinks
@@ -957,18 +966,14 @@ class Preset(metaclass=BasePreset):
957
966
 
958
967
  local_preset = original_filename
959
968
  # populate symlinks in local preset dir
960
- if not original_filename.is_relative_to(preset_dir):
969
+ if not original_filename.is_relative_to(self.preset_dir):
961
970
  relative_preset = original_filename.relative_to(preset_path)
962
- local_preset = preset_dir / relative_preset
971
+ local_preset = self.preset_dir / relative_preset
963
972
  mkdir(local_preset.parent, check_writable=False)
964
973
  if not local_preset.exists():
965
974
  local_preset.symlink_to(original_filename)
966
975
 
967
- # collapse home directory into "~"
968
- if local_preset.is_relative_to(home_dir):
969
- local_preset = Path("~") / local_preset.relative_to(home_dir)
970
-
971
- presets[local_preset] = (loaded_preset, category, preset_path, original_filename)
976
+ presets[local_preset.stem] = (loaded_preset, category, preset_path, original_filename)
972
977
 
973
978
  # sort by name
974
979
  DEFAULT_PRESETS = dict(sorted(presets.items(), key=lambda x: x[-1][0].name))
bbot/scripts/docs.py CHANGED
@@ -198,15 +198,15 @@ def update_docs():
198
198
  update_md_files("BBOT PRESETS", bbot_presets_table)
199
199
 
200
200
  # BBOT presets
201
- for yaml_file, (loaded_preset, category, preset_path, original_filename) in DEFAULT_PRESET.all_presets.items():
201
+ for _, (loaded_preset, category, preset_path, original_filename) in DEFAULT_PRESET.all_presets.items():
202
202
  preset_yaml = f"""
203
- ```yaml title={yaml_file.name}
203
+ ```yaml title={preset_path.name}
204
204
  {loaded_preset._yaml_str}
205
205
  ```
206
206
  """
207
207
  preset_yaml_expandable = f"""
208
208
  <details>
209
- <summary><b><code>{yaml_file.name}</code></b></summary>
209
+ <summary><b><code>{preset_path.name}</code></b></summary>
210
210
 
211
211
  ```yaml
212
212
  {loaded_preset._yaml_str}
@@ -218,11 +218,11 @@ def update_docs():
218
218
  update_md_files(f"BBOT {loaded_preset.name.upper()} PRESET EXPANDABLE", preset_yaml_expandable)
219
219
 
220
220
  content = []
221
- for yaml_file, (loaded_preset, category, preset_path, original_filename) in DEFAULT_PRESET.all_presets.items():
221
+ for _, (loaded_preset, category, preset_path, original_filename) in DEFAULT_PRESET.all_presets.items():
222
222
  yaml_str = loaded_preset._yaml_str
223
223
  indent = " " * 4
224
224
  yaml_str = f"\n{indent}".join(yaml_str.splitlines())
225
- filename = homedir_collapseuser(yaml_file)
225
+ filename = homedir_collapseuser(preset_path)
226
226
 
227
227
  num_modules = len(loaded_preset.scan_modules)
228
228
  modules = ", ".join(sorted([f"`{m}`" for m in loaded_preset.scan_modules]))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: bbot
3
- Version: 2.4.2.6590rc0
3
+ Version: 2.4.2.6596rc0
4
4
  Summary: OSINT automation for hackers.
5
5
  License: GPL-3.0
6
6
  Keywords: python,cli,automation,osint,threat-intel,intelligence,neo4j,scanner,python-library,hacking,recursion,pentesting,recon,command-line-tool,bugbounty,subdomains,security-tools,subdomain-scanner,osint-framework,attack-surface,subdomain-enumeration,osint-tool
@@ -1,4 +1,4 @@
1
- bbot/__init__.py,sha256=mI2Io-jdyc-O8pxTT_Lt7Mj9LUg-UjBRikUOBQOrAmo,163
1
+ bbot/__init__.py,sha256=f_lWfZIjwByTjeR_K-ytNiRjidI-4UQrBdUUWh9BFdk,163
2
2
  bbot/cli.py,sha256=1QJbANVw9Q3GFM92H2QRV2ds5756ulm08CDZwzwPpeI,11888
3
3
  bbot/core/__init__.py,sha256=l255GJE_DvUnWvrRb0J5lG-iMztJ8zVvoweDOfegGtI,46
4
4
  bbot/core/config/__init__.py,sha256=zYNw2Me6tsEr8hOOkLb4BQ97GB7Kis2k--G81S8vofU,342
@@ -240,7 +240,7 @@ bbot/presets/web/lightfuzz-heavy.yml,sha256=a-f11tSUj5NhVQJNm2NJb4OqXV8oPnwnd1kb
240
240
  bbot/presets/web/lightfuzz-light.yml,sha256=pkjTa5ULeOhCgRYPAoJR-cVfyhErT3I1aqmWGHTIgBk,899
241
241
  bbot/presets/web/lightfuzz-medium.yml,sha256=e5dKHkiGbLMIw1fTC6lKGH4UpnWit1XtvVdIuFS8dY4,497
242
242
  bbot/presets/web/lightfuzz-superheavy.yml,sha256=c5x-EpK-xbg-qWxPXLLp3ysKFl1LRhJyl_SlkPVowxQ,857
243
- bbot/presets/web/lightfuzz-xss.yml,sha256=5dNAmzwkdCyLy-disLO9V-eCQ1mOMNiNdQWNjGE4NlQ,679
243
+ bbot/presets/web/lightfuzz-xss.yml,sha256=LMe968_iKyQhnm1nPh6zXDeNyDum2_MPkLg7ukqr93A,680
244
244
  bbot/presets/web/paramminer.yml,sha256=8n-aDzufrZdtIlZwI0yh4-rQiwU1FPODYwmyra3l-1M,393
245
245
  bbot/presets/web-basic.yml,sha256=6YWSYclbuf9yr8-gILDpLvOUj5QjP4rlarm5_d5iBFw,79
246
246
  bbot/presets/web-screenshots.yml,sha256=Kh5yDh2kKLJPxO5A67VxKWzou6XU1Ct-NFZqYsa6Zh8,338
@@ -252,12 +252,12 @@ bbot/scanner/preset/__init__.py,sha256=If_YqKILIxjlaJvf8lFc5zQTHDkounLdC8x_72N-V
252
252
  bbot/scanner/preset/args.py,sha256=yADXhmmLWBODsEqw1NbEBh8UWltUEoB--2S7myHTwAQ,19212
253
253
  bbot/scanner/preset/conditions.py,sha256=hFL9cSIWGEsv2TfM5UGurf0c91cyaM8egb5IngBmIjA,1569
254
254
  bbot/scanner/preset/environ.py,sha256=9KbEOLWkUdoAf5Ez_2A1NNm6QduQElbnNnrPi6VDhZs,4731
255
- bbot/scanner/preset/path.py,sha256=Q29MO8cOEn690yW6bB08P72kbZ3C-H_TOEoXuwWnFM8,2274
256
- bbot/scanner/preset/preset.py,sha256=guntxt2RBX3bgXR4aFWOZwjGLHed66VJe-bXyaoTd08,40745
255
+ bbot/scanner/preset/path.py,sha256=0BnhI3brWdkpE96ZOEQwfwhZoKMMnXx0uXPVdAg8spI,2500
256
+ bbot/scanner/preset/preset.py,sha256=t9Aa3n3mpGVZ274z2hXaGsdpRZe0BSGuF3WTM6Dinj8,40817
257
257
  bbot/scanner/scanner.py,sha256=2slrxEfcBjSZgZ1jmQ34a4X6aMli80K85_eY8ti7zZQ,55471
258
258
  bbot/scanner/stats.py,sha256=re93sArKXZSiD0Owgqk2J3Kdvfm3RL4Y9Qy_VOcaVk8,3623
259
259
  bbot/scanner/target.py,sha256=lI0Tn5prQiPiJE3WW-ZLx_l6EFqzAVabtyL-nfXJ8cE,10636
260
- bbot/scripts/docs.py,sha256=ZLY9-O6OeEElzOUvTglO5EMkRv1s4aEuxJb2CthCVsI,10782
260
+ bbot/scripts/docs.py,sha256=paB_n6yzuuglNsc90h_-XzudWavwIbM6l62OUoGjsww,10772
261
261
  bbot/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
262
262
  bbot/test/bbot_fixtures.py,sha256=XrCQDLVe80BG3QTUDnXb0y-cWnBpJJoRh2Z3J3xJn_w,9961
263
263
  bbot/test/conftest.py,sha256=OacpJ98g00HqCoHpEnuzzMK47LkbZdJWr25Pm0SbTM0,11783
@@ -450,8 +450,8 @@ bbot/wordlists/raft-small-extensions-lowercase_CLEANED.txt,sha256=ZSIVebs7ptMvHx
450
450
  bbot/wordlists/top_open_ports_nmap.txt,sha256=LmdFYkfapSxn1pVuQC2LkOIY2hMLgG-Xts7DVtYzweM,42727
451
451
  bbot/wordlists/valid_url_schemes.txt,sha256=0B_VAr9Dv7aYhwi6JSBDU-3M76vNtzN0qEC_RNLo7HE,3310
452
452
  bbot/wordlists/wordninja_dns.txt.gz,sha256=DYHvvfW0TvzrVwyprqODAk4tGOxv5ezNmCPSdPuDUnQ,570241
453
- bbot-2.4.2.6590rc0.dist-info/LICENSE,sha256=GzeCzK17hhQQDNow0_r0L8OfLpeTKQjFQwBQU7ZUymg,32473
454
- bbot-2.4.2.6590rc0.dist-info/METADATA,sha256=fPojuean3_Dk8ZEd8YQ1V4FBfpyl6tZABs1jjqdbP_s,18308
455
- bbot-2.4.2.6590rc0.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
456
- bbot-2.4.2.6590rc0.dist-info/entry_points.txt,sha256=cWjvcU_lLrzzJgjcjF7yeGuRA_eDS8pQ-kmPUAyOBfo,38
457
- bbot-2.4.2.6590rc0.dist-info/RECORD,,
453
+ bbot-2.4.2.6596rc0.dist-info/LICENSE,sha256=GzeCzK17hhQQDNow0_r0L8OfLpeTKQjFQwBQU7ZUymg,32473
454
+ bbot-2.4.2.6596rc0.dist-info/METADATA,sha256=OsjFtdUM6w_FKP6FlYNmAhgYlnQTc8bOKqvOOYv4HfE,18308
455
+ bbot-2.4.2.6596rc0.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
456
+ bbot-2.4.2.6596rc0.dist-info/entry_points.txt,sha256=cWjvcU_lLrzzJgjcjF7yeGuRA_eDS8pQ-kmPUAyOBfo,38
457
+ bbot-2.4.2.6596rc0.dist-info/RECORD,,