-
Notifications
You must be signed in to change notification settings - Fork 33
/
install.sh
executable file
·41 lines (33 loc) · 1.22 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
for_all="$1"
script_name="jwt-crack.py"
main_path="$(realpath $0)"
tool_path=$(echo $main_path | cat | sed 's:install\.sh:jwt-crack\.py:')
req_path=$(echo $main_path | cat | sed 's:install\.sh:requirements\.txt:')
absolute="$(pwd)/$script_name"
bintool="jwtxpl"
if [[ $1 == "" ]]; then
if [ ! -d "$HOME/.local/bin" ]; then
mkdir "$HOME/.local/bin"
fi
if [[ ! $PATH == *"/.local/bin"* ]]; then
echo "export PATH=$PATH:/$HOME/.local/bin" >> $HOME/.bashrc
fi
bindir="$HOME/.local/bin"
chmod u+x $tool_path
python3 -m pip install -r $req_path
ln -s $tool_path $bindir/$bintool
echo "JWT cracker installed successfully. Now you can use jwtxpl <token> [OPTIONS]"
elif [[ $1 == "all" || $1 == "a" ]]; then
if [[ $(id | grep sudo) == "" && $(id | grep "uid=0") == "" ]]; then
echo "You have not root privileges. Only root can install the script for all users"
exit
fi
chmod +x $tool_path
pip3 install -r $req_path
sudo ln -s $tool_path /usr/local/bin/$bintool
echo "JWT cracker installed successfully. Now you can use jwtxpl <token> [OPTIONS]"
else
echo "Only the options all is avaiable. Use it to install the tool for all users."
exit
fi