예제 #1
0
파일: main.py 프로젝트: getdrive/commix
        # Check if defined "--timesec" option.
        if menu.options.timesec > 0:
            settings.TIMESEC = menu.options.timesec
        else:
            if menu.options.tor:
                settings.TIMESEC = 10
                warn_msg = "Increasing default value for option '--time-sec' to"
                warn_msg += " " + str(
                    settings.TIMESEC
                ) + ", because switch '--tor' was provided."
                print(settings.print_warning_msg(warn_msg))

        # Local IP address
        if not menu.options.offline:
            settings.LOCAL_HTTP_IP = simple_http_server.grab_ip_addr()
        else:
            settings.LOCAL_HTTP_IP = None

        # Check arguments
        if len(sys.argv) == 1:
            menu.parser.print_help()
            print("")
            raise SystemExit()
        else:
            # Check for INJECT_HERE tag.
            inject_tag_regex_match = re.search(
                settings.INJECT_TAG_REGEX, ",".join(str(x) for x in sys.argv))
            if inject_tag_regex_match:
                settings.INJECT_TAG = inject_tag_regex_match.group(0)
예제 #2
0
    if menu.options.delay > 0:
      settings.DELAY = menu.options.delay

    # Check if defined "--timesec" option.
    if menu.options.timesec > 0:
      settings.TIMESEC = menu.options.timesec
    else:
      if menu.options.tor:
        settings.TIMESEC = 10
        warn_msg = "Increasing default value for option '--time-sec' to"
        warn_msg += " " + str(settings.TIMESEC) + " because switch '--tor' was provided."
        print settings.print_warning_msg(warn_msg)  

    # Local IP address
    if not menu.options.offline:
      settings.LOCAL_HTTP_IP = simple_http_server.grab_ip_addr()
    else:
      settings.LOCAL_HTTP_IP = None  

    # Check arguments
    if len(sys.argv) == 1:
      menu.parser.print_help()
      print ""
      raise SystemExit()
    else:
      # Check for INJECT_HERE tag.
      inject_tag_regex_match = re.search(settings.INJECT_TAG_REGEX, ",".join(str(x) for x in sys.argv))
      if inject_tag_regex_match:
        settings.INJECT_TAG = inject_tag_regex_match.group(0)

    # Define the level of verbosity.