Skip to content

Simple tool to catch arguments provided to an excecutable

License

Notifications You must be signed in to change notification settings

itsyourap/ArgumentCatcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ArgumentCatcher

ArgumentCatcher is a Java based executable made to capture arguments passed to it.

Usage Scenario

Say you have an executable Foo.exe which launches Bar.exe and passes some arguments to it and Bar.exe does some magic. Now you are curious about what arguments might have Foo.exe passed to Bar.exe so that the magic happens. This is exactly where ArgumentCatcher comes into play.

Installation

You can download the latest Windows Executable or JAR from the releases page.

Preferably, you can build ArgumentCatcher by cloning the Git repository:

git clone https://github.com/itsyourap/ArgumentCatcher.git

You will need Java Development Kit (JDK) 8+ to build this project and a working Java Runtime Environment (JRE) 8+ to run this program.

After building a JAR from the sources, you can use Launch4j to wrap the JAR into an executable. You can find an example of Launch4j configuration in launch4j folder.

Usage

Here we will be solving this example situation with the help of ArgumentCatcher.

  1. Rename ArgumentCatcher executable to Bar.exe and put it in place of the original Bar.exe
  2. Now whenever Foo.exe launches Bar.exe with some arguments, a folder with name .argumentcatcher is created in the same folder as the executable is created and a LOG file is written into the folder which contains all the arguments in a readable manner.
  3. The log file is always appended, so don't worry about overwriting.

Now say, you want ArgumentCatcher to return some output to Foo.exe for a specific argument(s) passed to ArgumentCatcher so that Foo.exe may continue its further operations.

To make ArgumentCatcher return specific outputs for specific arguments, do this:-

  1. In the .argumentcatcher folder, there will be a folder named output (Create it if not present).
  2. Make a folder with the name of your executable, (here Bar.exe) and open it.
  3. In this folder, put files with the name of the argument and add .txt as extension and add the desired output in the file.

For example, say you want ArgumentCatcher to return beta when argument alpha is passed to Bar.exe. So, we first rename ArgumentCatcher executable to Bar.exe and put it in place of the original Bar.exe. Next we open .argumentcatcher folder and open output folder in it. Now in the output folder we create a folder with the name Bar.exe and open it. In the Bar.exe folder, we create alpha.txt file which will contain this:-

beta

So now, whenever Foo.exe tries to pass argument alpha to Bar.exe, it will get the output contained in the alpha.txt file, which in this case is beta.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

GPLv3