def verify_assimilate_output(self, filename, old_package, big_job=False): """ Creates Runner Output file from filename and calls one of verification methods depending on runner output file :param big_job: job bog enough to change host power :param filename: file name of runner output :param old_package: package before changes from assimilator :return: """ with open(filename, "r") as f: file = f.read() runner_output = RunnerOutput(file) # benchmark if runner_output.mode == "b": if runner_output.status_code == 0: self.verify_bench_ok(runner_output, old_package) else: self.verify_bench_error() # normal mode elif runner_output.mode == "n": if runner_output.status_code == 0: self.verify_normal_found(runner_output, old_package) elif runner_output.status_code == 1: self.verify_normal_not_found(runner_output, old_package, big_job) else: self.verify_normal_error() # benchmark all elif runner_output.mode == "a": pass
def test_benchmark_error(self): self.setup_benchmark(error=True) ret = self.call_runner() self.assertEqual(0, ret, "Runner return value") runner_command, out = self.verify_output_files() self.verify_parse_benchmark(runner_command) output = RunnerOutput(out) self.verify_output_benchmark_error(output)
def test_dictionary_error(self): self.setup_normal(AttackModes.dictionary, error=True) ret = self.call_runner() self.assertEqual(0, ret, "Runner return value") runner_command, out = self.verify_output_files() self.verify_parse_normal(runner_command, hash_type=0, mode=AttackModes.dictionary) output = RunnerOutput(out) self.verify_output_normal(output, error=True)
def test_combination_not_found(self): self.setup_normal(AttackModes.combination) ret = self.call_runner() self.assertEqual(0, ret, "Runner return value") runner_command, out = self.verify_output_files() self.verify_parse_normal(runner_command, hash_type=0, mode=AttackModes.combination) output = RunnerOutput(out) self.verify_output_normal(output)
def test_mask_found(self): self.setup_normal(AttackModes.mask, found=True, mask="?d?d?d?d") ret = self.call_runner() self.assertEqual(0, ret, "Runner return value") runner_command, out = self.verify_output_files() self.verify_parse_normal(runner_command, hash_type=0, mode=AttackModes.mask) output = RunnerOutput(out) self.verify_output_normal(output, found=True)