Advertisement
Doddy

LocateIP 0.3 (Tk)

Jan 1st, 2015
595
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.99 KB | None | 0 0
  1. #!usr/bin/ruby
  2. #LocateIP 0.3
  3. #(C) Doddy Hackman 2015
  4.  
  5. require "tk"
  6. require "open-uri"
  7. require "net/http"
  8. require "resolv"
  9.  
  10. # Functions
  11.  
  12. def get_ip(hostname)
  13.     begin
  14.         return Resolv.getaddress(hostname)
  15.     rescue
  16.         return "Error"
  17.     end
  18. end
  19.  
  20. def toma(web)
  21.     begin
  22.         return open(web, "User-Agent" => "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0").read
  23.     rescue
  24.         return "Error"
  25.     end
  26. end
  27.  
  28. def response_code(web)
  29.     begin
  30.         return Net::HTTP.get_response(URI(web)) .code
  31.     rescue
  32.         return "404"
  33.     end
  34. end
  35.  
  36. def tomar(web,arg)
  37.     begin
  38.         headers = {"User-Agent" => "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0"}
  39.         uri = URI(web)
  40.         http = Net::HTTP.new(uri.host, uri.port)
  41.         return http.post(uri.path,arg, headers).body
  42.     rescue
  43.         return "Error"
  44.     end
  45. end
  46.  
  47. #
  48.  
  49. window = TkRoot.new { title "LocateIP 0.3 (C) Doddy Hackman 2015" ; background "black" }
  50. window['geometry'] = '300x300-20+10'
  51.  
  52. TkLabel.new(window) do
  53.     background "black"
  54.     foreground "yellow"
  55.     text "    Target : "
  56.     place('relx'=>"0.1",'rely'=>"0.1")
  57. end
  58.  
  59. target = TkEntry.new(window){
  60.     background "black"
  61.     foreground "yellow"
  62.     width 25
  63.     place('relx'=>0.3,'rely'=>0.1)
  64. }
  65.  
  66. TkLabel.new(window) do
  67.     background "black"
  68.     foreground "yellow"
  69.     text "Console"
  70.     place('relx'=>0.4,'rely'=>0.2)
  71. end
  72.  
  73. console =TkText.new(window) do
  74.     background "black"
  75.     foreground "yellow"
  76.     width 30
  77.     height 10
  78.     place('relx'=>0.1,'rely'=>0.3)
  79. end
  80.  
  81. TkButton.new(window) do
  82.     text "Search"
  83.         background "black"
  84.     foreground "yellow"
  85.     width 17
  86.     activebackground "yellow"
  87.     highlightbackground  "yellow"
  88.     command proc{
  89.    
  90.         target = target.value.to_s
  91.    
  92.         console.insert("end",  "[+] Getting IP ...\n")
  93.  
  94.         ip = get_ip(target)
  95.  
  96.         web = "http://www.melissadata.com/lookups/iplocation.asp"
  97.  
  98.         console.insert("end", "\n[+] Locating ...\n\n")
  99.  
  100.         code = tomar(web,"ipaddress="+ip+"&btn=Submit")
  101.  
  102.         if code=~/City<\/td><td align=(.*)><b>(.*)<\/b><\/td>/
  103.             console.insert("end", "[+] City : "+$2+"\n")
  104.         else
  105.             console.insert("end", "[+] City : Not Found\n")
  106.         end
  107.  
  108.         if code=~/Country<\/td><td align=(.*)><b>(.*)<\/b><\/td>/
  109.             console.insert("end","[+] Country : "+$2+"\n")
  110.         else
  111.             console.insert("end", "[+] Country : Not Found\n")
  112.         end
  113.  
  114.         if code=~/State or Region<\/td><td align=(.*)><b>(.*)<\/b><\/td>/
  115.             console.insert("end", "[+] State or Region : "+$2+"\n")
  116.         else
  117.             console.insert("end","[+] State of Region : Not Found\n")
  118.         end
  119.  
  120.         console.insert("end","\n[+] Getting DNS ...\n\n")
  121.  
  122.         control = "0"
  123.  
  124.         code = toma("http://www.ip-adress.com/reverse_ip/"+ip)
  125.  
  126.         dnss = code.scan(/whois\/(.*?)\">Whois/)
  127.  
  128.         dnss.flatten.each do |dns|
  129.             begin
  130.                 if dns != ""
  131.                     control = "1"
  132.                     console.insert("end", "[+] DNS Found : "+dns)
  133.                 end
  134.             end
  135.         end
  136.  
  137.         if control=="0"
  138.             console.insert("end","\n[-] DNS Not Found\n")
  139.         end
  140.  
  141.         console.insert("end","\n\n[+] Finished")
  142.        
  143.     }
  144.     place('relx'=>0.3,'rely'=>0.9)
  145. end
  146.  
  147. Tk.mainloop
  148.  
  149. #The End ?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement