Update sshjump.new

This commit is contained in:
12nick12 2018-06-05 16:50:25 -04:00 committed by GitHub
parent 3dcf220718
commit 5049a27fa4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions

View File

@ -1,25 +1,27 @@
#!/bin/bash #!/bin/bash
dir=/opt/sshjump
arg1=$1 arg1=$1
if [ $arg1 = list ]; then if [ $arg1 = list ]; then
sqlite3 /opt/sshjump/sshjump.db 'select host,id from sshjump' sqlite3 $dir/sshjump.db 'select host,id from sshjump'
elif [ $arg1 = host ]; then elif [ $arg1 = host ]; then
user=$2 user=$2
host=$3 host=$3
port=$(sqlite3 /opt/sshjump/sshjump.db "select port from sshjump where host = \"$host\"") port=$(sqlite3 $dir/sshjump.db "select port from sshjump where host = \"$host\"")
ssh -p $port $user@localhost ssh -p $port $user@localhost
elif [ $arg1 = id ]; then elif [ $arg1 = id ]; then
user=$2 user=$2
id=$3 id=$3
port=$(sqlite3 /opt/sshjump/sshjump.db "select port from sshjump where id = \"$id\"") port=$(sqlite3 $dir/sshjump.db "select port from sshjump where id = \"$id\"")
ssh -p $port $user@localhost ssh -p $port $user@localhost
elif [ $arg1 = del ]; then elif [ $arg1 = del ]; then
id=$2 id=$2
sqlite3 /opt/sshjump/sshjump.db "delete from sshjump where id = \"$id\"" sqlite3 $dir/sshjump.db "delete from sshjump where id = \"$id\""
elif [ $arg1 = help ]; then elif [ $arg1 = help ]; then
echo "list: show list of devices" echo "list: show list of devices"