问题
I am working on a script to monitor my outgoing website connections. As an example, if I connect to reddit, I'd like the IP address of Reddit to be logged.
I have this functionality down just fine, but in the future, I'd like someone else to be able to run my Python code as an EXE file. However, my script currently requires you to run as Sudo since it is sniffing the IP addresses.
I'd like non-technical users to be able to use my app by simply clicking an EXE or entering their password if prompted. In order for it to provide maximum benefit for the end user, they would need the ability for it to run on computer start-up rather than having to activate it manually.
How can you run a Python EXE for this purpose without needing the user to utilize the command line? (I know how to make an EXE, but I mean not needing to use sudo)
OS would be mac and windows.
来源:https://stackoverflow.com/questions/62226169/python-exe-to-request-sudo-access