0

So, I'd like to use python to make a code to simplify the process of using a remote server as a proxy to browse the internet.

I usually do this through the following two commands:

ssh -D 12345 -N user@host
chromium-browser --temp-profile --proxy-server="socks://127.0.0.1:12345

So, my first thought was to simply do the following with the os module:

os.system('ssh -D 12345 -N user@host')
os.system('chromium-browser --temp-profile --proxy-server="socks://127.0.0.1:12345')

However, the problem is that the first command starts a process which runs continuously in the terminal and which I need to stay running throughout my second command. But of course, the second command will not execute until the first process is finished.

I've considered using the threading module, but I'm not sure how well this would work with the Linux environment, or how I would even go about doing so.

If any could provide any assistance, it would be greatly appreciated.

njszym
  • 41
  • 7

1 Answers1

0

you can use the paramiko python module to perform a remote command over ssh.

OhadBasan
  • 797
  • 6
  • 15