From 29a101da97ffb778f51104c087b620324870a032 Mon Sep 17 00:00:00 2001 From: bpatel Date: Mon, 1 Mar 2021 15:27:25 -0800 Subject: [PATCH] update local generator --- automated_detection_testing/detection_service.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/automated_detection_testing/detection_service.py b/automated_detection_testing/detection_service.py index 112a4aaa07..894b595293 100644 --- a/automated_detection_testing/detection_service.py +++ b/automated_detection_testing/detection_service.py @@ -20,6 +20,7 @@ import time + def main(args): parser = argparse.ArgumentParser(description="detection testing service based on Attack Range.") @@ -79,13 +80,15 @@ def main(args): with open(ssh_key_name, "w") as ssh_key: ssh_key.write(response['KeyMaterial']) os.chmod(ssh_key_name, 0o600) + private_key_path = str(os.getcwd() + "/" + ssh_key_name) + print (private_key_path) # build new version of ESCU sys.path.append(os.path.join(os.getcwd(),'security_content/bin')) + try: module = __import__('generate') - module.sys.argv = ['generate', '-p', 'security_content', '-o' 'security_content/package'] - results = module.main(module.sys.argv) + results = module.main(REPO_PATH = 'security_content' , OUTPUT_PATH = 'security_content/package', VERBOSE = '--verbose' ) except Exception as e: print('Error: ' + str(e)) @@ -97,7 +100,7 @@ def main(args): filedata = filedata.replace('windows_server_join_domain = 1', 'windows_server_join_domain = 0') filedata = filedata.replace('region = us-west-2', 'region = eu-central-1') filedata = filedata.replace('key_name = attack-range-key-pair', 'key_name = ' + ssh_key_name) - filedata = filedata.replace('private_key_path = ~/.ssh/id_rsa', 'private_key_path = /app/' + ssh_key_name) + filedata = filedata.replace('private_key_path = ~/.ssh/id_rsa', 'private_key_path = ' + private_key_path) filedata = filedata.replace('update_escu_app = 0', 'update_escu_app = 1') with open('attack_range/attack_range.conf', 'w') as file: