lib/string_ext.rb in ssh_scan-0.0.17.pre vs lib/string_ext.rb in ssh_scan-0.0.17
- old
+ new
@@ -53,10 +53,21 @@
end
end
def resolve_fqdn
- @fqdn ||= TCPSocket.gethostbyname(self)[3]
+ TCPSocket.gethostbyname(self)[3]
+ end
+
+ def resolve_ptr(timeout = 3)
+ begin
+ Timeout::timeout(timeout) {
+ reversed_dns = Resolv.new.getname(self)
+ return reversed_dns
+ }
+ rescue Timeout::Error,Resolv::ResolvError
+ return ""
+ end
end
def fqdn?
begin
resolve_fqdn