summaryrefslogtreecommitdiffstats
path: root/json.php
diff options
context:
space:
mode:
authorRemy <relst@relst.nl>2015-05-24 09:35:28 +0200
committerRemy <relst@relst.nl>2015-05-24 09:35:28 +0200
commit988f08b9eb952404b94817a973d1a19ff7c6524b (patch)
treeb23c940603507f240f377ba9278b49ae97dc6190 /json.php
parent5e7e74fe94062683cce82c189cd43dd18c3aff9b (diff)
downloadssl-decoder-988f08b9eb952404b94817a973d1a19ff7c6524b.zip
ssl-decoder-988f08b9eb952404b94817a973d1a19ff7c6524b.tar.gz
ssl-decoder-988f08b9eb952404b94817a973d1a19ff7c6524b.tar.bz2
Add support for specific endpoints
Diffstat (limited to 'json.php')
-rw-r--r--json.php16
1 files changed, 8 insertions, 8 deletions
diff --git a/json.php b/json.php
index 72b55fe..a915c38 100644
--- a/json.php
+++ b/json.php
@@ -10,13 +10,13 @@ foreach (glob("functions/*.php") as $filename) {
if ( isset($_GET['host']) && !empty($_GET['host'])) {
$data = [];
$hostname = mb_strtolower(get($_GET['host']));
- $host = parse_hostname($hostname);
- if ($host['port']) {
- $port = $host['port'];
- } else {
- $port = get($_GET['port'], '443');
- }
- $host = $host['hostname'];
+ $hostname = parse_hostname($hostname);
+ if ($hostname['multiple_ip']) {
+ $data["error"] = ["Host format is incorrect. (use \$host:\$ip.)"];
+ }
+ $host = $hostname['hostname'];
+ $ip = $hostname['ip'];
+ $port = get($_GET['port'], '443');
if ( !is_numeric($port) ) {
$port = 443;
}
@@ -25,7 +25,7 @@ if ( isset($_GET['host']) && !empty($_GET['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,$port);
+ $data["data"] = check_json($host, $ip, $port);
} elseif(isset($_GET['csr']) && !empty($_GET['csr'])) {
$write_cache = 1;
$cache_filename = (string) "results/saved.csr." . $epoch . "." . $random_bla . ".api.json";