Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev --> Stable 1.1.6 #1002

Merged
merged 206 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from 62 commits
Commits
Show all changes
206 commits
Select commit Hold shift + click to select a range
00afbfd
fix event stats tracking bug
TheTechromancer Jan 16, 2024
a12cc90
Merge pull request #999 from blacklanternsecurity/fix-event-stats
TheTechromancer Jan 16, 2024
ff6939e
added http status code, http title, waf to asset inventory
TheTechromancer Jan 16, 2024
c389563
include DNS records in asset inventory CSV
TheTechromancer Jan 17, 2024
31ae4d6
Description --> Technologies
TheTechromancer Jan 17, 2024
9c96cb4
fix tests
TheTechromancer Jan 17, 2024
1a48f75
fix visual issue with ports in libreoffice
TheTechromancer Jan 17, 2024
9aac994
Merge pull request #1001 from blacklanternsecurity/improved-asset-inv…
TheTechromancer Jan 18, 2024
4917530
Refresh module docs
blsaccess Jan 18, 2024
2227c89
fix filedownload options
TheTechromancer Jan 18, 2024
66a28f2
improve chain_lists helper
TheTechromancer Jan 18, 2024
9338bc6
Merge pull request #1005 from blacklanternsecurity/options-fix
TheTechromancer Jan 18, 2024
61e556a
Merge pull request #1006 from blacklanternsecurity/improve-chained-li…
TheTechromancer Jan 18, 2024
0143b53
asset inventory bugfixes and improvements
TheTechromancer Jan 18, 2024
4bbb928
removed debugging messages
TheTechromancer Jan 18, 2024
ed93357
url-decode http title
TheTechromancer Jan 18, 2024
e342a1e
http title parsing
TheTechromancer Jan 18, 2024
7d6fcc7
bugfix, add internal ip address column
TheTechromancer Jan 19, 2024
d9a8074
fix tests
TheTechromancer Jan 19, 2024
bbbe7c6
Increase subdomaincenter timeout
TheTechromancer Jan 19, 2024
e7c716c
asyncify emit_event, default qsize=100
TheTechromancer Jan 19, 2024
a40f5cb
add option to store httpx responses
TheTechromancer Jan 19, 2024
2a2e70d
blacked
TheTechromancer Jan 19, 2024
451e67c
fix tests
TheTechromancer Jan 19, 2024
b4fea8a
fix tests
TheTechromancer Jan 19, 2024
70328ce
Merge pull request #1010 from blacklanternsecurity/improved-asset-inv…
TheTechromancer Jan 19, 2024
902361d
Merge pull request #1013 from blacklanternsecurity/increase-subdomain…
TheTechromancer Jan 19, 2024
6a8be4c
Merge pull request #1015 from blacklanternsecurity/httpx-store-responses
TheTechromancer Jan 19, 2024
6575764
Refresh module docs
blsaccess Jan 19, 2024
ca3f3c2
fix tests
TheTechromancer Jan 19, 2024
4883687
fix tests again
TheTechromancer Jan 22, 2024
e60f4b7
fixed postman tests
TheTechromancer Jan 22, 2024
5af0482
Discard postman workspaces that do not explicitly contain the queried…
domwhewell-sage Jan 22, 2024
027c0ed
Merge pull request #1022 from domwhewell-sage/postman-module
TheTechromancer Jan 22, 2024
6df8bff
improve task counting for batch modules
TheTechromancer Jan 22, 2024
3778ff9
lovecraftian entities
TheTechromancer Jan 22, 2024
a623f5e
Merge pull request #1014 from blacklanternsecurity/qsize-tlc
TheTechromancer Jan 22, 2024
9af5ad8
gowitness - don't visit out-of-scope URLs (except social media pages)
TheTechromancer Jan 24, 2024
c9a4af4
ensure we don't get any unwanted web screenshots
TheTechromancer Jan 24, 2024
59a3369
Merge pull request #1027 from blacklanternsecurity/gowitness-fix
TheTechromancer Jan 24, 2024
36659a5
Refresh module docs
blsaccess Jan 24, 2024
021a0f6
update, pin black
TheTechromancer Jan 27, 2024
9044aee
Merge pull request #1032 from blacklanternsecurity/update-black
TheTechromancer Jan 27, 2024
056206f
fix massdns cname wildcard bug
TheTechromancer Jan 27, 2024
4d6375b
Merge pull request #1033 from blacklanternsecurity/fix-cname-wildcard
TheTechromancer Jan 27, 2024
30de135
added missing web-thorough flag to three web-basic modules: oauth, fi…
Sh4d0wHunt3rX Jan 27, 2024
f89cf0e
Update pyproject.toml
TheTechromancer Jan 27, 2024
1c6cca3
Merge pull request #1030 from amiremami/missing-flags
TheTechromancer Jan 28, 2024
4e33bb7
Refresh module docs
blsaccess Jan 28, 2024
6026e22
fix dependabot.yml
TheTechromancer Jan 28, 2024
d6cfe30
Merge pull request #1034 from blacklanternsecurity/bump-version
TheTechromancer Jan 28, 2024
be093aa
update release history
liquidsec Jan 29, 2024
5d8246a
fixing black pin
liquidsec Jan 29, 2024
b77f878
Merge pull request #1038 from blacklanternsecurity/update_release_his…
liquidsec Jan 29, 2024
edab5a8
clarify interactsh polling error
TheTechromancer Jan 29, 2024
8bba54c
update release history
TheTechromancer Jan 29, 2024
9809d5e
Merge pull request #1040 from blacklanternsecurity/interactsh-error-h…
TheTechromancer Jan 29, 2024
47c4c83
poetry update
TheTechromancer Jan 29, 2024
22792c8
fix event distribution stats
TheTechromancer Jan 29, 2024
373682a
improve event stats counter
TheTechromancer Jan 30, 2024
6cca54b
fix aggregate tests
TheTechromancer Jan 30, 2024
b945f13
Merge pull request #1042 from blacklanternsecurity/fix-event-stats
TheTechromancer Jan 30, 2024
240bb4b
improving serialization regexes, fixing excavate bug, excavate tests
liquidsec Feb 1, 2024
0700816
Merge pull request #1047 from blacklanternsecurity/excavate-serializa…
liquidsec Feb 1, 2024
ec1ea92
include source email address in PASSWORD, USERNAME, and HASHED_PASSWORD
TheTechromancer Feb 1, 2024
a824a5e
Merge pull request #1048 from blacklanternsecurity/include-emails-wit…
TheTechromancer Feb 1, 2024
6ede322
JSON module: option for SIEM-friendly output
TheTechromancer Feb 1, 2024
13af94a
updated docs
TheTechromancer Feb 1, 2024
a83dc73
Refresh module docs
blsaccess Feb 1, 2024
bdac5d6
updated docs
TheTechromancer Feb 1, 2024
52429f3
Added Newsletter Module
stryker2k2 Feb 2, 2024
11f5eeb
Merge pull request #1049 from blacklanternsecurity/siem-friendly-json
TheTechromancer Feb 2, 2024
3f7c3ac
Refresh module docs
blsaccess Feb 2, 2024
c4540cd
moving _baselined assignement to prevent race condition
liquidsec Feb 4, 2024
499ec3e
removing debug sleep import
liquidsec Feb 4, 2024
c302cb4
fix whitespace
liquidsec Feb 4, 2024
38982ad
lowering bypass403 collapse threshold
liquidsec Feb 4, 2024
5b22d50
Merge branch 'dev' into bypass403-diff-bug
liquidsec Feb 4, 2024
2193fe5
Merge pull request #1059 from blacklanternsecurity/bypass403-diff-bug
liquidsec Feb 5, 2024
66a33f9
Now using helpers.request
stryker2k2 Feb 5, 2024
6fe98a7
truncate human output to prevent blockingioerror
TheTechromancer Feb 5, 2024
b427b17
fix truncate string bug
TheTechromancer Feb 5, 2024
e980afd
log bbot version, start time, and full command at the beginning of ev…
TheTechromancer Feb 6, 2024
738b7af
fix rare telerik bug
TheTechromancer Feb 6, 2024
0c896e2
Fix rare postman error
TheTechromancer Feb 6, 2024
ac53b32
Merge pull request #1065 from blacklanternsecurity/log-bbot-version
TheTechromancer Feb 6, 2024
553cb8b
fix syntax error
TheTechromancer Feb 6, 2024
d8a6418
don't create asyncio tasks for dns stuff
TheTechromancer Feb 2, 2024
ce75405
fixed resolve_batch bug
TheTechromancer Feb 2, 2024
60e095f
multiprocessize collapse_url
TheTechromancer Feb 2, 2024
b6babc7
logging for wildcards
TheTechromancer Feb 2, 2024
a060815
make sure things are awaited
TheTechromancer Feb 2, 2024
0e6254e
fix bug in dns.py
TheTechromancer Feb 2, 2024
bf539b3
flaked
TheTechromancer Feb 2, 2024
19fe685
fix rare dns bug, verbosify abort_if
TheTechromancer Feb 2, 2024
126e39b
limit anubisdb due to excessive garbage results
TheTechromancer Feb 2, 2024
99042a8
clean up code
TheTechromancer Feb 2, 2024
9c92e93
blacked
TheTechromancer Feb 2, 2024
43133a1
remove custom cache, use cachetools
TheTechromancer Feb 2, 2024
d2fbaf5
increase max dnscommonsrv handlers, small masscan bugfix
TheTechromancer Feb 2, 2024
2958a3b
massdns speed optimizations
TheTechromancer Feb 3, 2024
fd984cd
dnscommonsrv rework, spellchecking
TheTechromancer Feb 3, 2024
d32d98d
fix tests
TheTechromancer Feb 3, 2024
d11ad06
fix scope accuracy tests
TheTechromancer Feb 3, 2024
5da0e43
just telerik things
TheTechromancer Feb 4, 2024
834ed0c
increase dnscommonsrv threads
TheTechromancer Feb 4, 2024
9bbd6d4
limit massdns brute force depth
TheTechromancer Feb 4, 2024
cab606d
small wildcard tweak
TheTechromancer Feb 4, 2024
bca67d8
internetdb speed optimization
TheTechromancer Feb 4, 2024
ed36be5
massdns tweaks
TheTechromancer Feb 5, 2024
d89cda2
fix internetdb bug
TheTechromancer Feb 5, 2024
4be75af
fix \s warning
TheTechromancer Feb 5, 2024
1c5a234
increase massdns qsize
TheTechromancer Feb 5, 2024
86c0171
increase qsize for speculate and excavate
TheTechromancer Feb 6, 2024
e02c686
log version command: verbose() --> trace()
TheTechromancer Feb 6, 2024
e9cb4fd
allow independent http/dns debugging (without needing -d)
TheTechromancer Feb 6, 2024
f540811
Added/Fixed Newsletters Tests; which added Newsletters to the Docs
stryker2k2 Feb 6, 2024
923c3cb
Undo 'usage: pytest' and fix endline in Newsletter
stryker2k2 Feb 6, 2024
3ff3572
Fixed endline
stryker2k2 Feb 6, 2024
bfba3bf
Merge pull request #1067 from blacklanternsecurity/postman-bugfix
TheTechromancer Feb 6, 2024
7cdab23
Merge pull request #1066 from blacklanternsecurity/telerik-bugfix
TheTechromancer Feb 6, 2024
e73196c
run_tests, black, lint, etc
stryker2k2 Feb 6, 2024
12451d0
better bypass403 error handling
liquidsec Feb 6, 2024
1da63d2
remove testing code
liquidsec Feb 6, 2024
3ab53d0
use better sqlite text factory
TheTechromancer Feb 6, 2024
bfef473
fix trace
TheTechromancer Feb 6, 2024
d60f645
Merge pull request #1070 from blacklanternsecurity/bypass403-errors
liquidsec Feb 7, 2024
0038030
Slimmed down module and using [FINDING] now
stryker2k2 Feb 7, 2024
88dc334
Merged dev -> newsletters
stryker2k2 Feb 7, 2024
161ec0a
black & remove unused variable
stryker2k2 Feb 7, 2024
2f788d7
default qsize --> 1000, unlimited qsize for speculate & excavate
TheTechromancer Feb 7, 2024
b57e914
Added log to base.py, added await self.emit_event, fixed test to look…
stryker2k2 Feb 7, 2024
a8f53a0
black and code cleanup
stryker2k2 Feb 7, 2024
eccb7a9
Test now compares to 'host' or 'url'
stryker2k2 Feb 7, 2024
0ec10c7
make sure gowitness has a working chrome install
TheTechromancer Feb 7, 2024
e1e03ed
Merge pull request #1073 from blacklanternsecurity/gowitness-bugfix
TheTechromancer Feb 7, 2024
d9efdc6
fix typo
TheTechromancer Feb 7, 2024
d37c0a3
use full binary path
TheTechromancer Feb 7, 2024
49b4f36
Merge pull request #1076 from blacklanternsecurity/gowitness-chromium…
TheTechromancer Feb 8, 2024
f498a97
removing weird characters from docs
liquidsec Feb 8, 2024
1a0ebf2
making nuclei mode case insensitive
liquidsec Feb 8, 2024
159ef6e
Merge pull request #1077 from blacklanternsecurity/weird-docs-chars
TheTechromancer Feb 8, 2024
bb7a55c
Refined Newsletter Test, Updated Poetry, Ran Black
stryker2k2 Feb 8, 2024
0c13422
Ran Flake8 & Created lint-tests.sh
stryker2k2 Feb 8, 2024
040f72e
Newline & Remove 'logging'
stryker2k2 Feb 8, 2024
1466be3
Set Newsletter to 'active' and removed lint-tests
stryker2k2 Feb 9, 2024
8411acb
Removed lint-tests
stryker2k2 Feb 9, 2024
0e34a80
Merge branch 'dev' into newsletters
stryker2k2 Feb 9, 2024
ae25d8a
fix aioconsole bug
TheTechromancer Feb 9, 2024
c151411
more aioconsole bugfixing
TheTechromancer Feb 9, 2024
381f12a
fixed console logic
TheTechromancer Feb 9, 2024
9498117
remove unneeded cancel logic
TheTechromancer Feb 9, 2024
a1d4f0d
flaked
TheTechromancer Feb 9, 2024
cb182de
Merge pull request #1072 from blacklanternsecurity/newsletters
TheTechromancer Feb 9, 2024
75d31cd
Refresh module docs
blsaccess Feb 9, 2024
7a6a4d5
Added BeautifulSoup Helper - Work in Progress
stryker2k2 Feb 9, 2024
9d24e30
adding more possible ajax endpoints
liquidsec Feb 12, 2024
9a0a058
black
liquidsec Feb 12, 2024
36817d8
removing debug statement
liquidsec Feb 12, 2024
7ec6e9f
debug --> verbose for batch event handling
TheTechromancer Feb 12, 2024
07eea20
keyboard listen logic fix
TheTechromancer Feb 12, 2024
29dce2f
debug massdns mutations
TheTechromancer Feb 12, 2024
a91fc43
don't dedup DNS child events
TheTechromancer Feb 13, 2024
e2d72f6
Merge pull request #1084 from blacklanternsecurity/ajaxpro_tweak
liquidsec Feb 13, 2024
281b9c1
Merge pull request #1086 from blacklanternsecurity/dns-dedup-bugfix
TheTechromancer Feb 13, 2024
ce95ce8
add debug statements for mutations
TheTechromancer Feb 13, 2024
e4db934
don't follow redirects in wafw00f
TheTechromancer Feb 13, 2024
e952e7f
Merge pull request #1089 from blacklanternsecurity/wafw00f-noredirect
TheTechromancer Feb 14, 2024
28f24ac
restore wildcard rdtype optimization
TheTechromancer Feb 14, 2024
d506409
Merge pull request #1051 from blacklanternsecurity/speed-optimizations
TheTechromancer Feb 14, 2024
92b563b
Refresh module docs
blsaccess Feb 14, 2024
205697b
Replace BeautifulSoup with the new 'helpers.beautifulsoup()'
stryker2k2 Feb 15, 2024
d00a0f8
black & flake8
stryker2k2 Feb 15, 2024
625d2ca
Added BeautifulSoup Web Helper Test
stryker2k2 Feb 15, 2024
c51e059
add socksio
TheTechromancer Feb 15, 2024
6ce4d75
Merge branch 'dev' into beautifulsoup
stryker2k2 Feb 15, 2024
138fa11
Merge pull request #1094 from blacklanternsecurity/socks-proxy
TheTechromancer Feb 15, 2024
497e5bb
Merged Dev & removed 'deps_pip'
stryker2k2 Feb 15, 2024
7fa7140
Updated download count badge
ooooo-create Feb 16, 2024
5682abd
use pepy for badge
ooooo-create Feb 16, 2024
1dd0c17
Merge pull request #1093 from blacklanternsecurity/beautifulsoup
TheTechromancer Feb 16, 2024
0bf7957
handle SOCKS error
TheTechromancer Feb 16, 2024
dedb8cc
fix interactsh bug with custom server
TheTechromancer Feb 16, 2024
e870cff
stringify custom server
TheTechromancer Feb 16, 2024
25e5390
Merge pull request #1098 from blacklanternsecurity/fix-socksio-error
TheTechromancer Feb 16, 2024
3c5f9e4
separate different colors
ooooo-create Feb 17, 2024
2109891
Merge branch 'dev' of https://github.com/blacklanternsecurity/bbot in…
ooooo-create Feb 17, 2024
b7f21e8
Merge pull request #1100 from blacklanternsecurity/interactsh-fix
TheTechromancer Feb 17, 2024
6f06a18
Merge pull request #1095 from ooooo-create/update_download_count_badge
TheTechromancer Feb 17, 2024
51a01e2
add siem_friendly option to http output module
TheTechromancer Feb 17, 2024
6d41eea
fix tests
TheTechromancer Feb 17, 2024
f7bdaba
Add splunk.py output module
w0Tx Feb 14, 2024
5f7596e
Add doc for splunk output module
w0Tx Feb 14, 2024
a4f030d
splunk tests
TheTechromancer Feb 17, 2024
4b94b75
updated docs
TheTechromancer Feb 17, 2024
2e70522
add output module list in README
TheTechromancer Feb 18, 2024
6967bce
update output module docs
TheTechromancer Feb 18, 2024
cb085d4
clarify targets in docs
TheTechromancer Feb 19, 2024
ff39b8d
Merge pull request #1103 from blacklanternsecurity/better-target-docs
TheTechromancer Feb 20, 2024
eca060b
Merge pull request #1101 from blacklanternsecurity/http-siem-friendly
TheTechromancer Feb 20, 2024
307f913
Refresh module docs
blsaccess Feb 20, 2024
069ecff
Merge pull request #1091 from w0Tx/output-splunk
TheTechromancer Feb 20, 2024
65907a3
Refresh module docs
blsaccess Feb 20, 2024
7a9428a
1.1.6 release notes
liquidsec Feb 21, 2024
28cb6e3
whitespace
liquidsec Feb 21, 2024
6d4151c
Merge pull request #1107 from blacklanternsecurity/v1.1.6-prerelease
liquidsec Feb 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dependabot.yml → .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ updates:
directory: "/"
schedule:
interval: "weekly"
target-branch: "dev"
open-pull-requests-limit: 10
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ For a full list of modules, including the data types consumed and emitted by eac
| passive | 57 | Never connects to target systems | affiliates, aggregate, anubisdb, asn, azure_realm, azure_tenant, bevigil, binaryedge, bucket_file_enum, builtwith, c99, censys, certspotter, chaos, columbus, credshed, crobat, crt, dehashed, digitorus, dnscommonsrv, dnsdumpster, emailformat, excavate, fullhunt, github_codesearch, github_org, hackertarget, hunterio, internetdb, ip2location, ipneighbor, ipstack, leakix, massdns, myssl, nsec, otx, passivetotal, pgp, postman, rapiddns, riddler, securitytrails, shodan_dns, sitedossier, skymem, social, speculate, subdomaincenter, sublist3r, threatminer, urlscan, viewdns, virustotal, wayback, zoomeye |
| subdomain-enum | 47 | Enumerates subdomains | anubisdb, asn, azure_realm, azure_tenant, bevigil, binaryedge, builtwith, c99, censys, certspotter, chaos, columbus, crt, digitorus, dnscommonsrv, dnsdumpster, dnszonetransfer, fullhunt, github_codesearch, github_org, hackertarget, httpx, hunterio, internetdb, ipneighbor, leakix, massdns, myssl, nsec, oauth, otx, passivetotal, postman, rapiddns, riddler, securitytrails, shodan_dns, sitedossier, sslcert, subdomain_hijack, subdomaincenter, subdomains, threatminer, urlscan, virustotal, wayback, zoomeye |
| active | 39 | Makes active connections to target systems | ajaxpro, badsecrets, bucket_amazon, bucket_azure, bucket_digitalocean, bucket_firebase, bucket_google, bypass403, dastardly, dnszonetransfer, ffuf, ffuf_shortnames, filedownload, fingerprintx, generic_ssrf, git, gowitness, host_header, httpx, hunt, iis_shortnames, masscan, nmap, ntlm, nuclei, oauth, paramminer_cookies, paramminer_getparams, paramminer_headers, robots, secretsdb, smuggler, sslcert, subdomain_hijack, telerik, url_manipulation, vhost, wafw00f, wappalyzer |
| web-thorough | 26 | More advanced web scanning functionality | ajaxpro, badsecrets, bucket_amazon, bucket_azure, bucket_digitalocean, bucket_firebase, bucket_google, bypass403, dastardly, ffuf_shortnames, generic_ssrf, git, host_header, httpx, hunt, iis_shortnames, nmap, ntlm, robots, secretsdb, smuggler, sslcert, subdomain_hijack, telerik, url_manipulation, wappalyzer |
| web-thorough | 29 | More advanced web scanning functionality | ajaxpro, azure_realm, badsecrets, bucket_amazon, bucket_azure, bucket_digitalocean, bucket_firebase, bucket_google, bypass403, dastardly, ffuf_shortnames, filedownload, generic_ssrf, git, host_header, httpx, hunt, iis_shortnames, nmap, ntlm, oauth, robots, secretsdb, smuggler, sslcert, subdomain_hijack, telerik, url_manipulation, wappalyzer |
| aggressive | 19 | Generates a large amount of network traffic | bypass403, dastardly, ffuf, ffuf_shortnames, generic_ssrf, host_header, ipneighbor, masscan, massdns, nmap, nuclei, paramminer_cookies, paramminer_getparams, paramminer_headers, smuggler, telerik, url_manipulation, vhost, wafw00f |
| web-basic | 17 | Basic, non-intrusive web scan functionality | azure_realm, badsecrets, bucket_amazon, bucket_azure, bucket_firebase, bucket_google, filedownload, git, httpx, iis_shortnames, ntlm, oauth, robots, secretsdb, sslcert, subdomain_hijack, wappalyzer |
| cloud-enum | 11 | Enumerates cloud resources | azure_realm, azure_tenant, bucket_amazon, bucket_azure, bucket_digitalocean, bucket_file_enum, bucket_firebase, bucket_google, httpx, oauth, subdomain_hijack |
Expand Down
51 changes: 47 additions & 4 deletions bbot/core/event/base.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import re
import json
import asyncio
import logging
Expand All @@ -6,25 +7,28 @@
from typing import Optional
from datetime import datetime
from contextlib import suppress
from urllib.parse import urljoin
from pydantic import BaseModel, field_validator

from .helpers import *
from bbot.core.errors import *
from bbot.core.helpers import (
extract_words,
split_host_port,
get_file_extension,
host_in_host,
is_domain,
is_subdomain,
is_ip,
is_ptr,
is_uri,
domain_stem,
make_netloc,
make_ip_type,
recursive_decode,
smart_decode,
get_file_extension,
validators,
split_host_port,
tagify,
validators,
)


Expand Down Expand Up @@ -866,6 +870,8 @@ def _words(self):


class URL_UNVERIFIED(BaseEvent):
_status_code_regex = re.compile(r"^status-(\d{1,3})$")

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.web_spider_distance = getattr(self.source, "web_spider_distance", 0)
Expand Down Expand Up @@ -921,6 +927,14 @@ def _data_id(self):
data = "spider-danger" + data
return data

@property
def http_status(self):
for t in self.tags:
match = self._status_code_regex.match(t)
if match:
return int(match.groups()[0])
return 0


class URL(URL_UNVERIFIED):
def sanitize_data(self, data):
Expand Down Expand Up @@ -973,7 +987,7 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# count number of consecutive redirects
self.num_redirects = getattr(self.source, "num_redirects", 0)
if str(self.data.get("status_code", 0)).startswith("3"):
if str(self.http_status).startswith("3"):
self.num_redirects += 1

def sanitize_data(self, data):
Expand Down Expand Up @@ -1001,6 +1015,34 @@ def _words(self):
def _pretty_string(self):
return f'{self.data["hash"]["header_mmh3"]}:{self.data["hash"]["body_mmh3"]}'

@property
def http_status(self):
try:
return int(self.data.get("status_code", 0))
except (ValueError, TypeError):
return 0

@property
def http_title(self):
http_title = self.data.get("title", "")
try:
return recursive_decode(http_title)
except Exception:
return http_title

@property
def redirect_location(self):
location = self.data.get("location", "")
# if it's a redirect
if location:
# get the url scheme
scheme = is_uri(location, return_scheme=True)
# if there's no scheme (i.e. it's a relative redirect)
if not scheme:
# then join the location with the current url
location = urljoin(self.parsed.geturl(), location)
return location


class VULNERABILITY(DictHostEvent):
_always_emit = True
Expand Down Expand Up @@ -1123,6 +1165,7 @@ class SOCIAL(DictEvent):

class WEBSCREENSHOT(DictHostEvent):
_always_emit = True
_quick_emit = True


class AZURE_TENANT(DictEvent):
Expand Down
19 changes: 10 additions & 9 deletions bbot/core/helpers/async_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,33 +57,34 @@ def __init__(self):

@property
def value(self):
return len(self.tasks)
return sum([t.n for t in self.tasks.values()])

def count(self, task_name, _log=True):
def count(self, task_name, n=1, _log=True):
if callable(task_name):
task_name = f"{task_name.__qualname__}()"
return self.Task(self, task_name, _log)
return self.Task(self, task_name, n=n, _log=_log)

class Task:
def __init__(self, manager, task_name, _log=True):
def __init__(self, manager, task_name, n=1, _log=True):
self.manager = manager
self.task_name = task_name
self.task_id = None
self.start_time = None
self.log = _log
self.n = n

async def __aenter__(self):
self.task_id = uuid.uuid4() # generate a unique ID for the task
self.task_id = uuid.uuid4()
# if self.log:
# log.trace(f"Starting task {self.task_name} ({self.task_id})")
async with self.manager.lock: # acquire the lock
async with self.manager.lock:
self.start_time = datetime.now()
self.manager.tasks[self.task_id] = self
return self.task_id # this will be passed as 'task_id' to __aexit__
return self

async def __aexit__(self, exc_type, exc_val, exc_tb):
async with self.manager.lock: # acquire the lock
self.manager.tasks.pop(self.task_id, None) # remove only current task
async with self.manager.lock:
self.manager.tasks.pop(self.task_id, None)
# if self.log:
# log.trace(f"Finished task {self.task_name} ({self.task_id})")

Expand Down
4 changes: 2 additions & 2 deletions bbot/core/helpers/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ def __init__(self, config, scan=None):
# cloud helpers
self.cloud = CloudHelper(self)

def interactsh(self):
return Interactsh(self)
def interactsh(self, *args, **kwargs):
return Interactsh(self, *args, **kwargs)

def http_compare(self, url, allow_redirects=False, include_cache_buster=True):
return HttpCompare(url, self, allow_redirects=allow_redirects, include_cache_buster=include_cache_buster)
Expand Down
7 changes: 5 additions & 2 deletions bbot/core/helpers/interactsh.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,13 @@ class Interactsh:
```
"""

def __init__(self, parent_helper):
def __init__(self, parent_helper, poll_interval=10):
self.parent_helper = parent_helper
self.server = None
self.correlation_id = None
self.custom_server = self.parent_helper.config.get("interactsh_server", None)
self.token = self.parent_helper.config.get("interactsh_token", None)
self.poll_interval = poll_interval
self._poll_task = None

async def register(self, callback=None):
Expand Down Expand Up @@ -234,6 +235,8 @@ async def poll(self):
r = await self.parent_helper.request(
f"https://{self.server}/poll?id={self.correlation_id}&secret={self.secret}", headers=headers
)
if r is None:
raise InteractshError("Error polling interact.sh: No response from server")

ret = []
data_list = r.json().get("data", None)
Expand Down Expand Up @@ -279,7 +282,7 @@ async def _poll_loop(self, callback):
log.warning(e)
log.trace(traceback.format_exc())
if not data_list:
await asyncio.sleep(10)
await asyncio.sleep(self.poll_interval)
continue
for data in data_list:
if data:
Expand Down
48 changes: 48 additions & 0 deletions bbot/core/helpers/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,50 @@ def url_parents(u):
u = parent


def best_http_status(code1, code2):
"""
Determine the better HTTP status code between two given codes.

The 'better' status code is considered based on typical usage and priority in HTTP communication.
Lower codes are generally better than higher codes. Within the same class (e.g., 2xx), a lower code is better.
Between different classes, the order of preference is 2xx > 3xx > 1xx > 4xx > 5xx.

Args:
code1 (int): The first HTTP status code.
code2 (int): The second HTTP status code.

Returns:
int: The better HTTP status code between the two provided codes.

Examples:
>>> better_http_status(200, 404)
200
>>> better_http_status(500, 400)
400
>>> better_http_status(301, 302)
301
"""

# Classify the codes into their respective categories (1xx, 2xx, 3xx, 4xx, 5xx)
def classify_code(code):
return int(code) // 100

class1 = classify_code(code1)
class2 = classify_code(code2)

# Priority order for classes
priority_order = {2: 1, 3: 2, 1: 3, 4: 4, 5: 5}

# Compare based on class priority
p1 = priority_order.get(class1, 10)
p2 = priority_order.get(class2, 10)
if p1 != p2:
return code1 if p1 < p2 else code2

# If in the same class, the lower code is better
return min(code1, code2)


def tldextract(data):
"""
Extracts the subdomain, domain, and suffix from a URL string.
Expand Down Expand Up @@ -1121,6 +1165,8 @@ def chain_lists(l, try_files=False, msg=None, remove_blank=True):
This function takes a list `l` and flattens it by splitting its entries on commas.
It also allows you to optionally open entries as files and add their contents to the list.

The order of entries is preserved, and deduplication is performed automatically.

Args:
l (list): The list of strings to chain together.
try_files (bool, optional): Whether to try to open entries as files. Defaults to False.
Expand All @@ -1137,6 +1183,8 @@ def chain_lists(l, try_files=False, msg=None, remove_blank=True):
>>> chain_lists(["a,file.txt", "c,d"], try_files=True)
['a', 'f_line1', 'f_line2', 'f_line3', 'c', 'd']
"""
if isinstance(l, str):
l = [l]
final_list = dict()
for entry in l:
for s in entry.split(","):
Expand Down
4 changes: 4 additions & 0 deletions bbot/core/helpers/names_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@
"ashley",
"audrey",
"austin",
"azathoth",
"baggins",
"bailey",
"barbara",
Expand Down Expand Up @@ -347,8 +348,10 @@
"courtney",
"craig",
"crystal",
"cthulu",
"curtis",
"cynthia",
"dagon",
"dale",
"dandelion",
"daniel",
Expand Down Expand Up @@ -554,6 +557,7 @@
"noah",
"norma",
"norman",
"nyarlathotep",
"obama",
"olivia",
"padme",
Expand Down
4 changes: 2 additions & 2 deletions bbot/modules/ajaxpro.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ async def handle_event(self, event):
probe_confirm = await self.helpers.request(f"{event.data}a/whatever.ashx")
if probe_confirm:
if probe_confirm.status_code != 200:
self.emit_event(
await self.emit_event(
{
"host": str(event.host),
"url": event.data,
Expand All @@ -40,7 +40,7 @@ async def handle_event(self, event):
ajaxpro_regex_result = self.ajaxpro_regex.search(resp_body)
if ajaxpro_regex_result:
ajax_pro_path = ajaxpro_regex_result.group(0)
self.emit_event(
await self.emit_event(
{
"host": str(event.host),
"url": event.data["url"],
Expand Down
4 changes: 2 additions & 2 deletions bbot/modules/azure_realm.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
class azure_realm(BaseModule):
watched_events = ["DNS_NAME"]
produced_events = ["URL_UNVERIFIED"]
flags = ["affiliates", "subdomain-enum", "cloud-enum", "web-basic", "passive", "safe"]
flags = ["affiliates", "subdomain-enum", "cloud-enum", "web-basic", "web-thorough", "passive", "safe"]
meta = {"description": 'Retrieves the "AuthURL" from login.microsoftonline.com/getuserrealm'}

async def setup(self):
Expand All @@ -22,7 +22,7 @@ async def handle_event(self, event):
auth_url, "URL_UNVERIFIED", source=event, tags=["affiliate", "ms-auth-url"]
)
url_event.source_domain = domain
self.emit_event(url_event)
await self.emit_event(url_event)

async def getuserrealm(self, domain):
url = f"https://login.microsoftonline.com/getuserrealm.srf?login=test@{domain}"
Expand Down
4 changes: 2 additions & 2 deletions bbot/modules/azure_tenant.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async def handle_event(self, event):
self.verbose(f'Found {len(domains):,} domains under tenant for "{query}": {", ".join(sorted(domains))}')
for domain in domains:
if domain != query:
self.emit_event(domain, "DNS_NAME", source=event, tags=["affiliate", "azure-tenant"])
await self.emit_event(domain, "DNS_NAME", source=event, tags=["affiliate", "azure-tenant"])
# tenant names
if domain.lower().endswith(".onmicrosoft.com"):
tenantname = domain.split(".")[0].lower()
Expand All @@ -44,7 +44,7 @@ async def handle_event(self, event):
event_data = {"tenant-names": sorted(tenant_names), "domains": sorted(domains)}
if tenant_id is not None:
event_data["tenant-id"] = tenant_id
self.emit_event(event_data, "AZURE_TENANT", source=event)
await self.emit_event(event_data, "AZURE_TENANT", source=event)

async def query(self, domain):
url = f"{self.base_url}/autodiscover/autodiscover.svc"
Expand Down
Loading
Loading