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

Add Lightfuzz #1817

Open
wants to merge 449 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
449 commits
Select commit Hold shift + click to select a range
2f51dce
hunt change description text
liquidsec Oct 15, 2024
f7a290f
fix cookies
invalid-email-address Oct 16, 2024
dd466bb
small bug fix parsing cookies
liquidsec Oct 16, 2024
518be6b
adding custom cookie support to httpx
liquidsec Oct 16, 2024
e1ea6d9
httpx tests for custom headers and cookies
liquidsec Oct 16, 2024
6c2a06a
oopsie
liquidsec Oct 16, 2024
e58967a
Merge pull request #1853 from blacklanternsecurity/lightfuzz-bodyparams
liquidsec Oct 16, 2024
0af6947
Merge branch 'dev' into lightfuzz
liquidsec Oct 16, 2024
a92d085
fixing bug with # in form action
liquidsec Oct 17, 2024
36b9832
handle dangerous redirects gracefully
liquidsec Oct 17, 2024
b4fda15
expanding path techniques for path submodule
liquidsec Oct 17, 2024
10c5741
fixing excavate relative paths, adding tests
liquidsec Oct 17, 2024
21ab06a
fixing test
liquidsec Oct 17, 2024
e431348
Merge branch 'dev' into lightfuzz
liquidsec Oct 17, 2024
cedb4e6
hunt consolidate categories
liquidsec Oct 17, 2024
61ca3ce
better error handling
liquidsec Oct 17, 2024
0f6b6f6
prevent false JSON tag
liquidsec Oct 18, 2024
45201f0
black
liquidsec Oct 18, 2024
be0dc4a
poetry lock update
liquidsec Oct 18, 2024
7020b48
poetry lock w/dev merge
liquidsec Oct 18, 2024
e02e91e
Merge branch 'dev' into lightfuzz
liquidsec Oct 18, 2024
e8a83c9
poetry.lock
liquidsec Oct 18, 2024
b59f41b
fixing but with html tag parameter extraction
liquidsec Oct 22, 2024
ab4fef4
truncate long error
liquidsec Oct 24, 2024
027210b
fixing bug with cloning web_parameters
liquidsec Oct 29, 2024
617add6
adding reflected_parameters module
liquidsec Oct 29, 2024
09f4b46
dev->lightfuzz merge
liquidsec Oct 29, 2024
aae28bc
Merge branch 'dev' into lightfuzz
liquidsec Oct 29, 2024
5520951
oops
liquidsec Oct 29, 2024
bc0b8b9
Merge branch 'lightfuzz' of https://github.com/blacklanternsecurity/b…
liquidsec Oct 29, 2024
14bc07f
Merge branch 'dev' into lightfuzz
liquidsec Oct 30, 2024
1695681
sync with dev
liquidsec Nov 5, 2024
8ab5222
Merge branch 'dev' into lightfuzz
liquidsec Nov 20, 2024
8ef31d5
black
liquidsec Nov 20, 2024
e4e99e6
poetry.lock update
liquidsec Nov 20, 2024
4d29a4a
fix tests
liquidsec Nov 21, 2024
0819db4
Merge branch 'dev' into lightfuzz
liquidsec Nov 21, 2024
a3a6ca0
Merge branch 'dev' into lightfuzz
liquidsec Nov 21, 2024
b9c39d6
dev to lightfuzz sync
liquidsec Nov 25, 2024
c94ba8f
making lightfuzz presets more explicit
liquidsec Nov 26, 2024
a50f771
initial lightfuzz docs
liquidsec Nov 26, 2024
164a091
readme adjust
liquidsec Nov 26, 2024
856ebc9
merge from dev
liquidsec Nov 26, 2024
5dd2318
exception for assert not in tests
liquidsec Nov 26, 2024
35c3918
ruff
liquidsec Nov 26, 2024
6264022
Merge branch 'dev' into lightfuzz
liquidsec Nov 26, 2024
0898c31
preset whitespace
liquidsec Nov 27, 2024
e0e6756
regex tweaks
liquidsec Nov 27, 2024
2763487
adding test for select tags
liquidsec Nov 27, 2024
0fef49c
tests passing
invalid-email-address Nov 27, 2024
c47fd7f
fix conflict
invalid-email-address Nov 27, 2024
81260a3
lint
invalid-email-address Nov 27, 2024
89effec
remove dead code
invalid-email-address Nov 27, 2024
93a9eb2
comment
invalid-email-address Nov 27, 2024
2203230
fix tests
invalid-email-address Nov 28, 2024
989d082
regex and other tweaks
liquidsec Nov 28, 2024
d4fbb73
i literally spent FOUR HOURS ON THIS BUG :( :( :(
liquidsec Nov 28, 2024
2971eb6
adding default blacklist to lightfuzz presets
liquidsec Nov 28, 2024
0510ee0
ssti submodule tweak
liquidsec Nov 28, 2024
060babf
may this bug be vanquished for all of eternity
liquidsec Nov 28, 2024
65ee9b0
Merge branch 'lightfuzz' into classify-envelopes
liquidsec Nov 28, 2024
5243089
additional ssti signature
liquidsec Nov 29, 2024
0ff947a
Merge branch 'lightfuzz' into classify-envelopes
liquidsec Nov 29, 2024
aa1bbcc
adding new envelope multiple test
liquidsec Nov 29, 2024
737999b
envelope bug fixes / enhancements
liquidsec Nov 29, 2024
c3ec029
remove debug
liquidsec Nov 29, 2024
cbfae57
variable name
liquidsec Nov 30, 2024
ab7e43d
Merge pull request #2045 from blacklanternsecurity/lightfuzz-crypto-r…
liquidsec Nov 30, 2024
c8888c0
stringifying all original values
liquidsec Nov 30, 2024
063a34d
Revert "stringifying all original values"
liquidsec Nov 30, 2024
64c6943
ensuring original_value is str
liquidsec Dec 3, 2024
a885451
fix?
invalid-email-address Dec 5, 2024
1f58cf4
Merge pull request #2043 from blacklanternsecurity/classify-envelopes
liquidsec Dec 18, 2024
4f4c2d7
Merge branch 'dev' into lightfuzz
liquidsec Dec 18, 2024
1f0f6c1
Merge branch 'dev' into lightfuzz
liquidsec Dec 18, 2024
4a72eda
adding form actions XSS detect, fixing parameter extraction bugs, dep…
liquidsec Dec 18, 2024
0efca3a
deps conflict resolution
liquidsec Dec 18, 2024
e98d2e8
remove debug msg
liquidsec Dec 18, 2024
8808fd3
better handling of malformed url errors during parameter extraction
liquidsec Dec 19, 2024
7487d7b
Merge branch 'dev' into lightfuzz
liquidsec Dec 20, 2024
85bd5ec
update poetry.lock
liquidsec Dec 20, 2024
ac4f329
dev to lightfuzz sync
liquidsec Jan 10, 2025
f40bd13
Merge branch 'dev' into lightfuzz
liquidsec Jan 12, 2025
f515957
parameter blist updates
liquidsec Jan 13, 2025
d43fde0
Merge branch 'lightfuzz' into parameter-blacklist-changes
liquidsec Jan 13, 2025
6bbc9d0
reduce false postives with canary probe
liquidsec Jan 13, 2025
8d6df7e
changing comments
liquidsec Jan 13, 2025
e8d0915
fixing tests
liquidsec Jan 13, 2025
10b9eb3
adding support for all parameter types
liquidsec Jan 13, 2025
969b07d
tests for all parameter types
liquidsec Jan 13, 2025
1a163e7
fix test
liquidsec Jan 13, 2025
cba944a
comment cleanup
liquidsec Jan 13, 2025
97aba58
Merge pull request #2167 from blacklanternsecurity/parameter-blacklis…
liquidsec Jan 14, 2025
7c77b1c
Merge pull request #2168 from blacklanternsecurity/lightfuzz-reflecte…
liquidsec Jan 14, 2025
60df382
fixed 'escaping the escape' xss technique false positives, added test…
liquidsec Jan 14, 2025
85b6ae7
asyncifying re.search calls
liquidsec Jan 14, 2025
2a73f4d
remove unnecessary test variables
liquidsec Jan 14, 2025
f87ff54
Merge branch 'dev' into lightfuzz
liquidsec Jan 14, 2025
e73caf3
regex optimization
liquidsec Jan 14, 2025
a46faae
update poetry.lock
liquidsec Jan 14, 2025
a42ae6e
Merge branch 'lightfuzz' into lightfuzz-javascript-quote-context
liquidsec Jan 14, 2025
c8a81af
update poetry.lock
liquidsec Jan 14, 2025
6e41245
Merge pull request #2173 from blacklanternsecurity/lightfuzz-javascri…
liquidsec Jan 14, 2025
86b0471
reducing serial submodule FP's, allowing validated original values to…
liquidsec Jan 15, 2025
a51fab2
fix test
liquidsec Jan 15, 2025
29e5b62
improved extraction of textarea parameters, additional tests for seri…
liquidsec Jan 15, 2025
47c7484
refector base64/hex checks within lightfuzz + tests
liquidsec Jan 15, 2025
a067064
adding baseline retry mechanism to serial
liquidsec Jan 16, 2025
543131f
excavate code hygiene
liquidsec Jan 16, 2025
0d3936a
Merge branch 'dev' into lightfuzz
liquidsec Jan 16, 2025
83b6a71
Merge branch 'lightfuzz' into excavate-parameter-refactor
liquidsec Jan 16, 2025
55ea28d
Merge branch 'lightfuzz' into lightfuzz-deserialize-fp-fix
liquidsec Jan 16, 2025
a593f3c
removing unused code
liquidsec Jan 16, 2025
a3d5eb5
fixing issue with parameter_extraction option not preventing WEB_PARA…
liquidsec Jan 16, 2025
96fd94b
updating lightfuzz presets
liquidsec Jan 17, 2025
8ffb5c0
docs update
liquidsec Jan 17, 2025
b274675
poetry.lock
liquidsec Jan 17, 2025
ac1d676
comments!
liquidsec Jan 17, 2025
769b70a
Merge branch 'lightfuzz' into lightfuzz-commentpalooza
liquidsec Jan 17, 2025
21d1b14
we were testing to ensure a bug was there :O
liquidsec Jan 17, 2025
b64d1d7
rename test
liquidsec Jan 17, 2025
ce8839d
Merge branch 'lightfuzz-commentpalooza' of https://github.com/blackla…
liquidsec Jan 17, 2025
cd42d22
Merge branch 'dev' into lightfuzz
liquidsec Jan 21, 2025
9ea09e8
poetry.lock update
liquidsec Jan 22, 2025
dbb5f4c
Merge branch 'lightfuzz' of https://github.com/blacklanternsecurity/b…
liquidsec Jan 22, 2025
6771eff
poetry.lock update
liquidsec Jan 22, 2025
63d0375
Merge branch 'dev' into lightfuzz
liquidsec Jan 22, 2025
89994b9
adding conditional url-encoding, fixing xml parameter extraction bug
liquidsec Jan 23, 2025
8919bc9
fix test
liquidsec Jan 23, 2025
d19a296
nuking debug junk
liquidsec Jan 23, 2025
5a4370e
Merge pull request #2181 from blacklanternsecurity/excavate-parameter…
liquidsec Jan 23, 2025
552b2aa
Merge branch 'lightfuzz' into lightfuzz-deserialize-fp-fix
liquidsec Jan 23, 2025
23f614d
Merge branch 'lightfuzz' into lightfuzz-commentpalooza
liquidsec Jan 23, 2025
ac55777
conditional spider warning
liquidsec Jan 23, 2025
a485fb2
fix whitespace
liquidsec Jan 23, 2025
13cc106
Merge pull request #2189 from blacklanternsecurity/lightfuzz-commentp…
liquidsec Jan 23, 2025
dc3354e
remove blacklist
liquidsec Jan 23, 2025
49f22a4
poetry.lock update
liquidsec Jan 23, 2025
0e05301
Merge branch 'lightfuzz' into lightfuzz-deserialize-fp-fix
liquidsec Jan 23, 2025
d1e8e38
Merge branch 'lightfuzz' into lightfuzz-portfilter
liquidsec Jan 23, 2025
98668dd
Merge pull request #2187 from blacklanternsecurity/lightfuzz-portfilter
liquidsec Jan 23, 2025
d0cef2c
Merge branch 'lightfuzz' into lightfuzz-deserialize-fp-fix
liquidsec Jan 23, 2025
1ed52d0
Merge branch 'lightfuzz' into lightfuzz-conditional-encoding
liquidsec Jan 23, 2025
a250d04
Merge pull request #2204 from blacklanternsecurity/lightfuzz-conditio…
liquidsec Jan 23, 2025
c7d44da
Merge branch 'lightfuzz' into lightfuzz-deserialize-fp-fix
liquidsec Jan 23, 2025
2b9a7bc
docstring, cleanup for serial lightfuzz module
invalid-email-address Jan 23, 2025
e80f402
Merge pull request #2176 from blacklanternsecurity/lightfuzz-deserial…
liquidsec Jan 23, 2025
128dc45
Merge branch 'dev' into lightfuzz
liquidsec Jan 24, 2025
bfb3f6c
poetry lock
liquidsec Jan 24, 2025
fe93fe9
correctly handling HttpCompare errors
liquidsec Jan 24, 2025
69d2875
cleaner implementation
liquidsec Jan 24, 2025
c839869
ruff format
liquidsec Jan 24, 2025
b739568
fixing additional params bug + adding tests
liquidsec Jan 24, 2025
bd2c355
Merge pull request #2213 from blacklanternsecurity/lightfuzz-serial-h…
liquidsec Jan 24, 2025
5514e3d
defragmenting additional_params code
liquidsec Jan 24, 2025
d8005b0
defragmenting additional_params code
liquidsec Jan 24, 2025
3d381f0
Merge branch 'lightfuzz' into lightfuzz-additional-params-fix
liquidsec Jan 24, 2025
df9c375
Merge branch 'lightfuzz-additional-params-fix' into lightfuzz-nosql
liquidsec Jan 24, 2025
630da18
Merge pull request #2215 from blacklanternsecurity/lightfuzz-addition…
liquidsec Jan 24, 2025
c26e1fd
Merge branch 'dev' into lightfuzz
liquidsec Jan 25, 2025
eccae90
poetry lock
liquidsec Jan 25, 2025
1628ecc
ruff format
liquidsec Jan 25, 2025
5d81861
Merge branch 'dev' into lightfuzz
liquidsec Jan 25, 2025
ca12988
Merge branch 'dev' into lightfuzz
liquidsec Jan 28, 2025
4c45037
Merge branch 'lightfuzz' into lightfuzz-nosql
liquidsec Feb 3, 2025
d570a69
lightfuzz refactor
liquidsec Feb 5, 2025
ea6b104
clean up
liquidsec Feb 5, 2025
ad2908b
nosqli submodule initial
liquidsec Feb 5, 2025
d3f7447
bug fixes, tests for nosqli submodule
liquidsec Feb 5, 2025
751c4c9
adding custom lightfuzz log handler
liquidsec Feb 5, 2025
4f76298
Merge branch 'dev' into lightfuzz
liquidsec Feb 6, 2025
33ec467
Merge branch 'lightfuzz' into lightfuzz-nosql
liquidsec Feb 8, 2025
1eae9f3
false postive fix
liquidsec Feb 8, 2025
a3dd8fa
bug fix
liquidsec Feb 8, 2025
72dc37b
refining wordlists
liquidsec Feb 9, 2025
dbdd935
remove nocase from serialization extractor
liquidsec Feb 9, 2025
a1a0622
reduce FPs
liquidsec Feb 9, 2025
3e8776e
bug fix
liquidsec Feb 9, 2025
f96fba3
Merge branch 'dev' into lightfuzz
liquidsec Feb 11, 2025
cf3cdb6
poetry.lock
liquidsec Feb 11, 2025
dbabc30
fixing issues with nosqli module
liquidsec Feb 13, 2025
93c2fe0
lint
liquidsec Feb 13, 2025
344169f
changing log severity
liquidsec Feb 13, 2025
1a47649
removing persist_cookies true default
liquidsec Feb 13, 2025
24a3188
less strict diff filtering
liquidsec Feb 13, 2025
8b62273
Merge branch 'dev' into lightfuzz
liquidsec Feb 13, 2025
c37a4cb
handle html-encoded actions
liquidsec Feb 13, 2025
f806235
fixing typo
liquidsec Feb 13, 2025
ac65332
typo
liquidsec Feb 13, 2025
913a9b1
fix issue with envelopes over-detecting
liquidsec Feb 13, 2025
4fd7f6d
speculative params optional, 494 false positives
liquidsec Feb 13, 2025
ceb224c
fixing test
liquidsec Feb 13, 2025
1436384
serial refactor
liquidsec Feb 14, 2025
6b7fa80
false positive reduction
liquidsec Feb 14, 2025
cf30b2f
remove problematic parameters
liquidsec Feb 14, 2025
dc35ebc
more false positive reduction
liquidsec Feb 14, 2025
de1b5e3
removing unnecessary import
liquidsec Feb 14, 2025
f689d29
harmless typo in yara regex
liquidsec Feb 14, 2025
ec20906
wordlist updates
liquidsec Feb 15, 2025
d037622
ruff format
liquidsec Feb 15, 2025
0386dad
tweaking nosql detection
liquidsec Feb 15, 2025
2525f8e
additional confirmation
liquidsec Feb 15, 2025
6145d6c
poetry.lock
liquidsec Feb 17, 2025
b487ad5
Merge branch 'dev' into lightfuzz
liquidsec Feb 17, 2025
f5be699
poetry.lock
liquidsec Feb 17, 2025
5caedd1
Merge branch 'lightfuzz' into lightfuzz-nosql
liquidsec Feb 17, 2025
385ae95
Merge pull request #2249 from blacklanternsecurity/lightfuzz-nosql
liquidsec Feb 20, 2025
db06d1e
better naming
liquidsec Feb 20, 2025
80cd396
Merge branch 'dev' into lightfuzz
liquidsec Feb 20, 2025
967d42e
readibility
liquidsec Feb 20, 2025
cbeef61
ruff format
liquidsec Feb 20, 2025
fbe5916
Merge branch 'lightfuzz' into lightfuzz-cleanup
liquidsec Feb 20, 2025
b0525ac
poetry.lock
liquidsec Feb 20, 2025
2576321
Merge branch 'lightfuzz' into lightfuzz-cleanup
liquidsec Feb 20, 2025
95a0e97
lightfuzz refactor
liquidsec Feb 21, 2025
369cbc0
Merge branch 'lightfuzz-cleanup' of https://github.com/blacklanternse…
liquidsec Feb 21, 2025
60ab11d
poetry.lock
liquidsec Feb 21, 2025
34e474f
exception for submodules dir
liquidsec Feb 21, 2025
c7f8755
remove temp fix
liquidsec Feb 21, 2025
2622039
fix tests
invalid-email-address Feb 21, 2025
fbb3f20
fix?
invalid-email-address Feb 21, 2025
88128b9
fix weird error
invalid-email-address Feb 21, 2025
a64eef1
remediating serial false positives
liquidsec Feb 24, 2025
9643d17
Merge branch 'lightfuzz-cleanup' of https://github.com/blacklanternse…
liquidsec Feb 24, 2025
6548209
removing pyahocorasick function
liquidsec Feb 25, 2025
fefa327
Merge branch 'dev' into lightfuzz
liquidsec Feb 25, 2025
7800fb3
poetry.lock
liquidsec Feb 25, 2025
aed8fa2
use yara
invalid-email-address Feb 25, 2025
979943b
cache compiled yara rules globally, since submodule is instantiated s…
invalid-email-address Feb 25, 2025
0d784b6
Revert "removing pyahocorasick function"
liquidsec Feb 26, 2025
630d9c5
add yara helper
invalid-email-address Feb 27, 2025
dec87da
fix conflict
invalid-email-address Feb 27, 2025
6cafa26
remove unused yara import
invalid-email-address Feb 27, 2025
3061c83
Reapply "removing pyahocorasick function"
liquidsec Feb 27, 2025
5d96d95
removing old lightfuzz log message calls
liquidsec Feb 27, 2025
732056e
Merge branch 'lightfuzz-cleanup' into use-yara
liquidsec Feb 27, 2025
c8f444c
bbot/modules/lightfuzz/submodules/crypto.py
liquidsec Feb 27, 2025
5948108
Revert "bbot/modules/lightfuzz/submodules/crypto.py"
liquidsec Feb 27, 2025
4e2ea40
ruff format
liquidsec Feb 27, 2025
70c4306
wtf
liquidsec Feb 27, 2025
1b2560c
Merge pull request #2317 from blacklanternsecurity/use-yara
liquidsec Feb 27, 2025
db8df37
Merge branch 'lightfuzz' into lightfuzz-cleanup
liquidsec Feb 27, 2025
6ff9326
removing deadly folder, making lightfuzz deadly
liquidsec Feb 27, 2025
5635113
fixing deadly folder stuff
liquidsec Feb 27, 2025
95bf6e1
poetry.lock
liquidsec Feb 27, 2025
3021ee9
Merge pull request #2300 from blacklanternsecurity/lightfuzz-cleanup
liquidsec Feb 27, 2025
3f5c792
Merge branch 'dev' into lightfuzz
liquidsec Feb 27, 2025
1d2ab85
doc update
liquidsec Feb 28, 2025
3a57966
add nosqli to preset
liquidsec Feb 28, 2025
a42d48d
changing log severity
liquidsec Mar 1, 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 @@ -592,6 +593,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 @@ -646,6 +651,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 @@ -827,7 +839,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 @@ -1327,12 +1345,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 @@ -1768,7 +1830,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 @@ -1828,7 +1889,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
Loading