Merge branch 'dev' of skyfall/tab-sorcery into master

master
Aaron Johnson 7 years ago committed by Gitea
commit c8b9cc59ae

@ -1,12 +1,21 @@
# Tab Sorcery # Tab Sorcery
This is still under development and will eventually cover more variables and connection types. A helpful script for simplifying connections to servers and devices on your network.
## To use: ## To use:
Add the script as a source file in your shell prompt, such as a line similar to this: Add the script as a source file in your shell prompt, such as a line similar to this:
```. $HOME/git/tab-sorcery/tab-sorcery.sh example.com 127.0.0.1```
The arguments in the example show the domain to scan for hostnames, and the IP address of the name server providing them. ```
Once done, all hostnames in the DNS zone should be available for SSH by a tab-completable alias of just the hostname. . $HOME/git/tab-sorcery/tab-sorcery.sh example.com 127.0.0.1 bob.user
```
Arguments are:
```
Scan Domain (example.com)
Nameserver address (127.0.0.1)
Default username (bob.user)
```
Once done, all hostnames in the DNS zone should be available for SSH/Telnet/RDP by a tab-completable alias of just the hostname (in new shell sessions).

@ -3,13 +3,35 @@
# ARGUMENTS: # ARGUMENTS:
# $1 == Domain to scan # $1 == Domain to scan
# $2 == Nameserver to do the zone transfer from # $2 == Nameserver to do the zone transfer from
# $3 == Default username for connections
scan_domain=$1 scan_domain=$1
scan_ns=$2 scan_ns=$2
dig skyfall.gear @$scan_ns AXFR | egrep -v 'SOA|NS|MX|DiG' | grep $scan_domain | awk '{print $1,$5}' > /tmp/.tab-sorcery zone_xfer=`dig $scan_domain @$scan_ns AXFR | egrep -v 'SOA|NS|MX|DiG' | grep $scan_domain | awk '{print $1,$4,$5}'`
for i in `awk -F. '{print $1}' /tmp/.tab-sorcery`; do alias $i="ssh `grep $i /tmp/.tab-sorcery | awk '{print $2}'`"; done for host in `echo $zone_xfer | awk '{print $1}'`; do
\rm -f /tmp/.tab-sorcery user_name=$3
connect_cmd="ssh -t"
host_short=`echo ${host} | awk -F. '{print $1}'`
if echo $zone_xfer | grep $host | grep TXT; then
if [ "`echo $zone_xfer | grep $host | grep TXT | awk '{print $3}'`" = '"lxc"' ]; then
user_name="root"
host_ip=`echo $zone_xfer | grep ${host} | grep A | awk '{print $3}'`
alias ${host_short}="${connect_cmd} ${user_name}@${host_ip}"
elif [ "`echo $zone_xfer | grep $host | grep TXT | awk '{print $3}'`" = '"windows"' ]; then
connect_cmd="rdesktop -g 1600x900"
host_ip=`echo $zone_xfer | grep ${host} | grep A | awk '{print $3}'`
alias ${host_short}="${connect_cmd} -u ${user_name} ${host_ip}"
elif [ "`echo $zone_xfer | grep $host | grep TXT | awk '{print $3}'`" = '"cisco"' ]; then
connect_cmd="telnet"
host_ip=`echo $zone_xfer | grep ${host} | grep A | awk '{print $3}'`
alias ${host_short}="${connect_cmd} ${host_ip}"
fi
else
host_ip=`echo $zone_xfer | grep $host | grep A | awk '{print $3}'`
alias ${host_short}="${connect_cmd} ${user_name}@${host_ip}"
fi >/dev/null
done
return 0 return 0

Loading…
Cancel
Save