1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-11-14 09:05:17 +01:00

tor.sh: fix resetting proxy settings

This commit is contained in:
Matthias Kretschmann 2016-05-15 18:20:39 +02:00
parent 3fa1227d8f
commit 25fc17a8bf
Signed by: m
GPG Key ID: BD3C1F3EDD7831FC
6 changed files with 29 additions and 12 deletions

View File

@ -31,7 +31,7 @@ kbd
pre
display: block
padding: ($spacer/2) 12px
padding: 0
margin: 0 0 $spacer
line-height: $line-height
color: $code-color
@ -51,7 +51,7 @@ pre
white-space: pre
overflow: auto
display: block
padding: 0
padding: ($spacer/2) 12px
font-size: inherit
color: inherit
background-color: transparent
@ -69,5 +69,5 @@ code.language-shell
content: "$"
color: $text-color-dimmed
display: inline-block
margin-left: -1.5em
margin-left: -.5em
margin-right: .8em

View File

@ -4,17 +4,17 @@
.highlight .hll { background-color: #515151 }
.highlight { color: #cccccc }
.highlight .c { color: #999999 } /* Comment */
.highlight .c { color: #777 } /* Comment */
.highlight .err { color: #f2777a } /* Error */
.highlight .k { color: #cc99cc } /* Keyword */
.highlight .l { color: #f99157 } /* Literal */
.highlight .n { color: #cccccc } /* Name */
.highlight .o { color: #66cccc } /* Operator */
.highlight .p { color: #cccccc } /* Punctuation */
.highlight .cm { color: #999999 } /* Comment.Multiline */
.highlight .cp { color: #999999 } /* Comment.Preproc */
.highlight .c1 { color: #999999 } /* Comment.Single */
.highlight .cs { color: #999999 } /* Comment.Special */
.highlight .cm { color: #777 } /* Comment.Multiline */
.highlight .cp { color: #777 } /* Comment.Preproc */
.highlight .c1 { color: #777 } /* Comment.Single */
.highlight .cs { color: #777 } /* Comment.Special */
.highlight .gd { color: #f2777a } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gh { color: #cccccc; font-weight: bold } /* Generic.Heading */

View File

@ -130,7 +130,7 @@ $input-border-focus = $brand-cyan
/////////////////////////////////////
$code-bg = #343642
$code-color = #C1C2C3
$code-color = $brand-light
$kbd-bg = $code-bg
$kbd-color = $code-color

Binary file not shown.

Before

Width:  |  Height:  |  Size: 236 KiB

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 273 KiB

After

Width:  |  Height:  |  Size: 140 KiB

View File

@ -5,6 +5,7 @@ title: Simple Tor setup on Mac OS X
image: teaser-tor.png
author: Matthias Kretschmann
date: 2015-08-02 21:57:30.912218000 +02:00
updated: 2016-05-15 18:26:46+02:00
category:
tags:
@ -43,7 +44,7 @@ tor
Congratulations, you now have Tor running on your system. But none of your network traffic is routed through it yet.
In order for all your system traffic being routed through Tor you need to adjust your system's network proxy settings whih you can either do visually in the System Preferences or programmatically via OS X's builtin `networksetup`.
In order for all your system traffic being routed through Tor you need to adjust your system's network proxy settings which you can either do visually in the System Preferences or programmatically via OS X's builtin `networksetup`.
## Set network proxy settings via System Preferences
@ -82,14 +83,30 @@ sudo -v
# Keep-alive: update existing `sudo` time stamp until finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
# trap ctrl-c and call disable_proxy()
function disable_proxy() {
sudo networksetup -setsocksfirewallproxystate $INTERFACE off
echo "$(tput setaf 64)" #green
echo "SOCKS proxy disabled."
echo "$(tput sgr0)" # color reset
}
trap disable_proxy INT
# Let's roll
sudo networksetup -setsocksfirewallproxy $INTERFACE 127.0.0.1 9050 off
sudo networksetup -setsocksfirewallproxystate $INTERFACE on
echo "$(tput setaf 64)" # green
echo "SOCKS proxy 127.0.0.1:9050 enabled."
echo "$(tput setaf 136)" # orange
echo "Starting Tor..."
echo "$(tput sgr0)" # color reset
tor
sudo networksetup -setsocksfirewallproxystate $INTERFACE off
```
Save this script under something like `tor.sh` in one of your sourced `bin` folders and use it as a replacement for the general `tor` command. So you can just run
Save this script under something like `tor.sh` in one of your sourced `bin` folders, make it executable with `chmod + x` and use it as a replacement for the general `tor` command. So you can just run
```shell
tor.sh