#include void DefineChars(char *, char *); void DefineAppends(char *); void DefineStrings(char [][7]); void Help(void); double setFilesize(void); void printsettings(char *,char *,double, char [][7],char *); FILE *passwords; FILE *wordlist; FILE *deleteF; FILE *a8Chars; int main(void){ char inputFile[17]; char originalFile[17]; char deleteFile[17]; char outputFile[17]="tmpA.txt"; char outputFileName[30]; char mangleReplacements[]="1234567890"; char mangleReplacers[]="izeasbtbgo"; char Appendchars[]="!#@,./?[]{}~:*&^%$£"; char InputWord[64]; char tmpWord[64]; char tmpWord2[64]; char OutputWord[64]; int wordLoop=0; int manglex=0; int size,choice; int x=65; int appendx=0; int RepCharSize; int run=0,outFileLength; int AppCharSize,sApp; char AppendString[4][7]={{"2009"},{"2008"},{"09"},{"08"}}; double FSizeRun=0,FSize=2000000000; char FileNumChar1='1',FileNumChar2='0'; /*Additions to be made: Capitalise first letter? make all caps make all lower lowercase 1st letter */ while(run==0){ system("cls"); printf("\nToms Word Mangler v3.4\n=======================\n"); printf("\n\n1. Run mangler\n"); printf("2. Choose replacement characters\n"); printf("3. Choose character additions and prepends\n"); printf("4. Define string additions\n"); printf("5. Set max file size\n"); printf("6. View currents settings\n"); printf("7. Help Guide\n"); printf("8. Exit"); printf("\n\nPlease make a selection: "); fflush(stdin); scanf("%d", &choice); switch(choice){ case 1: run=1; break; case 2:DefineChars(mangleReplacers, mangleReplacements); break; case 3:DefineAppends(Appendchars); break; case 4:DefineStrings(AppendString); break; case 5:FSize = setFilesize(); break; case 6:printsettings(mangleReplacements,mangleReplacers,FSize,AppendString,Appendchars); break; case 7:Help(); break; case 8:exit(1); break; } } system("cls"); printf("\nToms Word Mangler v3.4\n=======================\n"); printf("\n\nPlease enter the input filename: "); scanf("%s",&inputFile); printf("\n\nPlease enter the output filename: "); scanf("%s",&outputFileName); strcpy(originalFile, inputFile); outFileLength = (strlen(outputFileName)-1); outputFileName[outFileLength+3]='\0'; outputFileName[outFileLength+2]='t'; outputFileName[outFileLength+1]='x'; outputFileName[outFileLength]='t'; outputFileName[outFileLength-1]='.'; outputFileName[outFileLength-2]=FileNumChar1; //rename the new output file with a 1 at the end outputFileName[outFileLength-3]=FileNumChar2; //rename the new output file with a 0 at the end printf("\n\nPassword list %s is being created. Please be patient...\n\n",outputFileName); //loop for each append char if((passwords = fopen(outputFile, "w+"))==NULL) //Open tmp file 1 { printf("\n\nError Creating TXT file\n\n"); } if((wordlist = fopen(inputFile, "r"))==NULL) //Open wordlist { printf("\n\nError reading wordlist\n\n"); } //need to loop for as long as a word is available in file AppCharSize = (strlen(Appendchars)); //Check how many replacement characters there are while(fgets(InputWord, 64, wordlist)!=NULL){ //read in a word if (InputWord != NULL) { size = (strlen(InputWord) - 1); if (InputWord[size] == '\n') InputWord[size] = '\0'; //Set the terminating character } strcpy(tmpWord,InputWord); //Copy the input word to a tmp array fprintf(passwords,"%s\n",InputWord);//write word out to tmp file } for(appendx=0;appendx7){ fprintf(a8Chars,"%s\n",InputWord); FSizeRun+=size; FSizeRun+=2; if(FSizeRun>(FSize-10)){ //When output file size reaches just less than the user input FSizeRun=0; fclose(a8Chars); //close the output file FileNumChar1++; outputFileName[outFileLength-2]=FileNumChar1; //rename the new output file with a 1 at the end outputFileName[outFileLength-3]=FileNumChar2; //rename the new output file with a 0 at the end if(FileNumChar1=58){ FileNumChar2++; FileNumChar1=48; } if((a8Chars = fopen(outputFileName, "w+"))==NULL) //Open new file { printf("\n\nError creating final wordlist file\n\n"); } } } } fclose(a8Chars); fclose(wordlist); remove(inputFile); printf("\nComplete!\n\n"); system("pause"); } void DefineChars(char *replacements, char *replacers){ int x=0; char choice='Y'; system("cls"); printf("\nToms Word Mangler v3.4\n=======================\n"); printf("\nMax of 10 replacements\n"); while((choice=='Y'||choice=='y')&&x<10){ printf("\nChar to replace: "); fflush(stdin); scanf("%c",&replacements[x]); printf("Replace with: "); fflush(stdin); scanf("%c",&replacers[x]); x++; printf("\nWould you like to enter another? Y/N: "); fflush(stdin); scanf("%c",&choice); } replacements[x]='\0'; replacers[x]='\0'; system("cls"); printf("\nToms Word Mangler v3.4\n=======================\n"); printf("\n\nReplace: %s, with %s\n\n", replacements, replacers); system("pause"); } void DefineAppends(char *AppendChars){ int x=0; char choice='Y'; system("cls"); printf("\nToms Word Mangler v3.4\n=======================\n"); printf("\nMax 19 appendages\n"); while((choice=='Y'||choice=='y')&&x<19){ printf("\nChar to append/prepend: "); fflush(stdin); scanf("%c",&AppendChars[x]); x++; printf("\nWould you like to enter another? Y/N: "); fflush(stdin); scanf("%c",&choice); } AppendChars[x]='\0'; system("cls"); printf("\nToms Word Mangler v3.4\n=======================\n"); printf("\n\nAppend and Prepend %s\n\n", AppendChars); system("pause"); } void DefineStrings(char Appendstring[][7]){ int x=0; int stringLength; system("cls"); printf("\nToms Word Mangler v3.4\n=======================\n"); printf("\nMax 4 strings of 6 chars, press enter for none\n"); while(x<4){ printf("\nString %d: ",x+1); fflush(stdin); gets(Appendstring[x]); stringLength = strlen(Appendstring[x]); x++; } system("cls"); printf("\nToms Word Mangler v3.4\n=======================\n"); printf("\n\nAppend strings %s, %s, %s, %s\n\n", &Appendstring[0][0],&Appendstring[1][0],&Appendstring[2][0],&Appendstring[3][0]); system("pause"); } void Help(void){ system("cls"); printf("\nToms Word Mangler v3.4\n=======================\n"); printf("\n\nHelp.... coming soon!\n"); system("pause"); } double setFilesize(void){ double fileSize=0; while(fileSize<1){ system("cls"); printf("\nToms Word Mangler v3.4\n=======================\n"); printf("\nThe final dictionary will be split into chunks as defined here\n"); printf("\nPlease enter the size (in whole GB):"); scanf("%lf",&fileSize); } printf("\nFiles of %.0fGB will be created\n\n",fileSize); fileSize=fileSize*1000000000; system("pause"); return(fileSize); } void printsettings(char *replacers,char *toReplace,double fileSize, char appendStrings[][7],char *appendChars) { system("cls"); printf("\nToms Word Mangler v3.4\n=======================\n"); printf("\nCurrent Settings:\n----------------\n"); printf("\nTo be replaced: %s\n",toReplace); printf("With : %s\n",replacers); printf("\nMax File Size: %.0fGB\n",(fileSize/1000000000)); printf("\nStrings to append: %s, %s, %s, %s\n",&appendStrings[0][0],&appendStrings[1][0],&appendStrings[2][0],&appendStrings[3][0]); printf("\nCharacters to append and prepend: %s\n\n",appendChars); system("pause"); }