elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Rompecabezas de Bitcoin, Medio millón USD en premios


  Mostrar Temas
Páginas: 1 2 3 4 5 6 7 8 9 10 11 [12] 13 14 15 16
111  Programación / Java / [Aporte] Copiador de bytes en un mismo medio en: 29 Noviembre 2009, 19:53 pm
Hola a todos, hoy investigando y dando uso de la logica, he llegado a la siguiente conclusion sobre manipulacion directa de bytes:
ES como interepretar una hoja de calculo.

Y aqui el codigo fruto de mi mini-investigacion:

Código
  1. package archivos;
  2.  
  3.  
  4.  
  5. import java.io.FileNotFoundException;
  6. import java.io.IOException;
  7. import java.io.RandomAccessFile;
  8. import java.util.logging.Level;
  9. import java.util.logging.Logger;
  10.  
  11. /**
  12.  *
  13.  * @author debci
  14.  */
  15. public class ManipulacionArchivos {
  16. public static void main(String args[]) {
  17.        try {
  18.            // Se abre el fichero para lectura y escritura.
  19.            RandomAccessFile fichero = new RandomAccessFile("/home/debci/Imágenes/love.jpg", "rw");
  20. // Nos situamos en el byte 100 del fichero.
  21.            int longitud = (int) fichero.length();
  22.            fichero.seek(0);
  23.            byte[] matrizBytes = new byte[longitud];
  24.            for (int i = 0; i< fichero.length(); i++) {
  25.                try {
  26.                    fichero.seek(i);
  27.                    matrizBytes[i] = fichero.readByte();
  28.  
  29.                } catch (IOException ex) {
  30.                    Logger.getLogger(ManipulacionArchivos.class.getName()).log(Level.SEVERE, null, ex);
  31.                }
  32.            }
  33.            for (int x=0; x < fichero.length();x++){
  34.            System.out.println(matrizBytes[x]);
  35.            }
  36.            int doblePosicion = (int) (fichero.length() * 2);
  37.            if(fichero.length() == 0){
  38.                fichero.setLength(1);
  39.            }
  40.            fichero.setLength(doblePosicion);
  41.            for(int o = 0; o < 100; o++) {
  42.                //Bucle que copia bytes segun su posicion paralela con intervalos
  43.                //de x2
  44.            for(int y = 0; y < fichero.length() / 2 ; y++){
  45.                if(fichero.length() == 0){
  46.                    fichero.seek(0);
  47.                    fichero.writeByte(98);
  48.                }
  49.                fichero.seek(fichero.length()/2 + y);
  50.                fichero.writeByte(matrizBytes[y]);
  51.                int progreso = (int) fichero.length() / 2;
  52.                System.out.println("Quedan " + (progreso - y) + " bytes por copiar.");
  53.  
  54.            }
  55.  
  56.            }
  57.  
  58.        } catch (IOException ex) {
  59.            Logger.getLogger(ManipulacionArchivos.class.getName()).log(Level.SEVERE, null, ex);
  60.        }
  61.  
  62. }
  63. }
  64.  

Creo que no esta mal para haberlo sacado usando solamente mi logica y una duda que consulte en el foro.

Vereis que el algoritmo es rebuscado de coj**** pero servira para que muchos entiendan como funciona esto.

Saludos
112  Programación / Java / Guardar bytes de un archivo en una matriz en: 29 Noviembre 2009, 12:27 pm
Hola a todos, estoy intentando guardar un archivo (todos sus bytes) en una matriz, pero no lo consigo, mirad mi codigo:

Código
  1. package archivos;
  2.  
  3. import java.io.FileNotFoundException;
  4. import java.io.IOException;
  5. import java.io.RandomAccessFile;
  6. import java.util.logging.Level;
  7. import java.util.logging.Logger;
  8.  
  9. /**
  10.  *
  11.  * @author debci
  12.  */
  13. public class ManipulacionArchivos {
  14. public static void main(String args[]) {
  15.        try {
  16.            // Se abre el fichero para lectura y escritura.
  17.            RandomAccessFile fichero = new RandomAccessFile("/home/debci/test.archivo", "rw");
  18. // Nos situamos en el byte 100 del fichero.
  19.            int longitud = (int) fichero.length();
  20.            fichero.seek(100);
  21.            byte matrizBytes[] = new byte[longitud];
  22.            for(int i = 0; i< fichero.length(); i++) {
  23.  
  24.           matrizBytes[i] = fichero.readByte();
  25.           System.out.println(matrizBytes);
  26.            }
  27.  
Pero no lo consigo, quizas será porque el metodo
Código
  1. readByte();
no es aumentativo, no lo se, solo se que no lo consigo.

Un saludo a todos
113  Programación / Java / Problema con el detecion de Teclado en: 28 Noviembre 2009, 16:16 pm
Hola a todos, estoy mejorando mi RAT en java que pronto acabare pero se me presenta una duda, a partir del siguiente codigo:

Código
  1. ackage robot;
  2.  
  3. import java.awt.event.KeyEvent;
  4. import java.awt.event.KeyListener;
  5. import java.awt.*;
  6. import java.io.IOException;
  7. import java.util.logging.Level;
  8. import java.util.logging.Logger;
  9. import javax.swing.JFrame;
  10.  
  11. /**
  12.  *
  13.  * @author debci
  14.  */
  15. public class TestTeclado extends JFrame implements KeyListener {
  16. public static void main(String args[]){
  17.  
  18.      TestTeclado teclado = new TestTeclado();
  19.      teclado.Teclas();
  20.        try {
  21.            System.in.read();
  22.        } catch (IOException ex) {
  23.            Logger.getLogger(TestTeclado.class.getName()).log(Level.SEVERE, null, ex);
  24.        }
  25.  
  26. }
  27.  
  28.  
  29. public void KeyPress(KeyEvent evento) {
  30.    while(true) {
  31.        System.out.println("Se oprimió tecla: " + evento.getKeyText( evento.getKeyCode() ));
  32.    }
  33. }
  34.  
  35.    public void keyTyped(KeyEvent evento) {
  36.       while(true) {
  37.        System.out.println("Se oprimió tecla: " + evento.getKeyText( evento.getKeyCode() ));
  38.    }
  39.    }
  40.  
  41.    public void keyPressed(KeyEvent evento) {
  42.  
  43.    while(true) {
  44.        System.out.println("Se oprimió tecla: " + evento.getKeyText( evento.getKeyCode() ));
  45.    }
  46.    }
  47.    public void keyReleased(KeyEvent evento) {
  48.        while(true) {
  49.        System.out.println("Se oprimió tecla: " + evento.getKeyText( evento.getKeyCode() ));
  50.    }
  51.    }
  52.  
  53.    private void Teclas() {
  54.       TestTeclado tecladito = new TestTeclado();
  55.       tecladito.setVisible(true);
  56.        addKeyListener(this);
  57.    }
  58.  
  59. }
  60.  
La cosa, que diga cosas, es que se me presentan dos dudas:

1- Puedo agregar un keyListener a algo que no sea un frame? Es decir una simple aplicacion de shell.
2- Aunque lo haga con un jframe no me detecta las teclas, como es esto?

Saludos
114  Programación / Java / Problema con algoritmo encriptador y matriz en: 22 Noviembre 2009, 12:11 pm
Hola a todos, hoy estaba diseñando un algoritmo que cifra cadenas, cuando me dio un error extraño (puede que sea por mi autodidactia) que no soy capaz de resolver:


Código
  1. public void cifra() {
  2. String cadenaIntroducida = new String("Debci");
  3.  
  4. cadenaIntroducida.toUpperCase();
  5. char[] matrizCaracteres = cadenaIntroducida.toCharArray();
  6. int numeroCaracteres = matrizCaracteres.length;
  7. System.out.println("La cadena tiene " + numeroCaracteres +" caracteres." );
  8. for(int i = 0; i < numeroCaracteres; i++){
  9.    matrizCaracteres[i] = matrizCaracteres[i+1];
  10. }
  11. for(int x = 0; x < numeroCaracteres; x++){
  12.    System.out.println(matrizCaracteres[x]);
  13. }
  14.  
  15. }
La cosa, es que mi algoritmo hace lo siguiente, transforma todos los valores del array en el siguiente del indice, es decir, el valor que este en 0, sera transformado por el que este en 1, el de uno sera el 2, basicamente corre hacia un lado los indices.
Me da un error raro al ejecutar:
Código:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 5
        at encriptacion.Encriptador.cifra(Encriptador.java:23)
        at encriptacion.Encriptador.main(Encriptador.java:32)
La cadena tiene 5 caracteres.
Java Result: 1
A que se debe?

Saludos
115  Programación / Ingeniería Inversa / OllyDbg para Linux? en: 20 Noviembre 2009, 18:11 pm
Hola a todos, estaba investigando sobre el cracking, y me vino a la cabeza una duda existencial de las mias....  :¬¬
Existe algun debugger bueno para Linux? Con interfaz grafica si pudiese ser xD
He estado intentando compilar el EDB pero no hay pelotas, me da muchos errores y no genera binarios.

Saludos
116  Programación / Java / [APORTE] Solucionador de ecuaciones de 2o Grado en: 20 Noviembre 2009, 16:50 pm
Hola a todos, aqui os dejo, la plantilla, que he creado para solucionar ecuaciones de segundo grado con las dos raizes, como resultado:

Código
  1. /*
  2.  * Programa que resuelve ecuaciones de segundo grado
  3.  * con capacidad ilimitada.
  4.  */
  5.  
  6. /*
  7.  * Main.java
  8.  *
  9.  * Created on 20-nov-2009, 15:53:49
  10.  */
  11.  
  12. package ecuaciones;
  13.  
  14. /**
  15.  *
  16.  * @author debci
  17.  */
  18. public class Main extends javax.swing.JFrame {
  19.  
  20.    /** Creates new form Main */
  21.    public Main() {
  22.        initComponents();
  23.  
  24.    }
  25.  
  26.    /** Definicion de los mtodo y datos para la interfaz
  27.     */
  28.    @SuppressWarnings("unchecked")
  29.    // <editor-fold defaultstate="collapsed" desc="Generated Code">
  30.    private void initComponents() {
  31.  
  32.        Muestra = new javax.swing.JLabel();
  33.        jLabel1 = new javax.swing.JLabel();
  34.        jTextField1 = new javax.swing.JTextField();
  35.        jLabel2 = new javax.swing.JLabel();
  36.        a = new javax.swing.JTextField();
  37.        XCuadrado = new javax.swing.JLabel();
  38.        jLabel3 = new javax.swing.JLabel();
  39.        b = new javax.swing.JTextField();
  40.        jLabel4 = new javax.swing.JLabel();
  41.        jLabel5 = new javax.swing.JLabel();
  42.        c = new javax.swing.JTextField();
  43.        jScrollPane1 = new javax.swing.JScrollPane();
  44.        Consola = new javax.swing.JTextArea();
  45.        btnResolver = new javax.swing.JButton();
  46.  
  47.        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  48.        setTitle("Resolucion de ecuaciones de 2o Grado");
  49.  
  50.        Muestra.setToolTipText("Muestra de la ecuacion de segundo grado");
  51.  
  52.        jLabel1.setText("Resolucion de una ecuacion de segundo grado");
  53.  
  54.        jTextField1.setText("0");
  55.  
  56.        jLabel2.setText("=");
  57.  
  58.        jLabel3.setText("+");
  59.  
  60.        b.addActionListener(new java.awt.event.ActionListener() {
  61.            public void actionPerformed(java.awt.event.ActionEvent evt) {
  62.                bActionPerformed(evt);
  63.            }
  64.        });
  65.  
  66.        jLabel4.setText("X");
  67.  
  68.        jLabel5.setText("+");
  69.  
  70.        Consola.setColumns(20);
  71.        Consola.setEditable(false);
  72.        Consola.setRows(5);
  73.        Consola.setText("--Solventador de ecuaciones sencillo--\n--Version beta--\n--Andoni Diaz <andoni94@gmail.com>--\n----------------------------------------------------\n_____________________________________\n----------------------------------------------------\n");
  74.        Consola.setToolTipText("Consola de resolucion de ecuaciones");
  75.        Consola.setAutoscrolls(true);
  76.        jScrollPane1.setViewportView(Consola);
  77.  
  78.        btnResolver.setText("Resolver Ecuacion");
  79.        btnResolver.addActionListener(new java.awt.event.ActionListener() {
  80.            public void actionPerformed(java.awt.event.ActionEvent evt) {
  81.                btnResolverActionPerformed(evt);
  82.            }
  83.        });
  84.  
  85.        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  86.        getContentPane().setLayout(layout);
  87.        layout.setHorizontalGroup(
  88.            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  89.            .addGroup(layout.createSequentialGroup()
  90.                .addGap(68, 68, 68)
  91.                .addComponent(jLabel1)
  92.                .addContainerGap(84, Short.MAX_VALUE))
  93.            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
  94.                .addContainerGap(167, Short.MAX_VALUE)
  95.                .addComponent(Muestra, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)
  96.                .addGap(164, 164, 164))
  97.            .addGroup(layout.createSequentialGroup()
  98.                .addContainerGap()
  99.                .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
  100.                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  101.                .addComponent(jLabel2)
  102.                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  103.                .addComponent(a, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
  104.                .addGap(3, 3, 3)
  105.                .addComponent(XCuadrado, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
  106.                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  107.                .addComponent(jLabel3)
  108.                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  109.                .addComponent(b, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
  110.                .addGap(4, 4, 4)
  111.                .addComponent(jLabel4)
  112.                .addGap(18, 18, 18)
  113.                .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
  114.                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  115.                .addComponent(c, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
  116.                .addContainerGap(174, Short.MAX_VALUE))
  117.            .addGroup(layout.createSequentialGroup()
  118.                .addContainerGap()
  119.                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 382, javax.swing.GroupLayout.PREFERRED_SIZE)
  120.                .addContainerGap(55, Short.MAX_VALUE))
  121.            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
  122.                .addContainerGap(306, Short.MAX_VALUE)
  123.                .addComponent(btnResolver)
  124.                .addContainerGap())
  125.        );
  126.        layout.setVerticalGroup(
  127.            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  128.            .addGroup(layout.createSequentialGroup()
  129.                .addGap(15, 15, 15)
  130.                .addComponent(jLabel1)
  131.                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  132.                .addComponent(Muestra, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
  133.                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  134.                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  135.                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  136.                        .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  137.                        .addComponent(jLabel2)
  138.                        .addComponent(a, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  139.                        .addComponent(jLabel3)
  140.                        .addComponent(b, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  141.                        .addComponent(jLabel4)
  142.                        .addComponent(c, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  143.                        .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE))
  144.                    .addGroup(layout.createSequentialGroup()
  145.                        .addGap(4, 4, 4)
  146.                        .addComponent(XCuadrado, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)))
  147.                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  148.                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
  149.                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 28, Short.MAX_VALUE)
  150.                .addComponent(btnResolver)
  151.                .addContainerGap())
  152.        );
  153.  
  154.        pack();
  155.    }// </editor-fold>
  156.  
  157.    private void bActionPerformed(java.awt.event.ActionEvent evt) {                                            
  158.        // TODO add your handling code here:
  159.    }                                          
  160.  
  161.    private void btnResolverActionPerformed(java.awt.event.ActionEvent evt) {
  162.        int a_i;
  163.        int b_i;
  164.        int c_i;
  165.        int x;
  166.        int y;
  167.        //Transformacion de valores a entero
  168.        a_i = Integer.parseInt(a.getText());
  169.        b_i = Integer.parseInt(b.getText());
  170.        c_i = Integer.parseInt(c.getText());
  171.  
  172.        //Calculo del primer coeficiente, este es positivo
  173.        x=(int) ((-b_i + Math.sqrt(b_i ^ 2 - 4 * a_i * c_i)) / (2 * a_i));
  174.        //Calculo del segundo coeficiente, este es negativo
  175.        y=(int) ((-b_i - Math.sqrt(b_i ^ 2 - 4 * a_i * c_i)) / (2 * a_i));
  176.  
  177.       String ResultadoX = Integer.toString(x);
  178.       String ResultadoY = Integer.toString(y);
  179.       Consola.append("Resultados de la ecuacion obtenidos:\n");
  180.       Consola.append("X = "+ ResultadoX + "\n");
  181.       Consola.append("Y = "+ ResultadoY + "\n");
  182.       Consola.append("La dos raizes de la ecuacion son X y Y\n\n");
  183.       Consola.append("--------------------------------------\n\n");
  184.  
  185.    }
  186.  
  187.    /**
  188.     * @param args the command line arguments
  189.     */
  190.    public static void main(String args[]) {
  191.        java.awt.EventQueue.invokeLater(new Runnable() {
  192.            public void run() {
  193.                new Main().setVisible(true);
  194.                Muestra.setText("a*x^2+b*x+c");
  195.                XCuadrado.setText("X²");
  196.            }
  197.        });
  198.    }
  199.  
  200.    // Variables declaration - do not modify
  201.    private javax.swing.JTextArea Consola;
  202.    private static javax.swing.JLabel Muestra;
  203.    private static javax.swing.JLabel XCuadrado;
  204.    private javax.swing.JTextField a;
  205.    private javax.swing.JTextField b;
  206.    private javax.swing.JButton btnResolver;
  207.    private javax.swing.JTextField c;
  208.    private javax.swing.JLabel jLabel1;
  209.    private javax.swing.JLabel jLabel2;
  210.    private javax.swing.JLabel jLabel3;
  211.    private javax.swing.JLabel jLabel4;
  212.    private javax.swing.JLabel jLabel5;
  213.    private javax.swing.JScrollPane jScrollPane1;
  214.    private javax.swing.JTextField jTextField1;
  215.    // End of variables declaration
  216.  
  217. }
  218.  
Si, esta hecho con netbeans, al que no le guste que no mire xDDD  :¬¬
Sinceramente, diseñar interfaces con netbeans es mas rapido y ahorra tiempo de programacion, y mas os aseguro que antes programaba interfaces con la clase Swing y era un toston.

Bueno disfrutadlo ^^

Saludos

 ;)
117  Programación / Java / Problema de construcion de tabla en: 17 Noviembre 2009, 18:29 pm
Hola a todos, tengo una duda existencial (con la de cosas chungas que he pasado y me quedo aqui XDD)
Bueno mirad, os explico, he hecho un programita en java que hace graficas a partir de funciones, y lecturas en un db, la cosa es que doy la opcion de mostrarlo en forma de grafica y en forma de tabla de valores, la cosa esta en que la tabla de valores, se jode cuando hay un numero de mas de 1 una cifra, observad vosotros:

Código:
           X    |   f(X)   
     _______|__________
              1 |  200
              2 |  45
              3 |  215
              4 |  80
              5 |  80
              6 |  50
              7 |  30
              8 |  35
              9 |  40
           10 |  40
           11 |  40
           12 |  100
           13 |  400
Esta desalineada, asi que no sale bien, y no se en que estoy fallando :s

Mirad el codigo que genera la tabla de valores:

Código
  1. public static void getDatos(){
  2.           String sql = "Select x as meses, y as sesion from sesiones";
  3.           try{
  4.               statement = con.createStatement();
  5.                rs= statement.executeQuery(sql);
  6.                System.out.println("       X    |   f(X)   ");
  7.                System.out.println("     _______|__________");
  8.                while(rs.next())
  9.  
  10.                    System.out.println("          "+rs.getInt(1)+" "+"| "+" "+rs.getInt(2));
  11.  
  12.                rs.close();
  13.           }catch(SQLException e ){
  14.               System.err.println("Error: "+e);
  15.           }
  16.  
  17.      }
  18.  
Haber si me podeis orientar un poco.

Saludos a todos!
118  Programación / Java / Problema con JFreeChart en: 16 Noviembre 2009, 19:24 pm
Hola todos, he compuesto el siguiente codigo:

Código
  1. package ventana;
  2. import java.awt.Frame;
  3. import org.jfree.data.*;
  4. import org.jfree.chart.*;
  5. import org.jfree.chart.plot.*;
  6. import java.awt.image.*;
  7. import org.jfree.data.category.CategoryDataset;
  8. import org.jfree.data.category.DefaultCategoryDataset;
  9. import org.jfree.data.jdbc.JDBCCategoryDataset;
  10. import org.jfree.data.jdbc.JDBCXYDataset;
  11. import org.jfree.data.xy.XYDataset;
  12. import org.jfree.data.xy.XYSeries;
  13. import org.jfree.data.xy.XYSeriesCollection;
  14. import java.sql.*;
  15.  
  16.  
  17. /**
  18.  *
  19.  * @author  Administrador
  20.  */
  21. public class VentanaGrafica extends java.awt.Frame {
  22.    BufferedImage grafica = null;
  23.    static BufferedImage image;
  24.  
  25.    /** Creates new form VentanaGrafica */
  26.    public VentanaGrafica() {
  27.       super("Ejemplos usando JFreeChart.");
  28.        initComponents();
  29.    }
  30.  
  31.  
  32.    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">                          
  33.    private void initComponents() {
  34.  
  35.        addWindowListener(new java.awt.event.WindowAdapter() {
  36.            public void windowClosing(java.awt.event.WindowEvent evt) {
  37.                exitForm(evt);
  38.            }
  39.        });
  40.  
  41.        pack();
  42.    }
  43.    // </editor-fold>                        
  44.  
  45.    /** Exit the Application */
  46.    private void exitForm(java.awt.event.WindowEvent evt) {                          
  47.       System.exit(1);
  48.  
  49.    }                        
  50.  
  51.  
  52.    // Variables declaration - do not modify                    
  53.    // End of variables declaration                  
  54.    public static BufferedImage creaImagen(Connection con) {
  55.  
  56.        try{
  57.             String sql= "Select x as meses, y as ventas from sesiones";
  58.            JDBCXYDataset xyDataset = new JDBCXYDataset(con,sql);
  59.             JFreeChart chart = ChartFactory.createLineChart("Grafica de Ventas",
  60.                "Meses","Ventas %",(CategoryDataset) xyDataset,PlotOrientation.VERTICAL,
  61.                true,
  62.                true,
  63.                 true                // Show legend
  64.                );
  65.            //JFreeChart chart1 = ChartFactory.
  66.                image = chart.createBufferedImage(600,400);
  67.            return image;
  68.        }catch(SQLException e){
  69.            System.err.println("Error al obtener datos de la BDD: "+e);
  70.        }
  71.        return image;
  72.    }
  73.   public void paint(java.awt.Graphics g) {
  74.  
  75.        if(grafica == null) {
  76.            grafica = this.creaImagen(Conexion.con);
  77.        }
  78.        g.drawImage(grafica,40,80,null);
  79.    }
  80.  
  81.  
  82. }
  83.  
  84.  

Pero al ejecutarlo, me salta un error, y no me crea la grafica, asi que os pongo el error que tira:

Código:
Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: org.jfree.data.jdbc.JDBCXYDataset cannot be cast to org.jfree.data.category.CategoryDataset
        at ventana.VentanaGrafica.creaImagen(VentanaGrafica.java:65)
        at ventana.VentanaGrafica.paint(VentanaGrafica.java:82)
        at sun.awt.RepaintArea.paintComponent(RepaintArea.java:248)
        at sun.awt.X11.XRepaintArea.paintComponent(XRepaintArea.java:56)
        at sun.awt.RepaintArea.paint(RepaintArea.java:224)
        at sun.awt.X11.XComponentPeer.handleEvent(XComponentPeer.java:688)
        at java.awt.Component.dispatchEventImpl(Component.java:4706)
        at java.awt.Container.dispatchEventImpl(Container.java:2099)
        at java.awt.Window.dispatchEventImpl(Window.java:2475)
        at java.awt.Component.dispatchEvent(Component.java:4460)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Java Result: 1
GENERACIÓN CORRECTA (total time: 29 seconds)
119  Programación / Java / 2o Problema, encriptador con GUI en: 15 Noviembre 2009, 17:39 pm
HOla a todos, antes encontré una clase que encriptaba texto  :o y le hice una gui, la cosa es que la gui cifra bien, pero no descifra!

Codigo de la gui:

Código
  1. package main;
  2.  
  3. /**
  4.  *
  5.  * @author debci
  6.  */
  7. import encriptador.*;
  8. public class Main extends javax.swing.JFrame {
  9. public static String contraseñaEncriptada;
  10.    /** Creates new form Main */
  11.    public Main() {
  12.        initComponents();
  13.    }
  14.  
  15.    /** This method is called from within the constructor to
  16.      * initialize the form.
  17.      * WARNING: Do NOT modify this code. The content of this method is
  18.      * always regenerated by the Form Editor.
  19.      */
  20.    @SuppressWarnings("unchecked")
  21.    // <editor-fold defaultstate="collapsed" desc="Generated Code">
  22.    private void initComponents() {
  23.  
  24.        jTabbedPane1 = new javax.swing.JTabbedPane();
  25.        jPanel1 = new javax.swing.JPanel();
  26.        jLabel1 = new javax.swing.JLabel();
  27.        textoIntroducido = new javax.swing.JTextField();
  28.        claveIntroducida = new javax.swing.JTextField();
  29.        jLabel2 = new javax.swing.JLabel();
  30.        btnEncriptar = new javax.swing.JButton();
  31.        contraseEncr = new javax.swing.JLabel();
  32.        jLabel3 = new javax.swing.JLabel();
  33.        jPanel2 = new javax.swing.JPanel();
  34.        btnDesencriptar = new javax.swing.JButton();
  35.        entradaHash = new javax.swing.JTextField();
  36.        entradaClave = new javax.swing.JTextField();
  37.        jLabel4 = new javax.swing.JLabel();
  38.        jLabel5 = new javax.swing.JLabel();
  39.        jLabel6 = new javax.swing.JLabel();
  40.        clavedesencriptada = new javax.swing.JLabel();
  41.        jMenuBar1 = new javax.swing.JMenuBar();
  42.        jMenu1 = new javax.swing.JMenu();
  43.        jMenu2 = new javax.swing.JMenu();
  44.        jMenuItem1 = new javax.swing.JMenuItem();
  45.  
  46.        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  47.        setTitle("Encriptador Basico");
  48.  
  49.        jLabel1.setText("Introduzca el texto que desea cifrar:");
  50.  
  51.        jLabel2.setText("Introduzca la clave de cifrado:");
  52.  
  53.        btnEncriptar.setText("cifrar");
  54.        btnEncriptar.addActionListener(new java.awt.event.ActionListener() {
  55.            public void actionPerformed(java.awt.event.ActionEvent evt) {
  56.                btnEncriptarActionPerformed(evt);
  57.            }
  58.        });
  59.  
  60.        contraseEncr.setText("Contraseña cifrada");
  61.        contraseEncr.setToolTipText("Contraseña cifrada");
  62.  
  63.        jLabel3.setText("Contraseña cifrada:");
  64.  
  65.        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
  66.        jPanel1.setLayout(jPanel1Layout);
  67.        jPanel1Layout.setHorizontalGroup(
  68.            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  69.            .addGroup(jPanel1Layout.createSequentialGroup()
  70.                .addContainerGap()
  71.                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  72.                    .addComponent(textoIntroducido, javax.swing.GroupLayout.PREFERRED_SIZE, 179, javax.swing.GroupLayout.PREFERRED_SIZE)
  73.                    .addComponent(jLabel2)
  74.                    .addComponent(claveIntroducida, javax.swing.GroupLayout.PREFERRED_SIZE, 179, javax.swing.GroupLayout.PREFERRED_SIZE)
  75.                    .addComponent(jLabel1)
  76.                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
  77.                        .addComponent(contraseEncr)
  78.                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 47, Short.MAX_VALUE)
  79.                        .addComponent(btnEncriptar))
  80.                    .addComponent(jLabel3))
  81.                .addContainerGap())
  82.        );
  83.        jPanel1Layout.setVerticalGroup(
  84.            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  85.            .addGroup(jPanel1Layout.createSequentialGroup()
  86.                .addContainerGap()
  87.                .addComponent(jLabel1)
  88.                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  89.                .addComponent(textoIntroducido, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  90.                .addGap(18, 18, 18)
  91.                .addComponent(jLabel2)
  92.                .addGap(7, 7, 7)
  93.                .addComponent(claveIntroducida, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  94.                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  95.                .addComponent(jLabel3)
  96.                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  97.                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  98.                    .addComponent(btnEncriptar)
  99.                    .addComponent(contraseEncr))
  100.                .addContainerGap())
  101.        );
  102.  
  103.        contraseEncr.getAccessibleContext().setAccessibleParent(this);
  104.  
  105.        jTabbedPane1.addTab("cifrar", jPanel1);
  106.  
  107.        btnDesencriptar.setText("descifrar");
  108.        btnDesencriptar.addActionListener(new java.awt.event.ActionListener() {
  109.            public void actionPerformed(java.awt.event.ActionEvent evt) {
  110.                btnDesencriptarActionPerformed(evt);
  111.            }
  112.        });
  113.  
  114.        jLabel4.setText("Clave cifrada:");
  115.  
  116.        jLabel5.setText("Clave de descifrado:");
  117.  
  118.        jLabel6.setText("La clave descifrada es:");
  119.  
  120.        clavedesencriptada.setText("Clave descifrada");
  121.  
  122.        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
  123.        jPanel2.setLayout(jPanel2Layout);
  124.        jPanel2Layout.setHorizontalGroup(
  125.            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  126.            .addGroup(jPanel2Layout.createSequentialGroup()
  127.                .addContainerGap()
  128.                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  129.                    .addGroup(jPanel2Layout.createSequentialGroup()
  130.                        .addComponent(jLabel4)
  131.                        .addContainerGap(167, Short.MAX_VALUE))
  132.                    .addGroup(jPanel2Layout.createSequentialGroup()
  133.                        .addComponent(entradaHash, javax.swing.GroupLayout.DEFAULT_SIZE, 191, Short.MAX_VALUE)
  134.                        .addGap(87, 87, 87))
  135.                    .addGroup(jPanel2Layout.createSequentialGroup()
  136.                        .addComponent(jLabel5)
  137.                        .addContainerGap(124, Short.MAX_VALUE))
  138.                    .addGroup(jPanel2Layout.createSequentialGroup()
  139.                        .addComponent(entradaClave, javax.swing.GroupLayout.DEFAULT_SIZE, 191, Short.MAX_VALUE)
  140.                        .addGap(87, 87, 87))
  141.                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
  142.                        .addComponent(clavedesencriptada)
  143.                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 50, Short.MAX_VALUE)
  144.                        .addComponent(btnDesencriptar))
  145.                    .addGroup(jPanel2Layout.createSequentialGroup()
  146.                        .addComponent(jLabel6)
  147.                        .addContainerGap(108, Short.MAX_VALUE))))
  148.        );
  149.        jPanel2Layout.setVerticalGroup(
  150.            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  151.            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
  152.                .addContainerGap()
  153.                .addComponent(jLabel4)
  154.                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  155.                .addComponent(entradaHash, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  156.                .addGap(18, 18, 18)
  157.                .addComponent(jLabel5)
  158.                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  159.                .addComponent(entradaClave, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  160.                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  161.                .addComponent(jLabel6)
  162.                .addGap(7, 7, 7)
  163.                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  164.                    .addComponent(btnDesencriptar)
  165.                    .addComponent(clavedesencriptada))
  166.                .addContainerGap())
  167.        );
  168.  
  169.        jTabbedPane1.addTab("descifrar", jPanel2);
  170.  
  171.        jMenu1.setText("Archivo");
  172.        jMenuBar1.add(jMenu1);
  173.  
  174.        jMenu2.setText("Acerca de...");
  175.        jMenu2.addActionListener(new java.awt.event.ActionListener() {
  176.            public void actionPerformed(java.awt.event.ActionEvent evt) {
  177.                jMenu2ActionPerformed(evt);
  178.            }
  179.        });
  180.  
  181.        jMenuItem1.setText("Ver creditos del programa");
  182.        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
  183.            public void actionPerformed(java.awt.event.ActionEvent evt) {
  184.                jMenuItem1ActionPerformed(evt);
  185.            }
  186.        });
  187.        jMenu2.add(jMenuItem1);
  188.  
  189.        jMenuBar1.add(jMenu2);
  190.  
  191.        setJMenuBar(jMenuBar1);
  192.  
  193.        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  194.        getContentPane().setLayout(layout);
  195.        layout.setHorizontalGroup(
  196.            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  197.            .addGroup(layout.createSequentialGroup()
  198.                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 306, javax.swing.GroupLayout.PREFERRED_SIZE)
  199.                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  200.        );
  201.        layout.setVerticalGroup(
  202.            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  203.            .addComponent(jTabbedPane1, javax.swing.GroupLayout.Alignment.TRAILING)
  204.        );
  205.  
  206.        pack();
  207.    }// </editor-fold>
  208.  
  209.    private void jMenu2ActionPerformed(java.awt.event.ActionEvent evt) {                                      
  210.  
  211.    }                                      
  212.  
  213.    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {                                          
  214.        Acerca acerca = new Acerca();
  215.        acerca.setVisible(true);
  216.    }                                          
  217.  
  218.    private void btnEncriptarActionPerformed(java.awt.event.ActionEvent evt) {
  219.        String palabraNormal = textoIntroducido.getText();
  220.        String ClaveIntroducida = claveIntroducida.getText();
  221.  
  222.  
  223.        encriptador encriptador = new encriptador();
  224.        contraseñaEncriptada = encriptador.codificar(palabraNormal, ClaveIntroducida).trim();
  225.        contraseEncr.setText(contraseñaEncriptada);
  226.        contraseEncr.setVisible(true);
  227.  
  228.    }
  229.  
  230.    private void btnDesencriptarActionPerformed(java.awt.event.ActionEvent evt) {
  231.        String hashIntroducido = entradaHash.getText();
  232.        String claveDesencriptadora = entradaClave.getText();
  233.        entradaHash.setText(contraseñaEncriptada);
  234.        encriptador encriptador = new encriptador();
  235.        String claveDesencriptadaLimpia = encriptador.decodificar(hashIntroducido);
  236.        clavedesencriptada.setText(claveDesencriptadaLimpia);
  237.    }
  238.  
  239.    /**
  240.     * @param args the command line arguments
  241.     */
  242.    public static void main(String args[]) {
  243.        java.awt.EventQueue.invokeLater(new Runnable() {
  244.  
  245.            public void run() {
  246.                new Main().setVisible(true);
  247.                contraseEncr.setVisible(false);
  248.                clavedesencriptada.setVisible(false);
  249.            }
  250.        });
  251.    }
  252.  
  253.    // Variables declaration - do not modify
  254.    private javax.swing.JButton btnDesencriptar;
  255.    private javax.swing.JButton btnEncriptar;
  256.    private javax.swing.JTextField claveIntroducida;
  257.    private static javax.swing.JLabel clavedesencriptada;
  258.    private static javax.swing.JLabel contraseEncr;
  259.    private javax.swing.JTextField entradaClave;
  260.    private javax.swing.JTextField entradaHash;
  261.    private javax.swing.JLabel jLabel1;
  262.    private javax.swing.JLabel jLabel2;
  263.    private javax.swing.JLabel jLabel3;
  264.    private javax.swing.JLabel jLabel4;
  265.    private javax.swing.JLabel jLabel5;
  266.    private javax.swing.JLabel jLabel6;
  267.    private javax.swing.JMenu jMenu1;
  268.    private javax.swing.JMenu jMenu2;
  269.    private javax.swing.JMenuBar jMenuBar1;
  270.    private javax.swing.JMenuItem jMenuItem1;
  271.    private javax.swing.JPanel jPanel1;
  272.    private javax.swing.JPanel jPanel2;
  273.    private javax.swing.JTabbedPane jTabbedPane1;
  274.    private javax.swing.JTextField textoIntroducido;
  275.    // End of variables declaration
  276.  
  277. }
  278.  


Codigo de la clase encriptadora:


Código
  1. import java.io.BufferedReader;
  2. import java.io.InputStreamReader;
  3.  
  4. /**
  5.  *
  6.  * @author debci
  7.  */
  8. public class encriptador {
  9. //instance
  10.    private String claveOriginal="";
  11.    private String textoOriginal="";
  12.    private String claveActual="";
  13.    private char[][] matriz;
  14.    //reader
  15.    //methods
  16.    public String decodificar(String texto) {
  17.        int repeticiones=0;
  18.        int jSize= claveActual.length();
  19.        while (repeticiones<jSize) {
  20.            boolean cambio=false;
  21.            int i=repeticiones;
  22.            claveActual="";
  23.            for (int j=0; j<jSize;j++)
  24.                claveActual=claveActual+matriz[0][j];
  25.            while ((!cambio)&&(i<jSize)) {
  26.                    if (claveOriginal.charAt(repeticiones)==claveActual.charAt(i)){
  27.                    modificarArreglo(i,repeticiones);
  28.                    cambio=!cambio;
  29.                }
  30.                else
  31.                    i++;
  32.            }
  33.            repeticiones++;
  34.    }
  35.    String output="";
  36.    for (int i=1; i<matriz.length;i++)
  37.        for (int j=0; j<matriz[0].length;j++)
  38.            output=output + matriz[i][j];
  39.    return output;
  40. }
  41.    public String codificar(String texto, String clave){
  42.        claveOriginal=clave;
  43.        textoOriginal=texto;
  44.        int jSize= claveOriginal.length();
  45.        int iSize= (textoOriginal.length()/jSize)+1;
  46.        if ((textoOriginal.length()%jSize)!=0)
  47.            iSize++;
  48.  
  49.        System.out.println("Filas :" + iSize + " Columnas: "+jSize);
  50.  
  51.        matriz= new char[iSize][jSize];
  52.        int charPos=0;
  53.        int keyPos=0;
  54.        for (int i=0; i<claveOriginal.length();i++) {
  55.            matriz[0][i]=claveOriginal.charAt(i);
  56.        }
  57.        for (int i=1; i<iSize;i++) {
  58.            for (int j=0;j<jSize;j++) {
  59.                try {
  60.                    matriz[i][j]=textoOriginal.charAt(charPos);
  61.                    charPos++;
  62.                }
  63.                catch (Exception e) {matriz[i][j]=' '; charPos++;}
  64.            }
  65.        }
  66.        /*debug
  67.         for (int i=0; i<iSize;i++) {
  68.             for (int j=0; j<jSize;j++) {
  69.                 System.out.print(matriz[i][j]);
  70.             }
  71.         }
  72.         */
  73.  
  74.        int repeticiones=0;
  75.        while (repeticiones<jSize) {
  76.            char[] filaCero= new char[jSize-repeticiones];
  77.            for (int j=repeticiones; j<jSize; j++) {
  78.                filaCero[j-repeticiones]=matriz[0][j];
  79.            }
  80.            int i=0;
  81.            boolean cambio=false;
  82.                    //tamaño de filaCero
  83.            while ((i<jSize-repeticiones)&&(!cambio)){
  84.                if (esElMenor(filaCero,filaCero[i])){
  85.                    modificarArreglo(i+repeticiones,repeticiones);
  86.                    cambio=!cambio;
  87.                }
  88.                i++;
  89.            }
  90.            repeticiones++;
  91.        }
  92.        /*debug
  93.         for (int i=0; i<iSize;i++) {
  94.             for (int j=0; j<jSize;j++) {
  95.                 System.out.print(matrizAuxiliar[i][j]);
  96.             }
  97.         }
  98.         */
  99.       String output="";
  100.        for (int j=0; j<jSize;j++) {
  101.            for (int i=0; i<iSize;i++) {
  102.                if (i==0) claveActual=claveActual + matriz[i][j];
  103.                output=output+matriz[i][j];
  104.            }
  105.        }
  106.        return output;
  107.        /*debug
  108.         for (int j=0; j<jSize;j++) {
  109.             for (int i=0; i<iSize;i++) {
  110.                 System.out.print(matrizFinal[j][i]);
  111.             }
  112.             System.out.println();
  113.         }
  114.         */
  115.  
  116.     }
  117.    public void modificarArreglo(int colActual, int rep) { //intercambia las columnas que pasan como param
  118.        /*for (int i=0; i<matriz.length;i++)
  119.             matrizAuxiliar[i][rep]=matriz[i][colActual];*/
  120.        char[]aux = new char[matriz.length];
  121.        for (int i=0; i<matriz.length;i++){
  122.            aux[i]=matriz[i][rep];
  123.            matriz[i][rep]=matriz[i][colActual];
  124.            matriz[i][colActual]=aux[i];
  125.        }
  126.    }
  127.  
  128.    public boolean esElMenor(char[] arreglo, char car) {
  129.        boolean menor=true; //asume que es el menor.
  130.        int i =0;
  131.        if (car==' ')
  132.            menor = false;
  133.        else {
  134.            while ((i<arreglo.length)&&(menor)) {
  135.                if ((arreglo[i]!=' ')&&(car!=' ')&&(arreglo[i]<car))
  136.                    menor=!menor;
  137.                else
  138.                    i++;
  139.                }
  140.            }
  141.        return menor;
  142.    }
Al introducir una clave de descifrado falla, la cosa es que la clase de encriptacion no trae un argumento concreto, es decir hay que itnroducir una palabra pero no la clave de cifrado, asi que ya me dirán que hago XDDDD

Saludos
120  Seguridad Informática / Nivel Web / Problema con XSS en: 15 Noviembre 2009, 15:18 pm
Hola amigos, he llegado a la conclusion, por scaner, de que un servidor es vulnerable a injecion html, me dice que ejecute lo siguiente:

Código:
/k4KX2kZIUbAKEoyVDYVni3REhNfDl2MZJ69toj5WOCSLG9JQadQWH2HdZ9vrxAD01LvJIivIdZhLcEJUBddfBVi0tGWNFa0P3F4NsgtePjkC8vDbf3DmKfmlyYeBmhJvMiVNtjv0yVmNqkx7V5HHIbs0o59lMP4i2DgQPc0H94Pf0ROFuXFMwJHiI7LUluaVrViT29otAu5hXvq3H27e15TBX2fyMjP<font%20size=50>DEFACED<!--//--: MyWebServer 1.0.2 is vulnerable to HTML injection

como directorio (supongo), pero al ejecutarlo obetngo lo siguiente:

Código:
Forbidden

You don't have permission to access /k4KX2kZIUbAKEoyVDYVni3REhNfDl2MZJ69toj5WOCSLG9JQadQWH2HdZ9vrxAD01LvJIivIdZhLcEJUBddfBVi0tGWNFa0P3F4NsgtePjkC8vDbf3DmKfmlyYeBmhJvMiVNtjv0yVmNqkx7V5HHIbs0o59lMP4i2DgQPc0H94Pf0ROFuXFMwJHiI7LUluaVrViT29otAu5hXvq3H27e15TBX2fyMjP<font size=50>DEFACED<!--//--: MyWebServer 1.0.2 is vulnerable to HTML injection on this server.
Apache/2.2.8 (Win32) PHP/5.2.6 Server at *****.com Port 80

que estoy haciendo mal? ES uno de los conocidos fallos del servidor?

Saludos
Páginas: 1 2 3 4 5 6 7 8 9 10 11 [12] 13 14 15 16
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines