module wcc output gets overwritten when using multiple hosts
When using the wcc module against multiple hosts, only the last result gets written to the json output file.
Steps to reproduce the behavior i.e.: Command: netexec smb 192.168.100.0/24 -u domain_admin -p 'password' -M wcc -o OUTPUT=wcc.json
NetExec info
- OS: Kali
- Version of nxc: 1.4.0
- Installed from: apt
Im not totally sure but i think the problem lies within wcc.py line 133. The output file is opened with the following code:
with open(self.output, "w") which should be corrected to with open(self.output, "a") to ensure that the results for the next host are appended and not overwritten.
Hello, module author here, thanks for pointing it out. Unfortunately it is not just a matter of replacing with open(self.output, "w") with with open(self.output, "a") : apparently a different instance of the NXCModule class is created for each host, which does not work with the current approach of storing the results in the NXCModule object.
I'll see what I can do about this.