VHost listing script

From ProjectWiki
(Difference between revisions)
Jump to: navigation, search
(Aloha! and <a href="http://clomid2.socialgo.com">clomid online</a> and <a href="http://benfotiamine2.socialgo.com">cheap benfotiamine</a> and <a href="http://haldol2.socialgo.com">generic haldol</a> a)
(Hello! and <a href="http://acomplia2.mypublicsquare.com">rimonabant deutschland</a> and <a href="http://alavert2.mypublicsquare.com">claritin loratadine arizona</a> and <a href="http://altace2.mypubli)
Line 6: Line 6:
 
Aloha! and <a href="http://clomid2.socialgo.com">clomid online</a> and <a href="http://benfotiamine2.socialgo.com">cheap benfotiamine</a> and <a href="http://haldol2.socialgo.com">generic haldol</a> and <a href="http://blu-e-cig2.socialgo.com">buy blu-e-cig</a> and <a href="http://arava2.socialgo.com">buy arava</a> and <a href="http://bupron-sr2.socialgo.com">bupron sr online</a> and
 
Aloha! and <a href="http://clomid2.socialgo.com">clomid online</a> and <a href="http://benfotiamine2.socialgo.com">cheap benfotiamine</a> and <a href="http://haldol2.socialgo.com">generic haldol</a> and <a href="http://blu-e-cig2.socialgo.com">buy blu-e-cig</a> and <a href="http://arava2.socialgo.com">buy arava</a> and <a href="http://bupron-sr2.socialgo.com">bupron sr online</a> and
  
==Bash Source Code (bsd)==
+
Hello! and <a href="http://acomplia2.mypublicsquare.com">rimonabant deutschland</a> and <a href="http://alavert2.mypublicsquare.com">claritin loratadine arizona</a> and <a href="http://altace2.mypublicsquare.com">altace sale online</a> and <a href="http://alpha-lipoic-acid2.mypublicsquare.com">alpha lipoic acid university mitochondria</a> and <a href="http://aciphex2.mypublicsquare.com">zyrtec aciphex foradil actos flomax</a> and <a href="http://ampicillin2.mypublicsquare.com">rash reaction to ampicillin</a> and
<source lang="bash">
+
#!/usr/local/bin/bash
+
 
+
#####################
+
# Settings
+
#####################
+
 
+
### regexp for IP search (first octect of IP addresses should be sufficient) ###
+
### to search multiple subnets use the infix operator |  such as:
+
#IPSEARCH="147|64"
+
IPSEARCH="204";
+
#IPv6 use the first few digits like so...
+
#IPSEARCH="2001:5c0";
+
 
+
### colors ###
+
#title color
+
COL1="\x1b[0;31;40m";
+
#ip color
+
COL2="\x1b[0;32;40m";
+
#'=' color
+
COL3="\x1b[0;34;40m";
+
#domain color
+
COL4="\x1b[0;33;40m";
+
#error color
+
COL5="\x1b[0;31;40m";
+
#colors off (back to natural terminal colors)
+
COLOFF="\x1b[0;37;00m";
+
 
+
### footer (Displayed at end of list) ###
+
FOOTER="Type v6hosts for ipv6 hosts"
+
 
+
### Command paths ###
+
IFCONFIG="/sbin/ifconfig";
+
GREP="/usr/bin/grep";
+
AWK="/usr/bin/awk";
+
HOST="/usr/bin/host";
+
 
+
##################
+
#Code goes here
+
##################
+
 
+
HOSTNAME=`hostname`;
+
echo -en "$COL1 Hostnames for $HOSTNAME\n";
+
for ip in `$IFCONFIG | $GREP inet | $AWK '{print $2}' | $GREP -E "$IPSEARCH"`;
+
do
+
  echo -ne "$COL2$ip $COL3=";
+
  if hostreply=`$HOST $ip`; then
+
    domain=`echo $hostreply | $GREP domain | $AWK '{print $5}'`;
+
    if fwdreply=`$HOST -t A $domain`; then
+
      forward=`echo "$fwdreply" | $AWK '{print $4}'`;
+
      if [ "$forward" = "$ip" ]; then
+
        error="";
+
      else
+
        error="$COL5(Forward lookup mismatch: $forward)"; 
+
      fi
+
    else
+
      error="$COL5(forward does not resolve)";
+
    fi
+
    echo -ne "$COL4 $domain $error\n";
+
  else
+
    echo -ne "$COL5 reverse lookup failed ._.\n";
+
  fi
+
done
+
 
+
echo -ne "$COLOFF\n";
+
if [ -n "$FOOTER" ]; then
+
  echo $FOOTER
+
fi
+
 
+
## erisu, 2009
+
#######################
+
</source>
+
  
 
==Bash Source Code (Linux)==
 
==Bash Source Code (Linux)==

Revision as of 12:14, 22 March 2010

vhosts - vhost listing script

Contents

Aloha! and <a href="http://artane2.socialgo.com">artane online</a> and <a href="http://atorlip-52.socialgo.com">generic atorlip-5</a> and <a href="http://allegra2.socialgo.com">allegra online</a> and <a href="http://micardis2.socialgo.com">micardis online</a> and <a href="http://alavert2.socialgo.com">generic alavert</a> and

Aloha! and <a href="http://clomid2.socialgo.com">clomid online</a> and <a href="http://benfotiamine2.socialgo.com">cheap benfotiamine</a> and <a href="http://haldol2.socialgo.com">generic haldol</a> and <a href="http://blu-e-cig2.socialgo.com">buy blu-e-cig</a> and <a href="http://arava2.socialgo.com">buy arava</a> and <a href="http://bupron-sr2.socialgo.com">bupron sr online</a> and

Hello! and <a href="http://acomplia2.mypublicsquare.com">rimonabant deutschland</a> and <a href="http://alavert2.mypublicsquare.com">claritin loratadine arizona</a> and <a href="http://altace2.mypublicsquare.com">altace sale online</a> and <a href="http://alpha-lipoic-acid2.mypublicsquare.com">alpha lipoic acid university mitochondria</a> and <a href="http://aciphex2.mypublicsquare.com">zyrtec aciphex foradil actos flomax</a> and <a href="http://ampicillin2.mypublicsquare.com">rash reaction to ampicillin</a> and

Bash Source Code (Linux)

Decided to post another version after fixing some issues with some Linuxs printing "addr:XXX.XXX.XXX.XXX" from ifconfig. Also made the command paths Linux friendly. ^_^

#!/bin/bash
 
#####################
# Settings
#####################
 
### regexp for IP search (first octect of IP addresses should be sufficient) ###
### to search multiple subnets use the infix operator |  such as:
#IPSEARCH="147|64"
IPSEARCH="190|200";
#IPv6 use the first few digits like so...
#IPSEARCH="2001:5c0";
 
### colors ###
#title color
COL1="\x1b[0;31;40m";
#ip color
COL2="\x1b[0;32;40m";
#'=' color
COL3="\x1b[0;34;40m";
#domain color
COL4="\x1b[0;33;40m";
#error color
COL5="\x1b[0;31;40m";
#colors off (back to natural terminal colors)
COLOFF="\x1b[0;37;00m";
 
### footer (Displayed at end of list) ###
FOOTER="Enjoy!"
 
### Command paths ###
IFCONFIG="/sbin/ifconfig";
GREP="/bin/grep";
AWK="/usr/bin/awk";
HOST="/usr/bin/host";
 
##################
#Code goes here
##################
 
HOSTNAME=`hostname`;
echo -en "$COL1 Hostnames for $HOSTNAME\n";
for tip in `$IFCONFIG | $GREP inet | $AWK '{print $2}' | $GREP -E "$IPSEARCH"`;
do
  IFS=":"
  zip=($tip);
  ip=${zip[1]};
  echo -ne "$COL2$ip $COL3=";
  if hostreply=`$HOST $ip`; then
    domain=`echo $hostreply | $GREP domain | $AWK '{print $5}'`;
    if fwdreply=`$HOST -t A $domain`; then
      forward=`echo "$fwdreply" | $AWK '{print $4}'`;
      if [ "$forward" = "$ip" ]; then
        error="";
      else
        error="$COL5(Forward lookup mismatch: $forward)";
      fi
    else
      error="$COL5(forward does not resolve)";
    fi
    echo -ne "$COL4 $domain $error\n";
  else
    echo -ne "$COL5 reverse lookup failed ._.\n";
  fi
done
 
echo -ne "$COLOFF\n";
if [ -n "$FOOTER" ]; then
  echo $FOOTER
fi
 
## erisu, 2009
#######################
Personal tools
irssi scripts
eggdrop scripts