Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encoding error in get-netlocalgroup and get-netshare #5

Closed
ThePirateWhoSmellsOfSunflowers opened this issue Jul 8, 2016 · 1 comment

Comments

@ThePirateWhoSmellsOfSunflowers
Copy link
Collaborator

Hi dude !

Because of non ascii characters (maudits français) in the group name or the description, PywerView is not able to diplay them. Same problem in get-netshare.
Affected functions : get-netlocalgroup and get-netshare (but maybe in others too)

PywerView

$ ./pywerview.py get-netlocalgroup -w DOMAIN.lan -u administrator -p p@ssw0rd --dc-ip DC.domain.lan --computername COMPUTER01.domain.lan --list-groups

Traceback (most recent call last):
File "./pywerview.py", line 285, in
print '\n\n'.join(str(x) for x in results)
File "./pywerview.py", line 285, in
print '\n\n'.join(str(x) for x in results)
File "/home/x/tools/pywerview/pywerview/rpcobjects.py", line 50, in str
s += '{}: {}{}\n'.format(member[0], ' ' * (max_length - len(member[0])), member[1])
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe8' in position 56: ordinal not in range(128)

Powerview

PS C:\Users\administrator> Get-NetLocalGroup -ComputerName COMPUTER01.domain.lan -ListGroup

Server Group SID Description

COMPUTER01.domain.lan Administrateurs S-X-X-XX-XXX Les membres du groupe Admi...
COMPUTER01.domain.lan Duplicateurs S-X-X-XX-XXX Prend en charge la réplica...
COMPUTER01.domain.lan Invités S-X-X-XX-XXX Les membres du groupe Invi...
[..]

PywerView

$ ./pywerview.py get-netshare -w DOMAIN.lan -u administrator -p p@ssw0rd --computername COMPUTER01.domain.lan

Traceback (most recent call last):
File "./pywerview.py", line 285, in
print '\n\n'.join(str(x) for x in results)
File "./pywerview.py", line 285, in
print '\n\n'.join(str(x) for x in results)
File "/home/x/tools/pywerview/pywerview/rpcobjects.py", line 50, in str
s += '{}: {}{}\n'.format(member[0], ' ' * (max_length - len(member[0])), member[1])
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe0' in position 15: ordinal not in range(128)

Powerview

PS C:\Users\administrator> get-netshare -ComputerName COMPUTER01.domain.lan

shi1_netname shi1_type shi1_remark

IPC$ 2147483651 IPC distant
SharedDocs 0
print$ 0 Pilotes d'imprimantes
ADMIN$ 2147483648 Administration à distance
C$ 2147483648 Partage par défaut

(Oh for f*** sake's Github...)

By the way awesome tool ahah 👍

"I'm fear of encoding"

@the-useless-one
Copy link
Owner

Yes, "I'm fear of encoding" too 😛, but this commit should fix the issue. The encoding problem was only present when using RPC communications (impacket's LDAP seems to better handle encoding).

I also had to change how results were printed, so I took the opportunity to close #9 too.

Hope this works, if anyone else has a problem, feel free to reopen the issue.

Cheers,

Yannick

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants