ropnop / go-windapsearch

Utility to enumerate users, groups and computers from a Windows domain through LDAP queries
BSD 3-Clause "New" or "Revised" License
343 stars 46 forks source link

Running windapsearch from within go program. - Arguments not crossing over properly #14

Open roborobs1023 opened 3 years ago

roborobs1023 commented 3 years ago

I'm trying to run windapsearch from within another go program.

I am using cmd, err := exec.Command(path to windapsearch, "-d" + dc, "-u" + username, "-p"+ password, "-j", "-ousers.json", "-musers", "--attrs givenName,sn,userPrincipalName,Department", "--filter (!(userAccountControl:1.2.840.113556.1.4.803:=2))") fmt.Println(cmd)

for some reason when I run this within the go fmt.Println(cmd) shows that the correct string was transferred as the command C:\Scripts\Go\Test\os-cmd\windapsearch.exe -d'dc' -u'username' -p'password' -j -ousers.json -musers --attrs givenName,sn,userPrincipalName,Department --filter (!(userAccountControl:1.2.840.113556.1.4.803:=2))

neither the filter nor the attribute selection are being implemented however the output is going to the correct file.

When I run the same command as it is output by fmt directly in cmd everything works perfectly. Any ideas?