use IO::Socket;
$|=1;
if(($#ARGV + 1 ) != 2){
die "Usage: $0 host_ip smtp_port\n";
}
$host_ip=shift;
$smtp_port=shift;
$sock=IO::Socket::INET->new(PeerAddr => "$host_ip:$smtp_port", Timeout => 5) || die "$host_ip:$smtp_port is closed!\n";
$sock->recv($mem, 1000, 0);
$sock->send("EHLO test.com\r\n");
$sock->recv($mem2, 5000, 0);
$sock->shutdown(2);
if(lc($mem2)=~m/starttls/){
print "$host_ip:$smtp_port supports SMTP over TLS!\n";
}else{
print "$host_ip:$smtp_port does not support SMTP over TLS!\n";
}
exit(1);
No comments:
Post a Comment