diff --git a/README b/.gitignore similarity index 100% rename from README rename to .gitignore diff --git a/README.md b/README.md new file mode 100644 index 0000000..f187d71 --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +# Tab Sorcery + +This is still under development and will eventually cover more variables and connection types. + +## To use: + +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. + diff --git a/tab-sorcery.sh b/tab-sorcery.sh new file mode 100755 index 0000000..6dcd78e --- /dev/null +++ b/tab-sorcery.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env sh + +# ARGUMENTS: +# $1 == Domain to scan +# $2 == Nameserver to do the zone transfer from + +scan_domain=$1 +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 +for i in `awk -F. '{print $1}' /tmp/.tab-sorcery`; do alias $i="ssh `grep $i /tmp/.tab-sorcery | awk '{print $2}'`"; done +\rm -f /tmp/.tab-sorcery + +return 0 +