From 6c2be14a3dbe16af3afed83e337fc6af2be70a8e Mon Sep 17 00:00:00 2001 From: 12nick12 Date: Tue, 5 Jun 2018 15:24:58 -0400 Subject: [PATCH] Create sshjump.new --- server/sshjump.new | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 server/sshjump.new diff --git a/server/sshjump.new b/server/sshjump.new new file mode 100644 index 0000000..d3913e0 --- /dev/null +++ b/server/sshjump.new @@ -0,0 +1,21 @@ +#!/bin/bash + +arg1=$1 + +if [ $arg1 = list ]; then + sqlite3 /opt/sshjump/sshjump.db 'select host,id from sshjump' +fi + +if [ $arg1 = host ]; then + user=$2 + host=$3 + port=$(sqlite3 /opt/sshjump/sshjump.db 'select port from sshjump where host = host') + ssh -p $port $user@localhost +fi + +if [ $arg1 = id ]; then + user=$2 + id=$3 + port=$(sqlite3 /opt/sshjump/sshjump.db 'select port from sshjump where id = id') + ssh -p $port $user@localhost +fi