dnsvalidator icon indicating copy to clipboard operation
dnsvalidator copied to clipboard

File Operations append to files, existing checks on launch

Open codingo opened this issue 6 years ago • 0 comments

#5 introduced file operations however these are currently performed in append mode, as per:


        if self.output and level == 2:
            f = open(self.output, 'a')
            f.writelines("\n" + target)
            f.close()

This is a quick solution, and not ideal, as it wont' overwrite previous files. A flag should either be added to remove previous files before execution (not ideal) or the code should be update to create an open file handler with argparse and then perform a write operation throughout the programs execution. This last option would also have the added benefit of preventing continual file open/close operations throughout execution.

codingo avatar Jul 09 '19 04:07 codingo