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.
50 lines
1.5 KiB
50 lines
1.5 KiB
#!/usr/bin/env sh
|
|
|
|
# ARGUMENTS:
|
|
# $1 == Domain to scan
|
|
# $2 == Nameserver to do the zone transfer from
|
|
# $3 == Default username for connections
|
|
|
|
scan_domain=$1
|
|
scan_ns=$2
|
|
|
|
# Check for and set RDP geometry config
|
|
case "$SORC_GEOM_RDP" in
|
|
[0123456789]*x*[0123456789]) geom_rdp=$SORC_GEOM_RDP;;
|
|
*) geom_rdp='1600x900';;
|
|
esac
|
|
|
|
get_hostip () {
|
|
#host_ip=`echo $zone_xfer | grep ${host} | grep A | awk '{print $3}'`
|
|
host_ip=`echo $zone_xfer | grep $1 | grep A | awk '{print $3}'`
|
|
}
|
|
|
|
zone_xfer=`dig $scan_domain @$scan_ns AXFR | egrep -v 'SOA|NS|MX|DiG' | grep $scan_domain | awk '{print $1,$4,$5}'`
|
|
while read host <&3; do
|
|
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"
|
|
get_hostip ${host}
|
|
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 $geom_rdp"
|
|
get_hostip ${host}
|
|
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"
|
|
get_hostip ${host}
|
|
alias ${host_short}="${connect_cmd} ${host_ip}"
|
|
fi
|
|
else
|
|
get_hostip ${host}
|
|
alias ${host_short}="${connect_cmd} ${user_name}@${host_ip}"
|
|
fi >/dev/null
|
|
done 3< <(echo $zone_xfer | awk '{print $1}' | uniq)
|
|
|
|
unset -f get_hostip
|
|
return 0
|
|
|