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

 

 


Tema destacado: Como proteger una cartera - billetera de Bitcoin


  Mostrar Mensajes
Páginas: [1] 2
1  Programación / Programación C/C++ / [Aporte] Herramienta para transformar a ascii web en: 19 Junio 2013, 13:25 pm
Buenas, he hecho una pequeña tool en C para transformar una cadena ascii a hexadecimal.

Es practicamente inutil, pero la idea es automatizarlos  ;D ;D

La idea es usarlo en cosas como el XSS en webs que filtran las cadenas, pero no los valores hexadecimales.

Por ejemplo, el típico XSS ("><script>alert(42);</script>) se vería asi:

Código:
%22%3e%3c%73%63%72%69%70%74%3e%61%6c%65%72%74%28%34%32%29%3b%3c%2f%73%63%72%69%70%74%3e

El código es este (vale tanto para Unix como para Windows  :D)

Código
  1. //A tool for transforming an ascii string to web hex
  2. //IE: "test" == %74%65%73%74
  3. #include <stdio.h>
  4. #include <string.h>
  5.  
  6. int main(void) {
  7.  
  8.  char str[1024];
  9.  int i;
  10.  const char percent = 0x25;
  11.  printf("Enter the text\n");
  12.  scanf("%s", &str);
  13.  for(i = 0; i < strlen(str); i++) {
  14.    printf("%c%02x",percent, str[i]);
  15.  }
  16.  printf("\n");
  17.  
  18. #ifdef __WINDOWS__
  19.  printf("\n\n");
  20.  system("pause");
  21. #endif
  22. }

Espero que os guste este aporte y que os sea útil.  :rolleyes:
2  Programación / Programación C/C++ / Re: Es posible hacer esto sin arreglos? en: 16 Marzo 2013, 20:54 pm
Si puedes usar punteros lo que puedes hacer es "fingir" el array con las direcciones de memoria.

Código
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main(void) {
  5.  
  6. int *p, i, j, c=0;
  7.  
  8. p = malloc(sizeof(int)*10);
  9. for(i=0;i<10;i++) {
  10. printf("Introduzca un numero: ");
  11. scanf("%d", p+(sizeof(int)*i));
  12. for(j = 0; j < i; j++) {
  13. if(*(p+(sizeof(int)*i)) == *(p+(sizeof(int)*j))) {
  14. c++;
  15. }
  16. }
  17. }
  18. printf("Han ocurrido %d coincidencias\n", c);
  19. return 0;
  20. }
3  Programación / Programación C/C++ / Re: Problema con sockets en linux en: 6 Marzo 2013, 19:26 pm
Funcionó  ;D muchas gracias  :laugh:
4  Programación / Programación C/C++ / Problema con sockets en linux en: 6 Marzo 2013, 19:07 pm
Buenas, tengo este código que su idea es ser un pequeño cliente de irc, pero por ahora solo crea y conecta el socket. El problema viene al compilar:

Código:
$ gcc ircclientlinux.c 
ircclientlinux.c: En la función ‘main’:
ircclientlinux.c:13:21: error: no se conoce el tamaño de almacenamiento de ‘addr’

El código es el siguiente:
Código
  1. #include <unistd.h>
  2. #include <string.h>
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <sys/socket.h>
  6.  
  7. #define PORT 6667
  8. #define SERVER "128.237.157.136"
  9.  
  10. int main(void) {
  11.  
  12. int sockfd;
  13. struct sockaddr_in addr;
  14.  
  15. if((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
  16. printf("Error al crear el socket\n");
  17. return 0;
  18. }
  19. addr.sin_family = AF_INET;
  20. addr.sin_port = htons(PORT);
  21. addr.sin_addr.s_addr = inet_addr(SERVER);
  22. bzero(&(addr.sin_zero), 8);
  23.  
  24. if(connect(sockfd, (struct sockaddr *) &addr, sizeof(struct sockaddr)) == -1) {
  25. printf("Error al conectar al servidor\n");
  26. }
  27.  
  28. return 0;
  29. }
5  Sistemas Operativos / GNU/Linux / Re: ¿Antes las criticas recibidas para ubuntu 12.10, que linux instalar? en: 4 Marzo 2013, 10:35 am
Yo uso Archlinux, sí tienes paciencia es una distro genial  :xD. Sí eres un novato, lo suyo sería Linux Mint. Sí aun así quieres quedarte en Ubuntu, Xubuntu 12.04 es una opción muy interesante ;D.
6  Programación / Programación C/C++ / Re: Problema con GtkText [Linux][GTK+] en: 24 Febrero 2013, 11:28 am
Funcionó cambiando el Widget a GtkTextView  :laugh:. Muchisimas gracias por la solución.  ;-) ;-) ;-)
7  Seguridad Informática / Hacking / Re: Camuflar BAT o EXE en cualquiero otro formato como JPG, PNG, BMP, MP3 en: 23 Febrero 2013, 20:38 pm
No se que tal andarás de programación... Pero, hacer un programa que lea los bytes a pelo y cree un nuevo archivo. (En Unix funcionaría, por eso de que todo es un fichero, pero en Windows no se...)
8  Programación / Programación C/C++ / Re: Problema con GtkText [Linux][GTK+] en: 23 Febrero 2013, 20:12 pm
Prueba a cambiar esta linea:

Código
  1. gtk_text_set_editable((GtkText *) text_box, TRUE);

Por esta:

Código
  1. gtk_text_set_editable(GTK_TEXT(text_box), TRUE);

Ya probe esa solución y no me funcionó, pero gracias de todas formas  :D
9  Programación / Programación C/C++ / Re: Problema con GtkText [Linux][GTK+] en: 23 Febrero 2013, 16:48 pm
Puse un link a pastebin con el código, pero bueno, posteo la función problemática igualmente.

Código
  1. void create_window(int argc, char **argv) {
  2.    /**
  3.      * Creates a GTK+ dialog for editing the note          
  4.      */
  5.    GtkWidget *window, *save_button, *text_box, *container;
  6.  
  7.    gtk_init(&argc, &argv);
  8.  
  9.    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  10.    gtk_window_set_title((GtkWindow *) window, "Notes");
  11.    gtk_window_set_default_size((GtkWindow *) window, 300,160);
  12.    g_signal_connect((GObject *) window, "delete-event", (GCallback) gtk_main_quit, NULL);
  13.  
  14.    save_button = gtk_button_new_with_label("Save");
  15.    g_signal_connect((GObject *) save_button, "clicked", (GCallback) save_note, NULL /*By the way*/);
  16.  
  17.    container = gtk_vbox_new(FALSE, 1);
  18.  
  19.    text_box = gtk_text_new(NULL, NULL);
  20.    gtk_text_set_editable((GtkText *) text_box, TRUE);
  21.  
  22.    gtk_box_pack_start((GtkBox *) container, text_box, FALSE, FALSE, 0);
  23.    gtk_box_pack_start((GtkBox *) container, save_button, FALSE, FALSE, 0);
  24.  
  25.    gtk_container_add((GtkContainer *) window, container);
  26.  
  27.    gtk_widget_show_all(window);
  28.    gtk_main();
  29. }
10  Programación / Programación C/C++ / Re: Problema con GtkText [Linux][GTK+] en: 23 Febrero 2013, 11:44 am
No me explique bien :xD, ya edite explicandolo mejor.
Páginas: [1] 2
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines