Jump to content

K1u's Wordlist Generator


K1u
 Share

Recommended Posts

Extremely simple program.

Nothing special, but I needed to create this for personal use, recovering my PW's etc...

Most passwords are not phrases now adays, but random Capital, Lowercase letters, along side numbers and symbols.

Source:

#include <iostream>
#include <cstdlib>
#include <fstream>

/*
K1u's Wordlist Generator
Author: K1u.
Site: k0h.org.
Description: Creates user defined wordlist.
Disclaimer: I am not responsible for any damages this program my create.
I am not responsible for how you use this program.
*/

using namespace std;

int main(void)
{
   int timesPrint;
   int pwLen;
   
   /* Seed the RG. */
   srand(time(NULL));
   
   /* Characters to be randomized. */
   char randPw[256] = { 0 };
   
   /* Location of file, app flag to append to end of file, so files
   are not overwritten on multiple goes. */
   ofstream putout0 ("C:DEFINEPATHWORDLISTFTW.txt", ios::app);
     
   cout << "Welcome to K1u's wordlist generator Cheesy"
   << "nn"
   << "Please enter lines of passwords you would like.n";
     
   cin >> timesPrint;
   
   cout << "nWhat would you like randomized?n"
   << "Example: 1234567890n";
   
   cin >> randPw;
   
   cout << "nHow long would you like each password to be?n";
   
   cin >> pwLen;
   
   /* Program will crash if string length not shown to RG. */
   char pwRand = strlen(randPw);
   for(int i = 0; i < timesPrint; i++)
   {
           for(int i = 0; i < pwLen; i++)
           {
           putout0 << (randPw[rand() % pwRand]);
           }
   putout0 << "n";
   }
   
   system("PAUSE");
   return 0;
}

Here is the EXE if you wish for it, http://www.wikifortio.com/518829/K1us%20Wo...20Generator.rar

Currently set the TXT to output to the root of the C: drive. I need to allow users to define path to put at lol :D

Please suggest ways of improving this, ideas, etc..

Link to comment
Share on other sites

by just glancing over the code, a random string generator.

Two things i noticed immediately, "C:DEFINEPATHWORDLISTFTW.txt"  should be changed to just "WORDLISTFTW.txt", so it writes out the file to wherever the actual binary is ran. This stops the user having to edit the actual source and compile it themselfs to work correctly on their own machine. The fact that you have an OS specific directory hard coded into it straight away removes any portability.

An even better way is asking for user input to what directory it is stored in.

The other thing i noticed was  system("PAUSE"); near the end of your program.

Not only is this OS specific also and will only then run on a windows machine, its unnecessary and not very light on the resources. You should never call an OS command unless its really needed and if there is no other way around it. Instead just make your app ask for user input, any input, then after that do nothing, "return 0;". Thats the exact same thing without the need to go outside your own program. cin.get(); for example.

As far as i can see without a system call you can now also remove cstdlib from your headers.

I hope this was some help.

edit: forget the statement about removing cstdlib, you'll need that for rand();

Link to comment
Share on other sites

by just glancing over the code, a random string generator.

Two things i noticed immediately, "C:DEFINEPATHWORDLISTFTW.txt"  should be changed to just "WORDLISTFTW.txt", so it writes out the file to wherever the actual binary is ran. This stops the user having to edit the actual source and compile it themselfs to work correctly on their own machine. The fact that you have an OS specific directory hard coded into it straight away removes any portability.

An even better way is asking for user input to what directory it is stored in.

The other thing i noticed was  system("PAUSE"); near the end of your program.

Not only is this OS specific also and will only then run on a windows machine, its unnecessary and not very light on the resources. You should never call an OS command unless its really needed and if there is no other way around it. Instead just make your app ask for user input, any input, then after that do nothing, "return 0;". Thats the exact same thing without the need to go outside your own program. cin.get(); for example.

As far as i can see without a system call you can now also remove cstdlib from your headers.

I hope this was some help.

edit: forget the statement about removing cstdlib, you'll need that for rand();

#include <iostream>
#include <cstdlib>
#include <fstream>

/*
K1u's Wordlist Generator
Author: K1u.
Site: k0h.org.
Description: Creates user defined wordlist.
Disclaimer: I am not responsible for any damages this program my create.
I am not responsible for how you use this program.
*/

using namespace std;

int main(void)
{
   int timesPrint;
   int pwLen;
   
   /* Seed the RG. */
   srand(time(NULL));
   
   /* Characters to be randomized. */
   char randPw[256] = { 0 };
   
   /* Location of file, app flag to append to end of file, so files
   are not overwritten on multiple goes. */
   ofstream putout0 ("C:hay.txt", ios::app);
     
   cout << "Welcome to K1u's wordlist generator"
   << "nn"
   << "Please enter lines of passwords you would like.n";
     
   cin >> timesPrint;
   
   cout << "nWhat would you like randomized?n"
   << "Example: 1234567890n";
   
   cin.getline(randPw, 255);
   
   cout << "nHow long would you like each password to be?n";
   
   cin >> pwLen;
   
   /* Program will crash if string length not shown to RG. */
   char pwRand = strlen(randPw);
   for(int i = 0; i < timesPrint; i++)
   {
           for(int i = 0; i < pwLen; i++)
           {
           putout0 << (randPw[rand() % pwRand]);
           }
   putout0 << "n";
   }
   
   getchar();
   return 0;
}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...