Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: password generator ... all combinations

  1. #11
    Senior Member shamanvirtuel's Avatar
    Join Date
    Mar 2010
    Location
    Somewhere in the "Ex" human right country
    Posts
    2,988

    Default

    why code AGAIN something that works really good and that is included in BT ? i mean there's crunch , and after you can use john to multiply your wordlist ....
    Watch your back, your packetz will belong to me soon... xD

    BackTrack :
    Giving Machine Guns to Monkeys since 2006

  2. #12
    Just burned his ISO luckyr13's Avatar
    Join Date
    Jan 2008
    Posts
    16

    Smile sorry to be late

    Hi... im just want to respond to a few comments...

    for thorin:
    1) Instead of using 6 fuctions that all do the same thing why not use one and pass it a length? ie: gen(1) or gen(6) depending on the input from the user.
    well... i check the code and actually i didnt find how to make less code... maybe we can put all in one function but i guess thats the same that if we have 6 or more functions...

    [QUOTE]2) For single chars why bother with the array? You just end up
    wasting memory when you could just output single chars.
    youre right...

    4) Consider your 2 char code (and this applies all the way up). You end up with a 2x10 array (as the code is commented/posted here). Since you end up outputting the array as single characters anyway why not just store them as single characters to begin with or even better simply use your counter values? ie: Since you only care about output and not storage/reuse you could just simply use your counter variables and not store the values at all. i.e.: printf("%c%c\n", i, j);
    lol... yes, youre right


    for hhmatt81:
    Just a little constructive criticism, I think the code could be written differently but I'm unsure how it's done. Recursive perhaps? It would take some of the redundant code out and make it a lot shorter and a lot cleaner. I know I've seen similar programs written in a different way that did the exact same thing I just forget how its done.
    well... i didnt find a solution of how to make the code recursive... maybe i need a little help because i think that im missing something... actually if you insert a string as a parameter in a function you can use an array and make all possible combinations of that string... but i didnt find how to make it works for my code...

    for bhups:
    Hi, I am VERY interested in this application.

    From what i understand, this applications goes through all combinations from A, B, C, D all the way to ZZZZZZZZ in caps, nocaps and with charectors and numbers...

    this is correct?
    something like that... anyway i will post the base code to the end of this ... and maybe you can make it works for your own necesity... any comment im to your service...

    the code goes through all the combinations that you define in the static variables called MIN and MAX... also i suggest a few ranges... you should made the calculation to know how many words you will have with a combination.

    Something like:
    n=number of the range of values (if you need all the combination for the numbers 0 to 9... n=10)
    c=number of the long of the word (the string, if u need all the combinations for 4 characters... like 0000, 0001, 0002.... c=4)

    n^c = number of combinations that you will have

    for shamanvirtuel:
    why code AGAIN something that works really good and that is included in BT ? i mean there's crunch , and after you can use john to multiply your wordlist ....
    well... maybe just because i want to check the algorithm behind the idea of a password generator... i guess that are better codes or tools than my code... but if someone doesnt find it... could use mine.

    -------------------------------------------------------------------
    Well this is the final version of the idea with 5 functions, it doesnt include the comments because i hope that hhmatt81 could make another revision :
    Code:
    #include <stdio.h>
    
    //print all possible combinations (numbers, letters, symbols)
    //#define MIN 30
    //#define MAX 127
    
    //print all binary combinations
    //#define MIN 48
    //#define MAX 50
    
    //print all CAPITAL letter combinations
    //#define MIN 65
    //#define MAX 91
    
    //print all lowercase letter combinations
    //#define MIN 97
    //#define MAX 123
    
    //print all number combinations
    #define MIN 48
    #define MAX 58
    
    void title();
    void one();
    void two();
    void three();
    void four();
    void five();
    
    int main() {
    	title();
    	int number=0;
    	printf("Enter the Number of characters in the password(1-5) : ");
    	scanf("%d", &number);
    	switch(number) {
    		case 1:
    			one();
    			break;
    		case 2:
    			two();
    			break;
    		case 3:
    			three();
    			break;
    		case 4:
    			four();
    			break;
    		case 5:
    			five();
    			break;
    		default:
    			printf("Out of range, Enter a number between 1 and 5\n");
    	}
    	return 0;
    }
    
    
    void one() {
    	int i=0;
    	for(i=MIN; i<MAX; i++) {
    		printf("%c\n", i);
    	}
    }
    
    void two() {
    	int i=0;
    	int j=0;
    	for(i=MIN; i<MAX; i++) {
    		for(j=MIN; j<MAX; j++) {
    			printf("%c%c\n", i, j);
    		}
    	}
    }
    
    void three() {
    	int i=0;
    	int j=0;
    	int k=0;
    	for(i=MIN; i<MAX; i++) {
    		for(j=MIN; j<MAX; j++) {
    			for(k=MIN; k<MAX; k++) {
    				printf("%c%c%c\n", i,j,k);
    			}
    		}
    	}
    }
    
    void four() {
    	int i=0;
    	int j=0;
    	int k=0;	
    	int l=0;
    
    	for(i=MIN; i<MAX; i++) {
    		for(j=MIN; j<MAX; j++) {
    			for(k=MIN; k<MAX; k++) {
    				for(l=MIN; l<MAX; l++) {
    					printf("%c%c%c%c\n", i,j,k,l);
    				}
    			}
    		}
    	}
    }
    
    void five() {
    	int i=0;
    	int j=0;
    	int k=0;	
    	int l=0;
    	int m=0;	
    	
    	for(i=MIN; i<MAX; i++) {
    		for(j=MIN; j<MAX; j++) {
    			for(k=MIN; k<MAX; k++) {
    				for(l=MIN; l<MAX; l++) {
    					for(m=MIN; m<MAX; m++) {
    						printf("%c%c%c%c%c\n", i,j,k,l,m);
    					}
    				}
    			}
    		}
    	}
    }
    
    void title() {
    	system("clear");
    	printf("-------------------------------------\n");
    	printf("|       Dictionary Generator        |\n");
    	printf("|               1.0                 |\n");
    	printf("|           by luckyr13             |\n");
    	printf("-------------------------------------\n\n");
    	printf("Send suggestions and comments to: luckyr13@gmail.com\n");
    }
    the only way that i found of making all this with one function is using conditionals, but i dont find it very useful... with this version i guess that the code is a kind of less weird ... and also isnt very difficult to make changes in there.

    but... im open to comments... thanks anyway for all the comments and for readme

  3. #13
    Just burned his ISO
    Join Date
    Mar 2008
    Posts
    11

    Default

    This code is EXCELLENT!!!

    it does ALMOST EVERYTHING i want it to do!

    really appreciate the support mate.

    do know how I can save the genereated txt to a file afterwards? i.e. txt file?
    most of the lines are removed on CMD when i generate it.

    i've modified the code to allow me to output up to 8 charectors.

    thanks again!

  4. #14
    My life is this forum thorin's Avatar
    Join Date
    Jan 2010
    Posts
    2,629

    Default

    Quote Originally Posted by bhups View Post
    do know how I can save the genereated txt to a file afterwards? i.e. txt file?
    See the original post, just do standard linux stdout redirection.
    I'm a compulsive post editor, you might wanna wait until my post has been online for 5-10 mins before quoting it as it will likely change.

    I know I seem harsh in some of my replies. SORRY! But if you're doing something illegal or posting something that seems to be obvious BS I'm going to call you on it.

  5. #15
    Just burned his ISO
    Join Date
    Mar 2008
    Posts
    11

    Default

    i'm currently using Windows..

    not to worry though.. found out how its done on CMD.

    its similar to the first few posts.

    "C:\app.exe > generated.txt"

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •