chetan51 / sidestep

A Mac OS X application that automatically secures your Internet connection in unprotected wireless networks through SSH tunneling.
http://chetansurpur.com/projects/sidestep
MIT License
282 stars 32 forks source link

Feature Suggestion: Run a bash (or other type) of script on connect, and another on disconnect #67

Closed sebastientaggart closed 4 years ago

sebastientaggart commented 8 years ago

Maybe there's already a recipe for how to do this, if so I'd love some direction.

My specific use case is that when sidestep runs, I need to update .gitconfig with proxy = socks5://localhost:9050, and on disconnect, disable the line.

My bash script actually comments or uncomments those lines, one in [http and one in [https], if anyone is interested, these are the commands in my .bash_profile:

alias gpoff="sed -i '' '/proxy/s/^/;/g' ~/.gitconfig"
alias gpon="sed -i '' '/proxy/s/^;//g' ~/.gitconfig"

Which simply changes these lines in .gitconfig from

[http]
    proxy = socks5://localhost:9050
[https]
    proxy = socks5://localhost:9050

to

[http]
;   proxy = socks5://localhost:9050
[https]
;   proxy = socks5://localhost:9050

Thanks!