Add ssh-helper command
This commit is contained in:
parent
f5af1d9952
commit
9d05b29000
@ -175,10 +175,16 @@ if [ "$ARG" = "clip" ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ "$ARG" = "ssh_helper" ]; then
|
if [ "$ARG" = "ssh_helper" ]; then
|
||||||
if command -v iwgetid >/dev/null; then
|
if [ -f /proc/net/wireless ]; then
|
||||||
|
WIRELESS_DEV="$(perl -ne 'print if s/(\w+):.*/\1/' </proc/net/wireless)"
|
||||||
|
SSID="$(iw dev $WIRELESS_DEV link | perl -ne 'printf if s/\s*SSID: //')"
|
||||||
|
elif command -v iwgetid >/dev/null; then
|
||||||
SSID="$(iwgetid wlan0 -r)"
|
SSID="$(iwgetid wlan0 -r)"
|
||||||
elif command -v nmcli >/dev/null; then
|
elif command -v nmcli >/dev/null; then
|
||||||
SSID="$(nmcli -t -f active,ssid dev wifi | perl -ne 'print if s/yes://;')"
|
SSID="$(nmcli -t -f active,ssid dev wifi | perl -ne 'print if s/yes://;')"
|
||||||
|
elif command -v termux-wifi-connectioninfo >/dev/null; then
|
||||||
|
# Android device (termux)
|
||||||
|
SSID="$(termux-wifi-connectioninfo | perl -ne 'print if s/^\s*"ssid": "(.+)",$/\1/')"
|
||||||
fi
|
fi
|
||||||
case "$(hostname)" in
|
case "$(hostname)" in
|
||||||
sgen|egen|runner2)
|
sgen|egen|runner2)
|
||||||
@ -188,10 +194,12 @@ if [ "$ARG" = "ssh_helper" ]; then
|
|||||||
logger "Found SSID for $(hostname): $SSID"
|
logger "Found SSID for $(hostname): $SSID"
|
||||||
case "$SSID" in
|
case "$SSID" in
|
||||||
ATTskUYuI2)
|
ATTskUYuI2)
|
||||||
ssh -q -W "${1}" "${2}@192.168.1.200"
|
logger "ssh -q -W ${1} 192.168.1.200"
|
||||||
|
ssh -q -W "${1}" 192.168.1.200
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
ssh -q -W "${1}" -p 23 "${2}@austenwares.com"
|
logger "ssh -q -W ${1} -p 23 austenwares.com"
|
||||||
|
ssh -q -W "${1}" -p 23 austenwares.com
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user