Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!usr/bin/ruby
- #LocateIP 0.3
- #(C) Doddy Hackman 2015
- require "open-uri"
- require "net/http"
- require "resolv"
- # Functions
- def get_ip(hostname)
- begin
- return Resolv.getaddress(hostname)
- rescue
- return "Error"
- end
- end
- def toma(web)
- begin
- return open(web, "User-Agent" => "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0").read
- rescue
- return "Error"
- end
- end
- def response_code(web)
- begin
- return Net::HTTP.get_response(URI(web)) .code
- rescue
- return "404"
- end
- end
- def tomar(web,arg)
- begin
- headers = {"User-Agent" => "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0"}
- uri = URI(web)
- http = Net::HTTP.new(uri.host, uri.port)
- return http.post(uri.path,arg, headers).body
- rescue
- return "Error"
- end
- end
- def uso
- print "\n[+] Sintax : ruby locateip.rb <target>\n"
- end
- def head
- print "\n\n-- == LocateIP 0.3 == --\n\n"
- end
- def copyright
- print "\n\n-- == (C) Doddy Hackman 2015 == --\n\n"
- end
- def locateip(target)
- print "\n[+] Getting IP ...\n"
- ip = get_ip(target)
- print "\n[+] IP : "+ip+"\n"
- web = "http://www.melissadata.com/lookups/iplocation.asp"
- print "\n[+] Locating ...\n\n"
- code = tomar(web,"ipaddress="+ip+"&btn=Submit")
- if code=~/City<\/td><td align=(.*)><b>(.*)<\/b><\/td>/
- print "[+] City : "+$2+"\n"
- else
- print "[+] City : Not Found\n"
- end
- if code=~/Country<\/td><td align=(.*)><b>(.*)<\/b><\/td>/
- print "[+] Country : "+$2+"\n"
- else
- print "[+] Country : Not Found\n"
- end
- if code=~/State or Region<\/td><td align=(.*)><b>(.*)<\/b><\/td>/
- print "[+] State or Region : "+$2+"\n";
- else
- print "[+] State of Region : Not Found\n"
- end
- print "\n[+] Getting DNS ...\n\n"
- control = "0"
- code = toma("http://www.ip-adress.com/reverse_ip/"+ip)
- dnss = code.scan(/whois\/(.*?)\">Whois/)
- dnss.flatten.each do |dns|
- begin
- if dns != ""
- control = "1"
- print "[+] DNS Found : "+dns
- end
- end
- end
- if control=="0"
- print "\n[-] DNS Not Found\n"
- end
- end
- target = ARGV[0]
- head()
- if !target
- uso()
- else
- locateip(target)
- end
- copyright()
- #The End ?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement