ToolBox-1.0 - Multi-Call Binary Maker

Under development: PCMCIA, wireless, etc.
Post Reply
Message
Author
User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

ToolBox-1.0 - Multi-Call Binary Maker

#1 Post by SFR »

Some time ago I was investigating the possibility of creating a BusyBox-like multi-call binary, but, as opposed to BusyBox and alike, creating it from already compiled binaries.
I didn't find anything like that on the internet, but eventually came across the memfd_create system call, which creates an anonymous file in RAM than can be executed just like any file on a disk.
There is one downside, though - this syscall was added in kernel 3.17 and it's both build-time (kernel headers) and run-time requirement.

This tool can be used to create e.g. all-in-one, portable collection of favourite binaries (preferably statically linked and UPXed), but also scripts and other resources, like docs, images, etc.

Quick start:

0. Download the attached tarball and extract it
1. Make sure you have devx.sfs loaded
2. Put all binaries, scripts and other stuff in applets directory
3. Run ./toolbox.sh

(More info and a few examples of cross-compiling can be found in README file.)

This will create a multi-call binary named, by default, toolbox:

Code: Select all

# ./toolbox
Usage:
./toolbox <applet> [arguments]          execute an applet
./toolbox -l|--list                                    list available applets
./toolbox -d|--dump <applet>              dump an applet to stdout
./toolbox -v|--version                            show version info
./toolbox -h|--help                                this very help
# 
As you can see, you can run a specific applet by using its name as the first argument.
Just like with BusyBox, you can also create symlinks pointing to that binary:

Code: Select all

./toolbox -l | tr '\n' '\0' | xargs -0 -n1 ln -s toolbox
This, obviously, will be working only with binaries and scripts, not with non-executable assets.

There's also an option dump an applet to stdout, which may be desired in case of text files and maybe scripts, but for binary files stdout should be redirected to a file:

Code: Select all

./toolbox -d some_app > some_app
Btw, symlinks are embeddable as well (given that their targets are also found in applets dir), so you can embed e.g. busybox or dropbearmulti with all the relevant symlinks included.

Have fun &
Greetings!
Attachments
toolbox-1.0.tar.gz
MD5: f31ce0b0c96def6f6bbd1dfb6e2dba8e toolbox-1.0.tar.gz
(5.19 KiB) Downloaded 168 times
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#2 Post by sc0ttman »

Ooooh... this looks great..

I'd love to combine a few tools, to create a simpler, single binary file "webpack" alternative, that takes nice CLI options, instead of a config file...

Ideally something that can do these things:

- JSON file parser
- CSV parser
- read .hbs file, use mustache or handelbars templating system to output HTML

...ideally it would also contain rollup.js (for transpiling JS), and a sass transpiler... if that's possible...

This might be the place to start!
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

Post Reply