options.py 1.7 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #!/usr/bin/env python
  2. # -*- coding: iso-8859-15 -*-
  3. """
  4. BC (Border-Check) is a tool to retrieve info of traceroute tests over website navigation routes.
  5. GPLv3 - 2013-2014-2015 by psy (epsylon@riseup.net)
  6. """
  7. import optparse
  8. import json
  9. class BCOptions(optparse.OptionParser):
  10. def __init__(self, *args):
  11. optparse.OptionParser.__init__(self,
  12. prog='bc.py',
  13. version='\nBC (Border-Check) v0.2 - 2015 - (GPLv3.0)\n',
  14. usage= '\n\nbc [OPTIONS]')
  15. self.add_option("-w", "--wizard", action="store_true", dest="wizard", help="wizard installer")
  16. self.add_option("-d", "--debug", action="store_true", dest="debug", help="debug mode")
  17. self.add_option("-l", action="store", dest="lft_path", help="path to lft (fetch from source or use provided binary)")
  18. self.add_option("--xml", action="store", dest="export_xml", help="export traces to xml (ex: --xml foo.xml)")
  19. self.add_option("--load", action="store", dest="import_xml", help="import traces (non root required) (ex: --load bar.xml)")
  20. self.add_option("--bh", action="store", dest="browser_history", help="set browser's history path")
  21. self.add_option("-b", action="store", dest="browser", help="set browser type to be used: F = Firefox / C = Chrome / S = Safari / Ch = Chromium / N = None")
  22. #self.add_option("--proxy", action="store", dest="proxy", help="set proxy server")
  23. self._options={}
  24. def get_options(self, user_args=None):
  25. (options, args) = self.parse_args(user_args)
  26. self._options=options
  27. return options
  28. def save_options(self):
  29. optionfile=open("options.json","w")
  30. json.dump(self._options,optionfile)