I want to generate a list of passwords of a cretain length passwords from a packet FILE. The packet file means a .txt FILE which contains more than 1M passwords of certain lengths. I want to store password of DIFFERENT length in a various .txt FILES
/*this code is used to generate a packet for dictionary attacks which conatins the passwords of certain length */
#include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
#define MAX 50
void FileString(char *,int);
void createFile(ofstream &,ifstream &,char *,char *,int);
int main() {
ofstream outputfile;
ifstream intputfile;
int len1,len2;
char filename[MAX],p_file[MAX];
cout<<"Enter your packet file : "; cin>>p_file;
cout<<"Enter your range to obtained passwords for dictionary attacks...."<<endl<<endl;
cout<<"Enter length-1 : "; cin>>len1;
cout<<"Enter length-2 : "; cin>>len2;
cout<<"Total "<<len2-len1<<" files will generated "<<endl;
while(len1>len2)
{
FileString(filename,len1);
createFile(outputfile,intputfile,filename,p_file,len1);
len1++;
}
system("pause");
return 0;
}
void FileString(char *FILE,int f)
{
char name[MAX] = {"-length-pass.txt"};
char temp[MAX];
sprintf(temp,"%d",f);
strcat(temp,name);
strcpy(FILE,temp); //it created the .txt file strings
}
void createFile(ofstream &outfile,ifstream &infile,char *FILE,char *packet,int f)
{
char data[MAX];
outfile.open(FILE,ios::out);
infile.open(packet,ios::in);
if(outfile.is_open()&&infile.is_open())
{
while(!infile.eof())
{
infile>>data;
if(strlen(data)==f)
outfile<<data<<endl;
}
} else {
cout<<"Data is failed to written in a File "<<endl;
}
}
This a function it takes data and show nothing FILES to me