bbot 2.3.0.5336rc0__py3-none-any.whl → 2.3.0.5354rc0__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,4 +1,4 @@
1
1
  # version placeholder (replaced by poetry-dynamic-versioning)
2
- __version__ = "v2.3.0.5336rc"
2
+ __version__ = "v2.3.0.5354rc"
3
3
 
4
4
  from .scanner import Scanner, Preset
@@ -1,3 +1,5 @@
1
+ from contextlib import suppress
2
+
1
3
  from bbot.modules.base import BaseInterceptModule
2
4
 
3
5
 
@@ -28,15 +30,28 @@ class CloudCheck(BaseInterceptModule):
28
30
  if self.dummy_modules is None:
29
31
  self.make_dummy_modules()
30
32
  # cloud tagging by hosts
31
- hosts_to_check = set(str(s) for s in event.resolved_hosts)
32
- # we use the original host, since storage buckets hostnames might be collapsed to _wildcard
33
- hosts_to_check.add(str(event.host_original))
34
- for host in hosts_to_check:
33
+ hosts_to_check = set(event.resolved_hosts)
34
+ with suppress(KeyError):
35
+ hosts_to_check.remove(event.host_original)
36
+ hosts_to_check = [event.host_original] + list(hosts_to_check)
37
+
38
+ for i, host in enumerate(hosts_to_check):
39
+ host_is_ip = self.helpers.is_ip(host)
35
40
  for provider, provider_type, subnet in self.helpers.cloudcheck(host):
36
41
  if provider:
37
42
  event.add_tag(f"{provider_type}-{provider}")
43
+ if host_is_ip:
44
+ event.add_tag(f"{provider_type}-ip")
45
+ else:
46
+ # if the original hostname is a cloud domain, tag it as such
47
+ if i == 0:
48
+ event.add_tag(f"{provider_type}-domain")
49
+ # any children are tagged as CNAMEs
50
+ else:
51
+ event.add_tag(f"{provider_type}-cname")
38
52
 
39
53
  found = set()
54
+ str_hosts_to_check = [str(host) for host in hosts_to_check]
40
55
  # look for cloud assets in hosts, http responses
41
56
  # loop through each provider
42
57
  for provider in self.helpers.cloud.providers.values():
@@ -54,7 +69,7 @@ class CloudCheck(BaseInterceptModule):
54
69
  if event.type == "HTTP_RESPONSE":
55
70
  matches = await self.helpers.re.findall(sig, event.data.get("body", ""))
56
71
  elif event.type.startswith("DNS_NAME"):
57
- for host in hosts_to_check:
72
+ for host in str_hosts_to_check:
58
73
  match = sig.match(host)
59
74
  if match:
60
75
  matches.append(match.groups())
bbot/modules/portscan.py CHANGED
@@ -6,6 +6,9 @@ from radixtarget import RadixTarget
6
6
  from bbot.modules.base import BaseModule
7
7
 
8
8
 
9
+ # TODO: this module is getting big. It should probably be two modules: one for ping and one for SYN.
10
+
11
+
9
12
  class portscan(BaseModule):
10
13
  flags = ["active", "portscan", "safe"]
11
14
  watched_events = ["IP_ADDRESS", "IP_RANGE", "DNS_NAME"]
@@ -27,6 +30,8 @@ class portscan(BaseModule):
27
30
  "adapter_ip": "",
28
31
  "adapter_mac": "",
29
32
  "router_mac": "",
33
+ "cdn_tags": "cdn-",
34
+ "allowed_cdn_ports": None,
30
35
  }
31
36
  options_desc = {
32
37
  "top_ports": "Top ports to scan (default 100) (to override, specify 'ports')",
@@ -39,6 +44,8 @@ class portscan(BaseModule):
39
44
  "adapter_ip": "Send packets using this IP address. Not needed unless masscan's autodetection fails",
40
45
  "adapter_mac": "Send packets using this as the source MAC address. Not needed unless masscan's autodetection fails",
41
46
  "router_mac": "Send packets to this MAC address as the destination. Not needed unless masscan's autodetection fails",
47
+ "cdn_tags": "Comma-separated list of tags to skip, e.g. 'cdn,cloud'",
48
+ "allowed_cdn_ports": "Comma-separated list of ports that are allowed to be scanned for CDNs",
42
49
  }
43
50
  deps_common = ["masscan"]
44
51
  batch_size = 1000000
@@ -60,7 +67,15 @@ class portscan(BaseModule):
60
67
  try:
61
68
  self.helpers.parse_port_string(self.ports)
62
69
  except ValueError as e:
63
- return False, f"Error parsing ports: {e}"
70
+ return False, f"Error parsing ports '{self.ports}': {e}"
71
+ self.cdn_tags = [t.strip() for t in self.config.get("cdn_tags", "").split(",")]
72
+ self.allowed_cdn_ports = self.config.get("allowed_cdn_ports", None)
73
+ if self.allowed_cdn_ports is not None:
74
+ try:
75
+ self.allowed_cdn_ports = [int(p.strip()) for p in self.allowed_cdn_ports.split(",")]
76
+ except Exception as e:
77
+ return False, f"Error parsing allowed CDN ports '{self.allowed_cdn_ports}': {e}"
78
+
64
79
  # whether we've finished scanning our original scan targets
65
80
  self.scanned_initial_targets = False
66
81
  # keeps track of individual scanned IPs and their open ports
@@ -227,9 +242,20 @@ class portscan(BaseModule):
227
242
  parent=parent_event,
228
243
  context=f"{{module}} executed a {scan_type} scan against {parent_event.data} and found: {{event.type}}: {{event.data}}",
229
244
  )
230
- await self.emit_event(event)
245
+
246
+ await self.emit_event(event, abort_if=self.abort_if)
231
247
  return event
232
248
 
249
+ def abort_if(self, event):
250
+ if self.allowed_cdn_ports is not None:
251
+ # if the host is a CDN
252
+ for cdn_tag in self.cdn_tags:
253
+ if any(t.startswith(str(cdn_tag)) for t in event.tags):
254
+ # and if its port isn't in the list of allowed CDN ports
255
+ if event.port not in self.allowed_cdn_ports:
256
+ return True, "event is a CDN and port is not in the allowed list"
257
+ return False
258
+
233
259
  def parse_json_line(self, line):
234
260
  try:
235
261
  j = json.loads(line)
@@ -169,7 +169,7 @@ class subdomain_enum(BaseModule):
169
169
  if any(t.startswith("cloud-") for t in event.tags):
170
170
  is_cloud = True
171
171
  # reject if it's a cloud resource and not in our target
172
- if is_cloud and event not in self.scan.target:
172
+ if is_cloud and event not in self.scan.target.whitelist:
173
173
  return False, "Event is a cloud resource and not a direct target"
174
174
  # optionally reject events with wildcards / errors
175
175
  if self.reject_wildcards:
@@ -51,6 +51,10 @@ class TestCloudCheck(ModuleTestBase):
51
51
  await module.handle_event(event)
52
52
  assert "cloud-amazon" in event.tags, f"{event} was not properly cloud-tagged"
53
53
 
54
+ assert "cloud-domain" in aws_event1.tags
55
+ assert "cloud-ip" in other_event2.tags
56
+ assert "cloud-cname" in other_event3.tags
57
+
54
58
  for event in (aws_event3, other_event1):
55
59
  await module.handle_event(event)
56
60
  assert "cloud-amazon" not in event.tags, f"{event} was improperly cloud-tagged"
@@ -109,10 +109,12 @@ class TestPortscan(ModuleTestBase):
109
109
  if e.type == "DNS_NAME" and e.data == "dummy.asdf.evilcorp.net" and str(e.module) == "dummy_module"
110
110
  ]
111
111
  )
112
- assert 2 <= len([e for e in events if e.type == "IP_ADDRESS" and e.data == "8.8.8.8"]) <= 3
113
- assert 2 <= len([e for e in events if e.type == "IP_ADDRESS" and e.data == "8.8.4.4"]) <= 3
114
- assert 2 <= len([e for e in events if e.type == "IP_ADDRESS" and e.data == "8.8.4.5"]) <= 3
115
- assert 2 <= len([e for e in events if e.type == "IP_ADDRESS" and e.data == "8.8.4.6"]) <= 3
112
+ # the reason these numbers aren't exactly predictable is because we can't predict which one arrives first
113
+ # to the portscan module. Sometimes, one that would normally be deduped is force-emitted because it led to a new open port.
114
+ assert 2 <= len([e for e in events if e.type == "IP_ADDRESS" and e.data == "8.8.8.8"]) <= 4
115
+ assert 2 <= len([e for e in events if e.type == "IP_ADDRESS" and e.data == "8.8.4.4"]) <= 4
116
+ assert 2 <= len([e for e in events if e.type == "IP_ADDRESS" and e.data == "8.8.4.5"]) <= 4
117
+ assert 2 <= len([e for e in events if e.type == "IP_ADDRESS" and e.data == "8.8.4.6"]) <= 4
116
118
  assert 1 == len([e for e in events if e.type == "OPEN_TCP_PORT" and e.data == "8.8.8.8:443"])
117
119
  assert 1 == len([e for e in events if e.type == "OPEN_TCP_PORT" and e.data == "8.8.4.5:80"])
118
120
  assert 1 == len([e for e in events if e.type == "OPEN_TCP_PORT" and e.data == "8.8.4.6:631"])
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bbot
3
- Version: 2.3.0.5336rc0
3
+ Version: 2.3.0.5354rc0
4
4
  Summary: OSINT automation for hackers.
5
5
  Home-page: https://github.com/blacklanternsecurity/bbot
6
6
  License: GPL-3.0
@@ -249,10 +249,10 @@ flags:
249
249
 
250
250
  ```bash
251
251
  # everything everywhere all at once
252
- bbot -t evilcorp.com -p kitchen-sink
252
+ bbot -t evilcorp.com -p kitchen-sink --allow-deadly
253
253
 
254
254
  # roughly equivalent to:
255
- bbot -t evilcorp.com -p subdomain-enum cloud-enum code-enum email-enum spider web-basic paramminer dirbust-light web-screenshots
255
+ bbot -t evilcorp.com -p subdomain-enum cloud-enum code-enum email-enum spider web-basic paramminer dirbust-light web-screenshots --allow-deadly
256
256
  ```
257
257
 
258
258
  <!-- BBOT KITCHEN-SINK PRESET EXPANDABLE -->
@@ -1,4 +1,4 @@
1
- bbot/__init__.py,sha256=64_F2PE18hTp73HNgaDhvsf-5sGFJgIhexCXhwya6Nw,130
1
+ bbot/__init__.py,sha256=-FTJivANQg1DxYPRW-_-j0E66PFIwvSBnASvwTEpp_g,130
2
2
  bbot/cli.py,sha256=-9d6yCAYZaP0lIOCja-fSk3MiNclc-kbEgos10jYNUQ,10440
3
3
  bbot/core/__init__.py,sha256=l255GJE_DvUnWvrRb0J5lG-iMztJ8zVvoweDOfegGtI,46
4
4
  bbot/core/config/__init__.py,sha256=zYNw2Me6tsEr8hOOkLb4BQ97GB7Kis2k--G81S8vofU,342
@@ -120,7 +120,7 @@ bbot/modules/iis_shortnames.py,sha256=NI0lAcTzUTJCkw9uJZJB6_OsOQ7J6bSGtZw_nAWHvo
120
120
  bbot/modules/internal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
121
121
  bbot/modules/internal/aggregate.py,sha256=csWYIt2fUp9K_CRxP3bndUMIjpNIh8rmBubp5Fr1-nc,395
122
122
  bbot/modules/internal/base.py,sha256=BXO4Hc7XKaAOaLzolF3krJX1KibPxtek2GTQUgnCHk0,387
123
- bbot/modules/internal/cloudcheck.py,sha256=kkD5DC5Y7EPCiVTdEspZktkflArU3unx--9ciBikxHo,4099
123
+ bbot/modules/internal/cloudcheck.py,sha256=86wYVzoY8OeorpqQFger9UrdNdu2vTkd8XmC9xtplUc,4727
124
124
  bbot/modules/internal/dnsresolve.py,sha256=UW88BlpJ7gOjPARrjVgtwpDIDPNQZRpuIRpL2yVP6T4,15251
125
125
  bbot/modules/internal/excavate.py,sha256=XCwEreroQIRPBnKBNo1epLHcbycCZGYTuW73Zi8qZLU,51174
126
126
  bbot/modules/internal/speculate.py,sha256=hOJPrmJP8-APqSEbmYsbKrvovLIGIz4dJUoZyusq0w0,9270
@@ -160,7 +160,7 @@ bbot/modules/paramminer_getparams.py,sha256=_j6rgaqV5wGJoa8p5-KKbe2YsVGUtmWIanCV
160
160
  bbot/modules/paramminer_headers.py,sha256=QEnWxveQVuS91MEYKYtfquqdNzimN7sQHuxpcqiTHpo,10305
161
161
  bbot/modules/passivetotal.py,sha256=uGT6c_CUxBNInmClsTg8afIYA2ZykKYYCgjkyzujfHg,1653
162
162
  bbot/modules/pgp.py,sha256=Xu2M9WEIlwTm5-Lv29g7BblI05tD9Dl0XsYSeY6UURs,2065
163
- bbot/modules/portscan.py,sha256=eb1sNb8ffe5gcjOsOOvX48oNtecJ1Tqq6exoz_G_jZ4,13327
163
+ bbot/modules/portscan.py,sha256=2VSoxoh0AypE8DoGKHqE-a57G4Z91XEo3kquQ5OpM3Y,14656
164
164
  bbot/modules/postman.py,sha256=tbLrxi5pOycLABvphORxyK9duTSBXZLgpf1vAZvOIa0,3512
165
165
  bbot/modules/postman_download.py,sha256=dYKwZjM1Z8JTy8oKWha1WHZTetxVIYRM09-vsHBNNUI,9071
166
166
  bbot/modules/rapiddns.py,sha256=uONESr0B5pv9cSAr7lF4WWV31APUhXyHexvI04rUcyk,787
@@ -185,7 +185,7 @@ bbot/modules/templates/github.py,sha256=ENnDWpzzmZBsTisDx6Cg9V_NwJKyVyPIOpGAPkti
185
185
  bbot/modules/templates/postman.py,sha256=oxwVusW2EdNotVX7xnnxCTnWtj3xNPbfs8aff9s4phs,614
186
186
  bbot/modules/templates/shodan.py,sha256=BfI0mNPbqkykGmjMtARhmCGKmk1uq7yTlZoPgzzJ040,1175
187
187
  bbot/modules/templates/sql.py,sha256=bn8ZbTC0RkrA5wYOQ7RtSHfIywBm03L3mY344xH1Ue4,3417
188
- bbot/modules/templates/subdomain_enum.py,sha256=h2YhIWoMLUXV7EBIidiQezuwXf35T8tXmOO9Vg__sIY,8393
188
+ bbot/modules/templates/subdomain_enum.py,sha256=54prHdg_wgTBHIJLPLbDWBqq2x978NDfDOGG7R5A6fQ,8403
189
189
  bbot/modules/templates/webhook.py,sha256=MYhKWrNYrsfM0a4PR6yVotudLyyCwgmy2eI-l9LvpBs,3706
190
190
  bbot/modules/trickest.py,sha256=MRgLW0YiDWzlWdAjyqfPPLFb-a51r-Ffn_dphiJI_gA,1550
191
191
  bbot/modules/trufflehog.py,sha256=yOoCszQe6ZoJGBUHfFp-lj5JH-Izp9R-CltsmZnI3Fw,8554
@@ -291,7 +291,7 @@ bbot/test/test_step_2/module_tests/test_module_c99.py,sha256=-xyL1y3eX_rGuBR-U0N
291
291
  bbot/test/test_step_2/module_tests/test_module_censys.py,sha256=RoFfLS0hgASdSoctJEzaKrHVqqRkuPRKPTYVCX2rZLo,4177
292
292
  bbot/test/test_step_2/module_tests/test_module_certspotter.py,sha256=60jCOeK1yaUEgtTxYW-T47kZgKt9XxP2qBH9w-0MDBk,636
293
293
  bbot/test/test_step_2/module_tests/test_module_chaos.py,sha256=9JRgtDEnnJgmEMCTB2bqRJRkBavLys-6ypHPxrM_hXk,956
294
- bbot/test/test_step_2/module_tests/test_module_cloudcheck.py,sha256=sRWgotul2I4qY5SjNBDuo2iOceHs-3x0cqJ-K29GitY,3927
294
+ bbot/test/test_step_2/module_tests/test_module_cloudcheck.py,sha256=XWAkCpq0PMEGXksnK4tNR1IyPkjRd_anhCoT5tWmLU4,4074
295
295
  bbot/test/test_step_2/module_tests/test_module_code_repository.py,sha256=i02Tgvr_F9_E4d6aEaXrfdk71NkoDvjzP4C98l2rNGg,2414
296
296
  bbot/test/test_step_2/module_tests/test_module_columbus.py,sha256=JZG_EvDQoKGNcBhYOGaNr_FGU2s1BCzG6ePz4yfZcUg,564
297
297
  bbot/test/test_step_2/module_tests/test_module_credshed.py,sha256=rlvKZERFoAS-gg7sdgk6Pa2JbySmHDPee3zKUYATWlw,3362
@@ -355,7 +355,7 @@ bbot/test/test_step_2/module_tests/test_module_paramminer_getparams.py,sha256=mW
355
355
  bbot/test/test_step_2/module_tests/test_module_paramminer_headers.py,sha256=qTT-5fyqw69LaZBxak3FvPfH7lh9W0KVBtJgslD-3eQ,5545
356
356
  bbot/test/test_step_2/module_tests/test_module_passivetotal.py,sha256=fTGQECQ0OzcwiH64-0igFRKO-rs3kXScivZord_oWWU,1120
357
357
  bbot/test/test_step_2/module_tests/test_module_pgp.py,sha256=-m-nPq6WR5UzPDuxeZbuzBQfFi1QfrZQ8RZH4g11ocE,1609
358
- bbot/test/test_step_2/module_tests/test_module_portscan.py,sha256=StCm93P4q3o-NhPtUDOA6g_LTH2cwzEw0l2V5ZN5eeI,7306
358
+ bbot/test/test_step_2/module_tests/test_module_portscan.py,sha256=MsemMkkKVCJBd3HuyP5FOasfDGCj-JK7bpiPjBpmTjk,7552
359
359
  bbot/test/test_step_2/module_tests/test_module_postgres.py,sha256=6Seqq1Bq2FEXbJnTi_BYv8ZZPWdy-SfnY8UJN24Op0Q,2689
360
360
  bbot/test/test_step_2/module_tests/test_module_postman.py,sha256=XvgfMgUhJuVgGkgT-JzxJyevNSVv7YvX1yLKJHmD3dw,5026
361
361
  bbot/test/test_step_2/module_tests/test_module_postman_download.py,sha256=B_NajQaGQjwMSmcBCr37_7cvcnw4Zmh8k_hVoWL7bVI,21623
@@ -410,8 +410,8 @@ bbot/wordlists/raft-small-extensions-lowercase_CLEANED.txt,sha256=ruUQwVfia1_m2u
410
410
  bbot/wordlists/top_open_ports_nmap.txt,sha256=LmdFYkfapSxn1pVuQC2LkOIY2hMLgG-Xts7DVtYzweM,42727
411
411
  bbot/wordlists/valid_url_schemes.txt,sha256=VciB-ww0y-O8Ii1wpTR6rJzGDiC2r-dhVsIJApS1ZYU,3309
412
412
  bbot/wordlists/wordninja_dns.txt.gz,sha256=DYHvvfW0TvzrVwyprqODAk4tGOxv5ezNmCPSdPuDUnQ,570241
413
- bbot-2.3.0.5336rc0.dist-info/LICENSE,sha256=GzeCzK17hhQQDNow0_r0L8OfLpeTKQjFQwBQU7ZUymg,32473
414
- bbot-2.3.0.5336rc0.dist-info/METADATA,sha256=8uDNDLBuulreOPW5vhd6ZaD5x94NcyjyAxbW7W-8hOU,17239
415
- bbot-2.3.0.5336rc0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
416
- bbot-2.3.0.5336rc0.dist-info/entry_points.txt,sha256=cWjvcU_lLrzzJgjcjF7yeGuRA_eDS8pQ-kmPUAyOBfo,38
417
- bbot-2.3.0.5336rc0.dist-info/RECORD,,
413
+ bbot-2.3.0.5354rc0.dist-info/LICENSE,sha256=GzeCzK17hhQQDNow0_r0L8OfLpeTKQjFQwBQU7ZUymg,32473
414
+ bbot-2.3.0.5354rc0.dist-info/METADATA,sha256=1KTziVaVMXu5AycEu82eUZLY-mIQcs_0pqrsDJpcchA,17269
415
+ bbot-2.3.0.5354rc0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
416
+ bbot-2.3.0.5354rc0.dist-info/entry_points.txt,sha256=cWjvcU_lLrzzJgjcjF7yeGuRA_eDS8pQ-kmPUAyOBfo,38
417
+ bbot-2.3.0.5354rc0.dist-info/RECORD,,