-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
da7e94f
commit e4793e8
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import requests | ||
from bs4 import BeautifulSoup | ||
from prettytable import PrettyTable | ||
|
||
# URL hasil SQL injection | ||
url = "redacted_vulnerability_url" | ||
|
||
# Request ke URL | ||
response = requests.get(url) | ||
response.raise_for_status() | ||
|
||
# Parsing HTML dengan BeautifulSoup | ||
soup = BeautifulSoup(response.text, "html.parser") | ||
|
||
# Ekstrak tabel dari output | ||
text = soup.get_text() | ||
|
||
# Memisahkan tabel berdasarkan keyword "Table ::" | ||
sections = text.split("Table ::") | ||
metadata = sections[0].strip() | ||
|
||
# Menampilkan metadata (database info) | ||
metadata_table = PrettyTable() | ||
metadata_table.field_names = ["Property", "Value"] | ||
|
||
for line in metadata.splitlines(): | ||
if "::" in line: | ||
key, value = line.split("::", 1) | ||
metadata_table.add_row([key.strip(), value.strip()]) | ||
|
||
print("\n=== Database Metadata ===") | ||
print(metadata_table) | ||
|
||
# Menampilkan tabel database | ||
for section in sections[1:]: | ||
lines = section.strip().split("~") | ||
table_name = lines[0].strip() | ||
columns = [col.strip() for col in lines[1:] if col.strip()] | ||
|
||
# Membuat tabel PrettyTable | ||
table = PrettyTable() | ||
table.field_names = ["Column Index", "Column Name"] | ||
|
||
for idx, col in enumerate(columns, start=1): | ||
table.add_row([idx, col]) | ||
|
||
print(f"\n=== Table: {table_name} ===") | ||
print(table) |