$ip = $hostname['ip']; $port = get($_GET['port'], '443'); if (!is_numeric($port)) { $port = 443; } $fastcheck = $_GET['fastcheck']; $write_cache = 1; $hostfilename = preg_replace("([^\\w\\s\\d\\-_~,;:\\[\\]\\(\\).])", '', $host); $hostfilename = preg_replace("([\\.]{2,})", '', $host); $hostfilename = preg_replace("([^a-z0-9])", '', $host); $cache_filename = (string) "results/saved." . $hostfilename . "." . $epoch . "." . $random_bla . ".api.json"; $data["data"] = check_json($host, $ip, $port, $fastcheck); } elseif (isset($_GET['csr']) && !empty($_GET['csr'])) { $write_cache = 1; $cache_filename = (string) "results/saved.csr." . $epoch . "." . $random_bla . ".api.json"; $data["data"]["chain"]["1"] = csr_parse_json($_GET['csr']); } else { $data["error"] = ["Host is required"]; } $data['version'] = $version; $data = utf8encodeNestedArray($data); if (isset($data["data"]["error"])) { $data["error"] = $data["data"]["error"]; unset($data["data"]); } if ($_GET["type"] == "pretty") { header('Content-Type: text/html'); echo "<pre>"; echo htmlspecialchars(json_encode($data, JSON_PRETTY_PRINT)); echo "</pre>"; ?>
if (is_bool($key)) { $key = $key ? 'True' : 'False'; } if (is_bool($value)) { $value = $value ? 'True' : 'False'; } echo "<tr><td width='20%'>" . htmlspecialchars(ucfirst(str_replace('_', ' ', $key))) . "</td><td width='80%' style='font-family:monospace;'>" . wordwrap(htmlspecialchars($value), 65, "<br />", 1) . "</td></tr>"; } } } echo "</table>"; } echo "</section></div>"; } } elseif (!empty($_GET['csr'])) { $data = csr_parse_json($_GET['csr']); echo "<p><strong>This tool does not make conclusions. Please check the data and define the validity yourself!</strong><br>\n </p>"; $cache_filename = (string) "results/saved.csr." . $epoch . "." . $random_bla . ".html"; $cache_filename_json = (string) "results/saved.csr." . $epoch . "." . $random_bla . ".json"; if ($write_cache == 1) { echo "This result is saved at most 60 days on <a href=\""; echo htmlspecialchars($current_folder) . $cache_filename; echo "\">the following URL</a>. Do note that this might be deleted earlier if space runs out."; } if (strpos($_GET['csr'], "BEGIN CERTIFICATE REQUEST") !== false) { echo "<header><h2>CSR </h2></header><p>"; csr_parse($data); } else { echo "<header><h2>Certificate </h2></header><p>"; cert_parse($data); }