zmap/zdns

Validate input to zdns

vishalmohanty opened this issue · 1 comments

Consider this input to the tool

» echo "google.com,censys.io" | ./zdns A --name-servers=8.8.8.8 | python -m json.tool

On this input, zdns keeps waiting without making any progress or terminating. We have to currently terminate it manually by using Ctrl+C.

» echo "google.com,censys.io" | ./zdns A --name-servers=8.8.8.8 | python -m json.tool
^CTraceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 192, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/tool.py", line 53, in <module>
    main()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/tool.py", line 44, in main
    objs = (json.load(infile), )
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/__init__.py", line 293, in load
    return loads(fp.read(),
KeyboardInterrupt

Validate input before passing it to zdns.

Define a validate function for each of the input params and pass the params for validation