Advertisement
nuit

Wordlist Generator

Aug 15th, 2011
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.61 KB | None | 0 0
  1. #include <fstream>
  2. #include <iostream>
  3. #include <cmath>
  4. #include <ctime>
  5. #include <string.h>
  6. #include <stdlib.h>
  7.  
  8. using namespace std;
  9. int long s,l,minimum,maximum,flag;
  10. int D[255];
  11. char chr;
  12. string cycle,passphrase;
  13.  
  14.  
  15. int main(int argc, char *argv[])
  16. {
  17.     cycle = "";
  18.     flag = 0;
  19.     minimum = maximum = 8;
  20.  
  21.     ofstream fout;
  22.  
  23.     for(int i=1; i<argc; i++) {
  24.         if (strncmp(argv[i],"-m",2)==0) minimum = atoi(argv[i+1]);
  25.         if (strncmp(argv[i],"-n",2)==0) maximum = atoi(argv[i+1]);
  26.         if (strncmp(argv[i],"-l",2)==0) cycle = cycle + "abcdefghijklmnopqrstuvwxyz";
  27.         if (strncmp(argv[i],"-u",2)==0) cycle = cycle + "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  28.         if (strncmp(argv[i],"-d",2)==0) cycle = cycle + "0123456789";
  29.         if (strncmp(argv[i],"-p",2)==0) {
  30.             cycle = cycle + "_@#$&+-=%*^`~'!?.,:;()<>[]{}/|";
  31.             chr=92;
  32.             cycle = cycle + chr;
  33.             chr=34;
  34.             cycle = cycle + chr;
  35.         }
  36.         if (strncmp(argv[i],"-s",2)==0) cycle = cycle + " ";
  37.         if (strncmp(argv[i],"-c",2)==0) cycle = cycle + argv[i+1];
  38.         if (strncmp(argv[i],"-o",2)==0) {
  39.             fout.open(argv[i+1]);
  40.             flag = 1;
  41.         }
  42.         if (strncmp(argv[i],"-h",2)==0) {
  43.             cout << "Bruteforce Permutation Generator by nuit \n";
  44.             cout << "Usage: permutate [options] -o [path] \n";
  45.             cout << "Options: \n";
  46.             cout << "   -m : minimum string output length [default is 8] \n";
  47.             cout << "   -n : maximum string output length \n";
  48.             cout << "   -l : permutate using Lower Case letters [default] \n";
  49.             cout << "   -u : permutate using Upper Case letters \n";
  50.             cout << "   -d : permutate using Digits [0 - 9] \n";
  51.             cout << "   -p : permutate using Special characters [!@#$%^&* ...] \n";
  52.             cout << "   -s : permutate using Space character \n";
  53.             cout << "   -c [string]: permutate using custom string entry \n";
  54.             cout << "   -h : this screen \n";
  55.             exit(0);
  56.         }
  57.     }
  58.  
  59.     if (maximum < minimum) maximum = minimum;
  60.  
  61.     l = cycle.length();
  62.     if (l<1) {
  63.         cycle="abcdefghijklmnopqrstuvwxyz";
  64.         l = 26;
  65.     }
  66.     l=l-1;
  67.  
  68.     for(int i=0;i<=l;i++) D[cycle[i]]=i;
  69.  
  70.     minimum = minimum - 1;
  71.     maximum = maximum - 1;
  72.  
  73.     for(int size=minimum;size<=maximum;size++) {
  74.         passphrase = "";
  75.         for(int i=0;i<=size;i++) {
  76.             passphrase = passphrase + cycle[0];
  77.         }
  78.  
  79.         for(int j=1;j<=pow(double(l+1),size+1);j++) {
  80.             for(int i=0;i<=size;i++) {
  81.                 if (passphrase[size-i]==(cycle[l+1])) {
  82.                     passphrase[size-i]=cycle[0];
  83.                     passphrase[size-1-i] = cycle[D[passphrase[size-1-i]]+1];
  84.                 }
  85.             }
  86.             cout << passphrase << endl;
  87.             if (flag==1) {
  88.                 fout << passphrase << endl;
  89.             }
  90.             passphrase[size] = cycle[D[passphrase[size]]+1];
  91.         }
  92.     }
  93.  
  94.     if (flag==1) fout.close();
  95.  
  96.     return 0;
  97. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement