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

Improve autocalibration #1427

Merged
merged 3 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion db/400_blacklist.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
%2e%2e//google.com
%ff
%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/etc/passwd
%2e%2e;/test
%3f/
%C0%AE%C0%AE%C0%AF
.%2e/%2e%2e/%2e%2e/%2e%2e/etc/passwd
../../../../../../etc/passwd
..;/
cgi-bin/.%2e/%2e%2e/%2e%2e/%2e%2e/etc/passwd
30 changes: 9 additions & 21 deletions db/403_blacklist.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
.hta
.htaccess
.htaccess-dev
.htaccess-local
.htaccess-marco
.htaccess.BAK
.htaccess.bak
.htaccess.old
.htaccess.inc
.htaccess.txt
.htaccess~
.htaccess/
.htpasswd
.htpasswd-old
.htpasswd.bak
.htpasswd.inc
.htpa55wd
.htpasswd/
.htpasswrd
.htgroup
.htusers
%2e%2e//google.com
%ff
%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/etc/passwd
%2e%2e;/test
%3f/
%C0%AE%C0%AE%C0%AF
../../../../../../etc/passwd
..;/
cgi-bin/.%2e/%2e%2e/%2e%2e/%2e%2e/etc/passwd
2 changes: 2 additions & 0 deletions db/500_blacklist.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
%ff
%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/etc/passwd
%3f/
%C0%AE%C0%AE%C0%AF
%2e%2e;/test
../../../../../../etc/passwd
..;/

3 changes: 2 additions & 1 deletion db/dicc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
!.htaccess
!.htpasswd
%2e%2e//google.com
%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/etc/passwd
%2e%2e;/test
%3f/
%C0%AE%C0%AE%C0%AF
Expand Down Expand Up @@ -38,7 +39,7 @@
+CSCOT+/oem-customization?app=AnyConnect&type=oem&platform=..&resource-type=..&name=%2bCSCOE%2b/portal_inc.lua
+CSCOT+/translation
+CSCOT+/translation-table?type=mst&textdomain=/%2bCSCOE%2b/portal_inc.lua&default-language&lang=../
.%2e/%2e%2e/%2e%2e/%2e%2e/etc/passwd
../../../../../../etc/passwd
..;/
.0
.7z
Expand Down
13 changes: 4 additions & 9 deletions lib/core/fuzzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,29 +155,24 @@ def __init__(

def setup_scanners(self) -> None:
# Default scanners (wildcard testers)
self.scanners["default"].update(
{
"index": Scanner(self._requester, path=self._base_path),
"random": Scanner(
self._requester, path=self._base_path + WILDCARD_TEST_POINT_MARKER
),
}
self.scanners["default"]["random"] = Scanner(
self._requester, path=self._base_path + WILDCARD_TEST_POINT_MARKER
)

if options["exclude_response"]:
self.scanners["default"]["custom"] = Scanner(
self._requester, tested=self.scanners, path=options["exclude_response"]
)

for prefix in options["prefixes"] + DEFAULT_TEST_PREFIXES:
for prefix in set(options["prefixes"] + DEFAULT_TEST_PREFIXES):
self.scanners["prefixes"][prefix] = Scanner(
self._requester,
tested=self.scanners,
path=f"{self._base_path}{prefix}{WILDCARD_TEST_POINT_MARKER}",
context=f"/{self._base_path}{prefix}***",
)

for suffix in options["suffixes"] + DEFAULT_TEST_SUFFIXES:
for suffix in set(options["suffixes"] + DEFAULT_TEST_SUFFIXES):
self.scanners["suffixes"][suffix] = Scanner(
self._requester,
tested=self.scanners,
Expand Down
4 changes: 2 additions & 2 deletions lib/core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@

STANDARD_PORTS = {"http": 80, "https": 443}

DEFAULT_TEST_PREFIXES = (".",)
DEFAULT_TEST_PREFIXES = (".", ".ht")

DEFAULT_TEST_SUFFIXES = ("/",)
DEFAULT_TEST_SUFFIXES = ("/", "~")

DEFAULT_TOR_PROXIES = ("socks5://127.0.0.1:9050", "socks5://127.0.0.1:9150")

Expand Down
11 changes: 8 additions & 3 deletions lib/utils/diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,19 @@ def compare_to(self, content):

i = -1
splitted_content = content.split()
# Allow one miss, see https://github.com/maurosoria/dirsearch/issues/1279
misses = 0
for pattern in self._static_patterns:
try:
i = splitted_content.index(pattern, i + 1)
except ValueError:
return False
if misses or len(self._static_patterns) < 20:
return False

# The number of static patterns is not big enough to say it's a reliable method
if len(self._static_patterns) < 20 and len(content.split()) > len(self._base_content.split()):
misses += 1

# Static patterns doesn't seem to be a reliable enough method
if len(content.split()) > len(self._base_content.split()) and len(self._static_patterns) < 20:
return difflib.SequenceMatcher(None, self._base_content, content).ratio() > 0.75

return True
Expand Down
Loading