NullHypothesis / exitmap

A fast and modular scanner for Tor exit relays. The canonical repository (including issue tracker) is at https://gitlab.torproject.org/tpo/network-health/exitmap
https://www.cs.kau.se/philwint/spoiled_onions/
GNU General Public License v3.0
454 stars 107 forks source link

Add subparsers to make modules parameterised #49

Closed s4chin closed 6 years ago

s4chin commented 8 years ago

This approach is the second approach. exitmap -h prints out the help for exitmap, and exitmap module -h prints the help for the modules. So now exitmap works as exitmap module, for example if one wants to run dnspoison and checktest, one has to type two commands:

exitmap dnpoison
exitmap checktest

The con is that when a new module is added(as you recently did), the subparser code has to be modified so those modules can be used. But the code is a single line so I don't think it should be an issue. Should I continue with this approach?

NullHypothesis commented 8 years ago

Thanks, that sounds promising! Is it also possible to add module-specific command line arguments to exitmap's configuration file? For example, .exitmaprc could have the following content:

[Defaults]
verbosity = info
build_delay = 0.3
analysis_dir = /tmp/exitmap_scans
NullHypothesis commented 8 years ago

Thanks for your work, Sachin! Is this ready for review now?

s4chin commented 8 years ago

Okay, this is ready for review. Changes:

  1. Adding sub-commands to modules is trivial now. The command line args are passed to the setup() function of the modules, so the setup() function can be modified to handle the sub-arguments.
  2. ./bin/exitmap -h prints out help about exitmap with also the available module names.
  3. ./bin/exitmap module -h prints out help about the specific module.
  4. Multiple modules cannot be called in a single command.

I haven't implemented any sub-commands yet, but they can be easily done once the sub-command lists for modules have been decided.