首页
社区
课程
招聘
[分享]改进版的《黑客字典》VC++源码
发表于: 2005-10-19 18:27 8674

[分享]改进版的《黑客字典》VC++源码

2005-10-19 18:27
8674
这个是我们学校一个朋友写出来的,给大家共享一下,若有不妥,请版主删除该帖!

//-------------------------------------------------------------------------------//
//  黑客字典 v2.2 Source Code for Visual C++ 6.0                                 //
//                                                                               //
//     -->> Everyone free to use, modify, recompile!!!  Open it for Internet     //
//                                                                               //
//  Author:    W.Z.T                                                             //
//  HomePage:  http://tthacker.hackvip.cn                                        //
//  Publisher: http://www.suse.edu.cn                                            //
//  Release:   8/9/2005                                                          //
//-------------------------------------------------------------------------------//
/*

黑客字典2.2,改进了穷举的算法,密码最大长度为1000,使代码长度减小,程序的执行速度加快。
同时加入了新的功能,除了完成一般黑客字典的所有功能外. 还加入了辅助功能,协助黑客更好的
设置字典。

常规字典:

01。生日字典,提供12种格式。
02。手机。电话字典。
03。穷举给定长度的数字,大小写字母之间的排列。
04。支持字定义字符模式。

辅助功能:

05。增加了无穷个字典的合并功能,合并后可去除每两个字典档中重复的密码。
06。把一个较大的文件分解成若干个小的字典档。
07。向一个文件每个密码的前面或后面增加特定的字符串,或是删除特定的字符串。
08。把每个密码的前后调换。
09。从一个文件过滤出特定字符的密码。
10。可以将指定文件中每行指定的字符前面的字符保留。
11。将一个文件中每行中指定的字符串替换成另一个字符串。
12。完成类似txt2dic程式的功能,从指定程序过滤掉给定的字符串。

FAQ:

02.当穷举时,如果有'^',需在命令行下写两便。例如:@#^^,将生成@#^之间所有的排列。
---------------------------------------------------------------------------------*/

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#define MAX 1000
#define Max 100
#define M 600

void help(void);
void turn(char *,char *);    /*将密码倒转*/
void grep(char *,char *,char *);   /*保留特定字符串*/
void find(char *,char *,char *);   /*查找字符函数*/
void a_file(int,char **);
void c_file(int,char **);
void mobi(char *,char *,char *,char *,char *);   /*生成手机密码*/
void tel(char *,char *,char *,char *);           /*电话密码*/
void create(char *,char *,char *,char *);       /*穷举密码*/
void adle(char *,char *,char *,char *);      /*文件每行加入特定的字符串*/
void acle(char *,char *,char *,char *);      /*文件每行删除特定的字符串*/
void cut(char *,char *,char *,char *);    /*保留文件每行中特定字符前面的字符串*/
void txt2dic(char *,char *,char *,char *);  /*过滤特定字符串*/
void defi(char *,char *,char *,char *);  /*将指定的字符串替换成另一字符串*/
void birth(char *,char *,char *,char *,char *,char *,char *,char *);  /*生日字典*/

char a[MAX];        /*将要穷举的字符数组*/

char line[MAX][Max];

char b[]="0123456789";

char c[]="abcdefghijklmnopqrstuvwxyz";

char d[]="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

char e[]="0123456789abcdefghijklmnopqrstuvwxyz";

char h[]="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";

char g[]="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

char f[]="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main(int argc ,char **argv)
{
     FILE *fp1,*fp2,*fp3;
     long lenth1=0,len1=0;
     long sum=0,len2,len3;
     long lenth=0;
     int i,j;
     int flag=1;
     char line1[M],line2[M];
     char ch;

     if(argc==1)
     {
         help();
     }
     if(!strcmp(argv[1],"-tt"))
     {
             txt2dic(argv[2],argv[3],argv[4],argv[5]);
     }
     if(!strcmp(argv[1],"-g"))
     {
             grep(argv[2],argv[3],argv[4]);
     }
     if(!strcmp(argv[1],"-m"))
     {
            mobi(argv[2],argv[3],argv[4],argv[5],argv[6]);
     }
     if(!strcmp(argv[1],"-t"))
     {
         tel(argv[2],argv[3],argv[4],argv[5]);
     }

    if(!strcmp(argv[1],"-b"))
    {
         birth(argv[2],argv[3],argv[4],argv[5],argv[6],argv[7],argv[8],argv[9]);
    }

    if(!strcmp(argv[1],"-d"))
    {
         create(argv[2],argv[3],argv[4],argv[5]);
    }
    if(!strcmp(argv[1],"-ac"))
    {
         adle(argv[2],argv[3],argv[4],argv[5]);
    }
    if(!strcmp(argv[1],"-ca"))
    {
         acle(argv[2],argv[3],argv[4],argv[5]);
    }
    if(!strcmp(argv[1],"-u"))
    {
         turn(argv[2],argv[3]);
    }
    if(!strcmp(argv[1],"-cc"))
    {
         cut(argv[2],argv[3],argv[4],argv[5]);
    }
    if(!strcmp(argv[1],"-v"))
    {
        defi(argv[2],argv[3],argv[4],argv[5]);
    }

    if(!strcmp(argv[1],"-a"))   /*字典文件合并*/
    {
        a_file(argc,argv);
    }
    if(!strcmp(argv[1],"-c"))    /*字典文件分割*/
    {
        c_file(argc,argv);
    }
}

void mobi(char *a,char *b,char *c,char *d,char *e)   /*手机字典生成函数*/
{
    FILE *fp;
    char *aa=a;
    char *bb=b;
    char *cc=c;
    char *dd=d;
    char *ee=e;
    char ch;
    int p,q,j;
    long m,n,i;
    long lenth=0;
   
    if((fp=fopen(aa,"w+"))==NULL)
    {
         printf("Can't open the file %s\n",aa);
         exit(0);
    }
   
    p=atoi(bb);
    q=atoi(cc);
    m=atol(dd);
    n=atol(ee);
   
    if(p>q||m>n)       /*排错处理*/
    {
         printf("error,p must <= q or m <= n please input again:\n");
         exit(0);
    }
    for(j=p;j<=q;j++)
        for(i=m;i<=n;i++)
             fprintf(fp,"%d%ld\n",j,i,fp);
    rewind(fp);
   
    while((ch=fgetc(fp))!=EOF)
    {
         if(ch=='\n')
              ++lenth;
    }
    printf("done.\nthe file has %ld words in %s\n",lenth,aa);
    fclose(fp);
}

void tel(char *a,char *b,char *c,char *d)      /*电话字典生成函数*/
{
     FILE *fp;
     char *aa=a,*bb=b,*cc=c,*dd=d;
     int p,w=0;
     char ch;
     long m,n,i;
     long lenth=0;
     
     if((fp=fopen(aa,"w+"))==NULL)
     {
         printf("Can't open the file %s\n",aa);
         exit(0);
     }
     p=atoi(bb);
     m=atol(cc);
     n=atol(dd);
     if(m>=n)
     {
          printf("error.start_n must <= end_n\n");
          exit(0);
     }
     if(p>=1000)
     {
         for(i=m;i<=n;i++)
              fprintf(fp,"%d%ld\n",p,i);
     }
     else
     {
         for(i=m;i<=n;i++)
               fprintf(fp,"%d%d%ld\n",w,p,i);
     }
     rewind(fp);
     while((ch=fgetc(fp))!=EOF)
     {
         if(ch=='\n')
              ++lenth;
     }
     fclose(fp);
     printf("\nDone.\nThe file has %ld hang in %s.\n",lenth,aa);
}

void birth(char *a1,char *b1,char *c1,char *d1,char *e1,char *f1,char *g1,char *h1)
{
    FILE *fp;
    char *aa=a1,*bb=b1,*cc=c1,*dd=d1,*ee=e1,*ff=f1,*gg=g1,*hh=h1;
    long int lenth=0;
    int a,b,c,d,e,f,h,m=0;
    char ch,ch1='//',ch2=':',ch3='.',ch4='-',ch5='\\';
    if((fp=fopen(bb,"w+"))==NULL)
    {
        printf("Can't open the file %s.\n",bb);
        exit(0);
    }

    h=atoi(aa);
    a=atoi(cc);
    b=atoi(dd);
    c=atoi(ee);
    d=atoi(ff);
    e=atoi(gg);
    f=atoi(hh);

    if(a>d||b>e||c>f)
    {
         printf("error.check it again.\n");
         exit(0);
    }
    while(a<=d)
    {
        switch(h)
         {
             case 1:
                 if(b<10&&c<10)
                      fprintf(fp,"%d%d%d%d%d\n",a,m,b,m,c);
                 if(b>=10&&c<10)
                      fprintf(fp,"%d%d%d%d\n",a,b,m,c);
                 if(b<10&&c>=10)
                      fprintf(fp,"%d%d%d%d\n",a,m,b,c);
                 if(b>=10&&c>=10)
                      fprintf(fp,"%d%d%d\n",a,b,c);
                 break;
             case 2:
                 if(b<10&&c<10)
                      fprintf(fp,"%d%c%d%d%c%d%d\n",a,ch1,m,b,ch1,m,c);
                 if(b>=10&&c<10)
                      fprintf(fp,"%d%c%d%c%d%d\n",a,ch1,b,ch1,m,c);
                 if(b<10&&c>=10)
                      fprintf(fp,"%d%c%d%d%c%d\n",a,ch1,m,b,ch1,c);
                 if(b>=10&&c>=10)
                      fprintf(fp,"%d%c%d%c%d\n",a,ch1,b,ch1,c);
                 break;
             case 3:
                 if(b<10&&c<10)
                      fprintf(fp,"%d%c%d%d%c%d%d\n",a,ch2,m,b,ch2,m,c);
                 if(b>=10&&c<10)
                      fprintf(fp,"%d%c%d%c%d%d\n",a,ch2,b,ch2,m,c);
                 if(b<10&&c>=10)
                      fprintf(fp,"%d%c%d%d%c%d\n",a,ch2,m,b,ch2,c);
                 if(b>=10&&c>=10)
                      fprintf(fp,"%d%c%d%c%d\n",a,ch2,b,ch2,c);
                 break;
             case 4:
                 if(b<10&&c<10)
                      fprintf(fp,"%d%c%d%d%c%d%d\n",a,ch3,m,b,ch3,m,c);
                 if(b>=10&&c<10)
                      fprintf(fp,"%d%c%d%c%d%d\n",a,ch3,b,ch3,m,c);
                 if(b<10&&c>=10)
                      fprintf(fp,"%d%c%d%d%c%d\n",a,ch3,m,b,ch3,c);
                 if(b>=10&&c>=10)
                      fprintf(fp,"%d%c%d%c%d\n",a,ch3,b,ch3,c);
                 break;
             case 5:
                 if(b<10&&c<10)
                      fprintf(fp,"%d%c%d%d%c%d%d\n",a,ch4,m,b,ch4,m,c);
                 if(b>=10&&c<10)
                      fprintf(fp,"%d%c%d%c%d%d\n",a,ch4,b,ch4,m,c);
                 if(b<10&&c>=10)
                      fprintf(fp,"%d%c%d%d%c%d\n",a,ch4,m,b,ch4,c);
                 if(b>=10&&c>=10)
                      fprintf(fp,"%d%c%d%c%d\n",a,ch4,b,ch4,c);
                 break;
             case 6:
                      fprintf(fp,"%d%d%d\n",a,b,c);
                      break;
             case 7:
                      fprintf(fp,"%d%c%d%c%d\n",a,ch1,b,ch1,c);
                      break;
             case 8:
                      fprintf(fp,"%d%c%d%c%d\n",a,ch2,b,ch2,c);
                      break;
             case 9:
                      fprintf(fp,"%d%c%d%c%d\n",a,ch3,b,ch3,c);
                      break;
             case 10:
                      fprintf(fp,"%d%c%d%c%d\n",a,ch4,b,ch4,c);
                      break;
             case 11:
                      fprintf(fp,"%d%c%d%c%d\n",a,ch5,b,ch5,c);
                      break;
             case 12:
                   if(b<10&&c<10)
                      fprintf(fp,"%d%c%d%d%c%d%d\n",a,ch5,m,b,ch5,m,c);
                   if(b>=10&&c<10)
                      fprintf(fp,"%d%c%d%c%d%d\n",a,ch5,b,ch5,m,c);
                   if(b<10&&c>=10)
                      fprintf(fp,"%d%c%d%d%c%d\n",a,ch5,m,b,ch5,c);
                   if(b>=10&&c>=10)
                      fprintf(fp,"%d%c%d%c%d\n",a,ch5,b,ch5,c);
                   break;
       }
      c++;
     if(a==d)
     {
          if(b>=e&&c>f)
             break;
     }
     if(c>31)
     {
          b++;
          c=1;
          if(b>12)
          {
             a++;
             b=1;
          }
       }
    }
    rewind(fp);
    while((ch=fgetc(fp))!=EOF)
    {
       if(ch=='\n')
       lenth++;
    }
    fclose(fp);
    printf("\ndone.\nThe file has %ld hang in %s\n",lenth+1,bb);

}

void a_file(int len,char **line)
{
    FILE *s_fp,*t_fp;
    int i=2;
    int flag=1;
    long int lenth=0;
    long int sum=0;
    char buffer[Max];
    char buffer1[Max];
    char ch;
    char ch1='\n';
   
    if((s_fp=fopen(line,"w+"))==NULL)
    {
        printf("Can't open the file %s.\n",line);
        exit(0);
    }
    if((t_fp=fopen(line[i+1],"a"))==NULL)
    {
        printf("Can't open the file %s.\n",line[i+1]);
        exit(0);
    }
    fseek(t_fp,-1L,2);
    if((ch=fgetc(t_fp))!='\n')
    {
        printf("%c\n",ch);
        fputs("\n",t_fp);
    }
    fclose(t_fp);
   
    if((t_fp=fopen(line[i+1],"r"))==NULL)
    {
        printf("Can't open the file %s.\n",line[i+1]);
        exit(0);
    }
    while(fgets(buffer,512,t_fp)!=NULL)
    {
        fputs(buffer,s_fp);
        ++lenth;
    }
    rewind(s_fp);
    fclose(t_fp);
   
    printf("The file %s has %ld words\n\n",line[i+1],lenth);
    printf("waiting...\n");
    for(i=4;i<len;i++)
    {
        lenth=0;
        if((t_fp=fopen(line,"r"))==NULL)
        {
     printf("Can't open the file %s.\n",line);
            exit(0);
        }
        while(fgets(buffer,512,t_fp)!=NULL)
        {
            ++lenth;
            rewind(s_fp);
            while(fgets(buffer1,512,s_fp)!=NULL)
            {
                  if(!strcmp(buffer,buffer1))
                  {
                       flag=1;
                       break;
                  }
            }
            if(flag==1)
                  flag=0;
            else
                fputs(buffer,s_fp);
         }
         fputs("\n",s_fp);
         fclose(t_fp);
         printf("The file %s has %ld words.\n\n",line,lenth);
         printf("waiting...\n");
     }
     rewind(s_fp);
     
     while(fgets(buffer,512,s_fp)!=NULL)
           ++sum;
     fclose(s_fp);
     printf("The file %s has %ld words.\n\n",line[2],sum);
     printf("done.\n\nGood Luck:)\n");
}

void c_file(int len,char **line)
{
    FILE *s_fp,*t_fp;
    int i=2,j;
    long int  lenth=0,len1,len2,len3=0;
    char buffer[Max];
    char ch;
   
    if((s_fp=fopen(line,"r"))==NULL)
    {
         printf("Can't open the file %s.\n");
         exit(0);
    }
    while((ch=fgetc(s_fp))!=EOF)
         if(ch=='\n')
             lenth++;
    rewind(s_fp);
   
    len1=lenth/(len-3);
    len2=lenth%(len-3);
    for(i=3;i<len;i++)
    {
        if((t_fp=fopen(line,"w+"))==NULL)
        {
             printf("Can't open the file %s.\n",line);
             exit(0);
        }
        for(j=len3;j<len1;j++)
        {
             fgets(buffer,512,s_fp);
             fputs(buffer,t_fp);
        }
     fclose(t_fp);
        printf("finished file %s.\n",line);
        len3=len1;
        if(i==len)
        {
          len1+=len1;
             len1+=len2;
        }
        len1+=len1;
    }
}

void create(char *aa,char *bb,char *cc,char *dd)    /*穷举算法*/
{
    FILE *fp;
    char *a1=aa,*b2=bb,*c2=cc,*d2=dd,ch;
    char a2[MAX],line[MAX],up[MAX];
    int min,max,min1,max1,next,lenth;
    register int i=0,j;
    long lenth1=0;

    min=atoi(c2);
    max=atoi(d2);

    if(min>max)
    {
           printf("argv[3] must <= argv[4].\n");
           exit(0);
    }
   
    if(!strcmp(a1,"-s"))
           strcpy(a,c);
    else if(!strcmp(a1,"-b"))
           strcpy(a,d);
    else if(!strcmp(a1,"-n"))
           strcpy(a,b);
    else if(!strcmp(a1,"-sn"))
           strcpy(a,e);
    else if(!strcmp(a1,"-bn"))
           strcpy(a,h);
    else if(!strcmp(a1,"-sb"))
           strcpy(a,g);
    else if(!strcmp(a1,"-sbn"))
           strcpy(a,f);
    else
    {
           strcpy(a,a1);
    }
    if((fp=fopen(b2,"w+"))==NULL)
    {
           printf("Can't open the file.\n");
           exit(0);
    }
    puts(a);
    lenth=strlen(a);

    while(min<=max)
    {
           for(i=0;i<max;i++)
               up=0;
           next=1;
           while(next)
           {
                for(i=0;i<min;i++)      /*注意密码下标*/
                     line=a[up];
                line='\0';
                fputs(line,fp); fputs("\n",fp);
                for(j=min-1;j>=0;j--)
                {
                     up[j]++;           /*下标进位,穷举算法的关键*/
                           if(up[j]!=lenth)
                         break;
                     else
                     {
                         up[j]=0;
                         if(j==0)  next=0;
                     }
                }
          }
          min++;
    }
     rewind(fp);
     while((ch=fgetc(fp))!=EOF)
     {
           if(ch=='\n')
           ++lenth1;
     }
     fclose(fp);
     printf("\n");
     printf("Done.\nThe file has %ld hang in %s.\n",lenth1,bb);
}

void adle(char *aa,char *b,char *c,char *d)    /*文件每行前或后增加特定的字符串*/
{
        FILE *fp,*fp1;
        char *aaa=aa,*bb=b,*cc=c,*dd=d;
        char line1[600];
        int len,i;
        
        if((fp=fopen(cc,"r"))==NULL)
        {
             printf("Can't open the file %s\n",cc);
             exit(0);
        }
        if((fp1=fopen(dd,"w+"))==NULL)
        {
             printf("Can't open the file %s\n",dd);
             exit(0);
        }
        
        while(fgets(line1,512,fp)!=NULL)
        {
             if(!strcmp(aaa,"-a"))
             {
                  fputs(bb,fp1);
                  fputs(line1,fp1);
             }
             if(!strcmp(aaa,"-c"))
             {
                  len=strlen(line1);
                  for(i=0;i<(len-1);i++)
                      fputc(line1,fp1);
                  fputs(bb,fp1);
                  fputs("\n",fp1);
             }
       }
       fclose(fp1);
       fclose(fp);
       printf("done.\n");

}

void acle(char *aa,char *c,char *d,char *e)   /*文件的每行的前或后删除特定的字符串*/
{
        FILE *fp,*fp1;
        char line1[600];
        char *aaa=aa,*cc=c,*dd=d,*ee=e;
        int len,len1,i;
        
        len=strlen(cc);
        if((fp=fopen(dd,"r"))==NULL)
        {
              printf("Can't open the file %s\n",dd);
              exit(0);
        }
        if((fp1=fopen(ee,"w+"))==NULL)
        {
              printf("Can't open the file %s\n",ee);
              exit(0);
        }
        
        while(fgets(line1,512,fp)!=NULL)
        {
              len1=strlen(line1);
              if(!strcmp(aaa,"-a"))
              {
                  for(i=len;i<len1;i++)
                      fputc(line1,fp1);
              }
              if(!strcmp(aaa,"-b"))
              {
                  for(i=0;i<(len1-len-1);i++)
                      fputc(line1,fp1);
                  fputs("\n",fp1);
              }
       }
       fclose(fp);
       fclose(fp1);
       printf("done.\n");

}

void turn(char *aa,char *b)     /*将每行的密码倒转*/
{
       FILE *fp,*fp1;
       char line1[600];
       char *aaa=aa,*bb=b;
       int i,len;
       if((fp=fopen(aaa,"r"))==NULL)
       {
            printf("Can't open the file %s\n",aaa);
            exit(0);
       }
       if((fp1=fopen(bb,"w+"))==NULL)
       {
            printf("Can't open the file %s\n",bb);
            exit(0);
       }
       while(fgets(line1,512,fp)!=NULL)
       {
            len=strlen(line1);
                for(i=len-2;i>=0;i--)
            fputc(line1,fp1);
            fputs("\n",fp1);
       }
       fclose(fp);
       fclose(fp1);
       printf("done.\n");

}

void cut(char *aa,char *b,char *c,char *d)    /*保留文件每行中特定字符前面的字符串*/
{
      FILE *fp,*fp1;
      char line[600],ch;
      char *aaa=aa,*bb=b,*cc=c,*dd=d;
      int i,count=0,count1;
      if((fp=fopen(cc,"r"))==NULL)
      {
               printf("Can't open the file %s\n",cc);
            exit(0);
      }
      if((fp1=fopen(dd,"w+"))==NULL)
      {
              printf("Can't open the file %s\n",dd);
              exit(0);
      }
      count1=atoi(bb);           /*将字符转换成数字*/
           printf("%d\n",count1);
      while(fgets(line,512,fp)!=NULL)
        {
           count=0;
           for(i=0;i<strlen(line);i++)
           {
                      if(line==aaa[0])
                      {

                         count++;
                        }
           }
           if(count>=count1)
           {
                 printf("check...\n");
                  count=0;
                  for(i=0;i<strlen(line);i++)
                     {
                           if(line==aaa[0])
                                 count++;
                           if(count==count1)
                                 break;
                 fputc(line,fp1);
             }
             fputs("\n",fp1);
           }

        }
        fclose(fp);
        fclose(fp1);
        printf("done.\n");
}

void grep(char *aa,char *b,char *c)   /*保留每行中特定的字符串*/
{
        FILE *fp,*fp1;
        char line[600];
        char *aaa=aa,*bb=b,*cc=c;
        if((fp=fopen(bb,"r"))==NULL)
        {
            printf("Can't open the file %s\n",bb);
            exit(0);
        }
        if((fp1=fopen(cc,"w+"))==NULL)
        {
            printf("Can't open the file %s\n",cc);
            exit(0);
        }
        while(fgets(line,512,fp)!=NULL)
        {
            if(strstr(line,aaa)!=NULL)       /*比较要保留的字符串*/
                 fputs(line,fp1);
        }
        fclose(fp);
        fclose(fp1);
        printf("done.\n");
}

void txt2dic(char *aa,char *b,char *c,char *d)  /*过滤特定的字符*/
{
         FILE *fp1,*fp2;
         long int count=0,lenth=0;
         int i,flag=0;
         char a[Max],ch;
         char *aaa=aa,*bb=b,*cc=c,*dd=d;
         if((fp1=fopen(cc,"r"))==NULL)
         {
              printf("Can't open the file %s\n",cc);
              exit(1);
         }
         if((fp2=fopen(dd,"w+"))==NULL)
         {
              printf("Can't create the file %s.\n",dd);
              exit(1);
         }
        while((ch=fgetc(fp1))!=EOF)
        {
                 for(i=0;i<strlen(bb);i++)     /*开始过滤特定的字符*/
                 {
                      if(bb==ch)
                      {
                          flag=1;
                          break;
                      }
                 }
                 if(flag==1)
                 {
                      flag=0;
                      continue;
                 }
                 else
                 {
                   if(!strcmp(aaa,"-b"))       /*转换成大写字母*/
                   {
                             if(ch>='a'&&ch<='z')
                             {
                                    ch-=32;
                                    fputc(ch,fp2);
                                    ++count;
                             }
                             else if(ch=='\n')
                                    fputc('\n',fp2);
                             else
                             {
                                    fputc(ch,fp2);
                                    ++count;
                             }
                      }
                      if(!strcmp(aaa,"-s"))         /*转换成小写字母*/
                      {
                              if(ch>='A'&&ch<='Z')
                              {
                                      ch+=32;
                                     fputc(ch,fp2);
                                     ++count;
                              }
                              else if(ch=='\n')
                                      fputc('\n',fp2);
                           else
                              {
                                      fputc(ch,fp2);
                                      ++count;
                         }
                   }
             }
         }
         rewind(fp2);
         while((ch=fgetc(fp2))!=EOF)      /*计算密码个数*/
         {
                  if(ch=='\n')
                     ++lenth;
         }
         fclose(fp1);
         fclose(fp2);
         printf("\nThe dic has %ld hang\n",lenth);
         printf("Done.Good Luck:)\n");
}

void defi(char *a,char *b,char *c,char *d)
{
    FILE *fp,*fp1;
    char *a1=a,*b1=b;
    char *c1=c,*d1=d;
    char ch;
    char ch1='\n';
    char line[M];
    char line1[M];
    char line2[M];
   
    if((fp=fopen(c1,"a+"))==NULL)
    {
        printf("Can't open the file %s.\n",c1);
        exit(0);
    }
    fseek(fp,0L,2);
    if((ch=fgetc(fp))=='\n')
    {
        fclose(fp);
    }
    else
    {
        fputc(ch1,fp);
        fclose(fp);
    }
    if((fp=fopen(c1,"r"))==NULL)
    {
        printf("Can't open the file %s.\n",c1);
        exit(0);
    }
    if((fp1=fopen(d1,"w+"))==NULL)
    {
        printf("Can't open the file %s.\n",d1);
        exit(0);
    }
    while(fgets(line,512,fp)!=NULL)
    {
        if(strstr(line,a1)!=NULL)
        {
            find(line,a1,b1);
            fputs(line,fp1);
        }
        else
            fputs(line,fp1);
    }
    fclose(fp);
    fclose(fp1);
    printf("done.\n");
}

void find(char *a,char *b,char *c)
{
    char *sp=a,*cp=b,*p=c;
    char temp;
    char tp[M];
    char *p1=tp;
    int i=0,l=0;
    int j,k;
    int len;
   
    while(*sp)
    {
        j=0;
        temp=*(sp+i+j);
        while(*cp&&(temp==*(cp+j)))
        {
            temp=*(sp+i+ ++j);
        }
        if(*(cp+j)=='\0')
        {
            printf("%s,%d\n","found",i);
            /*#define m 8*/
            /*printf("%d\n",m);*/
            k=i;
            len=k+strlen(cp);
            l=0;
            while(len<strlen(sp))
            {
                *(p1+l)=*(sp+len);
                l++;
                len++;
            }
            *(p1+l)='\0';
            l=0;
            while(l<strlen(p))
            {
                *(sp+k)=*(p+l);
                k++;
                l++;
            }
            l=0;
            while(l<strlen(p1))
            {
                *(sp+k)=*(p1+l);
                k++;
                l++;
            }
            *(sp+k)='\0';
            break;
        }
        i++;
    }
}

void help(void)
{
         printf("\n\t                   SdiC <Protype 2.3>\n\n");
         printf("    Written by W.Z.T  <Don't be lazy,Just go ahead>  http://tthacker.hackvip.cn\n\n");
         printf("hackdic.exe -m c:\\pass.dic 130 137 78511315 78511319\n");
         printf("            -t c:\\pass.dic 813 3935248 3932559\n");
         printf("                           1476 8442132 8442159\n");
         printf("            -b <h> c:\\pass.dic 1985 1 2 1989 1 2 1\n");
         printf("                                  85 1 2 89 1 12 1\n");
         printf("            -d -s c:\\pass.txt 3 5\n");
         printf("               -b c:\\pass.txt 3 5\n");
         printf("               -n c:\\pass.txt 3 5\n");
         printf("               -sn c:\\pass.txt 3 5\n");
         printf("               -bn c:\\pass.txt 3 5\n");
         printf("               -sbn c:\\pass.txt 3 5\n");
         printf("               -sb c:\\pass.txt 3 5\n");
         printf("               -a c:\\pass.txt 3 5 75 99\n");
         printf("               ~!@#$% c:\\pass.txt 3 5\n");
         printf("            -a a.txt 1.txt 2.txt 3.txt.....\n");
         printf("            -c c.txt 1.txt 2.txt 3.txt.....\n");
         printf("            -ac -a sgl 1.txt 2.txt.\n");
         printf("                -c sgl 1.txt 2.txt.\n");
         printf("            -ca -a sgl 1.txt 2.txt.\n");
         printf("                -b sgl 1.txt 2.txt.\n");
         printf("            -u 1.txt 2.txt.\n");
         printf("            -g wangzhitong 1.txt 2.txt\n");
         printf("            -cc \";\" 2 1.txt 2.txt\n");
         printf("            -tt -b wangzhitong 1.txt 2.txt\n");
         printf("                -s wangzhitong 1.txt 2.txt\n");
         printf("            -v tthacker wangzhitong 1.txt 2.txt\n");
         printf("\n[optin--a]: -a add file and leave the different words.\n");
         printf("            -c cut file you want.\n");
         printf("            -ac -a add letters to file in the head.\n");
         printf("                -C add letters to file at the end.\n");
         printf("            -ca -a Cut letters from the head.\n");
         printf("                -b Cut letters from the end.\n");
         printf("            -u turn back.\n");
         printf("            -g leave the letters from the text.\n");
         printf("            -cc \n");
         printf("            -tt -b change into big letters.\n");
         printf("                -s change into small letters.\n");
         printf("\n[optin--b]: h=1,19850102\th=2,1985//0//02\n");
         printf("            h=3,1985:01:02\th=4,1985.01.02\n");
         printf("            h=5,1985-01-02\th=6,198512\n");
         printf("            h=7,1985//1//2\th=8,1985:1:2\n");
         printf("            h=9,1985.1.2\th=10,1985-1-2\n");
         printf("            h=11,1985\\1\\2\th=12,1985\\01\\02\n");
         exit(0);
}

[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课

收藏
免费 0
支持
分享
最新回复 (6)
雪    币: 229
活跃值: (70)
能力值: ( LV6,RANK:90 )
在线值:
发帖
回帖
粉丝
2
强悍!! 收藏!!
2005-10-19 18:48
0
雪    币: 214
活跃值: (70)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
3
先收藏,有空再搞下。。
2005-10-19 19:57
0
雪    币: 61
活跃值: (160)
能力值: ( LV9,RANK:170 )
在线值:
发帖
回帖
粉丝
4
来晚了,支持!
2005-10-22 12:16
0
雪    币: 200
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
5
略看了一下,没有考虑特殊符号是不是有点美中不足阿
2005-11-4 10:52
0
雪    币: 236
活跃值: (46)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
6
找了很久了。
谢谢。
2005-11-28 21:58
0
雪    币: 603
活跃值: (617)
能力值: ( LV12,RANK:660 )
在线值:
发帖
回帖
粉丝
7
叫C源码更合适。
2005-11-29 08:53
0
游客
登录 | 注册 方可回帖
返回
//