From 255fff88bd18a38e3287f2995f7970bc80f79299 Mon Sep 17 00:00:00 2001 From: byt3bl33d3r Date: Fri, 23 Oct 2015 10:12:29 -0600 Subject: [PATCH 1/2] fixes #23 --- crackmapexec.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/crackmapexec.py b/crackmapexec.py index 8459b7c1..7d93c5f5 100755 --- a/crackmapexec.py +++ b/crackmapexec.py @@ -83,21 +83,21 @@ def print_att(message): def yellow(text): try: - colored(text.decode('utf8'), 'yellow', attrs=['bold']) + return colored(text.decode('utf8'), 'yellow', attrs=['bold']) except UnicodeDecodeError: - colored(unicode(text, errors='ignore'), 'yellow', attrs=['bold']) + return colored(unicode(text, errors='ignore'), 'yellow', attrs=['bold']) def green(text): try: - colored(text.decode('utf8'), 'green', attrs=['bold']) + return colored(text.decode('utf8'), 'green', attrs=['bold']) except UnicodeDecodeError: - colored(unicode(text, errors='ignore'), 'green', attrs=['bold']) + return colored(unicode(text, errors='ignore'), 'green', attrs=['bold']) def red(text): try: - colored(text.decode('utf8'), 'red', attrs=['bold']) + return colored(text.decode('utf8'), 'red', attrs=['bold']) except UnicodeDecodeError: - colored(unicode(text, errors='ignore'), 'red', attrs=['bold']) + return colored(unicode(text, errors='ignore'), 'red', attrs=['bold']) # Structures # Taken from http://insecurety.net/?p=768 From c74d7720df18d85c7634ba42cd7c3de058b64aa7 Mon Sep 17 00:00:00 2001 From: byt3bl33d3r Date: Sat, 24 Oct 2015 10:41:15 -0600 Subject: [PATCH 2/2] Possible fix for #24 --- crackmapexec.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/crackmapexec.py b/crackmapexec.py index 8459b7c1..fc427b2c 100755 --- a/crackmapexec.py +++ b/crackmapexec.py @@ -60,43 +60,43 @@ DUMMY_SHARE = 'TMP' def print_error(message): try: cprint("[-] ", 'red', attrs=['bold'], end=message.decode('utf8')+'\n') - except UnicodeDecodeError: + except UnicodeDecodeError and UnicodeEncodeError: cprint("[-] ", 'red', attrs=['bold'], end=unicode(message, errors='ignore')+'\n') def print_status(message): try: cprint("[*] ", 'blue', attrs=['bold'], end=message.decode('utf8')+'\n') - except UnicodeDecodeError: + except UnicodeDecodeError and UnicodeEncodeError: cprint("[*] ", 'blue', attrs=['bold'], end=unicode(message, errors='ignore')+'\n') def print_succ(message): try: cprint("[+] ", 'green', attrs=['bold'], end=message.decode('utf8')+'\n') - except UnicodeDecodeError: + except UnicodeDecodeError and UnicodeEncodeError: cprint("[+] ", 'green', attrs=['bold'], end=unicode(message, errors='ignore')+'\n') def print_att(message): try: cprint(message.decode('utf8'), 'yellow', attrs=['bold']) - except UnicodeDecodeError: + except UnicodeDecodeError and UnicodeEncodeError: cprint(unicode(message, errors='ignore'), 'yellow', attrs=['bold']) def yellow(text): try: colored(text.decode('utf8'), 'yellow', attrs=['bold']) - except UnicodeDecodeError: + except UnicodeDecodeError and UnicodeEncodeError: colored(unicode(text, errors='ignore'), 'yellow', attrs=['bold']) def green(text): try: colored(text.decode('utf8'), 'green', attrs=['bold']) - except UnicodeDecodeError: + except UnicodeDecodeError and UnicodeEncodeError: colored(unicode(text, errors='ignore'), 'green', attrs=['bold']) def red(text): try: colored(text.decode('utf8'), 'red', attrs=['bold']) - except UnicodeDecodeError: + except UnicodeDecodeError and UnicodeEncodeError: colored(unicode(text, errors='ignore'), 'red', attrs=['bold']) # Structures