/* mfp_travatudin.c (c)oded by m4rc3l0 in 092003 * * * * Compile with: * * gcc -w -o mfp_travatudin travatudin.c * * * * Run: * * ./mfp_travatudin -h * * * * Greetz: Julie, bashx, decodi, r0ot, esc2, br, * * damita, mor_PH_eus, habeas, brun3rz, acubidu, * * deadsckt, ag_volfi, reignu, unistldu, sinner, * * japex, joshua, fingulino, portinari......... * * * * www.binaryrebels.cjb.net * * www.m4rc3l0rlz.hpg.ig.com.br * * * * Mail-eu: m4rc3l0rlz@yahoo.com.br */ #include #include #include #include #include #include #include #include #define TAG "\x6d\x66\x70" #define UND "\x5f" /* Change the BANNER */ #define BANNER "mfp_travatudin.c (c)oded by m4rc3l0\n\n" #define DPASS "catacutianaum" /* PASSW DEFAULT */ #define DTIME 120 /* DEFAULT TIME */ void use(char *s); void retorna(void); void trava_porra(char *passw, int tts); struct catar { char *pass; int tempo; }; int bflag = 0; int main(int argc, char *argv[]) { int i, dflag=0, nflag=0; char *temp1, *temp2, *bufi, c; char alfa[] = "abcdefghijklmnopqrswxyz"; // ordem certa ? struct catar uia; if((argc < 2) || (argc > 5)) use(argv[0]); while((i=getopt(argc, argv, "bdn:h")) != EOF) { switch(i) { case 'd': dflag=1; break; case 'n': nflag=1; uia.pass = optarg; break; case 'b': bflag=1; break; case '?': case 'h': use(argv[0]); } } if(dflag == 1) trava_porra(DPASS, DTIME); if(nflag == 1) { if(strstr(uia.pass, ":") != NULL) { temp1 = uia.pass; while(*uia.pass != ':') uia.pass++; *uia.pass = '\0'; uia.pass++; bufi = uia.pass; temp2 = atoi(bufi); uia.pass = temp1; for(c = (*bufi); c != '\0'; c = (*++bufi)) { if(!isdigit(c) || strchr(alfa, c)) { fprintf(stderr, "Time invalid\n"); exit(-1); } } uia.tempo = temp2; if(uia.tempo >= (int)65535) uia.tempo = DTIME; } else { uia.tempo = DTIME; } trava_porra(uia.pass, uia.tempo); } return(0); } void trava_porra(char *passw, int tts) { int k, ch; char pass2[1024]; struct termios term, oldterm; alarm(tts); signal(SIGINT, retorna); signal(SIGTERM, retorna); signal(SIGTSTP, retorna); signal(SIGQUIT, retorna); signal(SIGSEGV, retorna); tcgetattr(STDIN_FILENO, &oldterm); term = oldterm; term.c_lflag &= ~(ECHO|ECHOE|ECHOK|ECHONL|ICANON); tcsetattr(STDIN_FILENO, TCSAFLUSH, &term); while(1) { k = 0; if(bflag==1) { printf("\033[2J\033[01;01H"); printf("%s", BANNER); printf("Enter Password: "); } while((ch = getchar()) != '\n') pass2[k++] = ch; pass2[k] = 0; if(!(strcmp(passw, pass2))) { printf("\nOkey! Leaving...\n"); printf("\n"); tcsetattr(STDIN_FILENO, TCSAFLUSH, &oldterm); fflush(stdin); fflush(stdout); exit(0); } else { printf("\nPassword error\n"); sleep(1); fflush(stdin); fflush(stdout); bzero(pass2, sizeof(pass2)); } } } void retorna(void) { return; } void use(char *s) { printf("%s%stravatudin.c (c)oded by m4rc3l0\n", TAG, UND); printf("\nOptions: %s -d || -n [:] [-b] || [-h]\n", s); printf("Usage: \n"); printf(" %s -d Default Mode\n", s); printf(" %s -n [:] Change pass AND tts\n", s); printf(" %s -d || -n [:] -b Show BANNER\n", s); printf(" %s -h This help!\n", s); printf("Examples: \n %s -n tefodeleso:1000\n", s); exit(-1); }