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
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: