⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 precomp.c

📁 跟rainbow table结合破解windoes登陆密码及各种hash密码
💻 C
字号:
/*    This file is part of Ophcrack (Time-Memory-Trade-Off-crack).    Ophcrack is a Lanmanager/NTLM hash cracker based on the faster time-memory    trade-off using rainbow tables.         Created with the help of: Maxime Mueller, Luca Wullschleger, Claude    Hochreutiner and Andreas Huber.    Copyright 2004 Philippe Oechslin    Ophcrack is free software; you can redistribute it and/or modify    it under the terms of the GNU General Public License as published by    the Free Software Foundation; either version 2 of the License, or    (at your option) any later version.    Ophcrack is distributed in the hope that it will be useful,    but WITHOUT ANY WARRANTY; without even the implied warranty of    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    GNU General Public License for more details.    You should have received a copy of the GNU General Public License    along with Ophcrack; if not, write to the Free Software    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA*/#include <stdio.h>#include <stdlib.h>#include "make_hash.h"#include "make_redux.h"#include <unistd.h>#include <string.h>#include <sys/stat.h>/* Precompute the tables for the Time-Memory Trade-Off */static char rcsid[] = "$Id: precomp.c,v 1.0 2004/07/09 12:54:15 oechslin Exp $";/*  * $Log: precomp.c,v $ * Revision 1.0  2004/07/09 12:54:15  oechslin * Initial revision * */void usage(char *name){  printf("usage %s [-vx -m rows -M start_row -i col -d directory] -l length table\n",name);  printf("      -d directory where tables saved\n");  printf("      -m rows per table (taken from existing file if it exists)\n");  printf("      -M start at row start_row (if not working on an existing file)\n");  printf("      -t length of chains\n");  printf("      -i use identical redux function starting at col in each table\n");  printf("      -s stop and sort after this many columns\n");  printf("      -x do not sort the chains\n");  printf("      -v verbose mode\n");  exit(-1);}			  int main(int argc, char **argv){  extern int optind;  extern char *optarg;  struct stat file_info;  unsigned char hash[8];     int verbose = 0,    rows = 0,    no_sort = 0,    cols = 0,    start_col = 0,    same_redux = 999999,    stop_col = 0,    start_row = 0,    table,    k,p,l;      char c,    start[8]={0}, end[8]={0}, directory[128]="",  command[128];    unsigned char filename[256], oldfilename[256],pw[8];    FILE *oldfile=NULL, *tablefile;      while ((c=getopt(argc, argv, "xm:M:d:vt:s:i:"))>0) {      switch ((char)c) {      case 'd': strcpy(directory, optarg); break;      case 'm': rows = atoi(optarg); break;      case 'M': start_row = atoi(optarg); break;      case 't': cols = atoi(optarg); break;      case 's': stop_col = atoi(optarg); break;      case 'i': same_redux=atoi(optarg); break;      case 'v': verbose=1;break;      case 'x': no_sort=1;break;      case '?': usage(argv[0]);break;      }    }    if (!stop_col) stop_col=cols;    if (optind != argc-1) usage(argv[0]);        table=atoi(argv[optind++]);    init_redux(cols, same_redux);    set_redux(0,table);    /* see if already have a file with some of the columns */    sprintf(filename,"%stable%d",directory,table);    if ((oldfile=fopen(filename,"r"))) {      printf("Found existing file %s\n",filename);      /* check how many columns have already been calculated: */      fscanf(oldfile,"%6c%7s ",pw, end);      pw[6]=0;pw[7]=0;      l=strlen(end);      do {	make_hash(pw,hash); make_redux(hash,pw);	if (verbose) printf("%s\n",pw);	next_redux();	start_col++;      } while ((strncmp(pw,end,l)) && (start_col!=cols));      if (strncmp(pw,end,l)) {	printf("Invalid file. Please delete %s and start again.\n",	       filename);	exit (-1);      }      if (start_col==cols) {	printf("Table %s complete, nothing to do!\n",filename);	exit(1);      }      fclose(oldfile);      /* make a copy of the current file, as backup */      sprintf(oldfilename,"%s.%d",filename,start_col);      sprintf(command,"mv %s %s",filename,oldfilename);      system(command);      /* find out the number of rows in the existing file */      if (!(oldfile=fopen(oldfilename,"r"))) 	perror ("filename");      stat(oldfilename,&file_info);      rows = file_info.st_size /14;        start_row = 0;      printf("using %d rows from old file at column %d\n",	     rows,start_col);      stop_col +=start_col;      if (stop_col>cols) stop_col=cols;    }        if (verbose)       printf("calculating cols %d through %d\n",	     start_col,stop_col);    if (!(tablefile=fopen(filename,"w")))       perror ("filename");        printf("table%d: ",table); fflush(stdout);            for (l=start_row; l<start_row+rows; l++) {            /* gernerate starting point from file or row index */      if (oldfile) {	pw[1]=0;pw[2]=0;pw[3]=0;pw[4]=0;pw[5]=0;pw[6]=0;pw[7]=0;  	fscanf(oldfile,"%6c%7s ",start, pw);	fprintf(tablefile,"%s",start);      }      else {	p=l;	for (k=5; k>=0; k--) {	  pw[k]=chars[p%36];	  p/=36;	}	pw[6]=0; pw[7]=0;	fprintf(tablefile,"%s",pw);      }      if (verbose) printf("start: %s\n",pw);      /* create chain */            set_redux(start_col, table);            for (k=start_col; k<stop_col; k++) {	make_hash(pw,hash); make_redux(hash,pw);	if (verbose) printf("%s\n",pw);	next_redux();      }      fprintf(tablefile,"%-7s\n",pw);    }        printf(" generated\n");    fclose(tablefile);    if (!no_sort) {      printf("sorting table %d\n",table);      sprintf(command,"sort -u -k1.7 %s > tmp; mv tmp %s",	      filename, filename);      system(command);    }    return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -