Enero 23, 2018, 02:32:37 am

Autor Tema: [Ruby] LocateIP 0.3  (Leído 923 veces)

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

Desconectado BigBear

  • Yo vivo en CPH
  • ***
  • Mensajes: 736
  • Sexo: Masculino
    • Ver Perfil
[Ruby] LocateIP 0.3
« en: Junio 26, 2015, 05:18:35 pm »
Un simple script en Ruby para localizar una IP y sus DNS.

Version consola :

Código: (ruby) You are not allowed to view links. Register or Login
#!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 ?

Version Tk :

Código: (ruby) You are not allowed to view links. Register or Login
#!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 ?

Una imagen :



Eso es todo.


exclamation
[Ruby] Simple Backdoor in Ruby

Iniciado por BigBear

0 Respuestas
955 Vistas
Último mensaje Marzo 25, 2011, 01:34:44 pm
por BigBear
exclamation
[C#] LocateIP 0.2

Iniciado por BigBear

0 Respuestas
1034 Vistas
Último mensaje Julio 04, 2014, 11:24:41 am
por BigBear
exclamation
[Delphi] LocateIP 0.5

Iniciado por BigBear

2 Respuestas
736 Vistas
Último mensaje Abril 05, 2014, 02:25:30 pm
por BigBear
exclamation
[PyQT4] LocateIP 0.1

Iniciado por BigBear

2 Respuestas
1350 Vistas
Último mensaje Agosto 29, 2012, 05:53:35 pm
por BigBear
exclamation
[Java] LocateIP 0.1

Iniciado por BigBear

0 Respuestas
1140 Vistas
Último mensaje Enero 12, 2013, 08:48:53 pm
por BigBear
exclamation
[Delphi] LocateIP 0.1

Iniciado por BigBear

0 Respuestas
791 Vistas
Último mensaje Abril 25, 2013, 02:47:19 pm
por BigBear
exclamation
[Java] LocateIP 1.0

Iniciado por BigBear

0 Respuestas
1055 Vistas
Último mensaje Marzo 07, 2014, 11:54:51 am
por BigBear
exclamation
[Perl] LocateIP

Iniciado por BigBear

0 Respuestas
799 Vistas
Último mensaje Agosto 19, 2011, 06:30:28 pm
por BigBear
exclamation
[Perl] LocateIP 0.3

Iniciado por BigBear

0 Respuestas
682 Vistas
Último mensaje Enero 19, 2012, 01:21:49 pm
por BigBear
exclamation
[Java] LocateIP 0.2

Iniciado por BigBear

0 Respuestas
679 Vistas
Último mensaje Febrero 20, 2016, 08:51:56 am
por BigBear