Spaces:
Running
Running
raannakasturi
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -11,9 +11,36 @@ def requestAPI(domain):
|
|
11 |
except requests.exceptions.RequestException as e:
|
12 |
return {'error': f'Request failed: {e}'}
|
13 |
|
14 |
-
#
|
15 |
data = response.json()
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
def app():
|
19 |
with gr.Blocks(title="Project Gatekeeper - Get free SSL Certificates") as webui:
|
|
|
11 |
except requests.exceptions.RequestException as e:
|
12 |
return {'error': f'Request failed: {e}'}
|
13 |
|
14 |
+
# Process the data to match the desired output format
|
15 |
data = response.json()
|
16 |
+
result = data.get('result', {})
|
17 |
+
|
18 |
+
formatted_data = {
|
19 |
+
"Host": result.get("host", ""),
|
20 |
+
"Status": data.get("status", ""),
|
21 |
+
"Response Time": f"{data.get('response_time_sec', '0')}s",
|
22 |
+
"Resolved IP": result.get("resolved_ip", ""),
|
23 |
+
"Issued to": result.get("issued_to", ""),
|
24 |
+
"Issued Organization": result.get("issued_o", None),
|
25 |
+
"Issuer Country": result.get("issuer_c", ""),
|
26 |
+
"Issuer CN": result.get("issuer_cn", ""),
|
27 |
+
"Issuer Organization": result.get("issuer_o", ""),
|
28 |
+
"Cert S/N": result.get("cert_sn", ""),
|
29 |
+
"Cert SHA1": result.get("cert_sha1", ""),
|
30 |
+
"Cert Algorithm": result.get("cert_alg", ""),
|
31 |
+
"Cert Version": result.get("cert_ver", ""),
|
32 |
+
"Cert SANs": result.get("cert_sans", ""),
|
33 |
+
"Cert Expired": result.get("cert_exp", False),
|
34 |
+
"Cert Valid": result.get("cert_valid", False),
|
35 |
+
"Valid From": result.get("valid_from", ""),
|
36 |
+
"Valid Until": result.get("valid_till", ""),
|
37 |
+
"Validity Days": result.get("validity_days", 0),
|
38 |
+
"Days Left": result.get("days_left", 0),
|
39 |
+
"Valid Days to Expire": result.get("valid_days_to_expire", 0),
|
40 |
+
"HSTS Header Enabled": result.get("hsts_header_enabled", False)
|
41 |
+
}
|
42 |
+
|
43 |
+
return json.dumps(formatted_data, indent=2) # Format as pretty JSON
|
44 |
|
45 |
def app():
|
46 |
with gr.Blocks(title="Project Gatekeeper - Get free SSL Certificates") as webui:
|