# Bruteforce Program

## Recommended Posts

I created a program the reason was for another thread http://hak5.org/forums/index.php?showtopic=10617.

Right know it only goes to three letters and prints them but it isn't hard to modify them.

What do you guys and gals think of it. :)

Well on to the code.

```#Application: Python --&gt; http://www.python.org/
#Author: Zimmer
#Cool Program but don't use it for illegal reasons.
#
#
import sys
x = "abcdefghijklmnopqrstuvwxyzz"
b = -1
c = 0
r = 0
def CRACK():
print x[b]
def CRACK2():
print x[c]+x[b]
def CRACK3():
print x[r]+x[c]+x[b]
while b&lt;25:
b = b+1
CRACK()
b=-1
while c&lt;26:
b = b+1
if b==26:
c=c+1
b=0
CRACK2()
b=-1
while r&lt;26:
b = b+1
if b==26:
c=c+1
b=0
if c==26:
r=r+1
c=0
b=0
CRACK3()
#x = input("Pause")
#if 1==1:
#        sys.quit```

##### Share on other sites

Not too bad, at least not at breaking anything up to 3 characters long. I don't know python but if it is like C and most languages that say print then it looks like it will all be printed out on one single line. This could actually be a good thing if you remake your code to be more robust (using a function passed the min and max number of characters that the password or string is). You could even do it recursively in probably about 6 lines at that point and just print out the newline character(s) at the end of the recursive statement. If you are attempting to print out possible passwords to decrypt something like a rar file, I'd use crark. I've used it before and it worked very nicely for the file I was using with a password that was in my dictionary file.

##### Share on other sites

Ya I have it know up to 5 letters and then 10 letters using upper lower and numbers.

Update Code

```import sys
def crack10():
print x[y]+x[t]+x[e]+x[w]+x[q]+x[v]+x[z]+x[r]+x[c]+x[b]

x = "abcdefghijklmnopqrstuvwxyzzABCDEFGHIJKLMNOPQRSTUVWXYZZ1234567890"  #64
b = -1
c = 0
r = 0
z = 0
v = 0
q = 0
w = 0
e = 0
t = 0
y = 0
while b&lt;64:
b=b+1
if b==64:
c = c + 1
b = 0
if c==64:
r = r + 1
c = 0
b = 0
if r==64:
z=z+1
r = 0
c = 0
b = 0
if z==64:
v=v+1
z = 0
r = 0
c = 0
b = 0
if v==64:
y=y+1
v = 0
z = 0
r = 0
c = 0
b = 0
if y==64:
t=t+1
y = 0
v = 0
z = 0
r = 0
c = 0
b = 0 #tewq
if t==64:
e=e+1
t = 0
y = 0
v = 0
z = 0
r = 0
c = 0
b = 0
if e==64:
w=w+1
e = 0
t = 0
y = 0
v = 0
z = 0
r = 0
c = 0
b = 0
if w==64:
q=q+1
w = 0
e = 0
t = 0
y = 0
v = 0
z = 0
r = 0
c = 0
b = 0
crack10()```

##### Share on other sites

Wow, im surprised a million people didnt come and diss you in here for posting the code, I posted keylogger code and no body wanted to help, just talk trash about me posting keylogger code and how wrong it is, anyways im with you, nice post thanks

##### Share on other sites

i posted this in the other topic too... its just a dictionary attack on a rar file or zip. I was thinking of taking both these codes and adding some menu's to them and maybe even figuring out the whole multithreading stuff.... this could be the start of a purely python based brute force wrapper that could be used on many things....

also a little base64 converter program

The new and improved dictionary attack unrarer.

Still needs some error handling work though but works ok for watching the output of weirdness from this arr_pirate.rar file...

##### Share on other sites

does this actually work?.... could you show an example of use?

Ya I have it know up to 5 letters and then 10 letters using upper lower and numbers.

Update Code

```import sys
def crack10():
print x[q]+x[w]+x[e]+x[t]+x[y]+x[v]+x[z]+x[r]+x[c]+x[b]

x = "abcdefghijklmnopqrstuvwxyzzABCDEFGHIJKLMNOPQRSTUVWXYZZ1234567890"  #64
b = -1
c = -1
r = -1
z = -1
v = -1
q = -1
w = -1
e = -1
t = -1
y = -1
ch=b
while b=&lt;62:
ch = b + 1
b=ch
if b==64:
c = c + 1
b = 0
if c==64:
r = r + 1
c = 0
b = 0
if r==64:
z=z+1
r = 0
c = 0
b = 0
if z==64:
v=v+1
z = 0
r = 0
c = 0
b = 0
if v==64:
y=y+1
v = 0
z = 0
r = 0
c = 0
b = 0
if y==64:
t=t+1
y = 0
v = 0
z = 0
r = 0
c = 0
b = 0 #tewq
if t==64:
e=e+1
t = 0
y = 0
v = 0
z = 0
r = 0
c = 0
b = 0
if e==64:
w=w+1
e = 0
t = 0
y = 0
v = 0
z = 0
r = 0
c = 0
b = 0
if w==64:
q=q+1
w = 0
e = 0
t = 0
y = 0
v = 0
z = 0
r = 0
c = 0
b = 0
crack10()```

##### Share on other sites

Does it work?

Yes and no.

Yes...

Using print it is able to generate the code but...

No...

I am having trouble with the sys command to communicate with rar.exe.

##### Share on other sites

the code doesnt work by itself can you show me how it prints out correctly? i can probably make it interface with rar if i understand your code

when i try running your script this is what happens

G:\crypto>test2.py

File "G:\crypto\test2.py", line 17

while b=<62:

^

SyntaxError: invalid syntax

G:\crypto>

##### Share on other sites

How it works...

Well think of a clock

60 seconds to a one minute

60 minutes to an hour

24 hours to a day

7 days to a week

of 60*60*24*7=604800 seconds to a week.

so if you have 3 letters and a password that has either 1-3 letters in it. Then

a

b

c

aa

ab

ac

ba

bb

bc

ca

cb

cc

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

....

each time the next letter moves on the other numbers reset bcc to caa

##### Share on other sites

x = "abcdefghijklmnopqrstuvwxyzzABCDEFGHIJKLMNOPQRSTUVWXYZZ1234567890" #64

this is the set of number and letters that could make up all the passwords. #64 is just how many.

So in the code the

if b==64: Once b has gone through all the letters, etc

c = c + 1 The next letter progresses by one

b = 0 and b is reset

And each time more and more rows are reset

ROW: 3 2 1

a b c

So a is in ROW 3

b ROW 2

c ROW 1

each time row one goes through all of the set (letters, number, special characters, etc)

ROW 2 moves up one so it might move from b to c

##### Share on other sites

The code you were running had some errors it should run know.

##### Share on other sites

BTW Updated code above in original post in case you didn't know.

##### Share on other sites

How it works...

Well think of a clock

60 seconds to a one minute

60 minutes to an hour

24 hours to a day

7 days to a week

of 60*60*24*7=604800 seconds to a week.

so if you have 3 letters and a password that has either 1-3 letters in it. Then

a

b

ccc

....

each time the next letter moves on the other numbers reset bcc to caa

i got how it was supposed to work your code just confused me... i ran accross some python source code that does the same thing only alot better....in the spirit of not reinventing the wheel... the only thing is this code just outputs to a file.

```'''
Forgot to close the file after I opened it.
It now splits the files after a set limit.
It checks the file size after ever 1000 words. Easy to change.

TO DO:
Add in a way to restart the program from where it left off.
'''
import os
import time
numFile = 0
f=open('wordlist-' + str(numFile) + '.txt', 'w')

def xselections(items, n):
if n==0: yield []
else:
for i in xrange(len(items)):
for ss in xselections(items, n-1):
yield [items[i]]+ss

# Numbers = 48 - 57
# Capital = 65 - 90
# Lower = 97 - 122
numb = range(48,58)
cap = range(65,91)
low = range(97,123)
choice = 0
while int(choice) not in range(1,8):
choice = raw_input('''
1) Numbers
2) Capital Letters
3) Lowercase Letters
4) Numbers + Capital Letters
5) Numbers + Lowercase Letters
6) Numbers + Capital Letters + Lowercase Letters
7) Capital Letters + Lowercase Letters
: ''')

choice = int(choice)
poss = []
if choice == 1:
poss += numb
elif choice == 2:
poss += cap
elif choice == 3:
poss += low
elif choice == 4:
poss += numb
poss += cap
elif choice == 5:
poss += numb
poss += low
elif choice == 6:
poss += numb
poss += cap
poss += low
elif choice == 7:
poss += cap
poss += low

bigList = []
for i in poss:
bigList.append(str(chr(i)))

MIN = raw_input("What is the min size of the word? ")
MIN = int(MIN)
MAX = raw_input("What is the max size of the word? ")
MAX = int(MAX)
MAX_SIZE_MB = 100
MAX_SIZE_BYTES = MAX_SIZE_MB * 1024 * 1024
HOW_OFTEN_CHECK = 1000
count = 0
START_TIME = time.time()
for i in range(MIN,MAX+1):
for s in xselections(bigList,i):
count += 1
f.write(''.join(s) + '\n')
if count &gt;= HOW_OFTEN_CHECK:
size = os.path.getsize('wordlist-' + str(numFile) + '.txt')
if size &gt; MAX_SIZE_BYTES:
f.close()
numFile += 1
f=open('wordlist-' + str(numFile) + '.txt', 'w')
count = 0
print 'New File. Current word: ', ''.join(s)

f.close()
END_TIME = time.time()
print 'Time it took to compute files:', END_TIME - START_TIME, 'seconds'\```

##### Share on other sites

just a quick note. reinventing the wheel is a good way to get to know a language. what good is just having 1 wheel? unless your a unicyclist your gonna want more

##### Share on other sites

What do you mean reinventing the wheel is their any easier way to this?

##### Share on other sites

What do you mean reinventing the wheel is their any easier way to this?

the term "reinventing the wheel" is a term used around programming that means making something that has already been made.

and example would be an irc client. there are many irc clients. making another irc client is reinventing the wheel.

or

there are many mspaint clones. each clone is almost identical to the last. making another is reinventing the wheel.

its a way of saying a program has been done before.

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account. Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
• ### Recently Browsing   0 members

• No registered users viewing this page.
×