Loading digx.sh 0 → 100644 +77 −0 Original line number Diff line number Diff line #!/bin/bash function digx(){ red="\e[31;1m" green="\e[32;1m" empt="\e[0m" yel="\e[33;1m" bld="\033[1m" if [[ ! -z ${1} ]]; then if [[ $(echo ${1} | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b") == ${1} ]]; then local REV=$(dig -x ${1} +short) echo -e "${yel}PTR:${empt} $([[ ! -z ${REV} ]] && echo "${REV}" || echo "No PTR")" return 0 fi local DO=$1 local ARES=$(dig A ${DO} +short | xargs) local AAAARES=$(dig AAAA ${DO} +short | xargs) if [[ ! -z ${ARES} ]]; then echo -e " === ${bld}${green}${DO}${empt} === " if [[ ! -z ${AAAARES} ]]; then for i in ${AAAARES}; do local REV=$(dig -x ${i} +short) echo -e " ${yel}IPv6:${empt} ${i}\n$([[ ! -z ${REV} ]] && for n in ${REV}; do echo " ${yel}PTR:${empt} ${n}"; done || echo "No PTR")" done fi for i in ${ARES}; do local REV=$(dig -x ${i} +short) echo -e " ${yel}IPv4:${empt} ${i}\n$([[ ! -z ${REV} ]] && for n in ${REV}; do echo " ${yel}PTR:${empt} ${n}"; done || echo "No PTR")" done local MXS=$(dig MX ${DO} +short | wc -l) local MX=$(dig MX ${DO} +short | awk '{print$2}' | xargs) if [[ ! -z ${MX} ]]; then if [[ ${MXS} -ge 2 ]]; then echo -e " ---" fi for i in ${MX}; do echo -e " ${yel}MX:${empt} ${i}" local IMX=$(dig A ${i} +short| xargs) for p in ${IMX}; do local rp="$(dig -x ${p} +short)" echo -e " ${yel}IP:${empt} ${p}\n ${yel}PTR:${empt} $([[ ! -z ${rp} ]] && echo "${rp}" || echo "No PTR")" done done if [[ $(dig TXT ${DO} +short | wc -l) -ge 1 ]]; then echo -e " ---" echo -e "$(dig TXT ${DO} +short)" | while IFS= read -r line; do if [[ ! -z ${line} ]]; then echo -e " ${yel}TXT:${empt} ${line}" fi done fi local NSX=$(dig NS ${DO} +short | wc -l) local NS=$(dig NS ${DO} +short | xargs) if [[ ${NSX} -ge 2 ]]; then echo -e " ---" fi for i in ${NS}; do echo -e "${yel} NS:${empt} ${i}" done echo -e "\n" fi else echo -e "NO Record found for Domain: ${red}${DO}${empt}" echo -e "$(whois ${DO})" fi else echo "No args no results. Provide domain as first arg!"; return 1 fi } digx $1 Loading
digx.sh 0 → 100644 +77 −0 Original line number Diff line number Diff line #!/bin/bash function digx(){ red="\e[31;1m" green="\e[32;1m" empt="\e[0m" yel="\e[33;1m" bld="\033[1m" if [[ ! -z ${1} ]]; then if [[ $(echo ${1} | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b") == ${1} ]]; then local REV=$(dig -x ${1} +short) echo -e "${yel}PTR:${empt} $([[ ! -z ${REV} ]] && echo "${REV}" || echo "No PTR")" return 0 fi local DO=$1 local ARES=$(dig A ${DO} +short | xargs) local AAAARES=$(dig AAAA ${DO} +short | xargs) if [[ ! -z ${ARES} ]]; then echo -e " === ${bld}${green}${DO}${empt} === " if [[ ! -z ${AAAARES} ]]; then for i in ${AAAARES}; do local REV=$(dig -x ${i} +short) echo -e " ${yel}IPv6:${empt} ${i}\n$([[ ! -z ${REV} ]] && for n in ${REV}; do echo " ${yel}PTR:${empt} ${n}"; done || echo "No PTR")" done fi for i in ${ARES}; do local REV=$(dig -x ${i} +short) echo -e " ${yel}IPv4:${empt} ${i}\n$([[ ! -z ${REV} ]] && for n in ${REV}; do echo " ${yel}PTR:${empt} ${n}"; done || echo "No PTR")" done local MXS=$(dig MX ${DO} +short | wc -l) local MX=$(dig MX ${DO} +short | awk '{print$2}' | xargs) if [[ ! -z ${MX} ]]; then if [[ ${MXS} -ge 2 ]]; then echo -e " ---" fi for i in ${MX}; do echo -e " ${yel}MX:${empt} ${i}" local IMX=$(dig A ${i} +short| xargs) for p in ${IMX}; do local rp="$(dig -x ${p} +short)" echo -e " ${yel}IP:${empt} ${p}\n ${yel}PTR:${empt} $([[ ! -z ${rp} ]] && echo "${rp}" || echo "No PTR")" done done if [[ $(dig TXT ${DO} +short | wc -l) -ge 1 ]]; then echo -e " ---" echo -e "$(dig TXT ${DO} +short)" | while IFS= read -r line; do if [[ ! -z ${line} ]]; then echo -e " ${yel}TXT:${empt} ${line}" fi done fi local NSX=$(dig NS ${DO} +short | wc -l) local NS=$(dig NS ${DO} +short | xargs) if [[ ${NSX} -ge 2 ]]; then echo -e " ---" fi for i in ${NS}; do echo -e "${yel} NS:${empt} ${i}" done echo -e "\n" fi else echo -e "NO Record found for Domain: ${red}${DO}${empt}" echo -e "$(whois ${DO})" fi else echo "No args no results. Provide domain as first arg!"; return 1 fi } digx $1