Skip to content

Commit

Permalink
Support more usual cases for string_without_payload
Browse files Browse the repository at this point in the history
  • Loading branch information
devl00p committed Jul 31, 2024
1 parent 28acda2 commit 951f057
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions tests/attack/test_mod_ldap.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
def test_string_without_payload():
assert string_without_payload("Hello <there>", "<there>") == "Hello "
assert string_without_payload("Hello &lt;there&gt;", "<there>") == "Hello "
assert string_without_payload("Hello+%3Cthere%3E", " <there>") == "Hello"
assert string_without_payload("Hello%20%3Cthere%3E", " <there>") == "Hello"


def test_find_ldap_error():
Expand Down
11 changes: 10 additions & 1 deletion wapitiCore/attack/mod_ldap.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from os.path import join as path_join
from typing import Optional, Iterator, List, Tuple, Dict, Any
from hashlib import md5
from urllib.parse import quote_plus, quote

from httpx import RequestError

Expand All @@ -44,7 +45,15 @@ class PayloadInfo:
def string_without_payload(text: str, payload: str) -> str:
# Most search pages will show your search term. This will make the hash of the page change each time
# We remove here the search term its possible HTML escaped version.
return text.replace(payload, "").replace(html.escape(payload), "")
return text.replace(
payload, ""
).replace(
html.escape(payload), ""
).replace(
quote_plus(payload), ""
).replace(
quote(payload), "",
)


# from https://github.com/andresriancho/w3af/blob/master/w3af/plugins/audit/ldapi.py
Expand Down

0 comments on commit 951f057

Please sign in to comment.