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

Faster sqlmap #97

Merged
merged 1 commit into from
May 20, 2024
Merged
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
14 changes: 5 additions & 9 deletions karton_sqlmap/karton_sqlmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ def run(self, current_task: Task) -> None:
# (https://github.com/sqlmapproject/sqlmap/issues/5561) so it is done here.
soup = BeautifulSoup(response.text)
urls_with_injection_points = set()
expanded_urls_with_example_values = []
expanded_urls_with_example_values_dict = {}
for tag in soup.find_all():
new_url = None
for attribute in ["src", "href"]:
Expand All @@ -301,8 +301,8 @@ def run(self, current_task: Task) -> None:
new_url = new_url.split("#")[0]

if any(
new_url.split("?")[0].endswith(extension)
for extension in [".png", ".jpg", ".svg", ".jpeg", ".css", ".js"]
new_url.split("?")[0].lower().endswith(extension)
for extension in [".png", ".jpg", ".svg", ".jpeg", ".css", ".js", ".ico", ".woff2"]
):
# Let's not inject image/style paths
continue
Expand All @@ -318,13 +318,9 @@ def run(self, current_task: Task) -> None:
continue

urls_with_injection_points.add(url_with_injection_point)
expanded_urls_with_example_values.append(
(
url_with_injection_point,
example_value,
)
)
expanded_urls_with_example_values_dict[url_with_injection_point] = example_value

expanded_urls_with_example_values = list(expanded_urls_with_example_values_dict.items())
random.shuffle(expanded_urls_with_example_values)
expanded_urls_with_example_values = expanded_urls_with_example_values[
: ExtraModulesConfig.SQLMAP_MAX_URLS_TO_CRAWL
Expand Down
Loading