diff --git a/lib/utils/hash.py b/lib/utils/hash.py index c07e9b813..f8910afc4 100644 --- a/lib/utils/hash.py +++ b/lib/utils/hash.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# -*- coding: utf-8 -*- """ $Id$ @@ -7,6 +8,11 @@ Copyright (c) 2006-2010 sqlmap developers (http://sqlmap.sourceforge.net/) See the file 'doc/COPYING' for copying permission """ +try: + import crypt +except ImportError, _: + pass + import re import time @@ -347,7 +353,6 @@ def dictionaryAttack(attack_dict): warnMsg = "attack on '%s' is not available for Windows platform" % __functions__[hash_regex].func_name logger.warning(warnMsg) else: - import crypt attack_info.append([(user, hash_), {'salt': hash_[0:2]}]) if not attack_info: @@ -384,7 +389,7 @@ def dictionaryAttack(attack_dict): length = len(kb.wordlist) * len(suffix_list) - if hash_regex in (HASH.MYSQL, HASH.MYSQL_OLD, HASH.MD5_GENERIC, HASH.SHA1_GENERIC, HASH.CRYPT_GENERIC): + if hash_regex in (HASH.MYSQL, HASH.MYSQL_OLD, HASH.MD5_GENERIC, HASH.SHA1_GENERIC): count = 0 for suffix in suffix_list: