Identidad Falsa

Iniciado por Hu3c0, Febrero 15, 2015, 06:33:24 PM

Tema anterior - Siguiente tema

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

Febrero 15, 2015, 06:33:24 PM Ultima modificación: Diciembre 15, 2015, 07:20:16 PM por Expermicid
Hola compañeros de Underc0de, os presento un programa que he hecho en java para generar datos falsos, en realidad extrae los datos de una página web que los genera.

Recién he estado estudiando esta librería interesante No tienes permitido ver los links. Registrarse o Entrar a mi cuenta , bueno me puse a estudiarla y que mejor manera de estudiar una librería, que es haciendo un programa con ella.

Aquí os pongo el código porque a mí me gusta leer código para aprender y ver nuevas cosas:


Código: java
package identity_fake;

import java.awt.Color;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import javax.swing.JOptionPane;

/**
*
* @author Designer
*/
public class Identity_Fake extends javax.swing.JFrame {
    private static String pais=null;
    private static String sexo=null;
    private static int edad=18;
   
    public Identity_Fake() {
        initComponents();
        setLocationRelativeTo(null);
        setTitle("Fake identity Code by_Designer");
        getContentPane().setBackground(Color.black);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">                         
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        jComboBoxPaises = new javax.swing.JComboBox();
        jComboBoxSexo = new javax.swing.JComboBox();
        jSliderEdad = new javax.swing.JSlider();
        jTextFieldEdad = new javax.swing.JTextField();
        jButtonCrearId = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTextAreaRecibido = new javax.swing.JTextArea();
        jButton2 = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setFocusable(false);
        setFocusableWindowState(false);
        setUndecorated(true);
        setResizable(false);

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/Tituloidentity.PNG"))); // NOI18N

        jButton1.setBackground(java.awt.Color.lightGray);
        jButton1.setText("X");
        jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton1MouseClicked(evt);
            }
        });

        jComboBoxPaises.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Alemania", "Argentina", "Australia", "Bolivia", "Belice", "Brasil", "Canada", "Colombia", "Costa Rica", "Chile", "Cuba", "Ecuador", "El Salvador", "España", "Estados Unidos", "Francia", "Guatemala", "Haiti", "Honduras", "Holanda", "Inglaterra", "Mexico", "Nicaragua", "Nueva Zelanda", "Panama", "Paraguay", "Peru", "Puerto Rico", "Rep.Dominicana", "Reino Unido", "Uruguay", "Venezuela", " " }));
        jComboBoxPaises.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxPaisesActionPerformed(evt);
            }
        });

        jComboBoxSexo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Masculino", "Femenino" }));
        jComboBoxSexo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxSexoActionPerformed(evt);
            }
        });

        jSliderEdad.setMajorTickSpacing(10);
        jSliderEdad.setMaximum(99);
        jSliderEdad.setMinimum(18);
        jSliderEdad.setPaintTicks(true);
        jSliderEdad.setPaintTrack(false);
        jSliderEdad.setValue(33);
        jSliderEdad.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jSliderEdadStateChanged(evt);
            }
        });

        jTextFieldEdad.setBackground(new java.awt.Color(183, 245, 248));
        jTextFieldEdad.setText("Edad=33");
        jTextFieldEdad.setOpaque(false);

        jButtonCrearId.setText("Crear Identidad");
        jButtonCrearId.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonCrearIdActionPerformed(evt);
            }
        });

        jTextAreaRecibido.setColumns(20);
        jTextAreaRecibido.setRows(5);
        jTextAreaRecibido.setWrapStyleWord(true);
        jTextAreaRecibido.setOpaque(false);
        jScrollPane1.setViewportView(jTextAreaRecibido);

        jButton2.setText("Guardar en .txt");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        jButton3.setText("about");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(jScrollPane1)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jComboBoxPaises, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(28, 28, 28)
                        .addComponent(jComboBoxSexo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(26, 26, 26)
                        .addComponent(jSliderEdad, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(55, 55, 55)
                        .addComponent(jTextFieldEdad, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jButtonCrearId, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jButton1)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 36, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addComponent(jSliderEdad, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jComboBoxPaises)
                            .addComponent(jComboBoxSexo)))
                    .addComponent(jTextFieldEdad, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(78, 78, 78)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton1)
                    .addComponent(jButtonCrearId)
                    .addComponent(jButton2)
                    .addComponent(jButton3))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>                       

    private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {                                     
        System.exit(0);
    }                                     

    private void jComboBoxPaisesActionPerformed(java.awt.event.ActionEvent evt) {                                               
         this.pais=jComboBoxPaises.getSelectedItem().toString();
         
         
    }                                               

    private void jSliderEdadStateChanged(javax.swing.event.ChangeEvent evt) {                                         
        jTextFieldEdad.setText("Edad ="+jSliderEdad.getValue());
        this.edad=jSliderEdad.getValue();
       
       
       
    }                                       

    private void jComboBoxSexoActionPerformed(java.awt.event.ActionEvent evt) {                                             
          this.sexo=jComboBoxSexo.getSelectedItem().toString();
         
    }                                             

    private void jButtonCrearIdActionPerformed(java.awt.event.ActionEvent evt) {                                               
        StringBuffer aknew = new StringBuffer();
        TransferDateToUrl tdurl = new TransferDateToUrl();
        aknew=tdurl.Retorno(pais, sexo, pais);
        jTextAreaRecibido.setText(String.valueOf(aknew.toString()));
       
               
   
   
         JOptionPane.showMessageDialog
        (null,"Okey you've got....!"
                ,"Información",JOptionPane.INFORMATION_MESSAGE);
       
       
    }                                             

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                         
        File salida = new File(".");
        String rdnName= Long.toHexString(System.currentTimeMillis());
   
        BufferedWriter bw = null;
        try{
            String nameexit = salida.getAbsolutePath();
            bw =new BufferedWriter(new FileWriter(nameexit+"\\"+rdnName+".txt"));
            bw.write(jTextAreaRecibido.getText());
            bw.close();
        }
        catch (Exception e2){}
        jTextAreaRecibido.setText("");
        JOptionPane.showMessageDialog
        (null,"Okey you can do a new one...!"
                ,"Ready",JOptionPane.INFORMATION_MESSAGE);
    }                                       

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {                                         
       this.setVisible(false);
       About openform =new About();
       openform.setVisible(true);
    }                                       

    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Identity_Fake.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Identity_Fake.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Identity_Fake.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Identity_Fake.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

       
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Identity_Fake().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify                     
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButtonCrearId;
    private javax.swing.JComboBox jComboBoxPaises;
    private javax.swing.JComboBox jComboBoxSexo;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JSlider jSliderEdad;
    private javax.swing.JTextArea jTextAreaRecibido;
    private javax.swing.JTextField jTextFieldEdad;
    // End of variables declaration                   
}


Código: java
package identity_fake;

/**
*
* @author Designer
*/
import java.io.File;
import javax.swing.JOptionPane;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
public class TransferDateToUrl {
    private StringBuffer sB= new StringBuffer();
    TransferDateToUrl(){}
   
    public StringBuffer Retorno(String pais,String sexo,String edad){
     String url="http://www.datafakegenerator.com/generador.php";
        Document document= null;
        try{
          document=  Jsoup.connect(url)
                  .userAgent("Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:2.0b10) Gecko/20110126 Firefox/4.0b10")
                  .data("pais",pais,"sexo",sexo,"de",edad,"hasta",edad,"generar","Generar")
                  .cookie("auth","token")
                  .timeout(4000)
                  .post()
                  ;
         
          int intfinal=41;
          for (int i =13;i<intfinal;i++){
           Element tr = document.select("tr ").get(i);
          Elements td =tr.select("td");
        sB.append(td.text());
         
         
          }
         
        }
        catch (Exception e){
         JOptionPane.showMessageDialog
        (null,"Okey your file was create with exit....!\n"
                +"Use by your Own risk && be god boy...!"
               ,"Información",JOptionPane.INFORMATION_MESSAGE);
        }
     
        return this.sB;
       
    }
}





No tienes permitido ver los links. Registrarse o Entrar a mi cuenta