Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def install_logstash():
if not utilities.is_root():
sys.stderr.write('[-] This script must be run as root.\n')
sys.exit(1)
if utilities.get_memory_available_bytes() < 6 * (1000 ** 3):
sys.stderr.write('[-] Dynamite Logstash requires at-least 6GB to run currently available [{} GB]\n'.format(
utilities.get_memory_available_bytes()/(1024 ** 3)
))
sys.exit(1)
try:
ls_installer = logstash.LogstashInstaller()
utilities.download_java(stdout=True)
utilities.extract_java(stdout=True)
utilities.setup_java()
utilities.create_dynamite_user('password')
ls_installer.download_logstash(stdout=True)
ls_installer.extract_logstash(stdout=True)
ls_installer.setup_logstash(stdout=True)
except Exception:
sys.stderr.write('[-] A fatal error occurred while attempting to install LogStash: ')
traceback.print_exc(file=sys.stderr)
sys.exit(1)
sys.stdout.write('[+] *** LogStash + ElastiFlow (w/ Zeek Support) installed successfully. ***\n\n')
sys.stdout.write('[+] Next, Start your collector: \'dynamite.py start logstash\'.\n')
sys.stdout.flush()
time.sleep(1)
sys.stdout.write('[+] YOU MUST LOGOUT (or exit this shell) TO COMPLETE INSTALLATION')
sys.stdout.flush()
def install_logstash():
if not utilities.is_root():
sys.stderr.write('[-] This script must be run as root.\n')
sys.exit(1)
if utilities.get_memory_available_bytes() < 6 * (1000 ** 3):
sys.stderr.write('[-] Dynamite Logstash requires at-least 6GB to run currently available [{} GB]\n'.format(
utilities.get_memory_available_bytes()/(1024 ** 3)
))
sys.exit(1)
try:
ls_installer = logstash.LogstashInstaller()
utilities.download_java(stdout=True)
utilities.extract_java(stdout=True)
utilities.setup_java()
utilities.create_dynamite_user('password')
ls_installer.download_logstash(stdout=True)
ls_installer.extract_logstash(stdout=True)
ls_installer.setup_logstash(stdout=True)
except Exception:
sys.stderr.write('[-] A fatal error occurred while attempting to install LogStash: ')
traceback.print_exc(file=sys.stderr)
sys.exit(1)
sys.stdout.write('[+] *** LogStash + ElastiFlow (w/ Zeek Support) installed successfully. ***\n\n')
sys.stdout.write('[+] Next, Start your collector: \'dynamite.py start logstash\'.\n')
sys.stdout.flush()
time.sleep(1)
sys.stdout.write('[+] YOU MUST LOGOUT (or exit this shell) TO COMPLETE INSTALLATION')
sys.stdout.flush()
def install_logstash():
if not utilities.is_root():
sys.stderr.write('[-] This script must be run as root.\n')
sys.exit(1)
if utilities.get_memory_available_bytes() < 6 * (1000 ** 3):
sys.stderr.write('[-] Dynamite Logstash requires at-least 6GB to run currently available [{} GB]\n'.format(
utilities.get_memory_available_bytes()/(1024 ** 3)
))
sys.exit(1)
try:
ls_installer = logstash.LogstashInstaller()
utilities.download_java(stdout=True)
utilities.extract_java(stdout=True)
utilities.setup_java()
utilities.create_dynamite_user('password')
ls_installer.download_logstash(stdout=True)
ls_installer.extract_logstash(stdout=True)
ls_installer.setup_logstash(stdout=True)
except Exception:
sys.stderr.write('[-] A fatal error occurred while attempting to install LogStash: ')
traceback.print_exc(file=sys.stderr)
sys.exit(1)
sys.stdout.write('[+] *** LogStash + ElastiFlow (w/ Zeek Support) installed successfully. ***\n\n')
sys.stdout.write('[+] Next, Start your collector: \'dynamite.py start logstash\'.\n')
sys.stdout.flush()
time.sleep(1)
sys.stdout.write('[+] YOU MUST LOGOUT (or exit this shell) TO COMPLETE INSTALLATION')
sys.stdout.flush()
def install_elasticsearch():
if not utilities.is_root():
sys.stderr.write('[-] This script must be run as root.\n')
sys.exit(1)
if utilities.get_memory_available_bytes() < 6 * (1000 ** 3):
sys.stderr.write('[-] Dynamite ElasticSearch requires at-least 6GB to run currently available [{} GB]\n'.format(
utilities.get_memory_available_bytes()/(1024 ** 3)
))
sys.exit(1)
try:
es_installer = elasticsearch.ElasticInstaller()
utilities.download_java(stdout=True)
utilities.extract_java(stdout=True)
utilities.setup_java()
utilities.create_dynamite_user('password')
es_installer.download_elasticsearch(stdout=True)
es_installer.extract_elasticsearch(stdout=True)
def install_logstash():
if not utilities.is_root():
sys.stderr.write('[-] This script must be run as root.\n')
sys.exit(1)
if utilities.get_memory_available_bytes() < 6 * (1000 ** 3):
sys.stderr.write('[-] Dynamite Logstash requires at-least 6GB to run currently available [{} GB]\n'.format(
utilities.get_memory_available_bytes()/(1024 ** 3)
))
sys.exit(1)
try:
ls_installer = logstash.LogstashInstaller()
utilities.download_java(stdout=True)
utilities.extract_java(stdout=True)
utilities.setup_java()
utilities.create_dynamite_user('password')
ls_installer.download_logstash(stdout=True)
ls_installer.extract_logstash(stdout=True)
ls_installer.setup_logstash(stdout=True)
except Exception:
sys.stderr.write('[-] A fatal error occurred while attempting to install LogStash: ')
traceback.print_exc(file=sys.stderr)
sys.exit(1)
sys.stdout.write('[+] *** LogStash + ElastiFlow (w/ Zeek Support) installed successfully. ***\n\n')
sys.stdout.write('[+] Next, Start your collector: \'dynamite.py start logstash\'.\n')
sys.stdout.flush()
time.sleep(1)
sys.stdout.write('[+] YOU MUST LOGOUT (or exit this shell) TO COMPLETE INSTALLATION')
sys.stdout.flush()
def install_elasticsearch():
if not utilities.is_root():
sys.stderr.write('[-] This script must be run as root.\n')
sys.exit(1)
if utilities.get_memory_available_bytes() < 6 * (1000 ** 3):
sys.stderr.write('[-] Dynamite ElasticSearch requires at-least 6GB to run currently available [{} GB]\n'.format(
utilities.get_memory_available_bytes()/(1024 ** 3)
))
sys.exit(1)
try:
es_installer = elasticsearch.ElasticInstaller()
utilities.download_java(stdout=True)
utilities.extract_java(stdout=True)
utilities.setup_java()
utilities.create_dynamite_user('password')
es_installer.download_elasticsearch(stdout=True)
es_installer.extract_elasticsearch(stdout=True)
es_installer.setup_elasticsearch(stdout=True)
except Exception:
sys.stderr.write('[-] A fatal error occurred while attempting to install ElasticSearch: ')
traceback.print_exc(file=sys.stderr)
sys.exit(1)
sys.stdout.write('[+] *** ElasticSearch installed successfully. ***\n\n')
sys.stdout.write('[+] Next, Start your cluster: \'dynamite.py start elasticsearch\'.\n')
sys.stdout.flush()
time.sleep(1)
sys.stdout.write('[+] YOU MUST LOGOUT (or exit this shell) TO COMPLETE INSTALLATION')
sys.stdout.flush()
sys.exit(0)
def install_logstash():
if not utilities.is_root():
sys.stderr.write('[-] This script must be run as root.\n')
sys.exit(1)
if utilities.get_memory_available_bytes() < 6 * (1000 ** 3):
sys.stderr.write('[-] Dynamite Logstash requires at-least 6GB to run currently available [{} GB]\n'.format(
utilities.get_memory_available_bytes()/(1024 ** 3)
))
sys.exit(1)
try:
ls_installer = logstash.LogstashInstaller()
utilities.download_java(stdout=True)
utilities.extract_java(stdout=True)
utilities.setup_java()
utilities.create_dynamite_user('password')
ls_installer.download_logstash(stdout=True)
ls_installer.extract_logstash(stdout=True)
ls_installer.setup_logstash(stdout=True)
ls_installer.setup_logstash(stdout=True)
except Exception:
sys.stderr.write('[-] A fatal error occurred while attempting to install LogStash: ')
traceback.print_exc(file=sys.stderr)
sys.exit(1)
sys.stdout.write('[+] *** LogStash + ElastiFlow (w/ Zeek Support) installed successfully. ***\n\n')
sys.stdout.write('[+] Next, Start your collector: \'dynamite.py start logstash\'.\n')
sys.stdout.flush()
time.sleep(1)
sys.stdout.write('[+] YOU MUST LOGOUT (or exit this shell) TO COMPLETE INSTALLATION')
sys.stdout.flush()
if __name__ == '__main__':
args = _parse_cmdline()
utilities.source_environment_file()
if args.command == 'install':
if args.component == 'elasticsearch':
install_elasticsearch()
elif args.component == 'logstash':
install_logstash()
else:
sys.stderr.write('[-] Unrecognized component - {}\n'.format(args.component))
sys.exit(1)
elif args.command == 'start':
if args.component == 'elasticsearch':
sys.stdout.write('[+] Starting ElasticSearch.\n')
started = elasticsearch.ElasticProcess().start(stdout=True)
if started:
sys.stdout.write('[+] ElasticSearch started successfully. Check its status at any time with: '
'\'dynamite.py status elasticsearch\'.\n')
else:
def install_logstash():
if not utilities.is_root():
sys.stderr.write('[-] This script must be run as root.\n')
sys.exit(1)
if utilities.get_memory_available_bytes() < 6 * (1000 ** 3):
sys.stderr.write('[-] Dynamite Logstash requires at-least 6GB to run currently available [{} GB]\n'.format(
utilities.get_memory_available_bytes()/(1024 ** 3)
))
sys.exit(1)
try:
ls_installer = logstash.LogstashInstaller()
utilities.download_java(stdout=True)
utilities.extract_java(stdout=True)
utilities.setup_java()
utilities.create_dynamite_user('password')
ls_installer.download_logstash(stdout=True)
ls_installer.extract_logstash(stdout=True)
ls_installer.setup_logstash(stdout=True)
except Exception:
sys.stderr.write('[-] A fatal error occurred while attempting to install LogStash: ')
traceback.print_exc(file=sys.stderr)