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 "tk"
- 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
- #
- window = TkRoot.new { title "LocateIP 0.3 (C) Doddy Hackman 2015" ; background "black" }
- window['geometry'] = '300x300-20+10'
- TkLabel.new(window) do
- background "black"
- foreground "yellow"
- text " Target : "
- place('relx'=>"0.1",'rely'=>"0.1")
- end
- target = TkEntry.new(window){
- background "black"
- foreground "yellow"
- width 25
- place('relx'=>0.3,'rely'=>0.1)
- }
- TkLabel.new(window) do
- background "black"
- foreground "yellow"
- text "Console"
- place('relx'=>0.4,'rely'=>0.2)
- end
- console =TkText.new(window) do
- background "black"
- foreground "yellow"
- width 30
- height 10
- place('relx'=>0.1,'rely'=>0.3)
- end
- TkButton.new(window) do
- text "Search"
- background "black"
- foreground "yellow"
- width 17
- activebackground "yellow"
- highlightbackground "yellow"
- command proc{
- target = target.value.to_s
- console.insert("end", "[+] Getting IP ...\n")
- ip = get_ip(target)
- web = "http://www.melissadata.com/lookups/iplocation.asp"
- console.insert("end", "\n[+] Locating ...\n\n")
- code = tomar(web,"ipaddress="+ip+"&btn=Submit")
- if code=~/City<\/td><td align=(.*)><b>(.*)<\/b><\/td>/
- console.insert("end", "[+] City : "+$2+"\n")
- else
- console.insert("end", "[+] City : Not Found\n")
- end
- if code=~/Country<\/td><td align=(.*)><b>(.*)<\/b><\/td>/
- console.insert("end","[+] Country : "+$2+"\n")
- else
- console.insert("end", "[+] Country : Not Found\n")
- end
- if code=~/State or Region<\/td><td align=(.*)><b>(.*)<\/b><\/td>/
- console.insert("end", "[+] State or Region : "+$2+"\n")
- else
- console.insert("end","[+] State of Region : Not Found\n")
- end
- console.insert("end","\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"
- console.insert("end", "[+] DNS Found : "+dns)
- end
- end
- end
- if control=="0"
- console.insert("end","\n[-] DNS Not Found\n")
- end
- console.insert("end","\n\n[+] Finished")
- }
- place('relx'=>0.3,'rely'=>0.9)
- end
- Tk.mainloop
- #The End ?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement