@@ -478,6 +478,16 @@ def vbulletin_passwd(password, salt, **kwargs):
478
478
479
479
return "%s:%s" % (md5 (binascii .hexlify (md5 (getBytes (password )).digest ()) + getBytes (salt )).hexdigest (), salt )
480
480
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
+
481
491
def phpass_passwd (password , salt , count , prefix , ** kwargs ):
482
492
"""
483
493
Reference(s):
@@ -570,6 +580,7 @@ def _encode64(input_, count):
570
580
HASH .APACHE_SHA1 : apache_sha1_passwd ,
571
581
HASH .VBULLETIN : vbulletin_passwd ,
572
582
HASH .VBULLETIN_OLD : vbulletin_passwd ,
583
+ HASH .OSCOMMERCE_OLD : oscommerce_old_passwd ,
573
584
HASH .SSHA : ssha_passwd ,
574
585
HASH .SSHA256 : ssha256_passwd ,
575
586
HASH .SSHA512 : ssha512_passwd ,
@@ -1055,7 +1066,7 @@ def dictionaryAttack(attack_dict):
1055
1066
item = [(user , hash_ ), {"salt" : hash_ [0 :2 ]}]
1056
1067
elif hash_regex in (HASH .UNIX_MD5_CRYPT , HASH .APACHE_MD5_CRYPT ):
1057
1068
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 ):
1059
1070
item = [(user , hash_ ), {"salt" : hash_ .split (':' )[- 1 ]}]
1060
1071
elif hash_regex in (HASH .DJANGO_MD5 , HASH .DJANGO_SHA1 ):
1061
1072
item = [(user , hash_ ), {"salt" : hash_ .split ('$' )[1 ]}]
@@ -1302,8 +1313,12 @@ def crackHashFile(hashFile):
1302
1313
i = 0
1303
1314
attack_dict = {}
1304
1315
1316
+ check = None
1305
1317
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 :
1307
1322
user , hash_ = line .split (':' , 1 )
1308
1323
attack_dict [user ] = [hash_ ]
1309
1324
else :
0 commit comments