1

So here is something that I haven't yet figured out how to do

How can I automate VPN connection and call some APIs through this connection?

I have something here where I have to turn on something like tunnelbear, connect to an American node, do an API call, then turn off the VPN, I just can't figure out a way to automate these steps without doing UI automation, and I don't plan on doing UI Automation for this case, I like to have something that works as a background processor that runs every few mins, typical script automation, but this time with VPN automation

So what are your suggestions?

Show me what you got!

Comments
  • 1
    OS? Is the program callable from CLI?
  • 0
    @vortexman100 doesnt matter which os, and yes I could get away with cli, the point is I need a way, whatever way to do this

    I thought of finding like a version of chrome where I can automate stuff and change it's network settings like how tunnelbear does it on the normal client then use that to call the APIs

    In short, whatever way, get creative, like if you were in my case how would you do it in a way where you don't force the os to change the network settings just for this reason?
  • 1
    Linux. Write a script which setups the vpn and does everything that needs to be done. Create a new user and setup ip tables to route everything this user does over the vpn network interface (which is almost always tun0) now launch the script with that user (sudo or directly, or cronjob for recurring tasks)

    Edit:
    Stackoverflow for iptables https://askubuntu.com/a/205510

    Cronjob and new user should be easy to find.
  • 0
    @Revenger There is no way to not force an OS, as system calls and general procedures differ.

    Also, youd have tp write a device driver if not using tools by the os, as the os handles all networking.
Add Comment