Requests made to non-pfSense pages are processed and throw traceback
Closed this issue · 1 comments
jaredhendrickson13 commented
Requests made to non-pfSense pages are still processed and parsing attempts are made. This is because we are only checking that the pfSense webUI port is open and not any content that is specific to pfSense. Perhaps we should implement a function that makes a basic GET request to check for expected pfSense content and return an expected error when pfSense content is not found:
$ python3 pfsense-automator.py www.google.com --add-dns test jh.co 0.0.0.0 default -u admin -p pfsense
Traceback (most recent call last):
File "pfsense-automator.py", line 1007, in <module>
main()
File "pfsense-automator.py", line 726, in main
addDnsExitCode = add_dns_entry(pfsenseServer, user, key, hostToAdd, domainToAdd, ipToAdd, descrToAdd)
File "pfsense-automator.py", line 396, in add_dns_entry
authCheckData = {"__csrf_magic": get_csrf_token(url + "/index.php", "GET"), "usernamefld": user, "passwordfld": key, "login": "Sign In"} # Define our login POST data
File "pfsense-automator.py", line 305, in get_csrf_token
csrfParsed = "sid:" + csrfResponse['text'].split("sid:")[1].split(";")[0].replace(" ", "").replace("\n", "").replace("\"", "")
IndexError: list index out of range
jaredhendrickson13 commented
This has been addressed in development commit e03f016feefff1fea49da07c0ffd22a9ecf9943b
. Will be deployed in v0.0.3.