byt3bl33d3r / CrackMapExec

A swiss army knife for pentesting networks
BSD 2-Clause "Simplified" License
8.29k stars 1.64k forks source link

'utf-8' codec can't decode byte 0xf1 #806

Closed sec13b closed 9 months ago

sec13b commented 10 months ago

any help. Thank you image

suljov commented 10 months ago

did it get fixed or you found an fix? i have this too

suljov commented 10 months ago

i maybe found a loop hole or a reason. test using another wordlist. rockyou is "UTF-8 text" but other wordlists are "ASCII text" and those will work.

but this dont fix the fact it cant read files that are "UTF-8 text", some people want/have to use the rockyou wordlist and cant do it right now

sec13b commented 10 months ago

i didn't fix

0mMadnani commented 9 months ago

Can be fixed by simply opening the rockyou.txt in a text editor like leafpad and in save as option use the UTF-8 encoding while saving this will solve the issue

suljov commented 9 months ago

Can be fixed by simply opening the rockyou.txt in a text editor like leafpad and in save as option use the UTF-8 encoding while saving this will solve the issue

error say

"UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf1 in position 933: invalid continuation byte "

and checking rockyou.txt we get

$ file /usr/share/wordlists/rockyou.txt /usr/share/wordlists/rockyou.txt: Unicode text, UTF-8 text

sec13b commented 9 months ago

Some of the wordlists I have downloaded from the inter-webs have had malformed utf-8 contents. You can run this Linux command to clean up the UTF-8 by removing any non UTF-8 characters:

sudo iconv -f utf-8 -t utf-8 -c rockyou.txt

or

sudo iconv -f utf-8 -t utf-8 -c rockyou.txt > rockyou_utf_8.txt  (keep original rockyou.txt)

It's also wise to clean up any leading white-space since I don't know how john the ripper or other cracking applications will deal with it.

sed "s/^[ \t]*//" -i rockyou.txt
sed "s/^[ \t]*//" -i rockyou_utf_8..txt
┌──(kali㉿kali)-[~/CrackMapExec]
└─$ poetry run crackmapexec rdp 192.168.1.14 -u you -p /usr/share/wordlists/rockyou_utf_8.txt --no-brutepass