blechschmidt / massdns

A high-performance DNS stub resolver for bulk lookups and reconnaissance (subdomain enumeration)
GNU General Public License v3.0
3.08k stars 460 forks source link

Add a status output interval option🙏 #80

Closed shmilylty closed 2 years ago

shmilylty commented 3 years ago

Massdns status output is very useful, but when using other program calls, the massdns status output interval is very short, there will be a lot of information output, which will pollute the original software log output. I very much hope that massdns will add a status output interval option, and then the defauult time can be set to 1 second. Thank you very much.😊

blechschmidt commented 2 years ago

The status output already occurs once per second. In your case, you should probably parse the stderr output of massdns (with --status-format json) and output it at will.

As an example, the following Python snippet turns the status output into a progress bar:

proc = subprocess.Popen([massdns_path, '-o', 'Je', '-s', 'auto', '--retry', 'never', '-r', resolvers_path, '-w',
                         output_path, '--status-format', 'json', permutations_path], stderr=subprocess.PIPE)
last = 0
with tqdm.tqdm(total=100) as pbar:
    for line in proc.stderr:
        percent = json.loads(line.decode())['progress']['percent']
        pbar.update(percent - last)
        last = percent