@@ -478,6 +478,16 @@ def vbulletin_passwd(password, salt, **kwargs):
478478
479479 return "%s:%s" % (md5 (binascii .hexlify (md5 (getBytes (password )).digest ()) + getBytes (salt )).hexdigest (), salt )
480480
481+ def oscommerce_old_passwd (password , salt , ** kwargs ):
482+ """
483+ Reference: http://ryanuber.com/09-24-2010/os-commerce-password-hashing.html
484+
485+ >>> oscommerce_old_passwd(password='testpass', salt='6b')
486+ '16d39816e4545b3179f86f2d2d549af4:6b'
487+ """
488+
489+ return "%s:%s" % (md5 (getBytes (salt ) + getBytes (password )).hexdigest (), salt )
490+
481491def phpass_passwd (password , salt , count , prefix , ** kwargs ):
482492 """
483493 Reference(s):
@@ -570,6 +580,7 @@ def _encode64(input_, count):
570580 HASH .APACHE_SHA1 : apache_sha1_passwd ,
571581 HASH .VBULLETIN : vbulletin_passwd ,
572582 HASH .VBULLETIN_OLD : vbulletin_passwd ,
583+ HASH .OSCOMMERCE_OLD : oscommerce_old_passwd ,
573584 HASH .SSHA : ssha_passwd ,
574585 HASH .SSHA256 : ssha256_passwd ,
575586 HASH .SSHA512 : ssha512_passwd ,
@@ -1055,7 +1066,7 @@ def dictionaryAttack(attack_dict):
10551066 item = [(user , hash_ ), {"salt" : hash_ [0 :2 ]}]
10561067 elif hash_regex in (HASH .UNIX_MD5_CRYPT , HASH .APACHE_MD5_CRYPT ):
10571068 item = [(user , hash_ ), {"salt" : hash_ .split ('$' )[2 ], "magic" : "$%s$" % hash_ .split ('$' )[1 ]}]
1058- elif hash_regex in (HASH .JOOMLA , HASH .VBULLETIN , HASH .VBULLETIN_OLD ):
1069+ elif hash_regex in (HASH .JOOMLA , HASH .VBULLETIN , HASH .VBULLETIN_OLD , HASH . OSCOMMERCE_OLD ):
10591070 item = [(user , hash_ ), {"salt" : hash_ .split (':' )[- 1 ]}]
10601071 elif hash_regex in (HASH .DJANGO_MD5 , HASH .DJANGO_SHA1 ):
10611072 item = [(user , hash_ ), {"salt" : hash_ .split ('$' )[1 ]}]
@@ -1302,8 +1313,12 @@ def crackHashFile(hashFile):
13021313 i = 0
13031314 attack_dict = {}
13041315
1316+ check = None
13051317 for line in getFileItems (conf .hashFile ):
1306- if ':' in line :
1318+ if check is None and not attack_dict and ':' in line :
1319+ check = any (re .search (_ , line ) for _ in getPublicTypeMembers (HASH , True ))
1320+
1321+ if ':' in line and check is False :
13071322 user , hash_ = line .split (':' , 1 )
13081323 attack_dict [user ] = [hash_ ]
13091324 else :
0 commit comments