eval { $sock = Net::SSL->new( PeerAddr => $ip, PeerPort => $port, SSL_Debug => 0, Timeout => 30, ); $sock || warn "No Net::SSL session for IP $ip:$port\n"; }; if ($sock) { my $cert = $sock->get_peer_certificate; if ($cert) { print join( "\t", $host, $interface, $ip, $port, $cert->issuer_name, $cert->subject_name, $cert->not_before, $cert->not_after ), "\n"; } else { print join( "\t", $host, $interface, $ip, $port, 'no certificate found' ), "\n"; } } else { print join( "\t", $host, $interface, $ip, $port, 'no connection found' ), "\n"; }