Giter VIP home page Giter VIP logo

Comments (7)

s4chin avatar s4chin commented on June 1, 2024

I'd like to take a crack at this; any suggestions/starting point/hints?

from exitmap.

NullHypothesis avatar NullHypothesis commented on June 1, 2024

Python's argparse module allows sub commands, which is probably what we need here:
https://docs.python.org/2.7/library/argparse.html#sub-commands

The idea is that modules can define their own sub commands that are then loaded by the main argument parsing code. That's all I have, unfortunately, so you will have to experiment a bit.

from exitmap.

s4chin avatar s4chin commented on June 1, 2024

I've run into a problem here. As I understand, this is what the call should look like for parameterised modules(just an example):

./bin/exitmap --first-hop CCEF02AA454C0AB0FE1AC68304F6D8C4220C1912 dns -d www.example.com 1.2.3.4 www.foobar.com 11.22.33.44 checktest

As we want to take multiple values for -d, i.e. multiple custom domains and IP addresses for dns, it takes checktest as a parameter for -d, which is a problem.
There is probably no elegant way to do this in the exitmap.py itself using subparsers.
It will have to be done like this:
./bin/exitmap dns -d www.example.com 1.2.3.4 www.foo.com 5.6.7.8 -- checktest
or by calling the script twice

./bin/exitmap dns -d www.example.com 1.2.3.4 www.foo.com 5.6.7.8
./bin/exitmap checktest

Plus, I then have to name all modules while writing the sub-parsers, and thus the parser will need to be modified every time a module is to be added or deleted.
A solution I can think of can be to parse the command-line arguments to the modules in the module itself, i.e. parse_known_args() in exitmap.py, and parse the remaining_argv in their respective modules.
What do you think?

from exitmap.

s4chin avatar s4chin commented on June 1, 2024

Could you give here a list parameters to the modules? So far you have given only an example and I would like to know the parameters to be able to code them.

from exitmap.

NullHypothesis avatar NullHypothesis commented on June 1, 2024

For the DNS module, I think we would certainly like a destination argument. That would also come in handy for the cloudflared module. We could also create an argument for the patchingCheck module, to instruct it to download arbitrary files.

It would be great if we could take the current values as default values, if no module argument is given.

from exitmap.

avhvr-zz avatar avhvr-zz commented on June 1, 2024

Can I proceed on this using optparse?

from exitmap.

NullHypothesis avatar NullHypothesis commented on June 1, 2024

Can I proceed on this using optparse?

Feel free to give it a shot!

from exitmap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.