punk-security / dnsReaper

dnsReaper - subdomain takeover tool for attackers, bug bounty hunters and the blue team!
GNU Affero General Public License v3.0
1.93k stars 150 forks source link

Overwriting output file Path (--out) #125

Closed mohsinenar closed 1 year ago

mohsinenar commented 1 year ago

I was trying to integrate dnsReaper with another security automation tool. I used python to run the dnsReaper and Read the output as a JSON later. something like this.

output_file = tempfile.NamedTemporaryFile(suffix='.json')
command = ['python3', '/dnsReaper/main.py','single', '--domain', domain, '--out-format', 'json', '--out', output_file.name]
subprocess.run(command, check=True)

however, the tool always writes the output in a different path than the one I provided with output_file.name. This is because the following line in 'output.py' always adds the extension (.josn | .csv) to the file path.

self.path = f"{path}.{format}"
mohsinenar commented 1 year ago

A did a small change to the output,py file to make it work for me.

self.path = path if path.endswith(format) is True else f"{path}.{format}"

Should I create a PR?

SimonGurney commented 1 year ago

That looks like a great contribution.

If you raise a PR I'll give it a quick test and approve it for merging :)

mohsinenar commented 1 year ago

@SimonGurney I created a PR #126