Created
May 12, 2025 09:11
-
-
Save HouqiyuA/e6e2f0407b38be3d88d8b4e42c78667b to your computer and use it in GitHub Desktop.
Restcountries-server_version_leak
This file contains hidden or 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
| 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