/* source by hypnos & mioc */ /* modified by kreator */ /* Fri Jul 3 09:47:12 CEST 1998 */ /* log onto argv[1]:argv[2] and get %40c */ #include #include #include #include #include #include #include #include #include #include int main(int argc, char *argv[]) { FILE *in, *out; struct sockaddr_in sa; struct hostent *hp; int sock_in; long port; char shit_out[40+1]; if (!(hp=gethostbyname(argv[1]))) printf("CANNOT QUERY HOSTNAME: host %s\n", argv[1]), exit(EXIT_FAILURE); port=atol(argv[2]); bzero(&sa, sizeof(sa)); bcopy(hp->h_addr, (char *)&sa.sin_addr, hp->h_length); sa.sin_family=hp->h_addrtype; sa.sin_port=htons(port); sock_in=socket(hp->h_addrtype, SOCK_STREAM, 0); if(connect(sock_in, (struct sockaddr *) &sa, sizeof(sa))) printf("UNABLE TO CONNECT: host %s, port %ld\n", argv[1], port), exit(EXIT_FAILURE); in=fdopen(sock_in, "r"); out=fdopen(sock_in, "w"); printf("OPENED: host %s, port %ld\n", argv[1], port); fscanf(in, "%40[^\n]", shit_out); printf("OUTPUT: %s\n", shit_out); if (!close(sock_in)) printf("SESSION CLOSED\n"); else printf("ERROR CLOSING SESSION\n"), exit(EXIT_FAILURE); /* blahblah.. */ return(EXIT_SUCCESS); }