From b5aef9bcf91f0259015cf7ad6544791894a8b993 Mon Sep 17 00:00:00 2001
From: Miroslav Stampar <miroslav.stampar@gmail.com>
Date: Mon, 18 Apr 2011 10:16:38 +0000
Subject: [PATCH] fix for a bug reported by nightman (TypeError: unsupported
 operand type(s) for +: 'NoneType' and 'str')

---
 lib/utils/hash.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lib/utils/hash.py b/lib/utils/hash.py
index 64a92f104..a0c46f0c8 100644
--- a/lib/utils/hash.py
+++ b/lib/utils/hash.py
@@ -387,7 +387,9 @@ def dictionaryAttack(attack_dict):
 
         for item in attack_info:
             ((user, _), _) = item
-            kb.wordlist.append(normalizeUnicode(user))
+
+            if user:
+                kb.wordlist.append(normalizeUnicode(user))
 
         length = len(kb.wordlist) * len(suffix_list)
 
@@ -404,6 +406,9 @@ def dictionaryAttack(attack_dict):
 
                     count += 1
 
+                    if not isinstance(word, basestring):
+                        continue
+
                     if suffix:
                         word = word + suffix
 
@@ -458,6 +463,9 @@ def dictionaryAttack(attack_dict):
                         current = __functions__[hash_regex](password = word, uppercase = False, **kwargs)
                         count += 1
 
+                        if not isinstance(word, basestring):
+                            continue
+
                         if suffix:
                             word = word + suffix