Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jktr/arg-inject
add support for config files via LD_PRELOAD
https://github.com/jktr/arg-inject
command-line-arguments ld-preload shim
Last synced: 3 months ago
JSON representation
add support for config files via LD_PRELOAD
- Host: GitHub
- URL: https://github.com/jktr/arg-inject
- Owner: jktr
- Created: 2019-04-22T04:59:52.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-04-22T05:00:24.000Z (almost 6 years ago)
- Last Synced: 2024-08-03T17:10:21.865Z (6 months ago)
- Topics: command-line-arguments, ld-preload, shim
- Language: C
- Homepage:
- Size: 3.91 KB
- Stars: 15
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-ld-preload - arg-inject - add support for config files (Libraries)
README
# Arg Inject
Have you ever wanted to add config file support into
binary-only applications? Or maybe your application takes a password
via command line and you don't want it showing up in `ps`?Enter Arg Inject, a horrible bit of LD_PRELOAD trickery.
## usage
Build the shared object via `$ make`.
Place a file named `inject.conf` (or set a filename via
ENV_INJECT_FILE) in your $PWD that contains your program's
arguments. Note that each argument should be on a new line.Example:
```
$ cat inject.conf
-l
-a
```You can then proceed to call your program as follows:
```
$ LD_PRELOAD=$PWD/arg_inject.so ls -these-are-ignored -in-favor-of -inject.conf
total 44
drwx------ 1 jktr users 154 Apr 22 06:47 .
drwx------ 1 jktr users 126 Apr 22 06:36 ..
-rw------- 1 jktr users 2030 Apr 22 06:44 arg_inject.c
-rwx------ 1 jktr users 16576 Apr 22 06:46 arg_inject.so
-rw------- 1 jktr users 6 Apr 22 06:46 inject.conf
-rw------- 1 jktr users 82 Apr 22 06:46 Makefile
-rw------- 1 jktr users 648 Apr 22 06:47 README.md
```## license
This work is licensed (CC BY-SA 3.0); it's largely adapted from MvG's
Answer on Serverfault, which can be found
[here](https://serverfault.com/questions/592744/how-to-hide-a-password-passed-as-command-line-argument/592941#592941).