Exemplo n.º 1
0
 def test_binary_in_path(self):
     """
     Test binary_in_path
     """
     with tempfile.TemporaryDirectory() as tmpd:
         open(os.path.join(tmpd, 'testbin'), 'w').close()
         util.os.environ["PATH"] = tmpd
         self.assertTrue(util.binary_in_path('testbin'))
         self.assertEqual(util.os_paths, [tmpd])
Exemplo n.º 2
0
def check_requirements(use_git):
    """Ensure all requirements are satisfied before continuing."""
    required_bins = ["mock", "rpm2cpio", "nm", "objdump", "cpio", "readelf"]

    if use_git:
        required_bins.append("git")

    missing = [x for x in required_bins if not binary_in_path(x)]

    if missing:
        print_fatal("Required programs are not installed: {}".format(", ".join(missing)))
        sys.exit(1)
Exemplo n.º 3
0
def examine_abi(download_path, name):
    """Proxy the ABI reporting to the right function."""
    download_path = os.path.abspath(download_path)
    results_dir = os.path.abspath(os.path.join(download_path, "results"))

    if not os.path.exists(results_dir):
        util.print_fatal("Results directory does not exist, aborting")
        sys.exit(1)

    if util.binary_in_path("abireport"):
        examine_abi_host(download_path, results_dir, name)
    else:
        util.print_warning("abireport is not installed. Using slow scanning")
        examine_abi_fallback(download_path, results_dir, name)