I have just compiled the source code for a program called JohnTheRipper. Currently, if I want to run
john I have to
cd into the
run/ directory and execute it with
./john. However, I would much prefer being able to run the
john command from any directory, as if it were installed system wide. I can't make an alias for this, because I need to be able to pass parameters to the binary. So I tried making a small shell script.
#!/bin/bash /home/username/tools/JohnTheRipper/run/john $@
I placed this script into
/usr/local/bin so that it is in my path. This script works, but ONLY if I run it by specifying the path.
$ ls john -la -rwxr-xr-x 1 root root 56 Mar 20 03:54 john $ ./john --test Will run 4 OpenMP threads Benchmarking: descrypt, traditional crypt(3) [DES 256/256 AVX2-16]... (4xOMP) ...
It will not work if I try running it by using the
$PATH environment variable
$ which john /usr/local/bin/john $ john --test bash: syntax error near unexpected token `--test'
Why is this the case? Why aren't the command line arguments being passed to my shell script? And how can I set it up so that I can run the
john command from any directory, allowing me to pass it arguments?
Note The solution must be able to accept relative paths when passing parameters to john. For example, if I am in the directory
d/ with a file
wordlist.txt I want to be able to run john as such: