Im getting an error i believe is being caused by my usage descriptions but cant work out why. The idea is to grab a list of valid users in a file (username password), split that into a dictionary and return the dictionary. Then grab a file of servers (ip perline), turn that into a list. Then ill call a subprocess to mtstc, either populating a .rdp conf file or directly entering creds on cli (not got this far yet)
Any help would be appreciated.
ERROR
unknown@ubuntu:~$ ./rdpcheck.py -u userpass.txt -s servers.txt
Traceback (most recent call last):
File "./rdpcheck.py", line 30, in <module>
arguments = docopt(__doc__, version='0.1a')
File "/usr/local/lib/python2.7/dist-packages/docopt.py", line 560, in docopt
pattern = parse_pattern(formal_usage(DocoptExit.usage), options)
File "/usr/local/lib/python2.7/dist-packages/docopt.py", line 373, in parse_pattern
result = parse_expr(tokens, options)
File "/usr/local/lib/python2.7/dist-packages/docopt.py", line 387, in parse_expr
seq = parse_seq(tokens, options)
File "/usr/local/lib/python2.7/dist-packages/docopt.py", line 396, in parse_seq
atom = parse_atom(tokens, options)
File "/usr/local/lib/python2.7/dist-packages/docopt.py", line 415, in parse_atom
raise tokens.error("unmatched '%s'" % token)
docopt.DocoptLanguageError: unmatched '('
CODE
#!/usr/bin/python
"""
Script to check valid login credentials have ability to rdp to list of server.
Usage:
rdpcheck.py (-u <user>) (-s <server>)
rdpcheck.py -h | --help
Options:
-u --user
-s --server
-h --help This help screen this screen.
"""
from docopt import docopt
def getuserpass(userpass):
list = {}
with open(userpass, 'r') as text:
for line in text:
key, value = line.split()
return list
def getservers(servers):
slist = open(servers).readlines()
return [s.replace('\n', '.') for s in slist]
if __name__ == "__main__":
arguments = docopt(__doc__, version='0.1a')
print arguments