que tal.
Bueno, ChElAnO, tienes razon,pero lo mismo winterfuse esta de examenes o no kiere kodearlo, o ..
Al kaso, es que yo estoyde resaka y aburrido y le acabo de ahorrar el codeo.
Asi que, winterfuse, te he codeado esta tool dedicada para ti! :_)
/* codigo de averno para winterfuse */
/*
* dires-scan.c By averno.
*
* - Hecho para el compi: winterfuse, del foro.elhacker.net -
*
* Compilacion: gcc -O2 -o dires-scan dires-scan.c
*
* Uso:
* # ./dires-scan
www.elhost.com fichero_con_directorios_a_probar
*
* Ejemplo:
* # ./dires-scan
www.hacktheworld.com file.txt
*
* Aki, en el post, cambio los
- ( no va a salir ) por [~].
*/
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <errno.h>
#include <stdio.h>
#define MAX 1024
u_long resolve(char *);
void tester(char *host, int sock, char *argv[])
{
FILE *file;
char buff[MAX];
char tmp[MAX];
char tmp2[MAX];
int readbytes;
if ((file = fopen(argv[2], "r")) == NULL) {
fprintf(stderr, "[~] Error abriendo archivo %s!\n\n", argv[2]);
exit(-1);
}
while (fgets(buff, sizeof(buff), file) != NULL) {
if ((buff[0] == '#') || (buff[0] == '\n')) {
continue;
} /* kon esto, saltamos a la siguiente linea si el komienzo de la
linea es un komentario o una line vacia */
buff[strlen(buff) -1] = '\0'; /* Nos deshacemos del '\n' que pone
fgets() */
snprintf(tmp, sizeof(tmp), "GET /%s\\\n\n", buff);
if (write(sock, tmp, strlen(tmp)) == -1) {
perror("write()");
exit(-1);
}
while ((readbytes = read(sock, tmp2, 1024-1)) > 0) {
tmp2[readbytes] = '\0';
if (strstr(tmp2, "200") != NULL) {
printf("[~] Directorio \"%s\" Enkontrado, winterfuse!\n\n", buff);
break;
}
}
memset(&tmp, 0, sizeof(tmp));
memset(&tmp2, 0, sizeof(tmp2));
} /* Fin del loop while() de fgets() */
} /* Fin de la funcion tester() */
int main(int argc, char *argv[])
{
if (argc < 3) {
fprintf(stderr, "[~] Uso: %s <host> <file>\n\n", argv[0]);
exit(0);
}
struct sockaddr_in client;
struct hostent *he; /* utilizo gethostbyname(), ya que vamos a usar
nombres de dominio! */
int fd, readbytes, fl;
char buff[MAX];
if ((fd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
perror("socket()");
exit(-1);
}
if ((he = gethostbyname(argv[1])) == NULL) {
error("gethostbyname()");
exit(-1);
}
memset(&client, 0, sizeof(client));
client.sin_family = AF_INET;
client.sin_port = htons(80);
client.sin_addr = *((struct in_addr *)he->h_addr);
if (connect(fd, (struct sockaddr *)&client, sizeof(struct sockaddr)) == -1) {
perror("connect()");
exit(-1);
}
/*
fl = fcntl(fd, F_GETFL);
fcntl(fd, F_SETFL, fl | O_NONBLOCK); */
tester(argv[1], fd, argv);
return 0;
}
/* EOF */
Bueno, si kieres, te he subido este kodigo ( komprimido en .tar.gz ) a uno de mis hostings. Este,
contiene un fichero de ejemplo tambien que te acabo de hacer ( tiene 3 directorio! )
Solo tienes que aniadirle los dires que veas conveniente a dicho directorio y yasta.
http://www.geocities.com/shirleylla/winterfuse.tar.gz El codigo lo decidi hacer en C. Uso gethostbyname(), asi que no pongas IPs komo segundo argumento!
El uso es:
# ./dires-scan
www.webaprobar.com file.txt
Komo ves, el segundo argumento ( argv[2] ) es el fichero conteniendo los directorios.
Mira el de ejemplo si kieres.
Bueno,espero que te sirva y Gracias por ser agradecido!
Saludos, Suerte.
/**** MODIFIKO ****/
Bueno, os preguntareis.. Y para que incluyo fcntl.h, si no la ha usado??
Pues porke pense el hacer el socket non-blocking ( fcntl(socket, F_SETFL, O_NONBLOCK) )
pero al final, por varios motivos, esta blokeante. Se me ha olvidao kitar la libreria, pero kon la
resaka que gasto demasiado ha sio ya el poder codearla!
/**** MODIFIKO2 ****/
Bueno, pues eso, que he modifikado algo el GET, y he introducido el ultimo "\" del directorio
escapandolo.Asi, kreo que dara mejores resultados.