-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c26fd00
commit ca30948
Showing
12 changed files
with
1,469 additions
and
927 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
NOT_REQUESTED = object() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Copyright (c) stefan6419846. All rights reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text. | ||
|
||
""" | ||
Tools related to binary linking. | ||
""" | ||
|
||
from __future__ import annotations | ||
|
||
import subprocess | ||
from pathlib import Path | ||
|
||
|
||
def check_shared_objects(path: Path) -> str | None: | ||
""" | ||
Check which other shared objects a shared object links to. | ||
:param path: The file path to analyze. | ||
:return: The analysis results if the path points to a shared object, `None` otherwise. | ||
""" | ||
# TODO: Handle binary files here as well (like `/usr/bin/bc`). | ||
if path.suffix != ".so" and not (path.suffixes and path.suffixes[0] == ".so"): | ||
return None | ||
output = subprocess.check_output(["ldd", path], stderr=subprocess.PIPE) | ||
return output.decode("UTF-8") |
Oops, something went wrong.