[Ruby] IP Locator 0.1

Iniciado por BigBear, 11 Febrero 2012, 23:06 PM

0 Miembros y 1 Visitante están viendo este tema.

BigBear

Un localizador de IP.

Código (ruby) [Seleccionar]

#!usr/bin/ruby
#IP Locator 0.1
#Coded By Doddy H

require "net/http"
require "resolv"

def uso
  print "\n[+] iplocator.rb <site>\n"
end

def toma(web)
  return Net::HTTP.get_response(URI.parse(web)).body
end
 
def head()
  print "\n\n -- == IP Locator 0.1 == --\n\n"
end

def copyright()
   print "\n\n\n(C) Doddy Hackman 2012\n\n"
   exit(1)
end

target = ARGV[0]

head()
if !target
  uso()
else
  ip = Resolv.getaddress(target)
  web = "http://www.melissadata.com/lookups/iplocation.asp?ipaddress="+ip
  print "\n\n[+] Getting info\n\n\n"
  code = toma(web)
  if code=~/City<\/td><td align=(.*)><b>(.*)<\/b><\/td>/
    print "[+] City : "+$2+"\n";
  end
  if code=~/Country<\/td><td align=(.*)><b>(.*)<\/b><\/td>/
    print "[+] Country : "+$2+"\n";
  end
  if code=~/State or Region<\/td><td align=(.*)><b>(.*)<\/b><\/td>/
     print "[+] State or Region : "+$2+"\n";
  end
end

copyright()

# The End ?