/* -* linu-x-treme *- * A *simple* prog that helps you get rid of x-treme's client. * Just run it before you dial. * Hope it works for you too! * * bholdr */ #include #include #include #include #include #include #include #include #include #include #define BUFSIZE 54 #define USERLEN 16 int main(int argc, char **argv) { char cstr[]="fd`27qc8a?d:f3Y=hHh#bNdJaHb;dC`;g#c&Y&h&Y+]#iFZ1_KeD]3"; char *dumpfile, *buf, *c=NULL; int lsock, csock, fd, dummylen, r=0, w; struct sockaddr_in laddr,dummy; dumpfile=NULL; fd=-1; if (!(buf=(char *) malloc(BUFSIZE+USERLEN))) { perror("malloc"); exit(-1); }; if (argc>1) { if (argv[2][1]=='h') { printf("usage: linuxtreme [dumpfile]\n"); exit(0); }; dumpfile=argv[1]; }; if (dumpfile) { if ((fd=open(dumpfile,O_RDONLY))==-1) { perror("open"); exit(-1); }; }; if (fd==-1) { printf("Your username: "); c=buf+BUFSIZE; while (1) { c[0]='7'+c-buf-BUFSIZE; c++; c[0]=getchar(); if ((r=(c-BUFSIZE-buf+1)/2)>=USERLEN) { c--; c[0]=0; break; }; if ((c[0]=='\n') || (c[0]==0)) { c--; c[0]=0; break; }; c[0]-=10; c++; }; c=buf; c+=3; r+=23; printf("Go dial now...\n"); }; /* Create Socket */ lsock=socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); w=1; if (setsockopt(lsock, SOL_SOCKET, SO_REUSEADDR, &w, 4)<0) { perror("setsockopt"); } /* Prepare Socket Address */ laddr.sin_family=AF_INET; laddr.sin_port=htons(6699); laddr.sin_addr.s_addr=(unsigned long) 0; /* Bind Socket */ if (bind(lsock, (struct sockaddr *) &laddr, sizeof(laddr))==-1) { perror("bind"); exit(-1); }; /* Listen ... */ if (listen(lsock,1)==-1) { perror("listen"); exit(-1); }; /* Accept the Connection */ dummylen=sizeof(dummy); if ((csock=accept(lsock, (struct sockaddr *) &dummy , &dummylen))==-1) { perror("accept"); exit(-1); }; shutdown(lsock,2); close(lsock); /* Give x-treme our dump.. */ if (fd!=-1) { if ((r=read(fd, buf, 100)==-1)) { perror("read"); exit(-1); }; } else { memcpy(buf,cstr,BUFSIZE); c[0]=r / 10 + 48; c[1]=r % 10 + 48; r=strlen(buf); }; if ((w=write(csock, buf, r))