Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '''*********************************
- | level3 - brute force cracking |
- | ** |
- | http://wargame.nuitduhack.com/ |
- | http://www.nuitduhack.com/ |
- *********************************'''
- #!/usr/bin/python
- import os
- target = '/home/level3/crackme'
- wanted = '2:8vytm&*9|)].l(ol;a'
- arg = 'a'*20
- solution_string = ''
- size = 1024
- print "-->Brute force cracking"
- for char in range(20): # bf one by one
- for ascii in range(1, 256): # for all but \0 (ascii)
- arg = solution_string + chr(ascii) + 'a'*(19-char)
- # beware of bad char :
- if arg.find("'") == -1:
- # /home/level3/crackme 'all but single quote'
- cmd = "%s '%s'"%(target, arg)
- else:
- # /home/level3/crackme "all but double quote"
- cmd = '%s "%s"'%(target, arg)
- # reading the output
- res = os.popen(cmd).read(size)
- # searching for ciphered
- pos = res.find('Ciphered:')
- # ciphered is 20 bytes length
- ciphered = res[pos+10:pos+30]
- # check current ciphered char matching with wanted
- if ciphered[char] == wanted[char]:
- solution_string = ''.join([solution_string, chr(ascii)])
- break
- print '>%d%%'%(char*5)
- # print solution string
- print "\nSolution string: %s"%solution_string
- # print string as a list to get unprintable ascii
- print "Solution ascii: %s"%[solution_string]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement