def main()

in ransomware/testing/mock_ransomware.py [0:0]


def main():
    # Create target files
    cur_dir = os.path.dirname(os.path.realpath(__file__))
    target_dir = os.path.join(cur_dir, "ransomware_tmp")
    print("Create target files for ransomware")
    create_target_files(target_dir)

    mock_ransomware = os.path.join(cur_dir, "mock_ransomware.ps1")
    
    print("Running mock ransomware (single process)")
    cmd_str = "powershell.exe -ExecutionPolicy Bypass %s -path %s -delay %s" % (
        mock_ransomware,
        target_dir,
        5,
    )
    
    # Run ransomware
    print("Running {}".format(cmd_str))

    try:
        subprocess.check_call(cmd_str)
    except subprocess.CalledProcessError as e:
        print("mock_ransomware powershell subprocess did not complete")