import common import subprocess import os result_file = open("results.json", "a") # CFI + OH # micro-snake protection_time = common.measure_protection_time(["./cfi_oh.sh", "inputs/snake.bc", "snake_sens_list.txt", "inputs/micro-snake.in"]) print('CFI + OH snake protection time ' + str(protection_time)) runtime_overhead = common.measure_runtime_overhead(["python", "inputs/ptypipe.py", "inputs/micro-snake.in", "input_programs/snake"], ["python", "inputs/ptypipe.py", "inputs/micro-snake.in", "OH-build/protected"]) print('runtime overhead ' + str(runtime_overhead) + '%') size_overhead = common.measure_binary_overhead("input_programs/snake", "OH-build/protected") print('size overhead ' + str(size_overhead) + '%') memory_overhead = common.measure_memory_overhead(["python", "inputs/ptypipe.py", "inputs/micro-snake.in", "input_programs/snake"], ["python", "inputs/ptypipe.py", "inputs/micro-snake.in", "OH-build/protected"]) print('memory overhead ' + str(memory_overhead) + '%') snippet = common.create_snippet('micro-snake', 'CFI+OH', protection_time, runtime_overhead, memory_overhead, size_overhead) result_file.write(snippet) # RC # zopfli p = subprocess.Popen(["cp", "config_zopfli.json", "/home/sip/protection/stins4llvm"], stdout = subprocess.PIPE) out, err = p.communicate() os.chdir("/home/sip/protection/stins4llvm") #p = subprocess.Popen(["cd", "/home/sip/protection/stins4llvm"], stdout = subprocess.PIPE)
# SC # micro-snake protection_time = common.measure_protection_time( ["SC-build/src/self-checksumming", "input_programs/snake", "1", "snake"]) print('snake protection time ' + str(protection_time)) runtime_overhead = common.measure_runtime_overhead([ "python", "inputs/ptypipe.py", "inputs/micro-snake.in", "input_programs/snake" ], [ "python", "inputs/ptypipe.py", "inputs/micro-snake.in", "input_programs/snake_modified" ]) print('runtime overhead ' + str(runtime_overhead) + '%') size_overhead = common.measure_binary_overhead( "input_programs/snake", "input_programs/snake_modified") print('size overhead ' + str(size_overhead) + '%') memory_overhead = common.measure_memory_overhead([ "python", "inputs/ptypipe.py", "inputs/micro-snake.in", "input_programs/snake" ], [ "python", "inputs/ptypipe.py", "inputs/micro-snake.in", "input_programs/snake_modified" ]) print('memory overhead ' + str(memory_overhead) + '%') snippet = common.create_snippet('micro-snake', 'SC', protection_time, runtime_overhead, memory_overhead, size_overhead) result_file.write(snippet)
result_file = open("results.json", "a") #CFI # micro-snake protection_time = common.measure_protection_time([ "./compile.sh", "inputs/snake.bc", "CFI-build/snake", "snake_sens_list.txt" ]) print('CFI snake protection time ' + str(protection_time)) runtime_overhead = common.measure_runtime_overhead([ "python", "inputs/ptypipe.py", "inputs/micro-snake.in", "input_programs/snake" ], ["python", "inputs/ptypipe.py", "inputs/micro-snake.in", "CFI-build/snake"]) print('runtime overhead ' + str(runtime_overhead) + '%') size_overhead = common.measure_binary_overhead("input_programs/snake", "CFI-build/snake") print('size overhead ' + str(size_overhead) + '%') memory_overhead = common.measure_memory_overhead([ "python", "inputs/ptypipe.py", "inputs/micro-snake.in", "input_programs/snake" ], ["python", "inputs/ptypipe.py", "inputs/micro-snake.in", "CFI-build/snake"]) print('memory overhead ' + str(memory_overhead) + '%') snippet = common.create_snippet('micro-snake', 'CFI', protection_time, runtime_overhead, 0, size_overhead) result_file.write(snippet) # csnake protection_time = common.measure_protection_time([ "./compile.sh", "inputs/csnake.bc", "CFI-build/csnake",
["./run-oh-eval.sh", "inputs/snake.bc", "inputs/micro-snake.in"]) sc_protection_time = common.measure_protection_time( ["SC-build/src/self-checksumming", "OH-build/protected", "1", "protected"]) protection_time = oh_protection_time + sc_protection_time print('OH + SC snake protection time ' + str(protection_time)) runtime_overhead = common.measure_runtime_overhead([ "python", "inputs/ptypipe.py", "inputs/micro-snake.in", "input_programs/snake" ], [ "python", "inputs/ptypipe.py", "inputs/micro-snake.in", "OH-build/protected_modified" ]) print('runtime overhead ' + str(runtime_overhead) + '%') size_overhead = common.measure_binary_overhead("input_programs/snake", "OH-build/protected_modified") print('size overhead ' + str(size_overhead) + '%') memory_overhead = common.measure_memory_overhead([ "python", "inputs/ptypipe.py", "inputs/micro-snake.in", "input_programs/snake" ], [ "python", "inputs/ptypipe.py", "inputs/micro-snake.in", "OH-build/protected_modified" ]) print('memory overhead ' + str(memory_overhead) + '%') snippet = common.create_snippet('micro-snake', 'OH+SC', protection_time, runtime_overhead, memory_overhead, size_overhead) result_file.write(snippet)
# OH # micro-snake protection_time = common.measure_protection_time([ "../introspection-oblivious-hashing/run-oh.sh", "inputs/snake.bc", "inputs/micro-snake.in" ]) print('OH snake protection time ' + str(protection_time)) runtime_overhead = common.measure_runtime_overhead([ "python", "inputs/ptypipe.py", "inputs/micro-snake.in", "input_programs/snake" ], ["python", "inputs/ptypipe.py", "inputs/micro-snake.in", "./out"]) print('runtime overhead ' + str(runtime_overhead) + '%') size_overhead = common.measure_binary_overhead("input_programs/snake", "./out") print('size overhead ' + str(size_overhead) + '%') memory_overhead = common.measure_memory_overhead([ "python", "inputs/ptypipe.py", "inputs/micro-snake.in", "input_programs/snake" ], ["python", "inputs/ptypipe.py", "inputs/micro-snake.in", "./out"]) print('memory overhead ' + str(memory_overhead) + '%') snippet = common.create_snippet('micro-snake', 'OH', protection_time, runtime_overhead, memory_overhead, size_overhead) result_file.write(snippet) # c-snake protection_time = common.measure_protection_time([