#!/usr/bin/env bash # telcheck: Check for mail blocks with telnet # Nathan P. # 0.1a set -euo pipefail TEXT_BOLD="$(tput bold)" TEXT_UNSET="$(tput sgr0)" VERSION='0.1a' RELEASE='Toffee' MAIL_HOSTS=("mx-aol.mail.gm0.yahoodns.net:AOL & Yahoo!" "al-ip4-mx-vip1.prodigy.net:AT&T" "mx1.mxge.comcast.net:Comcast" "gmail-smtp-in.l.google.com:Gmail (Unreliable)" "outlook-com.olc.protection.outlook.com:Outlook & Hotmail") show_help() { cat<"; sleep 3s; echo -e "QUIT"; } | timeout 30s telnet -b "${SOURCE_IP}" "${@}" 25 || true } while [[ "${#}" -gt 0 ]]; do case "${1}" in -b|--source) SOURCE_IP="${2}" break ;; -v|--version) echo "${VERSION} \"${RELEASE}\"" exit 0 ;; -h|--help) show_help exit 0 ;; -B|--battle) exit 0 ;; -*) echo -e "Not sure what ${1} is supposed to mean" >&2 echo show_help exit 1 ;; *) break ;; esac done main