You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tab-sorcery/tab-sorcery.sh

37 lines
1.3 KiB

#!/usr/bin/env sh
# ARGUMENTS:
# $1 == Domain to scan
# $2 == Nameserver to do the zone transfer from
scan_domain=$1
scan_ns=$2
user_name=$3
zone_xfer=`dig $scan_domain @$scan_ns AXFR | egrep -v 'SOA|NS|MX|DiG' | grep $scan_domain | awk '{print $1,$4,$5}'`
for host in `echo $zone_xfer | awk -F. '{print $1}'`; do
user_name=$3
connect_cmd="ssh -t"
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}="${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}="${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}="${connect_cmd} ${host_ip}"
fi
else
host_ip=`echo $zone_xfer | grep $host | grep A | awk '{print $3}'`
alias ${host}="${connect_cmd} ${user_name}@${host_ip}"
fi >/dev/null
done
return 0