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

📄 binarize.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 <string.h>#include <sys/stat.h>#include <sys/types.h>#include <stdlib.h>/*$Id: binarize.c,v 1.0 2004/07/09 12:54:15 oechslin Exp $*/unsigned char chars[]="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";typedef struct {  unsigned int start;  unsigned long long int end;} line_struct;#define VERBOSE 0#define INDEX_SIZE 1727605  /* 36^4+36^3+36^2+36  + 1 */int compare(const line_struct *l1, line_struct *l2){    if (l1->end>l2->end) return 1;    if (l1->end<l2->end) return -1;    return 0;}int main(int argc, char **argv){    char outfilename[128];    char instr1[8], instr2[8];    int i,k,rows;    unsigned int l, l2, o;    unsigned int *index, prefix;    unsigned short postfix;    char *p;    struct stat file_info;    line_struct *lines,*line;    FILE *infile, *binfile, *startfile, *indexfile;    if (!(infile=fopen(argv[1],"r")))       perror ("must give filename as argument");    stat(argv[1],&file_info);    rows=file_info.st_size/14;    lines=(line_struct*)malloc(rows*sizeof(line_struct));    sprintf(outfilename,"%s.bin",argv[1]);    if (!(binfile=fopen(outfilename,"wb")))      perror ("cannot open output file");    sprintf(outfilename,"%s.start",argv[1]);    if (!(startfile=fopen(outfilename,"wb")))      perror ("cannot open output file");    sprintf(outfilename,"%s.index",argv[1]);    if (!(indexfile=fopen(outfilename,"wb")))      perror ("cannot open output file");    /*read points as 32 bit ints and store in array */    if (VERBOSE)       printf("reading data...\n");    instr1[6]=0; instr2[6]=0;i=0;    line=lines;    for (k=0; k<rows; k++) {      line->start=0;      line->end=0;      fscanf(infile,"%6c%7s ",instr1, instr2);            for (i=0; i<6; i++) 	line->start=line->start*36+strchr(chars,instr1[i])-(char*)chars;            l2 = strlen(instr2);      /*calculate offset from first 4 bytes */      prefix=0;      l=(l2<4 ? l2 : 4);       o=36*36*36*36;      for (i=0; i<4; i++) {	p=strchr(chars,instr2[i]);	if (i< l)	  prefix=prefix*36+p-(char*)chars;	else {	  prefix+=o;o/=36;	}      }      /*calculate postfix from last 4 bytes */      postfix=0;      l=(l2>4 ? l2-4 : 0); o=36*36*36;      for (i=0; i<3; i++) {	p=strchr(chars,instr2[i+4]);	if (i< l)	  postfix=postfix*36+p-(char*)chars;	else {	  postfix+=o;o/=36;	}      }      line->end=((unsigned long long)prefix<<16)+postfix;      if (VERBOSE)	printf("%s %s, %u %u-%hu:%llu\n",instr1,instr2,	       line->start,prefix,postfix,line->end);      line++;    }    /*fclose(infile);*/        if (VERBOSE)      for(i=0;i<rows;i++)	printf("%u,%llu\n",lines[i].start,lines[i].end);    printf("sorting...\n");    /* sort the array */    qsort(lines,rows,sizeof(line_struct),&compare);    if (VERBOSE)      for(i=0;i<rows;i++)	printf("%u,%llu\n",lines[i].start,lines[i].end);        /* output the sorted data into start and bin file */    printf("saving...\n");    index = (unsigned int*)calloc(INDEX_SIZE,sizeof(unsigned int));    line=lines;    if (VERBOSE) printf("%u ",line->start);    fwrite(&line->start,sizeof(unsigned int),1,startfile);    postfix= (short)(line++->end)&0xFFFF;    fwrite(&postfix,sizeof(short),1,binfile);    if (VERBOSE) printf("%hu\n",postfix);    for (i=1;i<rows;i++) {      if (VERBOSE) printf("%u ",line->start);      fwrite(&line->start,sizeof(unsigned int),1,startfile);      prefix=(unsigned long long int)line->end>>16;      if (!index[prefix] && prefix) index[prefix]=i;      postfix= (short)(line++->end)&0xFFFF;      fwrite(&postfix,sizeof(short),1,binfile);      if (VERBOSE) printf("%hu\n",postfix);    }    fclose(binfile);    fclose(startfile);    printf("Generating index\n");    /*output index into index file */    index[INDEX_SIZE-1]=rows;    for(i=1;i<INDEX_SIZE; i++)       if (!index[i]) {	k=i;	while(!index[++i]);	index[k]=index[i];      }    for (i=0;i<INDEX_SIZE;i++) {      fwrite(&index[i],sizeof(int),1,indexfile);    }    fclose(indexfile);        return 0;}

⌨️ 快捷键说明

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