Git Product home page Git Product logo

arg-inject's Introduction

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.