Skip to content

Commit

Permalink
Fixed bug where legitmate matches being ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
petedmarsh committed Jul 26, 2012
1 parent 6a98b18 commit 733e3e1
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions pybozo.py
Expand Up @@ -70,7 +70,7 @@ def webSearch(self, hash):

except:
pass

print results
return results

try:
Expand All @@ -84,7 +84,7 @@ class MD5Cracker(object):

PATTERNS = [ '(?P<plain>.+)\s+(?P<hash>%s)',
'(?P<hash>%s):(?P<plain>.+)',
'(md5|MD5)\s*\(("|\')?(?P<plain>.*?)("|\')?\)\s*(=|:)\s*("|\')?(?P<hash>%s)("|\')?',
'(md5|MD5)\s*\(("|\')?(?P<plain>.*?)("|\')?\)\s*(=|:)\s*("|\')?(?P<hash>%s)("|\')?'
]

def __init__(self, patterns = None):
Expand Down Expand Up @@ -121,9 +121,8 @@ def matches(self, hash, text):
for match in matches:
plain = match.group('plain')
possibleMatches.update([plain, plain.rstrip(), plain.lstrip(), plain.strip()])

matches = itertools.ifilter(lambda plain: self.verify(plain, hash), possibleMatches)


matches = list(itertools.ifilter(lambda plain: self.verify(plain, hash), possibleMatches))
return matches


Expand Down Expand Up @@ -213,17 +212,14 @@ def main(hash, cracker, googleAPIKey = None, userAgent = None, **kwargs):
google = pygoogle.SearchAPI(key = googleAPIKey)

urls = [result.url for result in google.webSearch(str(hash))]

for url in urls:
try:
text = getText(url, userAgent)
matches = cracker.matches(hash, text)
if matches:
for match in matches:
print match
if len(matches):
return matches
except urllib2.HTTPError, e:
continue
except:
continue

if __name__ == '__main__':

Expand All @@ -243,5 +239,9 @@ def main(hash, cracker, googleAPIKey = None, userAgent = None, **kwargs):

arguments['cracker'] = CRACKERS[arguments['cracker']]()

main(**arguments)
results = main(**arguments)

if results:
for result in results:
print result

0 comments on commit 733e3e1

Please sign in to comment.