dnsReaper icon indicating copy to clipboard operation
dnsReaper copied to clipboard

Overwriting output file Path (--out)

Open mohsinenar opened this issue 2 years ago • 3 comments

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 avatar Oct 08 '22 02:10 mohsinenar

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?

mohsinenar avatar Oct 08 '22 02:10 mohsinenar

That looks like a great contribution.

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

SimonGurney avatar Oct 08 '22 06:10 SimonGurney

@SimonGurney I created a PR #126

mohsinenar avatar Oct 08 '22 23:10 mohsinenar