Python getopt.getopt() Examples

The following are 30 code examples of getopt.getopt(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module getopt , or try the search function .
Example #1
Source File: runExploits.py    From firmanal with MIT License 10 votes vote down vote up
def main():
    exploits = []
    outfile = None
    if len (sys.argv) != 7:
        print ("Usage: ./runExploits.py -t <target-ip> -o <output-dir> -e <exploits>")
        print ("Note: <exploits> can be 'all' or a list of exploits seperated by ','")
        exit (1)
    opts, argv = getopt.getopt(sys.argv[1:], 'e:t:o:')
    for k, v in opts:
        if k == '-e':
            if v == 'all':
                exploits = list (METASPLOIT_EXPLOITS.keys()) + list (SHELL_EXPLOITS.keys())
            else:
                exploits = [int(x) for x in v.split(',')]
        if k == '-t':
            target = v
        if k == '-o':
            if not os.path.isdir(v):
                if os.path.exists(v):
                    os.remove(v)
                os.makedirs(v, 0o755);
            outfile = v + "/%(exploit)s.log"

    process(target, exploits, outfile) 
Example #2
Source File: base64.py    From jawfish with MIT License 9 votes vote down vote up
def main():
    """Small main program"""
    import sys, getopt
    try:
        opts, args = getopt.getopt(sys.argv[1:], 'deut')
    except getopt.error as msg:
        sys.stdout = sys.stderr
        print(msg)
        print("""usage: %s [-d|-e|-u|-t] [file|-]
        -d, -u: decode
        -e: encode (default)
        -t: encode and decode string 'Aladdin:open sesame'"""%sys.argv[0])
        sys.exit(2)
    func = encode
    for o, a in opts:
        if o == '-e': func = encode
        if o == '-d': func = decode
        if o == '-u': func = decode
        if o == '-t': test(); return
    if args and args[0] != '-':
        with open(args[0], 'rb') as f:
            func(f, sys.stdout.buffer)
    else:
        func(sys.stdin.buffer, sys.stdout.buffer) 
Example #3
Source File: ici.py    From ici with MIT License 7 votes vote down vote up
def main():
    try:
        options, args = getopt.getopt(sys.argv[1:], ["help"])
    except getopt.GetoptError as e:
        pass

    match = re.findall(r'[\w.]+', " ".join(args).lower())
    words = "_".join(match)
    response = get_response(words)
    if not response:
        return
    root = read_xml(response)
    show(root) 
Example #4
Source File: importdb.py    From firmanal with MIT License 6 votes vote down vote up
def main():
    infile = iid = None
    opts, argv = getopt.getopt(sys.argv[1:], "f:i:")
    for k, v in opts:
        if k == '-i':
            iid = int(v)
        if k == '-f':
            infile = v

    if infile and not iid:
        m = re.match(r"(\d+)\.tar\.gz", infile)
        if m:
            iid = int(m.groups(1))

    getarch (infile)
    process(iid, infile) 
Example #5
Source File: local_scores.py    From browserscope with Apache License 2.0 6 votes vote down vote up
def ParseArgs(argv):
  options, args = getopt.getopt(
      argv[1:],
      'h:e:p:f:',
      ['host=', 'email=', 'params=', 'mysql_default_file='])
  host = None
  gae_user = None
  params = None
  mysql_default_file = None
  for option_key, option_value in options:
    if option_key in ('-h', '--host'):
      host = option_value
    elif option_key in ('-e', '--email'):
      gae_user = option_value
    elif option_key in ('-p', '--params'):
      params = option_value
    elif option_key in ('-f', '--mysql_default_file'):
      mysql_default_file = option_value
  return host, gae_user, params, mysql_default_file, args 
Example #6
Source File: data_dump.py    From browserscope with Apache License 2.0 6 votes vote down vote up
def ParseArgs(argv):
  options, args = getopt.getopt(
      argv[1:],
      'h:e:f:rc',
      ['host=', 'email=', 'mysql_default_file=',
       'release', 'category_browsers_only'])
  host = None
  gae_user = None
  mysql_default_file = None
  is_release = False
  is_category_browsers_only = False
  for option_key, option_value in options:
    if option_key in ('-h', '--host'):
      host = option_value
    elif option_key in ('-e', '--email'):
      gae_user = option_value
    elif option_key in ('-f', '--mysql_default_file'):
      mysql_default_file = option_value
    elif option_key in ('-r', '--release'):
      is_release = True
    elif option_key in ('-c', '--category_browsers_only'):
      is_category_browsers_only = True
  return host, gae_user, mysql_default_file, is_release, is_category_browsers_only, args 
Example #7
Source File: rid.py    From razzy-spinner with GNU General Public License v3.0 6 votes vote down vote up
def run(self, args):
    rid = RegressiveImageryDictionary()
    load_default_dict = True
    load_default_exc = True
    html_output = False
    title = "RID Analysis"

    try:
      optlist, args = getopt.getopt(sys.argv[1:], 'd:e:ht:',
                                    ['add-dict=', 'add-exc='])
      for (o, v) in optlist:
        if o == '-d':
          rid.load_dictionary_from_file(v)
          load_default_dict = False
        elif o == '-e':
          rid.load_exclusion_list_from_file(v)
          load_default_exc = False
        elif o == '--add-dict':
          rid.load_dictionary_from_file(v)
        elif o == '--add-exc':
          rid.load_exclusion_list_from_file(v)
        elif o == '-h':
          html_output = True
        elif o == '-t':
          title = v
        else:
          sys.stderr.write("%s: illegal option '%s'\n" % (args[0], o))
          self.usage(args)
    except getopt.GetoptError, e:
      sys.stderr.write("%s: %s\n" % (args[0], e.msg))
      self.usage(args)
      sys.exit(1) 
Example #8
Source File: wordnet_app.py    From razzy-spinner with GNU General Public License v3.0 6 votes vote down vote up
def app():
    # Parse and interpret options.
    (opts, _) = getopt.getopt(argv[1:], "l:p:sh",
                              ["logfile=", "port=", "server-mode", "help"])
    port = 8000
    server_mode = False
    help_mode = False
    logfilename = None
    for (opt, value) in opts:
        if (opt == "-l") or (opt == "--logfile"):
            logfilename = str(value)
        elif (opt == "-p") or (opt == "--port"):
            port = int(value)
        elif (opt == "-s") or (opt == "--server-mode"):
            server_mode = True
        elif (opt == "-h") or (opt == "--help"):
            help_mode = True

    if help_mode:
        usage()
    else:
        wnb(port, not server_mode, logfilename) 
Example #9
Source File: admin.py    From browserscope with Apache License 2.0 6 votes vote down vote up
def ParseArgs(argv):
  options, args = getopt.getopt(
      argv[1:],
      'h:u:p:',
      ['host=', 'gae_user=', 'params='])
  host = None
  gae_user = None
  params = None
  for option_key, option_value in options:
    if option_key in ('-h', '--host'):
      host = option_value
    elif option_key in ('-u', '--gae_user'):
      gae_user = option_value
    elif option_key in ('-p', '--params'):
      params = option_value
  return host, gae_user, params, args 
Example #10
Source File: generate_mapping.py    From ovirt-ansible-disaster-recovery with Apache License 2.0 5 votes vote down vote up
def _init_vars(argv):
    url, username, password, ca, file_ = '', '', '', '', ''
    try:
        opts, args = \
            getopt.getopt(argv, "a:u:p:f:c:", ["a=", "u=", "p=", "f=", "c="])
    except getopt.GetoptError:
        print(
            '''
            -a <http://127.0.0.1:8080/ovirt-engine/api>\n
            -u <admin@portal>\n
            -p <password>\n
            -c </etc/pki/ovirt-engine/ca.pem>\n
            -f <disaster_recovery_vars.yml>
            ''')
        sys.exit(2)

    for opt, arg in opts:
        if opt == '-h':
            print(
                '''
                generate_mapping.py
                -a <http://127.0.0.1:8080/ovirt-engine/api>\n
                -u <admin@portal>\n
                -p <password>\n
                -c </etc/pki/ovirt-engine/ca.pem>\n
                -f <disaster_recovery_vars.yml>
                ''')
            sys.exit()
        elif opt in ("-a", "--url"):
            url = arg
        elif opt in ("-u", "--username"):
            username = arg
        elif opt in ("-p", "--password"):
            password = arg
        elif opt in ("-c", "--ca"):
            ca = arg
        elif opt in ("-f", "--file"):
            file_ = arg
    return url, username, password, ca, file_ 
Example #11
Source File: generate_mapping.py    From ovirt-ansible-disaster-recovery with Apache License 2.0 5 votes vote down vote up
def _init_vars(argv):
    url, username, password, ca, file_ = '', '', '', '', ''
    try:
        opts, args = \
            getopt.getopt(argv, "a:u:p:f:c:", ["a=", "u=", "p=", "f=", "c="])
    except getopt.GetoptError:
        print(
            '''
            -a <http://127.0.0.1:8080/ovirt-engine/api>\n
            -u <admin@portal>\n
            -p <password>\n
            -c </etc/pki/ovirt-engine/ca.pem>\n
            -f <disaster_recovery_vars.yml>
            ''')
        sys.exit(2)

    for opt, arg in opts:
        if opt == '-h':
            print(
                '''
                generate_mapping.py
                -a <http://127.0.0.1:8080/ovirt-engine/api>\n
                -u <admin@portal>\n
                -p <password>\n
                -c </etc/pki/ovirt-engine/ca.pem>\n
                -f <disaster_recovery_vars.yml>
                ''')
            sys.exit()
        elif opt in ("-a", "--url"):
            url = arg
        elif opt in ("-u", "--username"):
            username = arg
        elif opt in ("-p", "--password"):
            password = arg
        elif opt in ("-c", "--ca"):
            ca = arg
        elif opt in ("-f", "--file"):
            file_ = arg
    return url, username, password, ca, file_ 
Example #12
Source File: generate_mapping.py    From ovirt-ansible-disaster-recovery with Apache License 2.0 5 votes vote down vote up
def _init_vars(argv):
    url, username, password, ca, file_ = '', '', '', '', ''
    try:
        opts, args = \
            getopt.getopt(argv, "a:u:p:f:c:", ["a=", "u=", "p=", "f=", "c="])
    except getopt.GetoptError:
        print(
            '''
            -a <http://127.0.0.1:8080/ovirt-engine/api>\n
            -u <admin@portal>\n
            -p <password>\n
            -c </etc/pki/ovirt-engine/ca.pem>\n
            -f <disaster_recovery_vars.yml>
            ''')
        sys.exit(2)

    for opt, arg in opts:
        if opt == '-h':
            print(
                '''
                generate_mapping.py
                -a <http://127.0.0.1:8080/ovirt-engine/api>\n
                -u <admin@portal>\n
                -p <password>\n
                -c </etc/pki/ovirt-engine/ca.pem>\n
                -f <disaster_recovery_vars.yml>
                ''')
            sys.exit()
        elif opt in ("-a", "--url"):
            url = arg
        elif opt in ("-u", "--username"):
            username = arg
        elif opt in ("-p", "--password"):
            password = arg
        elif opt in ("-c", "--ca"):
            ca = arg
        elif opt in ("-f", "--file"):
            file_ = arg
    return url, username, password, ca, file_ 
Example #13
Source File: generate_mapping.py    From ovirt-ansible-disaster-recovery with Apache License 2.0 5 votes vote down vote up
def _init_vars(argv):
    url, username, password, ca, file_ = '', '', '', '', ''
    try:
        opts, args = \
            getopt.getopt(argv, "a:u:p:f:c:", ["a=", "u=", "p=", "f=", "c="])
    except getopt.GetoptError:
        print(
            '''
            -a <http://127.0.0.1:8080/ovirt-engine/api>\n
            -u <admin@portal>\n
            -p <password>\n
            -c </etc/pki/ovirt-engine/ca.pem>\n
            -f <disaster_recovery_vars.yml>
            ''')
        sys.exit(2)

    for opt, arg in opts:
        if opt == '-h':
            print(
                '''
                generate_mapping.py
                -a <http://127.0.0.1:8080/ovirt-engine/api>\n
                -u <admin@portal>\n
                -p <password>\n
                -c </etc/pki/ovirt-engine/ca.pem>\n
                -f <disaster_recovery_vars.yml>
                ''')
            sys.exit()
        elif opt in ("-a", "--url"):
            url = arg
        elif opt in ("-u", "--username"):
            username = arg
        elif opt in ("-p", "--password"):
            password = arg
        elif opt in ("-c", "--ca"):
            ca = arg
        elif opt in ("-f", "--file"):
            file_ = arg
    return url, username, password, ca, file_ 
Example #14
Source File: generate_mapping.py    From ovirt-ansible-disaster-recovery with Apache License 2.0 5 votes vote down vote up
def _init_vars(argv):
    url, username, password, ca, file_ = '', '', '', '', ''
    try:
        opts, args = \
            getopt.getopt(argv, "a:u:p:f:c:", ["a=", "u=", "p=", "f=", "c="])
    except getopt.GetoptError:
        print(
            '''
            -a <http://127.0.0.1:8080/ovirt-engine/api>\n
            -u <admin@portal>\n
            -p <password>\n
            -c </etc/pki/ovirt-engine/ca.pem>\n
            -f <disaster_recovery_vars.yml>
            ''')
        sys.exit(2)

    for opt, arg in opts:
        if opt == '-h':
            print(
                '''
                generate_mapping.py
                -a <http://127.0.0.1:8080/ovirt-engine/api>\n
                -u <admin@portal>\n
                -p <password>\n
                -c </etc/pki/ovirt-engine/ca.pem>\n
                -f <disaster_recovery_vars.yml>
                ''')
            sys.exit()
        elif opt in ("-a", "--url"):
            url = arg
        elif opt in ("-u", "--username"):
            username = arg
        elif opt in ("-p", "--password"):
            password = arg
        elif opt in ("-c", "--ca"):
            ca = arg
        elif opt in ("-f", "--file"):
            file_ = arg
    return url, username, password, ca, file_ 
Example #15
Source File: generate_mapping.py    From ovirt-ansible-disaster-recovery with Apache License 2.0 5 votes vote down vote up
def _init_vars(argv):
    url, username, password, ca, file_ = '', '', '', '', ''
    try:
        opts, args = \
            getopt.getopt(argv, "a:u:p:f:c:", ["a=", "u=", "p=", "f=", "c="])
    except getopt.GetoptError:
        print(
            '''
            -a <http://127.0.0.1:8080/ovirt-engine/api>\n
            -u <admin@portal>\n
            -p <password>\n
            -c </etc/pki/ovirt-engine/ca.pem>\n
            -f <disaster_recovery_vars.yml>
            ''')
        sys.exit(2)

    for opt, arg in opts:
        if opt == '-h':
            print(
                '''
                generate_mapping.py
                -a <http://127.0.0.1:8080/ovirt-engine/api>\n
                -u <admin@portal>\n
                -p <password>\n
                -c </etc/pki/ovirt-engine/ca.pem>\n
                -f <disaster_recovery_vars.yml>
                ''')
            sys.exit()
        elif opt in ("-a", "--url"):
            url = arg
        elif opt in ("-u", "--username"):
            username = arg
        elif opt in ("-p", "--password"):
            password = arg
        elif opt in ("-c", "--ca"):
            ca = arg
        elif opt in ("-f", "--file"):
            file_ = arg
    return url, username, password, ca, file_ 
Example #16
Source File: generate_mapping.py    From ovirt-ansible-disaster-recovery with Apache License 2.0 5 votes vote down vote up
def _init_vars(argv):
    url, username, password, ca, file_ = '', '', '', '', ''
    try:
        opts, args = \
            getopt.getopt(argv, "a:u:p:f:c:", ["a=", "u=", "p=", "f=", "c="])
    except getopt.GetoptError:
        print(
            '''
            -a <http://127.0.0.1:8080/ovirt-engine/api>\n
            -u <admin@portal>\n
            -p <password>\n
            -c </etc/pki/ovirt-engine/ca.pem>\n
            -f <disaster_recovery_vars.yml>
            ''')
        sys.exit(2)

    for opt, arg in opts:
        if opt == '-h':
            print(
                '''
                generate_mapping.py
                -a <http://127.0.0.1:8080/ovirt-engine/api>\n
                -u <admin@portal>\n
                -p <password>\n
                -c </etc/pki/ovirt-engine/ca.pem>\n
                -f <disaster_recovery_vars.yml>
                ''')
            sys.exit()
        elif opt in ("-a", "--url"):
            url = arg
        elif opt in ("-u", "--username"):
            username = arg
        elif opt in ("-p", "--password"):
            password = arg
        elif opt in ("-c", "--ca"):
            ca = arg
        elif opt in ("-f", "--file"):
            file_ = arg
    return url, username, password, ca, file_ 
Example #17
Source File: generate_mapping.py    From ovirt-ansible-disaster-recovery with Apache License 2.0 5 votes vote down vote up
def _init_vars(argv):
    url, username, password, ca, file_ = '', '', '', '', ''
    try:
        opts, args = \
            getopt.getopt(argv, "a:u:p:f:c:", ["a=", "u=", "p=", "f=", "c="])
    except getopt.GetoptError:
        print(
            '''
            -a <http://127.0.0.1:8080/ovirt-engine/api>\n
            -u <admin@portal>\n
            -p <password>\n
            -c </etc/pki/ovirt-engine/ca.pem>\n
            -f <disaster_recovery_vars.yml>
            ''')
        sys.exit(2)

    for opt, arg in opts:
        if opt == '-h':
            print(
                '''
                generate_mapping.py
                -a <http://127.0.0.1:8080/ovirt-engine/api>\n
                -u <admin@portal>\n
                -p <password>\n
                -c </etc/pki/ovirt-engine/ca.pem>\n
                -f <disaster_recovery_vars.yml>
                ''')
            sys.exit()
        elif opt in ("-a", "--url"):
            url = arg
        elif opt in ("-u", "--username"):
            username = arg
        elif opt in ("-p", "--password"):
            password = arg
        elif opt in ("-c", "--ca"):
            ca = arg
        elif opt in ("-f", "--file"):
            file_ = arg
    return url, username, password, ca, file_ 
Example #18
Source File: generate_mapping.py    From ovirt-ansible-disaster-recovery with Apache License 2.0 5 votes vote down vote up
def _init_vars(argv):
    url, username, password, ca, file_ = '', '', '', '', ''
    try:
        opts, args = \
            getopt.getopt(argv, "a:u:p:f:c:", ["a=", "u=", "p=", "f=", "c="])
    except getopt.GetoptError:
        print(
            '''
            -a <http://127.0.0.1:8080/ovirt-engine/api>\n
            -u <admin@portal>\n
            -p <password>\n
            -c </etc/pki/ovirt-engine/ca.pem>\n
            -f <disaster_recovery_vars.yml>
            ''')
        sys.exit(2)

    for opt, arg in opts:
        if opt == '-h':
            print(
                '''
                generate_mapping.py
                -a <http://127.0.0.1:8080/ovirt-engine/api>\n
                -u <admin@portal>\n
                -p <password>\n
                -c </etc/pki/ovirt-engine/ca.pem>\n
                -f <disaster_recovery_vars.yml>
                ''')
            sys.exit()
        elif opt in ("-a", "--url"):
            url = arg
        elif opt in ("-u", "--username"):
            username = arg
        elif opt in ("-p", "--password"):
            password = arg
        elif opt in ("-c", "--ca"):
            ca = arg
        elif opt in ("-f", "--file"):
            file_ = arg
    return url, username, password, ca, file_ 
Example #19
Source File: generate_mapping.py    From ovirt-ansible-disaster-recovery with Apache License 2.0 5 votes vote down vote up
def _init_vars(argv):
    url, username, password, ca, file_ = '', '', '', '', ''
    try:
        opts, args = \
            getopt.getopt(argv, "a:u:p:f:c:", ["a=", "u=", "p=", "f=", "c="])
    except getopt.GetoptError:
        print(
            '''
            -a <http://127.0.0.1:8080/ovirt-engine/api>\n
            -u <admin@portal>\n
            -p <password>\n
            -c </etc/pki/ovirt-engine/ca.pem>\n
            -f <disaster_recovery_vars.yml>
            ''')
        sys.exit(2)

    for opt, arg in opts:
        if opt == '-h':
            print(
                '''
                generate_mapping.py
                -a <http://127.0.0.1:8080/ovirt-engine/api>\n
                -u <admin@portal>\n
                -p <password>\n
                -c </etc/pki/ovirt-engine/ca.pem>\n
                -f <disaster_recovery_vars.yml>
                ''')
            sys.exit()
        elif opt in ("-a", "--url"):
            url = arg
        elif opt in ("-u", "--username"):
            username = arg
        elif opt in ("-p", "--password"):
            password = arg
        elif opt in ("-c", "--ca"):
            ca = arg
        elif opt in ("-f", "--file"):
            file_ = arg
    return url, username, password, ca, file_ 
Example #20
Source File: generate_mapping.py    From ovirt-ansible-disaster-recovery with Apache License 2.0 5 votes vote down vote up
def _init_vars(argv):
    url, username, password, ca, file_ = '', '', '', '', ''
    try:
        opts, args = \
            getopt.getopt(argv, "a:u:p:f:c:", ["a=", "u=", "p=", "f=", "c="])
    except getopt.GetoptError:
        print(
            '''
            -a <http://127.0.0.1:8080/ovirt-engine/api>\n
            -u <admin@portal>\n
            -p <password>\n
            -c </etc/pki/ovirt-engine/ca.pem>\n
            -f <disaster_recovery_vars.yml>
            ''')
        sys.exit(2)

    for opt, arg in opts:
        if opt == '-h':
            print(
                '''
                generate_mapping.py
                -a <http://127.0.0.1:8080/ovirt-engine/api>\n
                -u <admin@portal>\n
                -p <password>\n
                -c </etc/pki/ovirt-engine/ca.pem>\n
                -f <disaster_recovery_vars.yml>
                ''')
            sys.exit()
        elif opt in ("-a", "--url"):
            url = arg
        elif opt in ("-u", "--username"):
            username = arg
        elif opt in ("-p", "--password"):
            password = arg
        elif opt in ("-c", "--ca"):
            ca = arg
        elif opt in ("-f", "--file"):
            file_ = arg
    return url, username, password, ca, file_ 
Example #21
Source File: generate_mapping.py    From ovirt-ansible-disaster-recovery with Apache License 2.0 5 votes vote down vote up
def _init_vars(argv):
    url, username, password, ca, file_ = '', '', '', '', ''
    try:
        opts, args = \
            getopt.getopt(argv, "a:u:p:f:c:", ["a=", "u=", "p=", "f=", "c="])
    except getopt.GetoptError:
        print(
            '''
            -a <http://127.0.0.1:8080/ovirt-engine/api>\n
            -u <admin@portal>\n
            -p <password>\n
            -c </etc/pki/ovirt-engine/ca.pem>\n
            -f <disaster_recovery_vars.yml>
            ''')
        sys.exit(2)

    for opt, arg in opts:
        if opt == '-h':
            print(
                '''
                generate_mapping.py
                -a <http://127.0.0.1:8080/ovirt-engine/api>\n
                -u <admin@portal>\n
                -p <password>\n
                -c </etc/pki/ovirt-engine/ca.pem>\n
                -f <disaster_recovery_vars.yml>
                ''')
            sys.exit()
        elif opt in ("-a", "--url"):
            url = arg
        elif opt in ("-u", "--username"):
            username = arg
        elif opt in ("-p", "--password"):
            password = arg
        elif opt in ("-c", "--ca"):
            ca = arg
        elif opt in ("-f", "--file"):
            file_ = arg
    return url, username, password, ca, file_ 
Example #22
Source File: generate_mapping.py    From ovirt-ansible-disaster-recovery with Apache License 2.0 5 votes vote down vote up
def _init_vars(argv):
    url, username, password, ca, file_ = '', '', '', '', ''
    try:
        opts, args = \
            getopt.getopt(argv, "a:u:p:f:c:", ["a=", "u=", "p=", "f=", "c="])
    except getopt.GetoptError:
        print(
            '''
            -a <http://127.0.0.1:8080/ovirt-engine/api>\n
            -u <admin@portal>\n
            -p <password>\n
            -c </etc/pki/ovirt-engine/ca.pem>\n
            -f <disaster_recovery_vars.yml>
            ''')
        sys.exit(2)

    for opt, arg in opts:
        if opt == '-h':
            print(
                '''
                generate_mapping.py
                -a <http://127.0.0.1:8080/ovirt-engine/api>\n
                -u <admin@portal>\n
                -p <password>\n
                -c </etc/pki/ovirt-engine/ca.pem>\n
                -f <disaster_recovery_vars.yml>
                ''')
            sys.exit()
        elif opt in ("-a", "--url"):
            url = arg
        elif opt in ("-u", "--username"):
            username = arg
        elif opt in ("-p", "--password"):
            password = arg
        elif opt in ("-c", "--ca"):
            ca = arg
        elif opt in ("-f", "--file"):
            file_ = arg
    return url, username, password, ca, file_ 
Example #23
Source File: generate_mapping.py    From ovirt-ansible-disaster-recovery with Apache License 2.0 5 votes vote down vote up
def _init_vars(argv):
    url, username, password, ca, file_ = '', '', '', '', ''
    try:
        opts, args = \
            getopt.getopt(argv, "a:u:p:f:c:", ["a=", "u=", "p=", "f=", "c="])
    except getopt.GetoptError:
        print(
            '''
            -a <http://127.0.0.1:8080/ovirt-engine/api>\n
            -u <admin@portal>\n
            -p <password>\n
            -c </etc/pki/ovirt-engine/ca.pem>\n
            -f <disaster_recovery_vars.yml>
            ''')
        sys.exit(2)

    for opt, arg in opts:
        if opt == '-h':
            print(
                '''
                generate_mapping.py
                -a <http://127.0.0.1:8080/ovirt-engine/api>\n
                -u <admin@portal>\n
                -p <password>\n
                -c </etc/pki/ovirt-engine/ca.pem>\n
                -f <disaster_recovery_vars.yml>
                ''')
            sys.exit()
        elif opt in ("-a", "--url"):
            url = arg
        elif opt in ("-u", "--username"):
            username = arg
        elif opt in ("-p", "--password"):
            password = arg
        elif opt in ("-c", "--ca"):
            ca = arg
        elif opt in ("-f", "--file"):
            file_ = arg
    return url, username, password, ca, file_ 
Example #24
Source File: generate_mapping.py    From ovirt-ansible-disaster-recovery with Apache License 2.0 5 votes vote down vote up
def _init_vars(argv):
    url, username, password, ca, file_ = '', '', '', '', ''
    try:
        opts, args = \
            getopt.getopt(argv, "a:u:p:f:c:", ["a=", "u=", "p=", "f=", "c="])
    except getopt.GetoptError:
        print(
            '''
            -a <http://127.0.0.1:8080/ovirt-engine/api>\n
            -u <admin@portal>\n
            -p <password>\n
            -c </etc/pki/ovirt-engine/ca.pem>\n
            -f <disaster_recovery_vars.yml>
            ''')
        sys.exit(2)

    for opt, arg in opts:
        if opt == '-h':
            print(
                '''
                generate_mapping.py
                -a <http://127.0.0.1:8080/ovirt-engine/api>\n
                -u <admin@portal>\n
                -p <password>\n
                -c </etc/pki/ovirt-engine/ca.pem>\n
                -f <disaster_recovery_vars.yml>
                ''')
            sys.exit()
        elif opt in ("-a", "--url"):
            url = arg
        elif opt in ("-u", "--username"):
            username = arg
        elif opt in ("-p", "--password"):
            password = arg
        elif opt in ("-c", "--ca"):
            ca = arg
        elif opt in ("-f", "--file"):
            file_ = arg
    return url, username, password, ca, file_ 
Example #25
Source File: generate_mapping.py    From ovirt-ansible-disaster-recovery with Apache License 2.0 5 votes vote down vote up
def _init_vars(argv):
    url, username, password, ca, file_ = '', '', '', '', ''
    try:
        opts, args = \
            getopt.getopt(argv, "a:u:p:f:c:", ["a=", "u=", "p=", "f=", "c="])
    except getopt.GetoptError:
        print(
            '''
            -a <http://127.0.0.1:8080/ovirt-engine/api>\n
            -u <admin@portal>\n
            -p <password>\n
            -c </etc/pki/ovirt-engine/ca.pem>\n
            -f <disaster_recovery_vars.yml>
            ''')
        sys.exit(2)

    for opt, arg in opts:
        if opt == '-h':
            print(
                '''
                generate_mapping.py
                -a <http://127.0.0.1:8080/ovirt-engine/api>\n
                -u <admin@portal>\n
                -p <password>\n
                -c </etc/pki/ovirt-engine/ca.pem>\n
                -f <disaster_recovery_vars.yml>
                ''')
            sys.exit()
        elif opt in ("-a", "--url"):
            url = arg
        elif opt in ("-u", "--username"):
            username = arg
        elif opt in ("-p", "--password"):
            password = arg
        elif opt in ("-c", "--ca"):
            ca = arg
        elif opt in ("-f", "--file"):
            file_ = arg
    return url, username, password, ca, file_ 
Example #26
Source File: generate_mapping.py    From ovirt-ansible-disaster-recovery with Apache License 2.0 5 votes vote down vote up
def _init_vars(argv):
    url, username, password, ca, file_ = '', '', '', '', ''
    try:
        opts, args = \
            getopt.getopt(argv, "a:u:p:f:c:", ["a=", "u=", "p=", "f=", "c="])
    except getopt.GetoptError:
        print(
            '''
            -a <http://127.0.0.1:8080/ovirt-engine/api>\n
            -u <admin@portal>\n
            -p <password>\n
            -c </etc/pki/ovirt-engine/ca.pem>\n
            -f <disaster_recovery_vars.yml>
            ''')
        sys.exit(2)

    for opt, arg in opts:
        if opt == '-h':
            print(
                '''
                generate_mapping.py
                -a <http://127.0.0.1:8080/ovirt-engine/api>\n
                -u <admin@portal>\n
                -p <password>\n
                -c </etc/pki/ovirt-engine/ca.pem>\n
                -f <disaster_recovery_vars.yml>
                ''')
            sys.exit()
        elif opt in ("-a", "--url"):
            url = arg
        elif opt in ("-u", "--username"):
            username = arg
        elif opt in ("-p", "--password"):
            password = arg
        elif opt in ("-c", "--ca"):
            ca = arg
        elif opt in ("-f", "--file"):
            file_ = arg
    return url, username, password, ca, file_ 
Example #27
Source File: generate_mapping.py    From ovirt-ansible-disaster-recovery with Apache License 2.0 5 votes vote down vote up
def _init_vars(argv):
    url, username, password, ca, file_ = '', '', '', '', ''
    try:
        opts, args = \
            getopt.getopt(argv, "a:u:p:f:c:", ["a=", "u=", "p=", "f=", "c="])
    except getopt.GetoptError:
        print(
            '''
            -a <http://127.0.0.1:8080/ovirt-engine/api>\n
            -u <admin@portal>\n
            -p <password>\n
            -c </etc/pki/ovirt-engine/ca.pem>\n
            -f <disaster_recovery_vars.yml>
            ''')
        sys.exit(2)

    for opt, arg in opts:
        if opt == '-h':
            print(
                '''
                generate_mapping.py
                -a <http://127.0.0.1:8080/ovirt-engine/api>\n
                -u <admin@portal>\n
                -p <password>\n
                -c </etc/pki/ovirt-engine/ca.pem>\n
                -f <disaster_recovery_vars.yml>
                ''')
            sys.exit()
        elif opt in ("-a", "--url"):
            url = arg
        elif opt in ("-u", "--username"):
            username = arg
        elif opt in ("-p", "--password"):
            password = arg
        elif opt in ("-c", "--ca"):
            ca = arg
        elif opt in ("-f", "--file"):
            file_ = arg
    return url, username, password, ca, file_ 
Example #28
Source File: generate_mapping.py    From ovirt-ansible-disaster-recovery with Apache License 2.0 5 votes vote down vote up
def _init_vars(argv):
    url, username, password, ca, file_ = '', '', '', '', ''
    try:
        opts, args = \
            getopt.getopt(argv, "a:u:p:f:c:", ["a=", "u=", "p=", "f=", "c="])
    except getopt.GetoptError:
        print(
            '''
            -a <http://127.0.0.1:8080/ovirt-engine/api>\n
            -u <admin@portal>\n
            -p <password>\n
            -c </etc/pki/ovirt-engine/ca.pem>\n
            -f <disaster_recovery_vars.yml>
            ''')
        sys.exit(2)

    for opt, arg in opts:
        if opt == '-h':
            print(
                '''
                generate_mapping.py
                -a <http://127.0.0.1:8080/ovirt-engine/api>\n
                -u <admin@portal>\n
                -p <password>\n
                -c </etc/pki/ovirt-engine/ca.pem>\n
                -f <disaster_recovery_vars.yml>
                ''')
            sys.exit()
        elif opt in ("-a", "--url"):
            url = arg
        elif opt in ("-u", "--username"):
            username = arg
        elif opt in ("-p", "--password"):
            password = arg
        elif opt in ("-c", "--ca"):
            ca = arg
        elif opt in ("-f", "--file"):
            file_ = arg
    return url, username, password, ca, file_ 
Example #29
Source File: generate_mapping.py    From ovirt-ansible-disaster-recovery with Apache License 2.0 5 votes vote down vote up
def _init_vars(argv):
    url, username, password, ca, file_ = '', '', '', '', ''
    try:
        opts, args = \
            getopt.getopt(argv, "a:u:p:f:c:", ["a=", "u=", "p=", "f=", "c="])
    except getopt.GetoptError:
        print(
            '''
            -a <http://127.0.0.1:8080/ovirt-engine/api>\n
            -u <admin@portal>\n
            -p <password>\n
            -c </etc/pki/ovirt-engine/ca.pem>\n
            -f <disaster_recovery_vars.yml>
            ''')
        sys.exit(2)

    for opt, arg in opts:
        if opt == '-h':
            print(
                '''
                generate_mapping.py
                -a <http://127.0.0.1:8080/ovirt-engine/api>\n
                -u <admin@portal>\n
                -p <password>\n
                -c </etc/pki/ovirt-engine/ca.pem>\n
                -f <disaster_recovery_vars.yml>
                ''')
            sys.exit()
        elif opt in ("-a", "--url"):
            url = arg
        elif opt in ("-u", "--username"):
            username = arg
        elif opt in ("-p", "--password"):
            password = arg
        elif opt in ("-c", "--ca"):
            ca = arg
        elif opt in ("-f", "--file"):
            file_ = arg
    return url, username, password, ca, file_ 
Example #30
Source File: generate_mapping.py    From ovirt-ansible-disaster-recovery with Apache License 2.0 5 votes vote down vote up
def _init_vars(argv):
    url, username, password, ca, file_ = '', '', '', '', ''
    try:
        opts, args = \
            getopt.getopt(argv, "a:u:p:f:c:", ["a=", "u=", "p=", "f=", "c="])
    except getopt.GetoptError:
        print(
            '''
            -a <http://127.0.0.1:8080/ovirt-engine/api>\n
            -u <admin@portal>\n
            -p <password>\n
            -c </etc/pki/ovirt-engine/ca.pem>\n
            -f <disaster_recovery_vars.yml>
            ''')
        sys.exit(2)

    for opt, arg in opts:
        if opt == '-h':
            print(
                '''
                generate_mapping.py
                -a <http://127.0.0.1:8080/ovirt-engine/api>\n
                -u <admin@portal>\n
                -p <password>\n
                -c </etc/pki/ovirt-engine/ca.pem>\n
                -f <disaster_recovery_vars.yml>
                ''')
            sys.exit()
        elif opt in ("-a", "--url"):
            url = arg
        elif opt in ("-u", "--username"):
            username = arg
        elif opt in ("-p", "--password"):
            password = arg
        elif opt in ("-c", "--ca"):
            ca = arg
        elif opt in ("-f", "--file"):
            file_ = arg
    return url, username, password, ca, file_