[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bash Script for Mail sending Check



Alex Samad wrote:
how is that different from nmap ?
They essentially will both do the job. But im of the opinion that nmap is the wrong tool for the job. Especially considering its for a bash script (You can use swaks too).

The beauty about nc is that you can pipe it commands from a file, therefore simulate various options scenarios etc (e.g. smtp)

Google "netcat hacks" and you will see the power.

(This is my favourite : http://www.oreillynet.com/pub/h/1058 )

For the orignal poster, he / she wanted to connect and test for a SMTP server as well as issue a timeout (-w), netcat will do that which you can grep for. All in all, and what Im really trying to say is that your code may look a lot neater and easier, as opposed to

case "$( (sleep 5; echo quit; ps |awk '/telnet/{print "kill "$1}' |sh) | telnet > 192.168.0.20 25 2>&- )

nc -v -w 5 -z 192.168.0.20 25

I always get suspicious, when people start implementing and using kill. Nothing wrong with it, just think not enough brain power was put in and there generally is an easier and more elegant solution.

HTH and my Zim $1 worth of info.

Regards
Brent Clark





Reply to: