blint 3.0.4__tar.gz → 3.0.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {blint-3.0.4 → blint-3.0.6}/PKG-INFO +28 -14
- {blint-3.0.4 → blint-3.0.6}/README.md +26 -12
- {blint-3.0.4 → blint-3.0.6}/blint/cli.py +8 -1
- {blint-3.0.4 → blint-3.0.6}/blint/lib/binary.py +2 -1
- {blint-3.0.4 → blint-3.0.6}/blint/lib/sbom.py +3 -3
- {blint-3.0.4 → blint-3.0.6}/blint/lib/utils.py +13 -17
- {blint-3.0.4 → blint-3.0.6}/pyproject.toml +2 -2
- {blint-3.0.4 → blint-3.0.6}/LICENSE +0 -0
- {blint-3.0.4 → blint-3.0.6}/blint/__init__.py +0 -0
- {blint-3.0.4 → blint-3.0.6}/blint/config.py +0 -0
- {blint-3.0.4 → blint-3.0.6}/blint/cyclonedx/README.md +0 -0
- {blint-3.0.4 → blint-3.0.6}/blint/cyclonedx/__init__.py +0 -0
- {blint-3.0.4 → blint-3.0.6}/blint/cyclonedx/spdx.py +0 -0
- {blint-3.0.4 → blint-3.0.6}/blint/cyclonedx/spec.py +0 -0
- {blint-3.0.4 → blint-3.0.6}/blint/data/__init__.py +0 -0
- {blint-3.0.4 → blint-3.0.6}/blint/data/annotations/__init__.py +0 -0
- {blint-3.0.4 → blint-3.0.6}/blint/data/annotations/review_entries_generic.yml +0 -0
- {blint-3.0.4 → blint-3.0.6}/blint/data/annotations/review_entries_pe.yml +0 -0
- {blint-3.0.4 → blint-3.0.6}/blint/data/annotations/review_exe_go.yml +0 -0
- {blint-3.0.4 → blint-3.0.6}/blint/data/annotations/review_functions_generic.yml +0 -0
- {blint-3.0.4 → blint-3.0.6}/blint/data/annotations/review_imports_pe.yml +0 -0
- {blint-3.0.4 → blint-3.0.6}/blint/data/annotations/review_methods_generic.yml +0 -0
- {blint-3.0.4 → blint-3.0.6}/blint/data/annotations/review_methods_mips.yml +0 -0
- {blint-3.0.4 → blint-3.0.6}/blint/data/annotations/review_monero_generic.yml +0 -0
- {blint-3.0.4 → blint-3.0.6}/blint/data/annotations/review_monero_go.yml +0 -0
- {blint-3.0.4 → blint-3.0.6}/blint/data/annotations/review_monero_rust.yml +0 -0
- {blint-3.0.4 → blint-3.0.6}/blint/data/annotations/review_rootkits_win.yml +0 -0
- {blint-3.0.4 → blint-3.0.6}/blint/data/annotations/review_symbols_antiforensic.yml +0 -0
- {blint-3.0.4 → blint-3.0.6}/blint/data/annotations/review_symbols_generic.yml +0 -0
- {blint-3.0.4 → blint-3.0.6}/blint/data/annotations/review_symbols_hooka.yml +0 -0
- {blint-3.0.4 → blint-3.0.6}/blint/data/annotations/review_symbols_macho.yml +0 -0
- {blint-3.0.4 → blint-3.0.6}/blint/data/annotations/review_symbols_rust.yml +0 -0
- {blint-3.0.4 → blint-3.0.6}/blint/data/rules.yml +0 -0
- {blint-3.0.4 → blint-3.0.6}/blint/db.py +0 -0
- {blint-3.0.4 → blint-3.0.6}/blint/lib/__init__.py +0 -0
- {blint-3.0.4 → blint-3.0.6}/blint/lib/analysis.py +0 -0
- {blint-3.0.4 → blint-3.0.6}/blint/lib/android.py +0 -0
- {blint-3.0.4 → blint-3.0.6}/blint/lib/checks.py +0 -0
- {blint-3.0.4 → blint-3.0.6}/blint/lib/disassembler.py +0 -0
- {blint-3.0.4 → blint-3.0.6}/blint/lib/runners.py +0 -0
- {blint-3.0.4 → blint-3.0.6}/blint/logger.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: blint
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.6
|
|
4
4
|
Summary: Linter and SBOM generator for binary files.
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
License-File: LICENSE
|
|
@@ -28,6 +28,7 @@ Requires-Dist: custom-json-diff (>=2.1.6)
|
|
|
28
28
|
Requires-Dist: defusedxml (>=0.7.1)
|
|
29
29
|
Requires-Dist: flake8 (>=7.2.0) ; extra == "dev"
|
|
30
30
|
Requires-Dist: lief (>=0.16.6)
|
|
31
|
+
Requires-Dist: multi-demangle (>=1.0.1)
|
|
31
32
|
Requires-Dist: oras (>=0.2.28)
|
|
32
33
|
Requires-Dist: orjson (>=3.10.16)
|
|
33
34
|
Requires-Dist: packageurl-python (>=0.16.0)
|
|
@@ -37,7 +38,6 @@ Requires-Dist: pylint (>=3.3.6) ; extra == "dev"
|
|
|
37
38
|
Requires-Dist: pytest (>=8.3.5) ; extra == "dev"
|
|
38
39
|
Requires-Dist: pytest-cov (>=6.1.1) ; extra == "dev"
|
|
39
40
|
Requires-Dist: rich (>=14.0.0)
|
|
40
|
-
Requires-Dist: symbolic (==10.2.1)
|
|
41
41
|
Project-URL: CI, https://github.com/owasp-dep-scan/blint/actions
|
|
42
42
|
Description-Content-Type: text/markdown
|
|
43
43
|
|
|
@@ -57,13 +57,15 @@ blint is a tool for reverse engineers, security analysts, and developers to quic
|
|
|
57
57
|
- PE (Windows executables and DLLs)
|
|
58
58
|
- Mach-O (macOS and iOS, x64 and arm64)
|
|
59
59
|
- Android (APK, AAB, including DEX files in deep mode)
|
|
60
|
+
- Disassembler: AArch64, x86/x86-64, ARM, Mips, MicroMips.
|
|
60
61
|
|
|
61
62
|
## Key Features & Use Cases
|
|
62
63
|
|
|
63
64
|
- **Comprehensive Security Audits:** Automatically checks for common security mitigations like PIE, ASLR, NX, Stack Canaries, and RELRO. Ideal for ensuring your CI/CD pipeline produces hardened binaries.
|
|
64
65
|
- **Software Bill-of-Materials (SBOM) Generation:** Creates CycloneDX SBOMs for binaries built with Go, Rust, .NET, and Android toolchains, providing a clear inventory of third-party components for vulnerability management.
|
|
65
|
-
- **Deep Binary Inspection:**
|
|
66
|
-
-
|
|
66
|
+
- **Deep Binary Inspection:** Disassembles, extracts, and analyzes a wealth of information including symbols, functions, dependencies, and build toolchains. This raw data is saved as a detailed JSON file.
|
|
67
|
+
- For a complete guide to all attributes in this file, see the [Technical Metadata Documentation](./docs/METADATA.md).
|
|
68
|
+
- Navigate to the [disassembly guide](./docs/DISASSEMBLE.md).
|
|
67
69
|
- **Capability Analysis:** Identifies potentially sensitive capabilities by reviewing imported functions and symbols, such as network access, filesystem operations, or cryptographic API usage.
|
|
68
70
|
- **CI/CD Integration:** Can be added to build pipelines to enforce security policies, such as requiring code signing on all release artifacts.
|
|
69
71
|
- **Fuzzing Target Identification:** Suggests interesting functions to target for fuzzing based on common patterns in function names (e.g., `parse`, `decode`, `copy`).
|
|
@@ -73,38 +75,50 @@ blint is a tool for reverse engineers, security analysts, and developers to quic
|
|
|
73
75
|
|
|
74
76
|
`blint` requires Python >= 3.10.
|
|
75
77
|
|
|
76
|
-
```
|
|
78
|
+
```shell
|
|
77
79
|
pip install blint
|
|
78
80
|
```
|
|
79
81
|
|
|
80
82
|
For **disassembly support**, which enables instruction-level analysis of functions, install the `extended` version. This includes the [nyxstone](https://github.com/emproof-com/nyxstone) disassembler.
|
|
81
83
|
|
|
82
|
-
```
|
|
84
|
+
```shell
|
|
83
85
|
pip install blint[extended]
|
|
84
86
|
```
|
|
85
87
|
|
|
86
|
-
###
|
|
88
|
+
### Via Container Image
|
|
87
89
|
|
|
88
|
-
|
|
90
|
+
You can also run blint using the official container image available on GitHub Container Registry. This is a convenient way to run blint without installing Python or any dependencies on your host machine.
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
docker run --rm -it -v $(pwd):/app -w /app ghcr.io/owasp-dep-scan/blint:latest -i /path/to/your/binary
|
|
94
|
+
```
|
|
89
95
|
|
|
90
96
|
## Quick Start
|
|
91
97
|
|
|
92
98
|
Analyze a binary and save the reports to the `/tmp/blint` directory:
|
|
93
99
|
|
|
94
|
-
```
|
|
100
|
+
```shell
|
|
95
101
|
blint -i /bin/netstat -o /tmp/blint
|
|
96
102
|
```
|
|
97
103
|
|
|
104
|
+
```shell
|
|
105
|
+
docker run --rm -it -v /tmp:/tmp -v /bin:/app/bin -w /app ghcr.io/owasp-dep-scan/blint:latest -i /app/bin/netstat -o /tmp/blint
|
|
106
|
+
```
|
|
107
|
+
|
|
98
108
|
Analyze a Go or Rust binary and get suggestions for fuzzing targets:
|
|
99
109
|
|
|
100
|
-
```
|
|
110
|
+
```shell
|
|
101
111
|
blint -i /path/to/my-binary --suggest-fuzzable
|
|
102
112
|
```
|
|
103
113
|
|
|
104
114
|
Generate a CycloneDX SBOM for an Android application:
|
|
105
115
|
|
|
106
116
|
```shell
|
|
107
|
-
blint sbom -i /path/to/app.apk -o
|
|
117
|
+
blint sbom -i /path/to/app.apk -o sbom.cdx.json
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
```shell
|
|
121
|
+
docker run --rm -it -v /path/to:/app -w /app ghcr.io/owasp-dep-scan/blint:latest sbom -i /app/app.apk -o sbom.cdx.json
|
|
108
122
|
```
|
|
109
123
|
|
|
110
124
|
## Understanding the Output
|
|
@@ -117,7 +131,7 @@ blint produces several JSON artifacts in the specified reports directory.
|
|
|
117
131
|
| `findings.json` | A summary of the **security properties audit**. Designed for CI/CD integration. | Lists security mitigations like PIE, NX, and Stack Canaries and whether they are present. |
|
|
118
132
|
| `reviews.json` | A summary of the **capability review**. | Lists detected capabilities (e.g., "networking", "file-read", "crypto") based on the symbols and functions found. |
|
|
119
133
|
| `fuzzables.json` | A list of **suggested functions to fuzz**, generated when using the `--suggest-fuzzable` flag. | Identifies functions with names that suggest data parsing or manipulation, which are often good candidates for fuzzing. |
|
|
120
|
-
| `
|
|
134
|
+
| `sbom-*.cdx.json` | The **Software Bill-of-Materials (SBOM)**, generated by the `sbom` sub-command. | A CycloneDX-formatted JSON file detailing the binary's components and dependencies. |
|
|
121
135
|
|
|
122
136
|
## Advanced Usage: SBOM Generation with blintdb
|
|
123
137
|
|
|
@@ -135,7 +149,7 @@ The workflow is a two-step process:
|
|
|
135
149
|
|
|
136
150
|
2. **Generate the SBOM with blintdb enabled:**
|
|
137
151
|
```shell
|
|
138
|
-
blint sbom -i /path/to/binary -o
|
|
152
|
+
blint sbom -i /path/to/binary -o sbom.cdx.json --use-blintdb
|
|
139
153
|
```
|
|
140
154
|
|
|
141
155
|
This will cross-reference symbols found in your binary against the database to identify components like OpenSSL, zlib, and others.
|
|
@@ -188,7 +202,7 @@ options:
|
|
|
188
202
|
-i SRC_DIR_IMAGE [SRC_DIR_IMAGE ...], --src SRC_DIR_IMAGE [SRC_DIR_IMAGE ...]
|
|
189
203
|
Source directories, container images or binary files. Defaults to current directory.
|
|
190
204
|
-o SBOM_OUTPUT, --output-file SBOM_OUTPUT
|
|
191
|
-
SBOM output file. Defaults to
|
|
205
|
+
SBOM output file. Defaults to sbom-binary-postbuild.cdx.json in current directory.
|
|
192
206
|
--deep Enable deep mode to collect more used symbols and modules aggressively. Slow operation.
|
|
193
207
|
--stdout Print the SBOM to stdout instead of a file.
|
|
194
208
|
--exports-prefix EXPORTS_PREFIX [EXPORTS_PREFIX ...]
|
|
@@ -14,13 +14,15 @@ blint is a tool for reverse engineers, security analysts, and developers to quic
|
|
|
14
14
|
- PE (Windows executables and DLLs)
|
|
15
15
|
- Mach-O (macOS and iOS, x64 and arm64)
|
|
16
16
|
- Android (APK, AAB, including DEX files in deep mode)
|
|
17
|
+
- Disassembler: AArch64, x86/x86-64, ARM, Mips, MicroMips.
|
|
17
18
|
|
|
18
19
|
## Key Features & Use Cases
|
|
19
20
|
|
|
20
21
|
- **Comprehensive Security Audits:** Automatically checks for common security mitigations like PIE, ASLR, NX, Stack Canaries, and RELRO. Ideal for ensuring your CI/CD pipeline produces hardened binaries.
|
|
21
22
|
- **Software Bill-of-Materials (SBOM) Generation:** Creates CycloneDX SBOMs for binaries built with Go, Rust, .NET, and Android toolchains, providing a clear inventory of third-party components for vulnerability management.
|
|
22
|
-
- **Deep Binary Inspection:**
|
|
23
|
-
-
|
|
23
|
+
- **Deep Binary Inspection:** Disassembles, extracts, and analyzes a wealth of information including symbols, functions, dependencies, and build toolchains. This raw data is saved as a detailed JSON file.
|
|
24
|
+
- For a complete guide to all attributes in this file, see the [Technical Metadata Documentation](./docs/METADATA.md).
|
|
25
|
+
- Navigate to the [disassembly guide](./docs/DISASSEMBLE.md).
|
|
24
26
|
- **Capability Analysis:** Identifies potentially sensitive capabilities by reviewing imported functions and symbols, such as network access, filesystem operations, or cryptographic API usage.
|
|
25
27
|
- **CI/CD Integration:** Can be added to build pipelines to enforce security policies, such as requiring code signing on all release artifacts.
|
|
26
28
|
- **Fuzzing Target Identification:** Suggests interesting functions to target for fuzzing based on common patterns in function names (e.g., `parse`, `decode`, `copy`).
|
|
@@ -30,38 +32,50 @@ blint is a tool for reverse engineers, security analysts, and developers to quic
|
|
|
30
32
|
|
|
31
33
|
`blint` requires Python >= 3.10.
|
|
32
34
|
|
|
33
|
-
```
|
|
35
|
+
```shell
|
|
34
36
|
pip install blint
|
|
35
37
|
```
|
|
36
38
|
|
|
37
39
|
For **disassembly support**, which enables instruction-level analysis of functions, install the `extended` version. This includes the [nyxstone](https://github.com/emproof-com/nyxstone) disassembler.
|
|
38
40
|
|
|
39
|
-
```
|
|
41
|
+
```shell
|
|
40
42
|
pip install blint[extended]
|
|
41
43
|
```
|
|
42
44
|
|
|
43
|
-
###
|
|
45
|
+
### Via Container Image
|
|
44
46
|
|
|
45
|
-
|
|
47
|
+
You can also run blint using the official container image available on GitHub Container Registry. This is a convenient way to run blint without installing Python or any dependencies on your host machine.
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
docker run --rm -it -v $(pwd):/app -w /app ghcr.io/owasp-dep-scan/blint:latest -i /path/to/your/binary
|
|
51
|
+
```
|
|
46
52
|
|
|
47
53
|
## Quick Start
|
|
48
54
|
|
|
49
55
|
Analyze a binary and save the reports to the `/tmp/blint` directory:
|
|
50
56
|
|
|
51
|
-
```
|
|
57
|
+
```shell
|
|
52
58
|
blint -i /bin/netstat -o /tmp/blint
|
|
53
59
|
```
|
|
54
60
|
|
|
61
|
+
```shell
|
|
62
|
+
docker run --rm -it -v /tmp:/tmp -v /bin:/app/bin -w /app ghcr.io/owasp-dep-scan/blint:latest -i /app/bin/netstat -o /tmp/blint
|
|
63
|
+
```
|
|
64
|
+
|
|
55
65
|
Analyze a Go or Rust binary and get suggestions for fuzzing targets:
|
|
56
66
|
|
|
57
|
-
```
|
|
67
|
+
```shell
|
|
58
68
|
blint -i /path/to/my-binary --suggest-fuzzable
|
|
59
69
|
```
|
|
60
70
|
|
|
61
71
|
Generate a CycloneDX SBOM for an Android application:
|
|
62
72
|
|
|
63
73
|
```shell
|
|
64
|
-
blint sbom -i /path/to/app.apk -o
|
|
74
|
+
blint sbom -i /path/to/app.apk -o sbom.cdx.json
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
```shell
|
|
78
|
+
docker run --rm -it -v /path/to:/app -w /app ghcr.io/owasp-dep-scan/blint:latest sbom -i /app/app.apk -o sbom.cdx.json
|
|
65
79
|
```
|
|
66
80
|
|
|
67
81
|
## Understanding the Output
|
|
@@ -74,7 +88,7 @@ blint produces several JSON artifacts in the specified reports directory.
|
|
|
74
88
|
| `findings.json` | A summary of the **security properties audit**. Designed for CI/CD integration. | Lists security mitigations like PIE, NX, and Stack Canaries and whether they are present. |
|
|
75
89
|
| `reviews.json` | A summary of the **capability review**. | Lists detected capabilities (e.g., "networking", "file-read", "crypto") based on the symbols and functions found. |
|
|
76
90
|
| `fuzzables.json` | A list of **suggested functions to fuzz**, generated when using the `--suggest-fuzzable` flag. | Identifies functions with names that suggest data parsing or manipulation, which are often good candidates for fuzzing. |
|
|
77
|
-
| `
|
|
91
|
+
| `sbom-*.cdx.json` | The **Software Bill-of-Materials (SBOM)**, generated by the `sbom` sub-command. | A CycloneDX-formatted JSON file detailing the binary's components and dependencies. |
|
|
78
92
|
|
|
79
93
|
## Advanced Usage: SBOM Generation with blintdb
|
|
80
94
|
|
|
@@ -92,7 +106,7 @@ The workflow is a two-step process:
|
|
|
92
106
|
|
|
93
107
|
2. **Generate the SBOM with blintdb enabled:**
|
|
94
108
|
```shell
|
|
95
|
-
blint sbom -i /path/to/binary -o
|
|
109
|
+
blint sbom -i /path/to/binary -o sbom.cdx.json --use-blintdb
|
|
96
110
|
```
|
|
97
111
|
|
|
98
112
|
This will cross-reference symbols found in your binary against the database to identify components like OpenSSL, zlib, and others.
|
|
@@ -145,7 +159,7 @@ options:
|
|
|
145
159
|
-i SRC_DIR_IMAGE [SRC_DIR_IMAGE ...], --src SRC_DIR_IMAGE [SRC_DIR_IMAGE ...]
|
|
146
160
|
Source directories, container images or binary files. Defaults to current directory.
|
|
147
161
|
-o SBOM_OUTPUT, --output-file SBOM_OUTPUT
|
|
148
|
-
SBOM output file. Defaults to
|
|
162
|
+
SBOM output file. Defaults to sbom-binary-postbuild.cdx.json in current directory.
|
|
149
163
|
--deep Enable deep mode to collect more used symbols and modules aggressively. Slow operation.
|
|
150
164
|
--stdout Print the SBOM to stdout instead of a file.
|
|
151
165
|
--exports-prefix EXPORTS_PREFIX [EXPORTS_PREFIX ...]
|
|
@@ -138,7 +138,7 @@ def build_parser():
|
|
|
138
138
|
"-o",
|
|
139
139
|
"--output-file",
|
|
140
140
|
dest="sbom_output",
|
|
141
|
-
help="SBOM output file. Defaults to
|
|
141
|
+
help="SBOM output file. Defaults to sbom-binary-postbuild.cdx.json in current directory.",
|
|
142
142
|
)
|
|
143
143
|
sbom_parser.add_argument(
|
|
144
144
|
"--deep",
|
|
@@ -178,6 +178,13 @@ def build_parser():
|
|
|
178
178
|
nargs="+",
|
|
179
179
|
help="Directories containing pre-build and build BOMs. Use to improve the precision.",
|
|
180
180
|
)
|
|
181
|
+
sbom_parser.add_argument(
|
|
182
|
+
"--use-blintdb",
|
|
183
|
+
action="store_true",
|
|
184
|
+
default=os.path.exists(BLINTDB_LOC),
|
|
185
|
+
dest="use_blintdb",
|
|
186
|
+
help=f"Use blintdb for symbol resolution. Defaults to true if the file exists at {BLINTDB_LOC}. Use environment variables: BLINTDB_IMAGE_URL, BLINTDB_HOME, and BLINTDB_REFRESH for customization.",
|
|
187
|
+
)
|
|
181
188
|
db_parser = subparsers.add_parser(
|
|
182
189
|
"db", help="Command to manage the pre-compiled database."
|
|
183
190
|
)
|
|
@@ -396,7 +396,8 @@ def process_pe_resources(parsed_obj):
|
|
|
396
396
|
version_metadata = {}
|
|
397
397
|
version_info = rm.version if rm.has_version else None
|
|
398
398
|
if isinstance(version_info, list) and len(version_info):
|
|
399
|
-
|
|
399
|
+
if not isinstance(version_info[0], lief.lief_errors):
|
|
400
|
+
version_info = version_info[0]
|
|
400
401
|
if version_info and hasattr(version_info, "string_file_info"):
|
|
401
402
|
string_file_info: lief.PE.ResourceStringFileInfo = version_info.string_file_info
|
|
402
403
|
for lc_item in string_file_info.children:
|
|
@@ -189,7 +189,7 @@ def create_sbom(
|
|
|
189
189
|
symbols_purl_map: dict,
|
|
190
190
|
) -> CycloneDX:
|
|
191
191
|
"""
|
|
192
|
-
Creates a Software Bill
|
|
192
|
+
Creates a Software Bill-of-Materials (SBOM) with the provided components,
|
|
193
193
|
dependencies, output file, and SBOM object.
|
|
194
194
|
|
|
195
195
|
Args:
|
|
@@ -314,7 +314,7 @@ def process_exe_file(
|
|
|
314
314
|
use_blintdb: bool = False,
|
|
315
315
|
) -> list[Component]:
|
|
316
316
|
"""
|
|
317
|
-
Processes an executable file, extracts metadata, and generates a Software Bill
|
|
317
|
+
Processes an executable file, extracts metadata, and generates a Software Bill-of-Materials.
|
|
318
318
|
|
|
319
319
|
Args:
|
|
320
320
|
dependencies_dict (dict[str, set]): A dictionary of dependencies.
|
|
@@ -691,7 +691,7 @@ def process_android_file(
|
|
|
691
691
|
dependencies_dict (dict[str, set]): Existing dependencies dictionary.
|
|
692
692
|
deep_mode (bool): Flag indicating whether to process in deep mode.
|
|
693
693
|
f (str): File to be processed.
|
|
694
|
-
sbom (obj): Software Bill
|
|
694
|
+
sbom (obj): Software Bill-of-Materials object to be updated.
|
|
695
695
|
|
|
696
696
|
Returns:
|
|
697
697
|
list: Updated components list after processing.
|
|
@@ -4,6 +4,7 @@ import math
|
|
|
4
4
|
import os
|
|
5
5
|
import re
|
|
6
6
|
import hashlib
|
|
7
|
+
import multi_demangle
|
|
7
8
|
import shutil
|
|
8
9
|
import string
|
|
9
10
|
import tempfile
|
|
@@ -47,23 +48,18 @@ CHARSET = string.digits + string.ascii_letters + r"""!&@"""
|
|
|
47
48
|
# Known files compressed with ar
|
|
48
49
|
KNOWN_AR_EXTNS = (".a", ".rlib", ".lib")
|
|
49
50
|
|
|
51
|
+
demangle_options_complete = multi_demangle.DemangleOptions.complete()
|
|
52
|
+
demangle_options_name_only = multi_demangle.DemangleOptions.name_only()
|
|
50
53
|
|
|
51
|
-
|
|
52
|
-
try:
|
|
53
|
-
from symbolic._lowlevel import ffi, lib
|
|
54
|
-
from symbolic.utils import encode_str, decode_str, rustcall
|
|
55
|
-
except OSError:
|
|
56
|
-
SYMBOLIC_FOUND = False
|
|
57
|
-
|
|
58
|
-
def demangle_symbolic_name(symbol, lang=None, no_args=False):
|
|
54
|
+
def demangle_symbolic_name(symbol, name_only=False):
|
|
59
55
|
"""Demangles symbol using llvm demangle falling back to some heuristics. Covers legacy rust."""
|
|
60
|
-
if not SYMBOLIC_FOUND:
|
|
61
|
-
return symbol
|
|
62
56
|
try:
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
57
|
+
demangled_symbol = multi_demangle.demangle_symbol(
|
|
58
|
+
symbol,
|
|
59
|
+
options=demangle_options_name_only
|
|
60
|
+
if name_only
|
|
61
|
+
else demangle_options_complete,
|
|
62
|
+
)
|
|
67
63
|
# demangling didn't work
|
|
68
64
|
if symbol and symbol == demangled_symbol:
|
|
69
65
|
for ign in ("__imp_anon.", "anon.", ".L__unnamed"):
|
|
@@ -74,9 +70,9 @@ def demangle_symbolic_name(symbol, lang=None, no_args=False):
|
|
|
74
70
|
if symbol.startswith("@feat.00"):
|
|
75
71
|
return "SAFESEH"
|
|
76
72
|
if (
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
73
|
+
symbol.startswith("__imp_")
|
|
74
|
+
or symbol.startswith(".rdata$")
|
|
75
|
+
or symbol.startswith(".refptr.")
|
|
80
76
|
):
|
|
81
77
|
symbol = f"__declspec(dllimport) {symbol.removeprefix('__imp_').removeprefix('.rdata$').removeprefix('.refptr.')}"
|
|
82
78
|
demangled_symbol = (
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "blint"
|
|
3
|
-
version = "3.0.
|
|
3
|
+
version = "3.0.6"
|
|
4
4
|
description = "Linter and SBOM generator for binary files."
|
|
5
5
|
authors = [
|
|
6
6
|
{name= "Team AppThreat", email = "cloud@appthreat.com"},
|
|
@@ -12,7 +12,7 @@ dependencies = [
|
|
|
12
12
|
"defusedxml>=0.7.1",
|
|
13
13
|
"pydantic[email]>=2.11.3",
|
|
14
14
|
"orjson>=3.10.16",
|
|
15
|
-
"
|
|
15
|
+
"multi-demangle>=1.0.1",
|
|
16
16
|
"ar>=1.0.0",
|
|
17
17
|
"custom-json-diff>=2.1.6",
|
|
18
18
|
"appdirs>=1.4.4",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|