def _is_listening(stderr=False): env_dict = utilities.get_environment_file_dict() kibana_path_conf = env_dict.get('KIBANA_PATH_CONF') if not kibana_path_conf: if stderr: sys.stderr.write( '[-] Kibana configuration directory could not be located in ' '/etc/dynamite/environment.\n') return False if not os.path.exists(os.path.join(kibana_path_conf, 'kibana.yml')): if stderr: sys.stderr.write( '[-] Could not locate kibana.yml in {}\n'.format( kibana_path_conf)) return False try: kibana_config = KibanaConfigurator( configuration_directory=kibana_path_conf) except Exception: if stderr: sys.stderr.write( '[-] Un-parsable elasticsearch.yml or jvm.options \n') return False host = kibana_config.get_server_host() port = kibana_config.get_server_port() if host.strip() == '0.0.0.0': host = 'localhost' return utilities.check_socket(host, port)
def _is_listening(stderr=False): env_dict = utilities.get_environment_file_dict() es_path_conf = env_dict.get('ES_PATH_CONF') if not es_path_conf: if stderr: sys.stderr.write( '[-] ElasticSearch configuration directory could not be located in /etc/environment.\n' ) return False if not os.path.exists(os.path.join(es_path_conf, 'elasticsearch.yml')): if stderr: sys.stderr.write( '[-] Could not locate elasticsearch.yml in {}\n'.format( es_path_conf)) return False if not os.path.exists(os.path.join(es_path_conf, 'jvm.options')): if stderr: sys.stderr.write( '[-] Could not locate jvm.options in {}\n'.format( es_path_conf)) return False try: es_config = ElasticConfigurator( configuration_directory=es_path_conf) except Exception: if stderr: sys.stderr.write( '[-] Un-parsable elasticsearch.yml or jvm.options \n') return False host = es_config.get_network_host() port = es_config.get_network_port() if host.strip() == '0.0.0.0': host = 'localhost' return utilities.check_socket(host, port)
def check_elasticsearch_target(host, port, perform_check=True): if not perform_check: return if not check_socket(host, port): print( "\n\033[93m[-] ElasticSearch does not appear to be started on: {}:{}.\033[0m" .format(host, port)) if str(prompt_input( '\033[93m[?] Continue? [y|N]:\033[0m ')).lower() != 'y': exit(0) return
def is_listening(self): if not self.kibana_config: return False if not os.path.exists(self.kibana_config): return False kb_config_obj = kibana_config.ConfigManager(configuration_directory=self.kibana_config) host = kb_config_obj.server_host port = kb_config_obj.server_port if host.strip() == '0.0.0.0': host = 'localhost' return utilities.check_socket(host, port)
def is_listening(self): if not self.elasticsearch_config: return False if not os.path.exists(self.elasticsearch_config): return False es_config_obj = elastic_configs.ConfigManager( configuration_directory=self.elasticsearch_config) host = es_config_obj.network_host port = es_config_obj.http_port if host.strip() == '0.0.0.0': host = 'localhost' return utilities.check_socket(host, port)
def is_listening(self) -> bool: """ Check if Elasticsearch is listening Returns: True, if Elasticsearch HTTP service is listening """ if not self.elasticsearch_config: return False if not os.path.exists(self.elasticsearch_config): return False es_config_obj = elastic_configs.ConfigManager(configuration_directory=self.elasticsearch_config) host = es_config_obj.network_host port = es_config_obj.http_port return utilities.check_socket(host, port)
def is_listening(self): """Check if Kibana is listening Returns: True, if listening """ if not self.kibana_config: return False if not os.path.exists(self.kibana_config): return False kb_config_obj = kibana_config.ConfigManager(configuration_directory=self.kibana_config) host = kb_config_obj.host port = kb_config_obj.port if host.strip() == '0.0.0.0': host = 'localhost' return utilities.check_socket(host, port)