jaredhendrickson13 / pfsense-automator

pfSense Automator - a command line tool to make pfSense configurations
18 stars 4 forks source link

Username & Password not read from CLI #15

Open voice1 opened 4 years ago

voice1 commented 4 years ago

It appears that supplying -u -p on the CLI does not get read unless you have a significantly long arg list.

./pfsense-automator.py 192.168.1.1 --check-auth -u admin -p pfsense
WARNING: Large numbers of authentication failures will enforce a pfSense lockout for your IP address. Proceed with caution.
Please enter username: admin
Please enter password:
Authentication successful

Reviewing the code it appears that you have opted not to use the python argparse utility to capture and enforce command line parameters and have instead opted to hardcode the positional arguments using sys.argv is there a reason for this?

A better way is to read all the variables in via argparse and then use them throughout where needed, this way you avoided repeating your self multiple times.