Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <iostream>
- #include <cmath>
- #include <ctime>
- #include <string.h>
- #include <stdlib.h>
- using namespace std;
- int long s,l,minimum,maximum,flag;
- int D[255];
- char chr;
- string cycle,passphrase;
- int main(int argc, char *argv[])
- {
- cycle = "";
- flag = 0;
- minimum = maximum = 8;
- ofstream fout;
- for(int i=1; i<argc; i++) {
- if (strncmp(argv[i],"-m",2)==0) minimum = atoi(argv[i+1]);
- if (strncmp(argv[i],"-n",2)==0) maximum = atoi(argv[i+1]);
- if (strncmp(argv[i],"-l",2)==0) cycle = cycle + "abcdefghijklmnopqrstuvwxyz";
- if (strncmp(argv[i],"-u",2)==0) cycle = cycle + "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
- if (strncmp(argv[i],"-d",2)==0) cycle = cycle + "0123456789";
- if (strncmp(argv[i],"-p",2)==0) {
- cycle = cycle + "_@#$&+-=%*^`~'!?.,:;()<>[]{}/|";
- chr=92;
- cycle = cycle + chr;
- chr=34;
- cycle = cycle + chr;
- }
- if (strncmp(argv[i],"-s",2)==0) cycle = cycle + " ";
- if (strncmp(argv[i],"-c",2)==0) cycle = cycle + argv[i+1];
- if (strncmp(argv[i],"-o",2)==0) {
- fout.open(argv[i+1]);
- flag = 1;
- }
- if (strncmp(argv[i],"-h",2)==0) {
- cout << "Bruteforce Permutation Generator by nuit \n";
- cout << "Usage: permutate [options] -o [path] \n";
- cout << "Options: \n";
- cout << " -m : minimum string output length [default is 8] \n";
- cout << " -n : maximum string output length \n";
- cout << " -l : permutate using Lower Case letters [default] \n";
- cout << " -u : permutate using Upper Case letters \n";
- cout << " -d : permutate using Digits [0 - 9] \n";
- cout << " -p : permutate using Special characters [!@#$%^&* ...] \n";
- cout << " -s : permutate using Space character \n";
- cout << " -c [string]: permutate using custom string entry \n";
- cout << " -h : this screen \n";
- exit(0);
- }
- }
- if (maximum < minimum) maximum = minimum;
- l = cycle.length();
- if (l<1) {
- cycle="abcdefghijklmnopqrstuvwxyz";
- l = 26;
- }
- l=l-1;
- for(int i=0;i<=l;i++) D[cycle[i]]=i;
- minimum = minimum - 1;
- maximum = maximum - 1;
- for(int size=minimum;size<=maximum;size++) {
- passphrase = "";
- for(int i=0;i<=size;i++) {
- passphrase = passphrase + cycle[0];
- }
- for(int j=1;j<=pow(double(l+1),size+1);j++) {
- for(int i=0;i<=size;i++) {
- if (passphrase[size-i]==(cycle[l+1])) {
- passphrase[size-i]=cycle[0];
- passphrase[size-1-i] = cycle[D[passphrase[size-1-i]]+1];
- }
- }
- cout << passphrase << endl;
- if (flag==1) {
- fout << passphrase << endl;
- }
- passphrase[size] = cycle[D[passphrase[size]]+1];
- }
- }
- if (flag==1) fout.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement