Skip to content

Need to sanitize user input & perform error handling #24

@naveci

Description

@naveci

Hi all,

I was struggling a little with getting this script to work. I had the consistently the same error in the logs:

INFO:Executing the script in Verbose execution mode
INFO:Generating a JSessionID
ERROR:list index out of range
Traceback (most recent call last):
  File "sure.py", line 8354, in <module>
    jsessionid = generateSessionID(vmanage_lo_ip, args.username, password, args.vmanage_port)
  File "sure.py", line 211, in generateSessionID
    jsessionid = (login[3].split('=')[1][0:-1])
IndexError: list index out of range

The problem turns out to be in the password, because the user input was not sanitized. I had several special characters in the password, including a quote sign etc.
Perform error handling would've dealt with this issue in a better way. More importantly, sanitizing user input would prevent the script from breaking in the first place.

Metadata

Metadata

Assignees

Labels

assignedbugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions