the-useless-one / pywerview

A (partial) Python rewriting of PowerSploit's PowerView
GNU General Public License v3.0
908 stars 113 forks source link

UnicodeDecodeError in invoke-userhunter (develop branch) #21

Closed ThePirateWhoSmellsOfSunflowers closed 7 years ago

ThePirateWhoSmellsOfSunflowers commented 7 years ago

Zblah !

Once again, encoding error (develop branch)

$ ./pywerview.py invoke-userhunter -u Administrator -p password -w domain.local --username josé --dc-ip 172.16.0.1

Traceback (most recent call last):
  File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/root/pywerview-dev/pywerview/worker/hunting.py", line 43, in run
    result = self._hunt(target_computer)
  File "/root/pywerview-dev/pywerview/worker/hunting.py", line 92, in _hunt
    if target_user.membername.lower() in username.lower():
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3: ordinal not in range(128)

Oh come on José, get your shit together !

It's beacause here : https://github.com/the-useless-one/pywerview/blob/master/pywerview/worker/hunting.py#L83 you compare str object with unicode object. (The line numbers in the example above is wrong)

After some tests, this works for me : if "".format(target_user.membername.lower()) in username.lower(): or if target_user.membername.lower() in unicode(username.lower(), 'utf-8'): But I'm sure you have a better solution :smile:

(icym : https://stackoverflow.com/a/35444608)

Big Up :cactus:

the-useless-one commented 7 years ago

Goddammit, José! Thanks for the issue, I'll try to fix it this weekend.

Cheers,

Y

the-useless-one commented 7 years ago

Should be fixed now:

$ ./pywerview.py invoke-userhunter -t 192.168.47.132 -w uselessdomain.local -u root -p "awesomepassword" --username josé --computername 192.168.47.132 
computername: 192.168.47.132
localadmin:   
sessionfrom:  192.168.47.1
userdomain:   uselessdomain.local
username:     JOSÉ

Let me know if you have more problems. Cheers!

Y