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

more sql dumps #615

Merged
merged 5 commits into from
Nov 7, 2023
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
8 changes: 7 additions & 1 deletion artemis/reporting/modules/bruter/classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ def is_log_file(found_url: FoundURL) -> bool:


def is_sql_dump(found_url: FoundURL) -> bool:
sql_dump_markers = ["create table", "alter table", "insert into"]

def _starts_with_sql_dump_marker(line: str) -> bool:
line = line.strip().lower()
return any(line.startswith(marker) for marker in sql_dump_markers)

path = urllib.parse.urlparse(found_url.url).path
if ".sql" not in path.lower() and "/sql" not in path.lower() and "/db" not in path.lower():
return False
Expand All @@ -92,7 +98,7 @@ def is_sql_dump(found_url: FoundURL) -> bool:
if "sql dump" in found_url.content_prefix.lower():
return True

if "\ncreate table" in found_url.content_prefix.lower():
if any([_starts_with_sql_dump_marker(line) for line in found_url.content_prefix.split("\n")]):
return True

return False
Expand Down