Ver Mensaje Individual
  #5 (permalink)  
Antiguo 20/03/2009, 12:04
black_palma
 
Fecha de Ingreso: diciembre-2006
Mensajes: 60
Antigüedad: 17 años, 4 meses
Puntos: 0
Respuesta: error? ayuda :/

Cita:
Iniciado por drac94 Ver Mensaje
una cosa es la declaracion y otra muy diferente la inicializacion, lo que dice venkman es correcto tienes que declararla afuera para que la puedas usar valga la redundancia afuera

asi:
Código PHP:
int proximo=0;
        try{
            
proximo scanner.nextInt();
            if(
proximo>=100 || proximo==0){
                throw new 
Exception();
            }
        }catch(
Exception e){
            
System.out.println("Debes ingresar un valor del tipo int (del 1 al 100)");
            
System.exit(0);
        }
        for(
int i=0;i>=proximo;int++;){

        }
        
html.close(); 
pero si hago eso, al volver a retomar la variable proximo, tendra el valor ingresado por la consola? o será 0?

:/ en todo caso ya funcionó, ahora el problema es con el loop O.o
me tiene desesperado, alguna manito? :P
Código:
import java.io.*;
import java.net.URL;
import java.util.Scanner;


/**
 *
 * @author Juan Pablo Tosso
 * @version 0.5 - Beta
 * @since marzo del 2009
 * @nota este software a sido programado con propositos educativos. El autor no se hace responsable por el uso que se le de.
 */
public class Main  {


    public static String ask;
    public static void main(String[] args) throws IOException {

Scanner scanner = new Scanner(System.in);
System.out.println("Bienvenido!\n\n");
System.out.println("Ingrese una opcion:\n0: Cerrar Software.\n1: Proceder a injectar sitio.\n2: Analizar multiples sitios.\n");

     int next = scanner.nextInt();


switch (next){
    case 0:
        System.out.println("\n\nGracias por usar JInjector, el programa se cerrara en 5 segundos...\nhttp://www.eljuampi.net");
             try {
            Thread.sleep(1000);
            System.out.println("5...");
            Thread.sleep(1000);
            System.out.println("4...");
            Thread.sleep(1000);
            System.out.println("3...");
            Thread.sleep(1000);
            System.out.println("2...");
            Thread.sleep(1000);
            System.out.println("1...\n http://www.eljuampi.net");
            
       }
     catch (InterruptedException e) {
       e.printStackTrace();
       }
        System.exit(0);
        break;
    case 1:
        System.out.println("\nPor favor ingresa el sitio que deseas analizar(http://example.com/file.php?foo=):\n");
        ask = scanner.next();
        if(!ask.endsWith("=") || !ask.startsWith("http://")){
            System.out.println("\nDebes ingresar una URL correctamente!!");
            System.exit(0);
        }
        System.out.println("URL correcta, prosediendo a comprobar estado del servidor...\n\n");
        URL url = new URL(ask);
        try{
            if(url.openConnection().getContentLength()>=0){
            System.out.println("El sitio no se encuentra disponible.");
            System.exit(0);
        }
        }catch(Exception e){
           System.out.println("Error");
        }
        
        System.out.println("Sitio encontrado, cargando...\n");
        BufferedReader html = new BufferedReader(new InputStreamReader(url.openStream()));
        System.out.println("Sitio cargado exitosamente! \n ¿Desea revisar si el sitio es vulnerable? (si/no)\n");
        String pregunta = scanner.next();
        if(pregunta.equals("si")){
            /*Procedemos a analizar cada linea...*/
               String rawdata;
               Boolean funco = true;
               while((rawdata = html.readLine()) != null){
                   if(rawdata.contains("mysql_fetch_") || rawdata.contains("You have an error in your SQL syntax") || rawdata.contains("mysql_num_rows") || rawdata.contains("Division by zero in")){
                       funco = false;
                   }
               }
               if(funco){
                   System.out.println("Sitio aparentemente vulnerable =)");
               }else{
                   System.out.println("Sitio aparentemente no vulnerable =(");
               }
        }else{
            System.out.println("Escaneo de vulnerabilidades abortado\n");
        }
        System.out.println("Se iniciara el conteo de columnas, porfavor indique el maximo de columnas a buscar (maximo 100)");
        int proximo = 0;
        try{
            proximo = scanner.nextInt();
            if(proximo>=100 || proximo==0){
                throw new Exception();
            }
        }catch(Exception e){
            System.out.println("Debes ingresar un valor del tipo int (del 1 al 100)");
            System.exit(0);
        }
          for(int i=0;i>=proximo;i++;){
System.out.println(i);
       }
        html.close();
        break;
}

}