Jump to content

- - - - -

Brute force passwd cracking, am i doing it right?

python password-cracking password

  • Please log in to reply
1 reply to this topic

#1 TheShrubber


    I broke 10 posts and all I got was this lousy title!

  • Members
  • 11 posts
  • Gender:Male
  • Country:
  • Location:The hard cold North

Posted 12 February 2013 - 09:36 AM

Hey, so i just created this brute force script in Python that tries to figure out a password (in this example, the password is a constant string)


It creates a list() starting with one int(), it then counts in base-n untill it figures out the password (when it has to do a carry, it just expands the list)

Basicly, i was just wondering wether this is the way it's "usually" done.


chars = list('qwertyuiopasdfghjklzxcvbnmm')

passwd = []
chars_length = len(chars) - 1
test_passwd = 'abcde'
passwd = [0]

def getPass(attempt):
    global chars
    ret = ''
    for char in attempt:
        ret += chars[char]
    return ret

while True:

    passwd[0] += 1

    i = 0
    for char in passwd:
        if char == chars_length:
            passwd[i] = -1
                passwd[i+1] += 1
            except IndexError:
                passwd[i+1] += 1
                print(str( len(passwd) )+'\n'+getPass(passwd)+'\n===================')
        i += 1

    if getPass(passwd) == test_passwd:
        print('\nFOUND IT!!!\ngetPass( passwd ) == "{}"\n\t=> True'.format(test_passwd))

I attatched the script as a *.txt

Attached Files

Edited by TheShrubber, 15 February 2013 - 09:34 AM.

  • TheFunk likes this

#2 TheFunk


    SUP3R 31337

  • Members
  • 192 posts
  • Gender:Male
  • Country:

Posted 16 February 2013 - 04:39 PM

Looks about right to me. If my Python skills are still intact (they're definitely not) it looks to me as if you try every combination of your character set list for a given length then move to a new length. That's basically all bruteforcing is. Now figure out how to write that so it uses Cuda or OpenCL and you'll have yourself an extremely high-speed bruteforecing program you can call your own.

Also tagged with one or more of these keywords: python, password-cracking, password

BinRev is hosted by the great people at Lunarpages!