Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: support .arr, support ios/wasm binaries #4521

Merged
merged 12 commits into from
Dec 18, 2024
1 change: 1 addition & 0 deletions .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ pyyaml
skontar
Svunknown
urllib
aar
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ The following archive formats are currently supported by the auto-extractor:
| Archive Format | File Extension |
| -------------- | ---------------------------------------------- |
| zip | .zip, .exe, .jar, .msi, .egg, .whl, .war, .ear |
| | .aar |
| tar | .tar, .tgz, .tar.gz, .tar.xz, .tar.bz2 |
| deb | .deb, .ipk |
| rpm | .rpm |
Expand Down Expand Up @@ -348,7 +349,7 @@ On windows systems, you may need:

Windows has `Expand` installed by default, but `ar` and `7z` might need to be installed.
If you want to run our test-suite or scan a zstd compressed file, We recommend installing this [7-zip-zstd](https://github.com/mcmilk/7-Zip-zstd)
fork of 7zip. We are currently using `7z` for extracting `jar`, `apk`, `msi`, `exe` and `rpm` files.
fork of 7zip. We are currently using `7z` for extracting `jar`, `apk`, `aar`, `msi`, `exe` and `rpm` files.
To install `ar` you can install MinGW (which has binutils as a part of it) from [here](https://www.mingw-w64.org/downloads/#msys2) and run the downloaded .exe file.

If you get an error about building libraries when you try to install from pip,
Expand Down
1 change: 1 addition & 0 deletions cve_bin_tool/extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ def __init__(self, logger=None, error_mode=ErrorMode.TruncTrace):
".whl",
".war",
".ear",
".aar",
],
MIMES: [
"application/x-msdownload",
Expand Down
25 changes: 25 additions & 0 deletions cve_bin_tool/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,28 @@ def check_pe(_filename: str, signature: bytes) -> bool:
def check_fake_test(_filename: str, signature: bytes) -> bool:
"""check for fake tests under windows."""
return signature == b"MZ\x90\x00"


def check_mach_o_32(_filename: str, signature: bytes) -> bool:
"""Check for Mach-O 32-bit signature."""
return signature[:4] == b"\xFE\xED\xFA\xCE"


def check_mach_o_64(_filename: str, signature: bytes) -> bool:
"""Check for Mach-O 64-bit signature."""
return signature[:4] == b"\xFE\xED\xFA\xCF"


def check_mach_o_universal(_filename: str, signature: bytes) -> bool:
"""Check for Mach-O Universal Binary signature."""
return signature[:4] == b"\xCA\xFE\xBA\xBE"


def check_ios_arm(_filename: str, signature: bytes) -> bool:
"""Check for Mach-O Universal Binary signature."""
return signature[:4] == b"\xCF\xFA\xED\xFE"


def check_wasm(_filename: str, signature: bytes) -> bool:
"""Check for WebAssembly (WASM) signature."""
return signature[:4] == b"\x00\x61\x73\x6D"
1 change: 1 addition & 0 deletions cve_bin_tool/version_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ def is_executable(self, filename: str) -> tuple[bool, str | None]:
"PE32 executable",
"PE32+ executable",
"Mach-O",
"WebAssembly",
"YAFFS",
": data",
*list(valid_files.keys()),
Expand Down
Loading