diff options
author | Remy <relst@relst.nl> | 2015-09-15 07:03:06 +0200 |
---|---|---|
committer | Remy <relst@relst.nl> | 2015-09-15 07:03:06 +0200 |
commit | 4ae079b7e58652a0602f169316928888ec5a2f1c (patch) | |
tree | 6f1ffbad8bbaa1fb71d3be53572450c8408974ca | |
parent | 78e84216da00e4537ce5beeb39b55daa612dc879 (diff) | |
download | ssl-decoder-4ae079b7e58652a0602f169316928888ec5a2f1c.zip ssl-decoder-4ae079b7e58652a0602f169316928888ec5a2f1c.tar.gz ssl-decoder-4ae079b7e58652a0602f169316928888ec5a2f1c.tar.bz2 |
add heartbeat extension test
-rw-r--r-- | functions/connection.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/functions/connection.php b/functions/connection.php index 600a35b..ccf09d7 100644 --- a/functions/connection.php +++ b/functions/connection.php @@ -134,6 +134,23 @@ function test_heartbleed($ip, $port) { return $result; } +function heartbeat_test($host, $port) { + global $random_blurp, $timeout; + $result = 0; + + //pre_dump('echo | timeout ' . $timeout . ' openssl s_client -connect ' . escapeshellcmd($host) . ':' . escapeshellcmd($port) . ' -servername ' . escapeshellcmd($host) . ' -tlsextdebug 2>&1 < /dev/null | awk -F\" \'/server extension/ {print $2}\''); + + $output = shell_exec('echo | timeout ' . $timeout . ' openssl s_client -connect ' . escapeshellcmd($host) . ':' . escapeshellcmd($port) . ' -servername ' . escapeshellcmd($host) . ' -tlsextdebug 2>&1 </dev/null | awk -F\" \'/server extension/ {print $2}\''); + + $output = preg_replace("/[[:blank:]]+/"," ", $output); + $output = explode("\n", $output); + $output = array_map('trim', $output); + if ( in_array("heartbeat", $output) ) { + $result = 1; + } + return $result; +} + function test_sslv2($ip, $port) { global $timeout; $exitstatus = 0; @@ -474,6 +491,20 @@ function ssl_conn_metadata($data) { echo "</tr>"; } + echo "<tr>"; + echo "<td>"; + echo "Heartbeat Extension"; + echo "</td>"; + echo "<td>"; + + if ($data["heartbeat"] == "1") { + echo "Extension enabled."; + } else { + echo "Extenstion not enabled."; + } + echo "</td>"; + echo "</tr>"; + // headers echo "<tr>"; echo "<td>"; @@ -856,6 +887,8 @@ function ssl_conn_metadata_json($host, $ip, $port, $read_stream, $chain_data=nul } } + $result["heartbeat"] = heartbeat_test($host, $port); + $result["openssl_version"] = shell_exec("openssl version"); $result["datetime_rfc2822"] = shell_exec("date --rfc-2822"); } |