[C con Clase] Cliente de irc en C
yo vegano
xploiting en gmail.com
Mar Sep 30 22:29:03 CEST 2008
Hola, estoy programando un cliente de irc en C. Consigo conectar,
mando el nick, devuelvo el ping, y mando el user ident, pero no hay
manera de pasar de ahí. He comprobado que el servidor recibia los
comandos porque registré el tráfico con wireshark, y vi como el
servidor me mandaba los ACK cada vez que enviaba un comando.
Como puedo superar el paso de user ident? alguna idea?
Gracias, he aquí el codigo:
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#define PORT 6667
#define MAXDATASIZE 100
#define MAX 1000
int main(int argc, char *argv[])
{
int fd, numbytes,a;
char buf2[MAX];
char buf[MAXDATASIZE], mensaje[20], mensaje2[200];
struct hostent *he;
struct sockaddr_in server;
he=gethostbyname(argv[1]);
fd=socket(AF_INET, SOCK_STREAM, 0);
server.sin_family=AF_INET;
server.sin_port=htons(PORT);
server.sin_addr=*((struct in_addr *)he->h_addr);
bzero(&(server.sin_zero),8);
connect(fd, (struct sockaddr *)&server,sizeof(struct sockaddr));
numbytes=recv(fd,buf,MAXDATASIZE,0);
buf[numbytes]='\0';
printf("Mensaje del Servidor: %s\n",buf);
send(fd,"nick spycka",211,0);
numbytes=recv(fd,buf,MAXDATASIZE,0);
buf[numbytes]='\0';
printf("Mensaje del Servidor: %s\n",buf);
gets(mensaje);
send(fd,mensaje,211,0);
send(fd,"user ident pereira ramos josu",50,0);
numbytes=recv(fd,buf2,MAX,0);
buf2[numbytes]='\0';
printf("%s\n",buf2);
close(fd);
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <http://listas.conclase.net/pipermail/cconclase_listas.conclase.net/attachments/20080930/6e6ef4c2/attachment.html>
Más información sobre la lista de distribución Cconclase