I was wondering if it is possible to change the password for a wifi with a script instead of having to log-in to the routers firmware?
It is possible to do this with a script, but the script will have to "login to the routers firmware."
So, if you are trying to do this as a way of avoiding having to login..then no.
If you have the router credentials, and are looking for a way to automate the changing of keys, then yes, this is entirely possible. Also, like Polynomial said, it is sometimes possible to do this with built in management protocols. It would depend on the Make/Model of your router though.
More details are needed if you want specifics.
I'm not aware of any routers providing an easy API to change your wifi password in an automatic fashion.
However, every wifi router that I have used makes it possible to change the wifi password by logging into the router through a web browser using HTTP requests (GET / POST).
Thus its possible to automate out these activities if you want; granted it will be specific to your specific webbrowser. E.g., in python I can get to my router with using requests
Granted how to change the password, depends on the specific router, what POST variables it wants, what URL is required, etc.
Yes.. and no.
It's possible to do anything you want, but you have to address correct problem to right target:
As the first manager of your access via wifi is THE wifi router himself, the first thing to consider IS the router.
Depending on which router you use. I like DD-WRT open software as router's firmware. Based on Linux, I'm in known envionment. Support SSH remote access, with ssh keys, shell scripting, cron and a lot of other feature I know and have well tools and samples.
Secondly (if else), you could enable Radius on wifi router than maintain logins on radius server.