Advertisement
swarley

Whois

Dec 7th, 2011
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.53 KB | None | 0 0
  1. def ip_whois(m, ip, args="")
  2.   w = Whois.whois(ip)
  3.   hash, string, args = {}, [], args.split
  4.   w = w.to_s.split("\n").each {|line| begin; hash[line.split(':')[0].to_sym] = line.split(' ',2)[1]; rescue Exception; end }
  5.   args.each do |arg|
  6.       strings.push "#{arg}: #{hash[arg.to_sym]}"
  7.   end
  8.    m.reply "Netrange: #{hash[:NetRange]}"
  9.    m.reply "Netname:  #{hash[:NetHandle]}"
  10.    m.reply "Organization: #{hash[:OrgName]}"
  11.    m.reply "Country: #{hash[:Country]}"
  12.  
  13.    strings.each do |string|
  14.       m.reply string
  15.    end
  16. end
  17.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement