コード例 #1
0
 def test_digestible_json(self):
     test_uname = "Linux-3.10.0-1-generic-x86_64-with-Ubuntu-14.04-xenial"
     test_kernel = get_kernel_version(uname=test_uname)
     local_finds = find_exploit_locally(test_kernel)
     json_finds = convert_to_digestible(local_finds, digest="json")
     unjson_finds = json.loads(json_finds)
     self.assertEqual(len(unjson_finds[EXPLOIT_AVAILABLE]),
                      len(local_finds[EXPLOIT_AVAILABLE]))
コード例 #2
0
 def test_vulnerable_kernel_matching(self):
     # TODO: this kernel is not vulnerable to any of the exploits in the project, but is listed as vulnerable
     # TODO:		we need to unfortunately track down the kernel windows for each specific exploit for each
     # TODO:		specific distro for each specific kernel (i.e. 4.4.0-0 -> 4.4.x-last_patch)
     test_uname = 'Linux-4.4.0-75-generic-x86_64-with-Ubuntu-16.04-xenial'
     test_kernel = Kernel(test_uname)
     exploit_results = find_exploit_locally(test_kernel)
     print("")
     self.assertTrue(total_exploits(exploit_results["confirmed"]) < 1)
コード例 #3
0
 def test_dump_to_file(self):
     test_uname = "Linux-3.10.0-1-generic-x86_64-with-Ubuntu-14.04-xenial"
     test_kernel = get_kernel_version(uname=test_uname)
     local_finds = find_exploit_locally(test_kernel)
     json_finds = convert_to_digestible(local_finds, digest="json")
     test_outfile = os.path.join(ROOT_DIR, "output.json")
     if os.path.exists(test_outfile):
         os.remove(test_outfile)
     write_digestible_to_file(test_outfile, json_finds)
     self.assertTrue(os.path.exists(test_outfile))
     # remove it so it's not in the project
     if os.path.exists(test_outfile):
         os.remove(test_outfile)
コード例 #4
0
 def test_find_exploit_locally(self):
     test_uname = "Linux-4.10.0-1-generic-x86_64-with-Ubuntu-16.04-xenial"
     test_kernel = Kernel(test_uname)
     exploit_results = find_exploit_locally(test_kernel)
     self.assertGreaterEqual(
         len(exploit_results["confirmed"][HIGH_RELIABILITY]), 1)
コード例 #5
0
 def test_digestible_xml(self):
     test_uname = "Linux-3.10.0-1-generic-x86_64-with-Ubuntu-14.04-xenial"
     test_kernel = get_kernel_version(uname=test_uname)
     local_finds = find_exploit_locally(test_kernel)
コード例 #6
0
 def test_patched_kernel_matching(self):
     test_uname = "Linux-4.99.0-1-generic-i686-with-Ubuntu-16.04-xenial"
     test_kernel = Kernel(test_uname)
     exploit_results = find_exploit_locally(test_kernel)
     self.assertTrue(total_exploits(exploit_results["confirmed"]) < 1)