Closed Thread
Results 1 to 7 of 7

Thread: Passwords

  1. #1
    Join Date
    Apr 2009
    Location
    Trapped in my own little world.
    Posts
    2,487
    Rep Power
    33

    Passwords

    So I found an old backup and have a encrypted file. I know some of the letters in the password so I tried searching for a bruteforce program but I kinda gave up on that lol. I figured it wouldnt take much to figure this out myself.

    Then I ran into this problem. If I have the possible characters into an array, I figured if I just put it into a loop and go through each character and inside that go through each charcter, etc I would get all the possibilities.

    Code:
    <pre>
    <?PHP
    $eol 
    "\n";
    $chars = array("a""b""c");
    $i 0;
    while(
    $i count($chars)) {
        
    $ii 0;
        while(
    $ii count($chars)) {
            
    $iii 0;
            while(
    $iii count($chars)) {
                echo 
    $chars[$i].$chars[$ii].$chars[$iii].$eol;
                
    $iii++;
            }
            
    $ii++;
        }
        
    $i++;
    }
    ?>
    </pre>
    Basically if I have this it echos out:
    aaa
    aab
    aac
    aba
    abb
    abc
    aca
    acb
    acc
    baa
    bab
    bac
    bba
    bbb
    bbc
    bca
    bcb
    bcc
    caa
    cab
    cac
    cba
    cbb
    cbc
    cca
    ccb
    ccc
    Which is correct but what if I want more than 3 caracters? Is there an easier way to do this then to embed more loops inside the loops? In that case if I wasnt sure if it was say 6 characters or 7 characters id have to run the program with 6 loops, then that fails I go again with 7? Is there a way to do this and just run it once? There has gotta be another way then 17+ embed loops lol

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

     
  3. #2
    Jordan Guest

    Re: Passwords

    Yup, you can use recursion to get it done easier. Modified this script here to fit your needs: Brute Force PHP Script : eternal rise

  4. #3
    Join Date
    Apr 2009
    Location
    Trapped in my own little world.
    Posts
    2,487
    Rep Power
    33

    Re: Passwords

    Ah recursion - should look more into this have not did to much with it quite yet besides the basic loop lol.

    Thanks for it tho this really helps =)

  5. #4
    Jordan Guest

    Re: Passwords

    It is a neat subject to look into and work with.

  6. #5
    Join Date
    Apr 2009
    Location
    Trapped in my own little world.
    Posts
    2,487
    Rep Power
    33

    Re: Passwords

    Yes, I believe my data structure teacher said recursion is a main concept in computer science.

  7. #6
    Join Date
    Sep 2007
    Location
    Karlstad, Sweden
    Posts
    3,082
    Blog Entries
    7
    Rep Power
    42

    Re: Passwords

    Yes it is, there is even whole program languages based purely on recursion. (PROLOG at least), where you have a fact, which can contain of a fact and a list and the list can contain a fact and a list etc...
    __________________________________________
    I study Information Systems at Karlstad University when I'm not on CodeCall

  8. #7
    Join Date
    Jul 2006
    Location
    Amherst, New York, United States
    Posts
    6,277
    Blog Entries
    26
    Rep Power
    20

    Re: Passwords

    Quote Originally Posted by orjan View Post
    Yes it is, there is even whole program languages based purely on recursion. (PROLOG at least), where you have a fact, which can contain of a fact and a list and the list can contain a fact and a list etc...
    Just because Prolog doesn't have loops doesn't mean it is based on recursion. However, Prolog _is_ based on logic.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Best Passwords?
    By Wanch in forum Linux/Unix General
    Replies: 25
    Last Post: 02-01-2009, 12:34 PM
  2. Passwords
    By travy92 in forum Visual Basic Programming
    Replies: 6
    Last Post: 10-06-2007, 08:33 AM
  3. Passwords?
    By littlefranciscan in forum General Programming
    Replies: 3
    Last Post: 03-06-2007, 01:22 PM
  4. Passwords
    By Chan in forum C# Programming
    Replies: 5
    Last Post: 08-07-2006, 05:26 AM
  5. Passwords
    By NeedHelp in forum Technology Ramble
    Replies: 3
    Last Post: 07-21-2006, 01:20 PM

Tags for this Thread

Bookmarks

Posting Permissions

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