#!/usr/bin/env bash # Prowler - the handy cloud security tool (copyright 2018) by Toni de la Fuente # # Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy # of the License at http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software distributed # under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR # CONDITIONS OF ANY KIND, either express or implied. See the License for the # specific language governing permissions and limitations under the License. # Function test_tcp_connectivity is in include/os_detector # Functions to connection responses initially used for Elasticsearch related checks httpStatus(){ case $1 in 000) SERVER_RESPONSE="000 Not responding" ;; 200) SERVER_RESPONSE="200 Successful" ;; 400) SERVER_RESPONSE="400 Error: Bad Request" ;; 401) SERVER_RESPONSE="401 Error: Unauthorized" ;; 403) SERVER_RESPONSE="403 Error: Forbidden" ;; 404) SERVER_RESPONSE="404 Error: Not Found" ;; 407) SERVER_RESPONSE="407 Error: Proxy Authentication Required" ;; 408) SERVER_RESPONSE="408 Error: Request Timeout" ;; 500) SERVER_RESPONSE="500 Error: Internal Server Error" ;; 502) SERVER_RESPONSE="502 Error: Bad Gateway" ;; 503) SERVER_RESPONSE="503 Error: Service Unavailable" ;; 504) SERVER_RESPONSE="504 Error: Gateway Timeout" ;; 505) SERVER_RESPONSE="505 Error: HTTP Version Not Supported" ;; *) SERVER_RESPONSE="HTTP: status not defined." ;; esac }