Skip to content

Add Lightfuzz #1817

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

Merged
merged 480 commits into from
Apr 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
480 commits
Select commit Hold shift + click to select a range
8f2e1bd
sync with dev
liquidsec Nov 5, 2024
2c13f63
Merge branch 'dev' into lightfuzz
liquidsec Nov 20, 2024
ffb98cf
black
liquidsec Nov 20, 2024
595e708
poetry.lock update
liquidsec Nov 20, 2024
9ab77f0
fix tests
liquidsec Nov 21, 2024
c7166ca
Merge branch 'dev' into lightfuzz
liquidsec Nov 21, 2024
7726ed2
Merge branch 'dev' into lightfuzz
liquidsec Nov 21, 2024
6caedf1
dev to lightfuzz sync
liquidsec Nov 25, 2024
39b6ee1
making lightfuzz presets more explicit
liquidsec Nov 26, 2024
50f25bf
initial lightfuzz docs
liquidsec Nov 26, 2024
c90b0e2
readme adjust
liquidsec Nov 26, 2024
0dbc50c
merge from dev
liquidsec Nov 26, 2024
09c3553
exception for assert not in tests
liquidsec Nov 26, 2024
f756241
ruff
liquidsec Nov 26, 2024
306aea3
Merge branch 'dev' into lightfuzz
liquidsec Nov 26, 2024
11a2847
preset whitespace
liquidsec Nov 27, 2024
d774c40
regex tweaks
liquidsec Nov 27, 2024
7f49a9d
adding test for select tags
liquidsec Nov 27, 2024
7c5d8bb
tests passing
invalid-email-address Nov 27, 2024
197e60f
fix conflict
invalid-email-address Nov 27, 2024
ba4dcf4
lint
invalid-email-address Nov 27, 2024
708b1c2
remove dead code
invalid-email-address Nov 27, 2024
b6f2fbc
comment
invalid-email-address Nov 27, 2024
97dd33b
fix tests
invalid-email-address Nov 28, 2024
f82db7c
regex and other tweaks
liquidsec Nov 28, 2024
39dfd5a
i literally spent FOUR HOURS ON THIS BUG :( :( :(
liquidsec Nov 28, 2024
aa50a68
adding default blacklist to lightfuzz presets
liquidsec Nov 28, 2024
285da0b
ssti submodule tweak
liquidsec Nov 28, 2024
7030d6c
may this bug be vanquished for all of eternity
liquidsec Nov 28, 2024
a9206fb
Merge branch 'lightfuzz' into classify-envelopes
liquidsec Nov 28, 2024
422aabf
additional ssti signature
liquidsec Nov 29, 2024
9495586
Merge branch 'lightfuzz' into classify-envelopes
liquidsec Nov 29, 2024
9f34c83
adding new envelope multiple test
liquidsec Nov 29, 2024
15b3b8c
envelope bug fixes / enhancements
liquidsec Nov 29, 2024
2cd8877
remove debug
liquidsec Nov 29, 2024
8f3f09c
variable name
liquidsec Nov 30, 2024
46c10f1
Merge pull request #2045 from blacklanternsecurity/lightfuzz-crypto-r…
liquidsec Nov 30, 2024
8ff02cb
stringifying all original values
liquidsec Nov 30, 2024
c538478
Revert "stringifying all original values"
liquidsec Nov 30, 2024
047e090
ensuring original_value is str
liquidsec Dec 3, 2024
8f48412
fix?
invalid-email-address Dec 5, 2024
c43264e
Merge pull request #2043 from blacklanternsecurity/classify-envelopes
liquidsec Dec 18, 2024
0e553ae
Merge branch 'dev' into lightfuzz
liquidsec Dec 18, 2024
f4db10e
Merge branch 'dev' into lightfuzz
liquidsec Dec 18, 2024
2782eeb
adding form actions XSS detect, fixing parameter extraction bugs, dep…
liquidsec Dec 18, 2024
92c4787
deps conflict resolution
liquidsec Dec 18, 2024
70cd873
remove debug msg
liquidsec Dec 18, 2024
c6c2096
better handling of malformed url errors during parameter extraction
liquidsec Dec 19, 2024
c72e5ce
Merge branch 'dev' into lightfuzz
liquidsec Dec 20, 2024
3d9a00c
update poetry.lock
liquidsec Dec 20, 2024
1866e9b
dev to lightfuzz sync
liquidsec Jan 10, 2025
b1dea6a
Merge branch 'dev' into lightfuzz
liquidsec Jan 12, 2025
e4a0733
parameter blist updates
liquidsec Jan 13, 2025
82c0435
Merge branch 'lightfuzz' into parameter-blacklist-changes
liquidsec Jan 13, 2025
e3ab779
reduce false postives with canary probe
liquidsec Jan 13, 2025
e23895a
changing comments
liquidsec Jan 13, 2025
01d1bcb
fixing tests
liquidsec Jan 13, 2025
c98218d
adding support for all parameter types
liquidsec Jan 13, 2025
6d403d8
tests for all parameter types
liquidsec Jan 13, 2025
3cde353
fix test
liquidsec Jan 13, 2025
e87e44b
comment cleanup
liquidsec Jan 13, 2025
df23efb
Merge pull request #2167 from blacklanternsecurity/parameter-blacklis…
liquidsec Jan 14, 2025
6433475
Merge pull request #2168 from blacklanternsecurity/lightfuzz-reflecte…
liquidsec Jan 14, 2025
e333a2b
fixed 'escaping the escape' xss technique false positives, added test…
liquidsec Jan 14, 2025
7cca3dd
asyncifying re.search calls
liquidsec Jan 14, 2025
5b55b4c
remove unnecessary test variables
liquidsec Jan 14, 2025
2e9304a
Merge branch 'dev' into lightfuzz
liquidsec Jan 14, 2025
defb106
regex optimization
liquidsec Jan 14, 2025
1d69166
update poetry.lock
liquidsec Jan 14, 2025
9d158b6
Merge branch 'lightfuzz' into lightfuzz-javascript-quote-context
liquidsec Jan 14, 2025
ab005d5
update poetry.lock
liquidsec Jan 14, 2025
a8469c6
Merge pull request #2173 from blacklanternsecurity/lightfuzz-javascri…
liquidsec Jan 14, 2025
3216110
reducing serial submodule FP's, allowing validated original values to…
liquidsec Jan 15, 2025
558d909
fix test
liquidsec Jan 15, 2025
282f268
improved extraction of textarea parameters, additional tests for seri…
liquidsec Jan 15, 2025
58d3f98
refector base64/hex checks within lightfuzz + tests
liquidsec Jan 15, 2025
c0c9fd5
adding baseline retry mechanism to serial
liquidsec Jan 16, 2025
b279560
excavate code hygiene
liquidsec Jan 16, 2025
b2ce466
Merge branch 'dev' into lightfuzz
liquidsec Jan 16, 2025
386c980
Merge branch 'lightfuzz' into excavate-parameter-refactor
liquidsec Jan 16, 2025
e1a3431
Merge branch 'lightfuzz' into lightfuzz-deserialize-fp-fix
liquidsec Jan 16, 2025
3db67ee
removing unused code
liquidsec Jan 16, 2025
3227aa4
fixing issue with parameter_extraction option not preventing WEB_PARA…
liquidsec Jan 16, 2025
fae0ec7
updating lightfuzz presets
liquidsec Jan 17, 2025
498818f
docs update
liquidsec Jan 17, 2025
9471a23
poetry.lock
liquidsec Jan 17, 2025
d14386f
comments!
liquidsec Jan 17, 2025
7ea7654
Merge branch 'lightfuzz' into lightfuzz-commentpalooza
liquidsec Jan 17, 2025
723a3e2
we were testing to ensure a bug was there :O
liquidsec Jan 17, 2025
d495131
rename test
liquidsec Jan 17, 2025
177b255
Merge branch 'lightfuzz-commentpalooza' of https://github.com/blackla…
liquidsec Jan 17, 2025
1a40622
Merge branch 'dev' into lightfuzz
liquidsec Jan 21, 2025
48ce021
poetry.lock update
liquidsec Jan 22, 2025
484188e
Merge branch 'lightfuzz' of https://github.com/blacklanternsecurity/b…
liquidsec Jan 22, 2025
9a43ff4
poetry.lock update
liquidsec Jan 22, 2025
9f3b6d9
Merge branch 'dev' into lightfuzz
liquidsec Jan 22, 2025
b86dbf5
adding conditional url-encoding, fixing xml parameter extraction bug
liquidsec Jan 23, 2025
3d550ad
fix test
liquidsec Jan 23, 2025
1f86143
nuking debug junk
liquidsec Jan 23, 2025
4e8cbca
Merge pull request #2181 from blacklanternsecurity/excavate-parameter…
liquidsec Jan 23, 2025
ba8b4f5
Merge branch 'lightfuzz' into lightfuzz-deserialize-fp-fix
liquidsec Jan 23, 2025
ef3b3cd
Merge branch 'lightfuzz' into lightfuzz-commentpalooza
liquidsec Jan 23, 2025
6a0fe3a
conditional spider warning
liquidsec Jan 23, 2025
bb85917
fix whitespace
liquidsec Jan 23, 2025
add8494
Merge pull request #2189 from blacklanternsecurity/lightfuzz-commentp…
liquidsec Jan 23, 2025
45aa274
remove blacklist
liquidsec Jan 23, 2025
ddeab09
poetry.lock update
liquidsec Jan 23, 2025
c4ed8ac
Merge branch 'lightfuzz' into lightfuzz-deserialize-fp-fix
liquidsec Jan 23, 2025
69d5bc3
Merge branch 'lightfuzz' into lightfuzz-portfilter
liquidsec Jan 23, 2025
5d25a95
Merge pull request #2187 from blacklanternsecurity/lightfuzz-portfilter
liquidsec Jan 23, 2025
cbb329a
Merge branch 'lightfuzz' into lightfuzz-deserialize-fp-fix
liquidsec Jan 23, 2025
b3bad4e
Merge branch 'lightfuzz' into lightfuzz-conditional-encoding
liquidsec Jan 23, 2025
9d87fef
Merge pull request #2204 from blacklanternsecurity/lightfuzz-conditio…
liquidsec Jan 23, 2025
7772f3d
Merge branch 'lightfuzz' into lightfuzz-deserialize-fp-fix
liquidsec Jan 23, 2025
5421a68
docstring, cleanup for serial lightfuzz module
invalid-email-address Jan 23, 2025
928500d
Merge pull request #2176 from blacklanternsecurity/lightfuzz-deserial…
liquidsec Jan 23, 2025
2c3b29e
Merge branch 'dev' into lightfuzz
liquidsec Jan 24, 2025
1d6ebb3
poetry lock
liquidsec Jan 24, 2025
d9a245d
correctly handling HttpCompare errors
liquidsec Jan 24, 2025
fccbec7
cleaner implementation
liquidsec Jan 24, 2025
9aa3c0d
ruff format
liquidsec Jan 24, 2025
e0a762f
fixing additional params bug + adding tests
liquidsec Jan 24, 2025
557075b
Merge pull request #2213 from blacklanternsecurity/lightfuzz-serial-h…
liquidsec Jan 24, 2025
e49afbb
defragmenting additional_params code
liquidsec Jan 24, 2025
80c1bc1
defragmenting additional_params code
liquidsec Jan 24, 2025
d44f42c
Merge branch 'lightfuzz' into lightfuzz-additional-params-fix
liquidsec Jan 24, 2025
9419cb9
Merge branch 'lightfuzz-additional-params-fix' into lightfuzz-nosql
liquidsec Jan 24, 2025
3abff4b
Merge pull request #2215 from blacklanternsecurity/lightfuzz-addition…
liquidsec Jan 24, 2025
0e57f4e
Merge branch 'dev' into lightfuzz
liquidsec Jan 25, 2025
53532e9
poetry lock
liquidsec Jan 25, 2025
72f989a
ruff format
liquidsec Jan 25, 2025
ddd7b1f
Merge branch 'dev' into lightfuzz
liquidsec Jan 25, 2025
a5bc6af
Merge branch 'dev' into lightfuzz
liquidsec Jan 28, 2025
9e1da33
Merge branch 'lightfuzz' into lightfuzz-nosql
liquidsec Feb 3, 2025
62041ae
lightfuzz refactor
liquidsec Feb 5, 2025
4df8c1d
clean up
liquidsec Feb 5, 2025
29300ae
nosqli submodule initial
liquidsec Feb 5, 2025
35eac1d
bug fixes, tests for nosqli submodule
liquidsec Feb 5, 2025
4c0d02c
adding custom lightfuzz log handler
liquidsec Feb 5, 2025
f36cf5c
Merge branch 'dev' into lightfuzz
liquidsec Feb 6, 2025
f7c5e49
Merge branch 'lightfuzz' into lightfuzz-nosql
liquidsec Feb 8, 2025
eb8138c
false postive fix
liquidsec Feb 8, 2025
a700369
bug fix
liquidsec Feb 8, 2025
594d3a3
refining wordlists
liquidsec Feb 9, 2025
93f1534
remove nocase from serialization extractor
liquidsec Feb 9, 2025
1bc1549
reduce FPs
liquidsec Feb 9, 2025
4fd6054
bug fix
liquidsec Feb 9, 2025
bbb533c
Merge branch 'dev' into lightfuzz
liquidsec Feb 11, 2025
71261dd
poetry.lock
liquidsec Feb 11, 2025
24add3b
fixing issues with nosqli module
liquidsec Feb 13, 2025
855172d
lint
liquidsec Feb 13, 2025
b1c5f05
changing log severity
liquidsec Feb 13, 2025
9be2111
removing persist_cookies true default
liquidsec Feb 13, 2025
8fc9dc4
less strict diff filtering
liquidsec Feb 13, 2025
6641daf
Merge branch 'dev' into lightfuzz
liquidsec Feb 13, 2025
3b94e72
handle html-encoded actions
liquidsec Feb 13, 2025
c708430
fixing typo
liquidsec Feb 13, 2025
3c7c5bb
typo
liquidsec Feb 13, 2025
a3c9f6a
fix issue with envelopes over-detecting
liquidsec Feb 13, 2025
ab4bb5d
speculative params optional, 494 false positives
liquidsec Feb 13, 2025
28b467a
fixing test
liquidsec Feb 13, 2025
f64f21e
serial refactor
liquidsec Feb 14, 2025
afec562
false positive reduction
liquidsec Feb 14, 2025
2030164
remove problematic parameters
liquidsec Feb 14, 2025
c8fd802
more false positive reduction
liquidsec Feb 14, 2025
e71beaf
removing unnecessary import
liquidsec Feb 14, 2025
1689d84
harmless typo in yara regex
liquidsec Feb 14, 2025
62d08c5
wordlist updates
liquidsec Feb 15, 2025
6896d6f
ruff format
liquidsec Feb 15, 2025
2a4a893
tweaking nosql detection
liquidsec Feb 15, 2025
a41f123
additional confirmation
liquidsec Feb 15, 2025
f44e8e8
poetry.lock
liquidsec Feb 17, 2025
74330b2
Merge branch 'dev' into lightfuzz
liquidsec Feb 17, 2025
2e33f0c
poetry.lock
liquidsec Feb 17, 2025
1cbc177
Merge branch 'lightfuzz' into lightfuzz-nosql
liquidsec Feb 17, 2025
0bb2f87
Merge pull request #2249 from blacklanternsecurity/lightfuzz-nosql
liquidsec Feb 20, 2025
0089f98
better naming
liquidsec Feb 20, 2025
1b77695
Merge branch 'dev' into lightfuzz
liquidsec Feb 20, 2025
5aafeaf
readibility
liquidsec Feb 20, 2025
bb8e2fd
ruff format
liquidsec Feb 20, 2025
4240411
Merge branch 'lightfuzz' into lightfuzz-cleanup
liquidsec Feb 20, 2025
6e70db1
poetry.lock
liquidsec Feb 20, 2025
c3f27c9
Merge branch 'lightfuzz' into lightfuzz-cleanup
liquidsec Feb 20, 2025
ecc8328
lightfuzz refactor
liquidsec Feb 21, 2025
e8fe02a
Merge branch 'lightfuzz-cleanup' of https://github.com/blacklanternse…
liquidsec Feb 21, 2025
c29a460
poetry.lock
liquidsec Feb 21, 2025
8af7a97
exception for submodules dir
liquidsec Feb 21, 2025
b962c0b
remove temp fix
liquidsec Feb 21, 2025
513d0ec
fix tests
invalid-email-address Feb 21, 2025
dcab247
fix?
invalid-email-address Feb 21, 2025
9ec573b
fix weird error
invalid-email-address Feb 21, 2025
4cbd375
remediating serial false positives
liquidsec Feb 24, 2025
893b452
Merge branch 'lightfuzz-cleanup' of https://github.com/blacklanternse…
liquidsec Feb 24, 2025
132ad63
removing pyahocorasick function
liquidsec Feb 25, 2025
ca89f15
Merge branch 'dev' into lightfuzz
liquidsec Feb 25, 2025
f6e1bf3
poetry.lock
liquidsec Feb 25, 2025
a8fc1a7
use yara
invalid-email-address Feb 25, 2025
762f7c9
cache compiled yara rules globally, since submodule is instantiated s…
invalid-email-address Feb 25, 2025
e571873
Revert "removing pyahocorasick function"
liquidsec Feb 26, 2025
94d90db
add yara helper
invalid-email-address Feb 27, 2025
41c6181
fix conflict
invalid-email-address Feb 27, 2025
618c60c
remove unused yara import
invalid-email-address Feb 27, 2025
52c1d58
Reapply "removing pyahocorasick function"
liquidsec Feb 27, 2025
895761a
removing old lightfuzz log message calls
liquidsec Feb 27, 2025
38806f2
Merge branch 'lightfuzz-cleanup' into use-yara
liquidsec Feb 27, 2025
dc69566
bbot/modules/lightfuzz/submodules/crypto.py
liquidsec Feb 27, 2025
4f1a44f
Revert "bbot/modules/lightfuzz/submodules/crypto.py"
liquidsec Feb 27, 2025
b21641b
ruff format
liquidsec Feb 27, 2025
3e75da2
wtf
liquidsec Feb 27, 2025
dc59577
Merge pull request #2317 from blacklanternsecurity/use-yara
liquidsec Feb 27, 2025
8a6e1be
Merge branch 'lightfuzz' into lightfuzz-cleanup
liquidsec Feb 27, 2025
92d653c
removing deadly folder, making lightfuzz deadly
liquidsec Feb 27, 2025
33d7079
fixing deadly folder stuff
liquidsec Feb 27, 2025
64c7d33
poetry.lock
liquidsec Feb 27, 2025
95e56d7
Merge pull request #2300 from blacklanternsecurity/lightfuzz-cleanup
liquidsec Feb 27, 2025
bc02df2
Merge branch 'dev' into lightfuzz
liquidsec Feb 27, 2025
1cce7d8
doc update
liquidsec Feb 28, 2025
1aecc05
add nosqli to preset
liquidsec Feb 28, 2025
f0e879c
changing log severity
liquidsec Mar 1, 2025
3c07650
remove print statement
liquidsec Mar 5, 2025
6e930a9
improving in-tag xss detection
liquidsec Mar 6, 2025
3c41409
Merge branch 'dev' into lightfuzz
liquidsec Mar 7, 2025
6f59b78
updating submodule docs
liquidsec Mar 7, 2025
9ce98ab
small tweak
liquidsec Mar 7, 2025
b7da137
ruff check
liquidsec Mar 7, 2025
1070be8
Merge pull request #2341 from blacklanternsecurity/lightfuzz-submodul…
liquidsec Mar 7, 2025
8209987
sync with dev
liquidsec Mar 13, 2025
db4b3d8
better regex
liquidsec Mar 18, 2025
131e014
Merge branch 'dev' into lightfuzz
liquidsec Mar 18, 2025
9eab748
Merge branch 'dev' into lightfuzz
liquidsec Mar 20, 2025
a01f8bb
removing debug
liquidsec Mar 20, 2025
991e193
more specific exception
liquidsec Mar 20, 2025
59d6630
moving parameter blacklist to config
liquidsec Mar 20, 2025
aee81c4
moving string constants
liquidsec Mar 20, 2025
4724c5a
adding lightfuzz to autodocs
liquidsec Mar 20, 2025
d1e367c
async parameter extraction
liquidsec Mar 20, 2025
bcf0e56
fixing doc
liquidsec Mar 20, 2025
829a6bd
async regex
liquidsec Mar 20, 2025
113d941
async
liquidsec Mar 20, 2025
8d0478a
Merge branch 'dev' into lightfuzz
liquidsec Mar 25, 2025
0f51833
poetry.lock update
liquidsec Apr 9, 2025
079be7a
fix test
liquidsec Apr 23, 2025
061c1b9
fix test
liquidsec Apr 23, 2025
da689c1
fix test
liquidsec Apr 23, 2025
4085cc9
fix test
liquidsec Apr 23, 2025
9a4335b
ruff format
liquidsec Apr 23, 2025
bcaf402
Merge branch 'dev' into lightfuzz
liquidsec Apr 25, 2025
91fd670
lint
liquidsec Apr 25, 2025
a47d32c
more descriptive presets
liquidsec Apr 25, 2025
dfa7364
last lightfuzz update
invalid-email-address Apr 25, 2025
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ For details, see [Configuration](https://www.blacklanternsecurity.com/bbot/Stabl
- [List of Modules](https://www.blacklanternsecurity.com/bbot/Stable/modules/list_of_modules)
- [Nuclei](https://www.blacklanternsecurity.com/bbot/Stable/modules/nuclei)
- [Custom YARA Rules](https://www.blacklanternsecurity.com/bbot/Stable/modules/custom_yara_rules)
- [Lightfuzz](https://www.blacklanternsecurity.com/bbot/Stable/modules/lightfuzz)
- **Misc**
- [Contribution](https://www.blacklanternsecurity.com/bbot/Stable/contribution)
- [Release History](https://www.blacklanternsecurity.com/bbot/Stable/release_history)
Expand Down
68 changes: 64 additions & 4 deletions bbot/core/event/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
import ipaddress
import traceback

from copy import copy
from pathlib import Path
from typing import Optional
from copy import copy, deepcopy
from contextlib import suppress
from radixtarget import RadixTarget
from pydantic import BaseModel, field_validator
Expand Down Expand Up @@ -40,6 +40,7 @@
validators,
get_file_extension,
)
from bbot.core.helpers.web.envelopes import BaseEnvelope


log = logging.getLogger("bbot.core.event")
Expand Down Expand Up @@ -633,6 +634,10 @@ def parent(self, parent):
elif not self._dummy:
log.warning(f"Tried to set invalid parent on {self}: (got: {repr(parent)} ({type(parent)}))")

@property
def children(self):
return []

@property
def parent_id(self):
parent_id = getattr(self.get_parent(), "id", None)
Expand Down Expand Up @@ -687,6 +692,13 @@ def get_parents(self, omit=False, include_self=False):
e = parent
return parents

def clone(self):
# Create a shallow copy of the event first
cloned_event = copy(self)
# Re-assign a new UUID
cloned_event._uuid = uuid.uuid4()
return cloned_event

def _host(self):
return ""

Expand Down Expand Up @@ -868,7 +880,13 @@ def json(self, mode="json", siem_friendly=False):
j["discovery_path"] = self.discovery_path
j["parent_chain"] = self.parent_chain

# parameter envelopes
parameter_envelopes = getattr(self, "envelopes", None)
if parameter_envelopes is not None:
j["envelopes"] = parameter_envelopes.to_dict()

# normalize non-primitive python objects

for k, v in list(j.items()):
if k == "data":
continue
Expand Down Expand Up @@ -1368,12 +1386,56 @@ class URL_HINT(URL_UNVERIFIED):


class WEB_PARAMETER(DictHostEvent):
@property
def children(self):
# if we have any subparams, raise a new WEB_PARAMETER for each one
children = []
envelopes = getattr(self, "envelopes", None)
if envelopes is not None:
subparams = sorted(list(self.envelopes.get_subparams()))

if envelopes.selected_subparam is None:
current_subparam = subparams[0]
envelopes.selected_subparam = current_subparam[0]
if len(subparams) > 1:
for subparam, _ in subparams[1:]:
clone = self.clone()
clone.envelopes = deepcopy(envelopes)
clone.envelopes.selected_subparam = subparam
clone.parent = self
children.append(clone)
return children

def sanitize_data(self, data):
original_value = data.get("original_value", None)
if original_value is not None:
try:
envelopes = BaseEnvelope.detect(original_value)
setattr(self, "envelopes", envelopes)
except ValueError as e:
log.verbose(f"Error detecting envelopes for {self}: {e}")
return data

def _data_id(self):
# dedupe by url:name:param_type
url = self.data.get("url", "")
name = self.data.get("name", "")
param_type = self.data.get("type", "")
return f"{url}:{name}:{param_type}"
envelopes = getattr(self, "envelopes", "")
subparam = getattr(envelopes, "selected_subparam", "")

return f"{url}:{name}:{param_type}:{subparam}"

def _outgoing_dedup_hash(self, event):
return hash(
(
str(event.host),
event.data["url"],
event.data.get("name", ""),
event.data.get("type", ""),
event.data.get("envelopes", ""),
)
)

def _url(self):
return self.data["url"]
Expand Down Expand Up @@ -1810,7 +1872,6 @@ def make_event(
data = net.network_address

event_class = globals().get(event_type, DefaultEvent)

return event_class(
data,
event_type=event_type,
Expand Down Expand Up @@ -1868,7 +1929,6 @@ def event_from_json(j, siem_friendly=False):

resolved_hosts = j.get("resolved_hosts", [])
event._resolved_hosts = set(resolved_hosts)

event.timestamp = datetime.datetime.fromisoformat(j["timestamp"])
event.scope_distance = j["scope_distance"]
parent_id = j.get("parent", None)
Expand Down
17 changes: 10 additions & 7 deletions bbot/core/helpers/diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,24 @@ def __init__(
parent_helper,
method="GET",
data=None,
json=None,
allow_redirects=False,
include_cache_buster=True,
headers=None,
cookies=None,
timeout=15,
timeout=10,
):
self.parent_helper = parent_helper
self.baseline_url = baseline_url
self.include_cache_buster = include_cache_buster
self.method = method
self.data = data
self.json = json
self.allow_redirects = allow_redirects
self._baselined = False
self.headers = headers
self.cookies = cookies
self.timeout = 15
self.timeout = 10

@staticmethod
def merge_dictionaries(headers1, headers2):
Expand All @@ -53,12 +55,13 @@ async def _baseline(self):
follow_redirects=self.allow_redirects,
method=self.method,
data=self.data,
json=self.json,
headers=self.headers,
cookies=self.cookies,
retries=2,
timeout=self.timeout,
)
await self.parent_helper.sleep(1)
await self.parent_helper.sleep(0.5)
# put random parameters in URL, headers, and cookies
get_params = {self.parent_helper.rand_string(6): self.parent_helper.rand_string(6)}

Expand All @@ -76,12 +79,12 @@ async def _baseline(self):
follow_redirects=self.allow_redirects,
method=self.method,
data=self.data,
json=self.json,
retries=2,
timeout=self.timeout,
)

self.baseline = baseline_1

if baseline_1 is None or baseline_2 is None:
log.debug("HTTP error while establishing baseline, aborting")
raise HttpCompareError(
Expand All @@ -90,6 +93,7 @@ async def _baseline(self):
if baseline_1.status_code != baseline_2.status_code:
log.debug("Status code not stable during baseline, aborting")
raise HttpCompareError("Can't get baseline from source URL")

try:
baseline_1_json = xmltodict.parse(baseline_1.text)
baseline_2_json = xmltodict.parse(baseline_2.text)
Expand All @@ -105,11 +109,9 @@ async def _baseline(self):

for k in ddiff.keys():
for x in list(ddiff[k]):
log.debug(f"Added {k} filter for path: {x.path()}")
self.ddiff_filters.append(x.path())

self.baseline_json = baseline_1_json

self.baseline_ignore_headers = [
h.lower()
for h in [
Expand Down Expand Up @@ -167,7 +169,6 @@ def compare_body(self, content_1, content_2):
if len(ddiff.keys()) == 0:
return True
else:
log.debug(ddiff)
return False

async def compare(
Expand All @@ -178,6 +179,7 @@ async def compare(
check_reflection=False,
method="GET",
data=None,
json=None,
allow_redirects=False,
timeout=None,
):
Expand Down Expand Up @@ -208,6 +210,7 @@ async def compare(
follow_redirects=allow_redirects,
method=method,
data=data,
json=json,
timeout=timeout,
)

Expand Down
6 changes: 5 additions & 1 deletion bbot/core/helpers/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from .regex import RegexHelper
from .wordcloud import WordCloud
from .interactsh import Interactsh
from .yara_helper import YaraHelper
from .depsinstaller import DepsInstaller
from .async_helpers import get_event_loop

Expand Down Expand Up @@ -85,6 +86,7 @@ def __init__(self, preset):
self._cloud = None

self.re = RegexHelper(self)
self.yara = YaraHelper(self)
self._dns = None
self._web = None
self.config_aware_validators = self.validators.Validators(self)
Expand Down Expand Up @@ -129,7 +131,8 @@ def http_compare(
cookies=None,
method="GET",
data=None,
timeout=15,
json=None,
timeout=10,
):
return HttpCompare(
url,
Expand All @@ -141,6 +144,7 @@ def http_compare(
timeout=timeout,
method=method,
data=data,
json=json,
)

def temp_filename(self, extension=None):
Expand Down
Loading