#!/bin/bash # # Copyright (C) 2008 vladz # # tcp_scanner.sh -- TCP port scanner and banner disclosure in Bash [ $# -lt 2 ] && \ { echo "usage: $0 ..."; exit 1; } target="$1"; shift ; ports="${@}"; fd=/dev/tcp/${target} for i in ${ports} do echo -n "Port ${i}: "; read -t3 x &>/dev/null <$fd/$i echo ${x-closed.}; unset x done