Skip to content

Instantly share code, notes, and snippets.

@HouqiyuA
Created May 12, 2025 09:11
Show Gist options
  • Select an option

  • Save HouqiyuA/e6e2f0407b38be3d88d8b4e42c78667b to your computer and use it in GitHub Desktop.

Select an option

Save HouqiyuA/e6e2f0407b38be3d88d8b4e42c78667b to your computer and use it in GitHub Desktop.
Restcountries-server_version_leak
import requests
# Target service URL
url = "http://192.168.126.129:8080/rest/v2/demonym/abc"
# Custom request headers
headers = {
"Accept": "application/json"
}
# Send the GET request
response = requests.get(url, headers=headers)
# Extract the 'Server' header from the response
server_header = response.headers.get("Server", "No Server header found")
# Print status code and server header
print("[*] Status Code:", response.status_code)
print("[*] Server Header:", server_header)
# Check if the server header contains "Jetty" (indicating a version leak)
if "Jetty" in server_header:
print("[+] Server version information is disclosed:", server_header)
print("[!] Vulnerability detected: Server version disclosure. Consider hiding or masking the 'Server' header.")
else:
print("[-] No obvious server version information detected.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment