I have a Mac and I'm programming a sort of security script (I know it's useless and overkill but I'm just trying to expand my knowledge of Python) and one of the steps in my script requires a password from the admin before it can execute.
I want to make it so this script will execute under certain circumstances and I don't want it to require any human interaction. I've tried doing the following:
os.system("sudo -s")
os.system("my password")
However, it tells me that I typed the password wrong (clearly Apple made it so you can't have a program type it).
In short, I've tried everything. I then figured out that you can copy and paste the password and it works. So my question is: how can I have my script copy and paste the password and then hit enter? Alternatively, is there a better way to achieve this?