deptective
Project description
Deptective
What? Deptective automatically determines the native dependencies required to run any arbitrary program or command.
How? Deptective runs the command, observing which nonexistent files it attempts to open. If the command fails, Deptective attempts to install the dependencies that provide the nonexistent files, and runs the command again. If installing a dependency does not change the observable behavior of the command, then Deptective backtracks and tries a different dependency. This process continues until either the command succeeds or there are no more dependencies that could provide a missing file.
Quickstart ๐
$ pip3 install deptective
Running it ๐
You simply point deptective to any executable, script, or shell command:
$ deptective cat /usr/bin/transmission-gtk
[10:10:44] INFO Copying source files to the container... dependencies.py:546
INFO Updating apt sources... dependencies.py:553
[10:10:58] INFO Installing coreutils into de790cc40abe... dependencies.py:575
[10:11:10] INFO Installing transmission-gtk into 0b26c0931f9f... dependencies.py:575
๐ cat โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 0% -:--:-- 0/2
1 ๐พ transmission-gtk โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 0/?
[10:12:11] INFO Satisfying dependencies: ๐พ transmission-gtk cli.py:304
Install with: apt-get install transmission-gtk
Say you download some source code that you need to build with GNU autotools. Simply run
$ deptective ./configure
and Deptective will automatically determine all of the requirements necessary to build the code!
If you know the specific file you are missing and you want to see all of the packages that provide that file, you
can use the -s option:
$ deptective -s /usr/bin/transmission-gtk
[10:13:02] INFO Packages providing /usr/bin/transmission-gtk: transmission-gtk cli.py:276
By default, Deptective returns the first satisfying set of dependencies it discovers. This is not guaranteed to be the
smallest satisfying set of dependencies (i.e., it may include unnecessary dependencies). Deptective can enumerate an
arbitrary number of results with the -n argument.
Prerequisites ๐งฉ
Depective uses Docker to snapshot installation state, avoid polluting the host system with unnecessary dependencies, and investigate dependencies across different distributions.
If running from Linux, Deptective defaults to checking for dependencies on the host's distribution, architecture, and
package manager, if possible. If running from a different operating system, Deptective defaults to searching for
dependencies on the latest version of Ubuntu using apt. Package managers, operating systems, releases, and
architectures can be specified through command line arguments (see deptective --help).
A list of all supported operating systems, releases, and architectures can be enumerated with the deptective --list
command.
Caveats and Troubleshooting โ ๏ธ
Log Directory for Debugging ๐
Deptective can save logs and runtime artifacts to a specified directory using the --log-dir option. This is especially useful for debugging failed dependency resolution attempts, as it will preserve information about partial results and command outputs.
$ deptective --log-dir ./debug-logs ./configure
If the log directory already exists, you can use the --force option to overwrite it:
$ deptective --log-dir ./debug-logs --force ./configure
If no log directory is specified, Deptective will create a temporary directory and report its location when errors occur.
Host System Paths ๐
As mentioned above, Deptective does its analysis within Docker containers. Deptective will automatically copy
its current working directory on the host system into /workdir/ inside the container.
This means that if the command being inspected references files with absolute paths and/or files that are not in the
directory subtree rooted at $PWD, the command will likely fail. There are plans to address this in a later version of
Deptective.
Package Index Cache ๐
Deptective builds a package index cache mapping file paths to packages that provide them the first time it is run.
However, package databases like apt are constantly changing, with vulnerable packages being yanked and new packages
added. You can force a rebuild of the package index cache by running deptective --rebuild.
Path Testing Latency โณ
Deptective uses the Docker API to test the existence of files accessed by the target command. On certain Docker configurationsโparticularly when macOS is the host OSโ, this can be very slow. A different, faster mechanism for testing files will be added in a future release.
Contact ๐ฌ
If you'd like to file a bug report or feature request, please use our issues page. Feel free to contact us or reach out in Empire Hacking for help using or extending Deptective.
License ๐
This utility was developed by Trail of Bits. It is licensed under the GNU Lesser General Public License v3.0. Contact us if you're looking for an exception to the terms.
ยฉ 2025, Trail of Bits.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file deptective-0.1.0.tar.gz.
File metadata
- Download URL: deptective-0.1.0.tar.gz
- Upload date:
- Size: 29.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91c9ce94d9ed573ade2403073d46b6ea473ee0f0ac72ba1416db8bcdd8962ed2
|
|
| MD5 |
4f997334264b33097de957ee37bd5147
|
|
| BLAKE2b-256 |
121d0fec13d9b3eb363fafa33bab4cd0fbd73441987fd9fca0ba397639e4b670
|
Provenance
The following attestation bundles were made for deptective-0.1.0.tar.gz:
Publisher:
release.yml on trailofbits/deptective
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
deptective-0.1.0.tar.gz -
Subject digest:
91c9ce94d9ed573ade2403073d46b6ea473ee0f0ac72ba1416db8bcdd8962ed2 - Sigstore transparency entry: 268728043
- Sigstore integration time:
-
Permalink:
trailofbits/deptective@a5550db90afc7971e0af80773bfe190b04ba257d -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/trailofbits
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a5550db90afc7971e0af80773bfe190b04ba257d -
Trigger Event:
release
-
Statement type:
File details
Details for the file deptective-0.1.0-py2.py3-none-any.whl.
File metadata
- Download URL: deptective-0.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 32.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5f692690317a647e3bb8d4656da0e97259579e4ceba551837a4355a0adf865c
|
|
| MD5 |
e7bccc4afbcd37884d9fa1d75ac78e73
|
|
| BLAKE2b-256 |
0b6f5acb815a5455d9f14418e1e07af78fba471b43c19a705eb5953f6d982c41
|
Provenance
The following attestation bundles were made for deptective-0.1.0-py2.py3-none-any.whl:
Publisher:
release.yml on trailofbits/deptective
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
deptective-0.1.0-py2.py3-none-any.whl -
Subject digest:
d5f692690317a647e3bb8d4656da0e97259579e4ceba551837a4355a0adf865c - Sigstore transparency entry: 268728045
- Sigstore integration time:
-
Permalink:
trailofbits/deptective@a5550db90afc7971e0af80773bfe190b04ba257d -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/trailofbits
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a5550db90afc7971e0af80773bfe190b04ba257d -
Trigger Event:
release
-
Statement type: