logo

deblob

remove binary executables from a directory git clone https://anongit.hacktivis.me/git/deblob.git/
commit: f1f1ebcb3833d906c9d68d580014a7e2eb9502de
parent 6e65f8e3df6b2085ee0aacc66a4ba3429587edaa
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Mon, 23 Dec 2024 08:02:27 +0100

Add support for Mach-O executables

At least Apple Silicon ones

Diffstat:

M.reuse/dep55+++++
ALICENSES/ISC.txt8++++++++
Mdeblob.12++
Mmain.ha6++++--
Atest/fixtures/macos-arm64.o0
5 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/.reuse/dep5 b/.reuse/dep5 @@ -6,3 +6,8 @@ Source: https://hacktivis.me/projects/deblob Files: test/fixtures/pyc/*.pyc test/fixtures/pickle/*.pickle test/fixtures/hello.luac* test/fixtures/hello.class test/fixtures/hello.jar test/fixtures/hello.nqp.moarvm test/fixtures/hello.pir.pbc test/fixtures/perl_storage.pst test/fixtures/hello.beam test/fixtures/empty.dtb test/fixtures/hello-chez.so test/fixtures/hello.n test/fixtures/hello-ocaml.* test/fixtures/compiled/hello-racket_rkt.zo test/fixtures/hello.elc test/fixtures/hello.cnut Copyright: 2019 deblob Authors <https://hacktivis.me/projects/deblob> License: BSD-3-Clause + +# Grabbed from https://github.com/ibara/freebee-cli +Files: test/fixtures/macos-arm64.o +Copyright: 2024 Brian Callahan <bcallah@openbsd.org> +License: ISC diff --git a/LICENSES/ISC.txt b/LICENSES/ISC.txt @@ -0,0 +1,8 @@ +ISC License: + +Copyright (c) 2004-2010 by Internet Systems Consortium, Inc. ("ISC") +Copyright (c) 1995-2003 by Internet Software Consortium + +Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/deblob.1 b/deblob.1 @@ -92,6 +92,8 @@ Erlang BEAM files and BEAM/PKZIP-based escripts .It Java Class files and Archives (JAR) .It +Mach-O executables +.It Python 2.7 & 3.8/3.9/3.10/3.11/3.12 bytecode files, typically .Sq *.pyc .It diff --git a/main.ha b/main.ha @@ -24,7 +24,8 @@ const magic: [_](str, []u8) = [ ("Unix ar(1)", ['!', '<', 'a', 'r', 'c', 'h', '>', '\n']), ("PC-BIOS", [0x55, 0xAA]), ("Erlang FOR1 BEAM", ['F', 'O', 'R', '1']), - ("Java .class / MachO exec", [0xCA, 0xFE, 0xBA, 0xBE]), + ("Java .class / Mach-O exec", [0xCA, 0xFE, 0xBA, 0xBE]), + ("Mach-O exec", [0xCF, 0xFA, 0xED, 0xFE]), ("WinNT EXE", ['M', 'Z', 0x90, 0x00, 0x03, 0x00, 0x00, 0x00]), // Partial MSDOS stub header (ECMA-335 Common Language Infrastructure) ("Lua bytecode", [0x1B, 'L', 'u', 'a']), ("Wasm", [0x00, 'a', 's', 'm']), @@ -240,6 +241,7 @@ fn id_blob(filename: str) (void | str | fs::error | io::error) = { ("Python Pickle v5", "test/fixtures/pickle/hello.5.pickle"), ("Apple PEF", "test/fixtures/qemu_vga.ndrv"), //("", "test/fixtures/option.rom"), + ("MachO exec", "test/fixtures/macos-arm64.o"), ]; for (let i = 0z; i < len(blobs); i += 1) { @@ -379,7 +381,7 @@ fn check_dir(dirname: str) (void | errors::invalid | io::error) = { case let e: fs::error => fmt::fatalf("deblob: error: os::readdir({}): {}", dirname, fs::strerror(e)); }; - assert(len(files_before) == 60); + assert(len(files_before) == 61); const ret = check_dir(dirname); assert(ret is void); diff --git a/test/fixtures/macos-arm64.o b/test/fixtures/macos-arm64.o Binary files differ.