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


Tema destacado: Recopilación Tutoriales y Manuales Hacking, Seguridad, Privacidad, Hardware, etc


  Mostrar Mensajes
Páginas: 1 ... 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 [57] 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 ... 140
561  Seguridad Informática / Análisis y Diseño de Malware / Re: quiero aprender a infectar un dispositovo, soy nuevo. en: 3 Mayo 2019, 01:43 am
no he probado virtual box, lo estoy instalando ahora, para probarlo, gracias.

fue lo primero que te dije jajjaja, ahí es donde tendrás tu laboratorio  :xD
562  Seguridad Informática / Análisis y Diseño de Malware / Re: quiero aprender a infectar un dispositovo, soy nuevo. en: 3 Mayo 2019, 01:24 am
rub'n, otra preunta, estoy tratando de cifrar a darkcomet pero mi computadora esta eliminando todo los archivos, y desactive el AV y no para de hacerlo

apagala , lo probaste en virtual box?
563  Programación / Java / Re: Ayuda con lectura y escritura en ficheros Java en: 2 Mayo 2019, 19:52 pm
Por ahí va la cosa y cuando lo pongas, usa GeShi en modo bash  ;D

Código
  1. package com.ficheros.foro;
  2.  
  3. import javax.swing.*;
  4. import java.io.BufferedReader;
  5. import java.io.BufferedWriter;
  6. import java.io.IOException;
  7. import java.nio.charset.Charset;
  8. import java.nio.file.Files;
  9. import java.nio.file.Path;
  10. import java.nio.file.Paths;
  11. import java.time.LocalDate;
  12. import java.util.ArrayList;
  13. import java.util.List;
  14. import java.util.Objects;
  15. import java.util.logging.Logger;
  16.  
  17. /**
  18.  * autor @rub´n
  19.  * https://foro.elhacker.net/java/ayuda_con_lectura_y_escritura_en_ficheros_java-t495247.0.html
  20.  */
  21. public class RelPerCen {
  22.  
  23.    private static final Logger LOGGER = Logger.getLogger(RelPerCen.class.getSimpleName());
  24.    private static final String MATCHES = "|             |";
  25.    private static final String REEMPLAZO = "|" + LocalDate.MIN.toString() + "|";
  26.    private static final String REPLACE = "[\\]\\[]";
  27.  
  28.    public static List<String> leerFichero(final String nombre) {
  29.        final List<String> list = new ArrayList<>();
  30.        LOGGER.info("Raiz de proyecto" + Paths.get(".").toAbsolutePath().toString());
  31.        try (final BufferedReader br = Files.newBufferedReader(Paths.get(nombre), Charset.defaultCharset())) {
  32.            LOGGER.info("Leyendo el fichero de empleados\n");
  33.            String line = "";
  34.            final StringBuilder sb = new StringBuilder();
  35.            while (Objects.nonNull(line = br.readLine())) {
  36.               if (!line.contains(MATCHES)) {
  37.                    final String s = line.replace(MATCHES, REEMPLAZO);
  38.                    sb.append(s)
  39.                            .append(System.lineSeparator());
  40.                }
  41.                if (line.contains(MATCHES)) {
  42.                    final String s = line.replace(MATCHES, REEMPLAZO);
  43.                    sb.append(s)
  44.                            .append(System.lineSeparator());
  45.                }
  46.            }
  47.            /**
  48.              * Despues del while
  49.              */
  50.            list.add(sb.toString());
  51.        } catch (IOException ex) {
  52.            JOptionPane.showMessageDialog(null, "No existe el fichero");
  53.            LOGGER.severe("No existe el fichero " + ex.toString());
  54.        }
  55.        return list;
  56.    }
  57.  
  58.    public static void escribir(final List<String> empleado, final String nombreFichero) {
  59.        try (final BufferedWriter bw = Files.newBufferedWriter(Paths.get(nombreFichero))) {
  60.  
  61.            bw.write(empleado.toString()
  62.                    .replaceAll(REPLACE, ""));
  63.  
  64.        } catch (IOException ex) {
  65.            LOGGER.severe("Error al escribir fichero " + ex.toString());
  66.        }
  67.    }
  68.  
  69.    public static void main(String... blablablablabla) {
  70.        final RelPerCen r = new RelPerCen();
  71.        /**
  72.          * Leer el fichero completamente
  73.          */
  74.        final List<String> ficheroLiedo = r.leerFichero("ficheroEmpleados.txt");
  75.        /**
  76.          * Crear el fichero con las fechas de cese en LocalDate.MIN
  77.          */
  78.        r.escribir(ficheroLiedo, "ficheroEmpleadosConFechaDeCese.txt");
  79.    }
  80. }



Salida actual, falta formateo

Código
  1. Título: PERSONAL DEL CENTRO
  2. Autor: Aplicación Séneca, CONSEJERÍA DE EDUCACIÓN Y DEPORTE, Junta de Andalucía
  3. Fecha de creación: 30/04/19 - 10:01
  4.  
  5.  
  6. ---------------------------------------+----------------------------------------+-------------------------+-------------+---------+-----------
  7. Empleado/a                             |Puesto                                  |Fecha de toma de posesión|Fecha de cese|Evaluador|Coordinador
  8. ---------------------------------------+----------------------------------------+-------------------------+-------------+---------+-----------
  9. Aldridge Torres, Pérez                 |Física y Química P.E.S.                 |01/09/2012               |-999999999-01-01|Sí       |No
  10. Álvarez Ortega, María Dolores          |Pedagogía Terapeutica Eso               |01/09/2005               |-999999999-01-01|No       |No
  11. Baquero Reyes, Cristina                |Biología y Geología P.E.S.              |18/02/2019               |30/04/2019   |No       |No
  12. Bermúdez Iñiguez, José Luis            |Geografía e Historia P.E.S.             |01/09/2018               |30/06/2019   |No       |No
  13. Beswick Algarrada, Cristina            |Orientación Educativa P.E.S.            |01/09/2008               |-999999999-01-01|No       |No
  14. Blanco Borrego, Mirian                 |Física y Química P.E.S.                 |01/09/2004               |-999999999-01-01|No       |
  15. Borrego Alcaide, Miguel Ángel          |Lengua Castellana y Literatura P.E.S.   |01/09/2018               |30/06/2019   |No       |No
  16. Butrón Cobo, Lucía                     |Administración de Empresas P.E.S.       |25/09/2018               |09/03/2019   |No       |No
564  Programación / Java / Re: Ayuda con lectura y escritura en ficheros Java en: 2 Mayo 2019, 16:45 pm
Si, el fichero tenía el siguiente contenido:

https://imgur.com/BEi5fTO

perfecto bien, no hay otra manera de tenerlo que no sea imagen? no puedes postearlo aqui?
565  Programación / Java / Re: Ayuda con lectura y escritura en ficheros Java en: 2 Mayo 2019, 15:49 pm
Te mostraron como seria el fichero .txt que esta leyendo? como lo escribieron?
566  Programación / Java / Re: Ayuda con lectura y escritura en ficheros Java en: 2 Mayo 2019, 15:37 pm
https://foro.elhacker.net/java/leer_datos_de_un_fichero_y_crear_una_lista_con_ellos-t495171.0.html

ya te pasaste por aqui no?  :¬¬


Pon código  >:D y con GeSHi así

567  Seguridad Informática / Análisis y Diseño de Malware / Re: quiero aprender a infectar un dispositovo, soy nuevo. en: 2 Mayo 2019, 10:14 am
Usa una virtual Machine, Virtualbox , Vmware, para que empieces, indetectable debes de cifrarlo, y no jodas a nadie que te puedes meter en rollos, o ir al calabozo
568  Programación / Java / Re: Proyectos en NetBeans problemas al ejecutar en: 1 Mayo 2019, 21:29 pm
Saludos,

- Como rub'n ya había dicho en un post anterior, tienes que ir a Run > Clean and Build para limpiar y actualizar tu proyecto.

Tal cual doc, pero me he dado cuenta que con 14 a 15 años, nos tienen que repetir las cosas unass cuántas veces, y ni hablar de 30  :xD
569  Programación / Java / Re: Formateo dinámico en JTextField en: 1 Mayo 2019, 20:34 pm
  • Primero obtén el valor del JTextField
  • Conviértelos a un array lista lo que quieras, que sea un array o lista XD
  • Luego recorres esa lista
  • Cuentas 2 posiciones y le setteas un " "  >:D



Código
  1. package com.prueba.foro;
  2. import javax.swing.*;
  3. import java.awt.*;
  4. import java.util.function.Predicate;
  5. import java.util.stream.Collectors;
  6. import java.util.stream.IntStream;
  7.  
  8. /**
  9.  * @autor rub´n
  10.  */
  11. public class FormatearJTextField extends JFrame {
  12.  
  13.    private final JLabel jLabelTitulo = new JLabel("Introduce 10 números, enter para validar");
  14.    private final JTextField jTextField = new JTextField();
  15.    private final JLabel jLabel = new JLabel("Resultado: ");
  16.    private final JPanel mainJPanel = new JPanel();
  17.  
  18.    private static final String ESPACIOS = "\\s+";
  19.    private static final String LETRAS = "[a-zA-Z]+";
  20.    private static final String NUMEROS_HASTA_10 = "[0-9]{10}";
  21.    private static final String NUMEROS = "[0-9]+";
  22.  
  23.    public FormatearJTextField() {
  24.        super("Formatear JTextField 00 00 00...");
  25.  
  26.        configureLayouts();
  27.  
  28.        configureJFrame();
  29.    }
  30.  
  31.    private void configureJFrame() {
  32.        add(mainJPanel);
  33.        setResizable(Boolean.FALSE);
  34.        setPreferredSize(new Dimension(366, 150));
  35.        pack();
  36.        setLocationRelativeTo(null);
  37.        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  38.        setVisible(true);
  39.    }
  40.  
  41.    private void configureLayouts() {
  42.        mainJPanel.setLayout(new BoxLayout(mainJPanel, BoxLayout.Y_AXIS));
  43.        mainJPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
  44.        mainJPanel.add(jLabelTitulo, BorderLayout.NORTH);
  45.        mainJPanel.add(Box.createVerticalStrut(20));
  46.        mainJPanel.add(jTextField, BorderLayout.CENTER);
  47.        mainJPanel.add(Box.createVerticalStrut(20));
  48.        mainJPanel.add(jLabel, BorderLayout.SOUTH);
  49.  
  50.        listenerJTextField();
  51.    }
  52.  
  53.    /**
  54.      * Listener del JTextField
  55.      */
  56.    private void listenerJTextField() {
  57.        jTextField.addActionListener(e -> {
  58.            final String valor = jTextField.getText();
  59.  
  60.            final Predicate<String> predicate = p -> p.replaceAll(ESPACIOS,"")
  61.                    .matches(NUMEROS_HASTA_10);
  62.  
  63.            if (validar(valor, predicate)) {
  64.                JOptionPane.showMessageDialog(null, "Valores correctos");
  65.  
  66.                final char[] chars = valor.toCharArray();
  67.                String sResultado = IntStream.range(0, chars.length)
  68.                        .mapToObj(index -> chars[index])
  69.                        .collect(Collectors.toList())
  70.                        .toString()
  71.                        .replaceAll(ESPACIOS, "")//quitar espacios en blanco
  72.                        .replaceAll(",", "")//remover ,
  73.                        .replaceAll("\\[", "")//remover [
  74.                        .replaceAll("\\]", "");//remover ]
  75.  
  76.                final StringBuilder sb = new StringBuilder();
  77.                for (int f = 0; f < sResultado.length() - 1; f += 2) {
  78.                    sb.append(sResultado.substring(f, (f + 2)).concat(" "));
  79.                }
  80.  
  81.                jLabel.setText("");
  82.                jLabel.setText("Resultado: " + sb.toString());
  83.                jTextField.setText(sb.toString());
  84.  
  85.            } else {
  86.                final String sError = valor.replaceAll(ESPACIOS,"");
  87.                if (validar(sError, p -> p.matches(LETRAS))) {
  88.                    JOptionPane.showMessageDialog(null, "Valores invalidos");
  89.                 } else if(validar(sError, p -> p.matches(NUMEROS))) {
  90.                    JOptionPane.showMessageDialog(null, "cantidad de numeros es: " + sError.length());
  91.                } else {
  92.                    JOptionPane.showMessageDialog(null, "Valores invalidos");
  93.                }
  94.            }
  95.        });
  96.    }
  97.  
  98.    /**
  99.      * Validador
  100.      *
  101.      * @param value valor obtenido del JTextField
  102.      * @return boolean
  103.      */
  104.    private boolean validar(final String value, final Predicate<String> predicate) {
  105.        return predicate.test(value);
  106.    }
  107.  
  108.    public static void main(String... blabla) {
  109.        new Thread(FormatearJTextField::new).start();
  110.    }
  111. }
  112.  

570  Programación / Java / Re: Formateo dinámico en JTextField en: 1 Mayo 2019, 20:13 pm
Te refieres a cuando obtengas el valor del JTextField que lo formateé de esa manera?
Páginas: 1 ... 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 [57] 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 ... 140
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines