Compare commits
8 Commits
18b8086955
...
master
Author | SHA1 | Date | |
---|---|---|---|
9241d2f96d | |||
6712ebfae9 | |||
76a35b8301 | |||
068400457c | |||
|
3dd87f641d | ||
|
5d2b454f24 | ||
|
69b343498f | ||
|
35de743065 |
23
Makefile
Normal file
23
Makefile
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
# sshin - ssh in
|
||||||
|
# See LICENSE file for copyright and license details.
|
||||||
|
|
||||||
|
# paths
|
||||||
|
PREFIX = /home/${USER}/.local
|
||||||
|
MANPREFIX = $(PREFIX)/share/man
|
||||||
|
SHELL = bash
|
||||||
|
|
||||||
|
SRC = drw.c dmenu.c stest.c util.c
|
||||||
|
OBJ = $(SRC:.c=.o)
|
||||||
|
|
||||||
|
all: install
|
||||||
|
|
||||||
|
install:
|
||||||
|
mkdir -p $(DESTDIR)$(PREFIX)/bin
|
||||||
|
cp sshin $(PREFIX)/bin
|
||||||
|
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
|
||||||
|
cp sshin.1 $(DESTDIR)$(MANPREFIX)/man1
|
||||||
|
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
rm -f $(DESTDIR)$(PREFIX)/bin/sshin
|
||||||
|
rm -f $(DESTDIR)$(MANPREFIX)/man1/sshin.1
|
10
setup.sh
10
setup.sh
|
@ -1,3 +1,7 @@
|
||||||
mkdir ~/.local/share/sshin
|
#!/bin/bash
|
||||||
cp port_association ~/.local/share/sshin/
|
[[ $(uname) = "Linux" ]] && grep "sshin" ~/.bashrc >/dev/null || echo "alias sshin=\"~/gitclones/sshin/sshin\"" >> ~/.bashrc; echo "run \"source ~/.bashrc\"";exit
|
||||||
cp sshin ~/.local/bin || echo "Error in copying executable to .local/bin" && echo "Run: sudo cp sshin /usr/bin/"
|
|
||||||
|
PREFIX=~/.local/
|
||||||
|
mkdir $PREFIX/share/sshin
|
||||||
|
[[ -e $PREFIX/share/sshin/port_association ]] || cp port_association $PREFIX/share/sshin/
|
||||||
|
cp sshin $PREFIX/bin/ || echo "Error in copying executable to $PREFIX/bin" && echo "if on linux, run: sudo cp sshin /usr/bin/"
|
||||||
|
|
11
sshin
11
sshin
|
@ -6,6 +6,7 @@ usage() {
|
||||||
echo "This tools automatically chooses the server port based on the port_association file in ~/local/share/sshin/port_association"
|
echo "This tools automatically chooses the server port based on the port_association file in ~/local/share/sshin/port_association"
|
||||||
echo
|
echo
|
||||||
echo "Example: \"sshin foo bar.com \" will run \"ssh foo@bar.com -p 2323\""
|
echo "Example: \"sshin foo bar.com \" will run \"ssh foo@bar.com -p 2323\""
|
||||||
|
echo "Example: \"sshin foo 43 \" will run \"ssh foo@192.168.1.43\""
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,12 +16,16 @@ IP_PREFIX="192.168.1."
|
||||||
re='^[0-9]+$'
|
re='^[0-9]+$'
|
||||||
command="ssh ${1}@"
|
command="ssh ${1}@"
|
||||||
shift
|
shift
|
||||||
#[[ $1 =~ $re ]] && command="${command}192.168.1.$2" || port=$(grep $1 ~/.local/share/sshin/port_association | awk '{print $NF}') && command="${command}$1 -p $port"
|
|
||||||
if [[ $1 =~ $re ]]
|
if [[ $1 =~ $re ]]
|
||||||
then
|
then
|
||||||
command="${command}192.168.1.$1"
|
command="${command}192.168.1.$1"
|
||||||
else
|
else
|
||||||
port=$(grep $1 ~/.local/share/sshin/port_association | awk '{print $NF}') && command="${command}$1 -p $port"
|
[[ $(uname) = "Linux" ]] && ports_file="$HOME/.local/share/sshin/port_association" || ports_file="$HOME/sshin/port_association"
|
||||||
|
port=$(grep $1 $ports_file | awk '{print $2}')
|
||||||
|
command="${command}$1"
|
||||||
|
[[ -n $port ]] && command="${command} -p $port"
|
||||||
|
dport=$(grep $1 $ports_file | awk '{print $NF}')
|
||||||
|
[[ -n $port ]] && command="${command} -D$dport"
|
||||||
fi
|
fi
|
||||||
#echo $command
|
echo $command
|
||||||
$command
|
$command
|
||||||
|
|
20
sshin.1
Normal file
20
sshin.1
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
.\" Manpage for sshin - ssh in
|
||||||
|
.\" Contact marco@raber.me to correct errors or typos.
|
||||||
|
.TH man 8 "27 April 2022" "1.0" "sshin man page"
|
||||||
|
.SH NAME
|
||||||
|
sshin \- ssh in(to a machine)
|
||||||
|
.SH SYNOPSIS
|
||||||
|
sshin [USER] [last byte of IP address OR hostname]
|
||||||
|
.SH DESCRIPTION
|
||||||
|
sshin is a script that simplifies ssh connection. NO MORE REACHING FOR THE @ SYMBOL USED BY THE UTTERLY DERANGED
|
||||||
|
.SH OPTIONS
|
||||||
|
sshin options:
|
||||||
|
.TP
|
||||||
|
.B \-h
|
||||||
|
Display help
|
||||||
|
.SH SEE ALSO
|
||||||
|
ssh
|
||||||
|
.SH BUGS
|
||||||
|
eh ditemeli voi
|
||||||
|
.SH AUTHOR
|
||||||
|
Marco Raber (marco@raber.me)
|
Loading…
Reference in New Issue
Block a user