Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
Simple script that starts a service at router level
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Miller_" data-source="post: 1795525" data-attributes="member: 148127"><p>Yeah, you start the VPN at router level and <em>all</em> traffic will be directed through the VPN. As opposed to starting a VPN session on the computer, which only affects the machine in question. It comes really useful when you have devices not capable of initiating a VPN connection on their own, like an apple TV for instance.</p><p></p><p></p><p>Thanks for the input guys, I came up with a very basic code in the meantime:</p><p></p><p><span style="font-family: 'Courier New'">tell application "Terminal"</span></p><p><span style="font-family: 'Courier New'"> activate</span></p><p><span style="font-family: 'Courier New'"> do script "ssh root@192.168.1.1"</span></p><p><span style="font-family: 'Courier New'"> delay 3</span></p><p><span style="font-family: 'Courier New'"> tell application "System Events"</span></p><p><span style="font-family: 'Courier New'"> keystroke "myPassword"</span></p><p><span style="font-family: 'Courier New'"> keystroke return</span></p><p><span style="font-family: 'Courier New'"> keystroke "/etc/init.d/openvpn start"</span></p><p><span style="font-family: 'Courier New'"> keystroke return</span></p><p><span style="font-family: 'Courier New'"> delay 1</span></p><p><span style="font-family: 'Courier New'"> keystroke "exit"</span></p><p><span style="font-family: 'Courier New'"> keystroke return</span></p><p><span style="font-family: 'Courier New'"> delay 1</span></p><p><span style="font-family: 'Courier New'"> end tell</span></p><p><span style="font-family: 'Courier New'"> quit application "Terminal"</span></p><p><span style="font-family: 'Courier New'">end tell</span></p><p></p><p>It actually works very well, but not what you suggested Raz0rEdge - the biggest problem being with the password out in the open. So I use Expect to fix that, but I'm really struggling to understand how it works. How would the password <em>not be</em> 'in the open' with Expect?</p></blockquote><p></p>
[QUOTE="Miller_, post: 1795525, member: 148127"] Yeah, you start the VPN at router level and [I]all[/I] traffic will be directed through the VPN. As opposed to starting a VPN session on the computer, which only affects the machine in question. It comes really useful when you have devices not capable of initiating a VPN connection on their own, like an apple TV for instance. Thanks for the input guys, I came up with a very basic code in the meantime: [FONT=Courier New]tell application "Terminal" activate do script "ssh root@192.168.1.1" delay 3 tell application "System Events" keystroke "myPassword" keystroke return keystroke "/etc/init.d/openvpn start" keystroke return delay 1 keystroke "exit" keystroke return delay 1 end tell quit application "Terminal" end tell[/FONT] It actually works very well, but not what you suggested Raz0rEdge - the biggest problem being with the password out in the open. So I use Expect to fix that, but I'm really struggling to understand how it works. How would the password [I]not be[/I] 'in the open' with Expect? [/QUOTE]
Verification
Post reply
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
Simple script that starts a service at router level
Top