the-useless-one / pywerview

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

LDAP search error on all get-net* commands #11

Closed byt3bl33d3r closed 8 years ago

byt3bl33d3r commented 8 years ago

Hey!

Was playing around with pywerview and noticed this error kept popping up whenever I try to use a function that performs an LDAP query. Pinging @asolino since he might be interested in this error as well.

Command : python ./pywerview.py get-netuser -t DC_IP -u user -p password

Traceback (most recent call last):
  File "./pywerview.py", line 290, in <module>
    results = args.func(**parsed_args)
  File "/home/byt3bl33d3r/Tools/pywerview/pywerview/net.py", line 99, in get_netuser
    for user in domain_connection.search(searchFilter=user_search_filter, attributes=list()):
  File "build/bdist.linux-x86_64/egg/impacket/ldap/ldap.py", line 331, in search
impacket.ldap.ldap.LDAPSearchError: Error in searchRequest -> 'invalidDNSyntaxn':0000208F: NameErr: DSID-03100225, problem 2006 (BAD_NAME), data 8350, best match of:
    'dc='

Let me know if you need more info!

Cheers

the-useless-one commented 8 years ago

Hey man, thanks for filing this issue.

The problem is that if you're performing a LDAP query against a DC, you need to give the -w argument. I didn't want to put it as a mandatory parameter, because some functions work with local accounts (like get-netsession and stuff). I'll try to think of some way to make it work, I'm leaving this open for now.

Cheers,

Y

asolino commented 8 years ago

Hey folks.. based on what you said.. doesn't look like there's anything we should change at the impacket level right?

byt3bl33d3r commented 8 years ago

Doesn't look like it! I managed to fix this in #12

asolino commented 8 years ago

Awesome mate.. thanks!