Merge pull request #1217 from splunk/testing_bug

update generator automated_detection_testing
This commit is contained in:
P4T12ICK
2021-03-04 17:41:30 +01:00
committed by GitHub
@@ -20,6 +20,7 @@ import time
def main(args):
parser = argparse.ArgumentParser(description="detection testing service based on Attack Range.")
@@ -79,13 +80,14 @@ 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)
# 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 = 'True' )
except Exception as e:
print('Error: ' + str(e))
@@ -97,7 +99,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:
@@ -238,4 +240,5 @@ def get_secret(secret_name):
if __name__ == "__main__":
main(sys.argv[1:])