sheepsafe 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +20 -15
- data/bin/sheepsafe +6 -2
- data/lib/sheepsafe/config.rb +4 -4
- data/lib/sheepsafe/controller.rb +20 -21
- data/lib/sheepsafe/installer.rb +26 -22
- data/lib/sheepsafe/network.rb +6 -4
- data/lib/sheepsafe.rb +1 -2
- data/sheepsafe.gemspec +5 -6
- data/spec/sheepsafe_spec.rb +56 -27
- metadata +13 -29
- data/doc/add-untrusted-apply.jpg +0 -0
- data/doc/edit-locations.jpg +0 -0
- data/lib/sheepsafe/status.rb +0 -14
data/README.md
CHANGED
@@ -5,7 +5,14 @@ http://github.com/nicksieger/sheepsafe
|
|
5
5
|
|
6
6
|
## Description
|
7
7
|
|
8
|
-
Sheepsafe is a small utility to keep you safe from [FireSheep][]!
|
8
|
+
Sheepsafe is a small utility to keep you safe from [FireSheep][]!
|
9
|
+
It's a tool for mobile geeks.
|
10
|
+
|
11
|
+
We all know the cookie-stealing issue has been out there for a while,
|
12
|
+
but now with [FireSheep][], it just got way too easy. If you're like
|
13
|
+
me, I don't want to get exposed at the next gathering of techies at a
|
14
|
+
conference or even at a local coffee shop with this thing out there.
|
15
|
+
So I built Sheepsafe for myself.
|
9
16
|
|
10
17
|
Sheepsafe was built to automate the task of switching your network
|
11
18
|
configuration to use a SOCKS proxy whenever you join an untrusted
|
@@ -34,29 +41,21 @@ but this setup Works For Me.
|
|
34
41
|
|
35
42
|
## Install
|
36
43
|
|
37
|
-
- First install the gem:
|
38
|
-
|
44
|
+
- First install the gem:
|
45
|
+
sudo gem install sheepsafe
|
46
|
+
It's recommended to install using the system Ruby to minimize
|
39
47
|
difficulties informing launchd about an [RVM][] or some other
|
40
48
|
package manager.
|
41
49
|
- After installing the gem, run `sheepsafe install` and follow the
|
42
50
|
prompts for configuring Sheepsafe.
|
43
51
|
|
44
|
-
### Setting up the "Untrusted" location
|
45
|
-
|
46
|
-
One manual step that you need to do during installation is to create
|
47
|
-
an "Untrusted" location for Sheepsafe to configure and use when you're
|
48
|
-
on an untrusted network. Sheepsafe will prompt you to do these steps
|
49
|
-
during installation.
|
50
|
-
|
51
|
-
![Edit locations...](http://github.com/nicksieger/sheepsafe/raw/master/doc/edit-locations.jpg)
|
52
|
-
|
53
|
-
![Add Untrusted and Apply...](http://github.com/nicksieger/sheepsafe/raw/master/doc/add-untrusted-apply.jpg)
|
54
|
-
|
55
52
|
## Growl
|
56
53
|
|
57
54
|
If you wish to receive Growl notifications when Sheepsafe is switching
|
58
55
|
your location, be sure to install the `growlnotify` utility from the
|
59
|
-
"Extras" folder in the Growl .dmg.
|
56
|
+
"Extras" folder in the Growl .dmg. Then install the `growl` gem:
|
57
|
+
|
58
|
+
sudo gem install growl
|
60
59
|
|
61
60
|
## Post-install
|
62
61
|
|
@@ -68,6 +67,12 @@ settings for making connections, where applicable.
|
|
68
67
|
- Run `sheepsafe uninstall` to unregister the Launchd task and remove
|
69
68
|
Sheepsafe vestiges from your system.
|
70
69
|
|
70
|
+
## Give back
|
71
|
+
|
72
|
+
I'll gladly accept [pull requests][pr] and [bug reports][issues].
|
73
|
+
|
71
74
|
[FireSheep]: http://codebutler.com/firesheep
|
72
75
|
[RVM]: http://rvm.beginrescueend.com/
|
73
76
|
[polo]: http://www.symonds.id.au/marcopolo/
|
77
|
+
[pr]: http://github.com/nicksieger/sheepsafe/pulls
|
78
|
+
[issues]: http://github.com/nicksieger/sheepsafe/issues
|
data/bin/sheepsafe
CHANGED
@@ -8,9 +8,13 @@ rescue LoadError
|
|
8
8
|
require 'sheepsafe'
|
9
9
|
end
|
10
10
|
|
11
|
-
if ARGV.length == 1
|
11
|
+
if ARGV.length == 1
|
12
12
|
installer = Sheepsafe::Installer.new
|
13
|
-
|
13
|
+
if installer.respond_to?(ARGV.first)
|
14
|
+
installer.send(ARGV.first)
|
15
|
+
else
|
16
|
+
abort "unknown command #{ARGV.first}. Try 'install', 'update', or 'uninstall'."
|
17
|
+
end
|
14
18
|
else
|
15
19
|
# Allow network changes to sink in for a couple more seconds
|
16
20
|
sleep 2
|
data/lib/sheepsafe/config.rb
CHANGED
@@ -8,9 +8,9 @@ module Sheepsafe
|
|
8
8
|
ARRAY_ATTRS = %w(trusted_names)
|
9
9
|
|
10
10
|
def self.load_config
|
11
|
-
|
12
|
-
rescue
|
13
|
-
raise "Unable to read
|
11
|
+
YAML.load_file(FILE)
|
12
|
+
rescue Errno::ENOENT
|
13
|
+
raise "Unable to read ~/.sheepsafe.yml; please run sheepsafe-install"
|
14
14
|
end
|
15
15
|
|
16
16
|
attr_reader :config
|
@@ -30,7 +30,7 @@ module Sheepsafe
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def write
|
33
|
-
File.open(FILE, "w") {|f| f << YAML.dump(
|
33
|
+
File.open(FILE, "w") {|f| f << YAML.dump(config) }
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
data/lib/sheepsafe/controller.rb
CHANGED
@@ -1,18 +1,21 @@
|
|
1
1
|
require 'daemons'
|
2
2
|
require 'logger'
|
3
|
-
|
3
|
+
begin
|
4
|
+
require 'growl'
|
5
|
+
rescue LoadError
|
6
|
+
end
|
4
7
|
|
5
8
|
module Sheepsafe
|
6
9
|
class Controller
|
7
10
|
LOG_FILE = Sheepsafe::Config::FILE.sub(/\.yml/, '.log')
|
8
11
|
|
9
|
-
def initialize(config = nil,
|
10
|
-
@config
|
11
|
-
@
|
12
|
-
@logger
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
def initialize(config = nil, network = nil, logger = nil)
|
13
|
+
@config = config || Sheepsafe::Config.new
|
14
|
+
@network = network || Sheepsafe::Network.new(@config)
|
15
|
+
@logger = logger || begin
|
16
|
+
STDOUT.reopen(File.open(LOG_FILE, (File::WRONLY | File::APPEND)))
|
17
|
+
Logger.new(STDOUT)
|
18
|
+
end
|
16
19
|
end
|
17
20
|
|
18
21
|
def run
|
@@ -28,7 +31,7 @@ module Sheepsafe
|
|
28
31
|
bring_socks_proxy 'up'
|
29
32
|
system "scselect #{@config.untrusted_location}"
|
30
33
|
end
|
31
|
-
@config.last_network = @
|
34
|
+
@config.last_network = @network
|
32
35
|
@config.write
|
33
36
|
end
|
34
37
|
else
|
@@ -38,19 +41,19 @@ module Sheepsafe
|
|
38
41
|
end
|
39
42
|
|
40
43
|
def network_up?
|
41
|
-
@
|
44
|
+
@network.up?
|
42
45
|
end
|
43
46
|
|
44
47
|
def network_changed?
|
45
|
-
@
|
48
|
+
@network.ssid != @config.last_network.ssid || @network.bssid != @config.last_network.bssid
|
46
49
|
end
|
47
50
|
|
48
51
|
def switch_to_trusted?
|
49
|
-
@
|
52
|
+
@network.trusted?
|
50
53
|
end
|
51
54
|
|
52
55
|
def switch_to_untrusted?
|
53
|
-
!@
|
56
|
+
!@network.trusted?
|
54
57
|
end
|
55
58
|
|
56
59
|
def bring_socks_proxy(direction)
|
@@ -65,21 +68,17 @@ module Sheepsafe
|
|
65
68
|
end
|
66
69
|
|
67
70
|
def notify_ok(msg)
|
68
|
-
|
69
|
-
Growl.notify_ok(msg)
|
71
|
+
when_growl_available { Growl.notify_ok(msg) }
|
70
72
|
log(msg)
|
71
73
|
end
|
72
74
|
|
73
75
|
def notify_warning(msg)
|
74
|
-
|
75
|
-
Growl.notify_warning(msg)
|
76
|
+
when_growl_available { Growl.notify_warning(msg) }
|
76
77
|
log(msg)
|
77
78
|
end
|
78
79
|
|
79
|
-
def
|
80
|
-
|
81
|
-
log("WARNING: Growl not installed (probably couldn't find growlnotify in PATH: #{ENV['PATH']})")
|
82
|
-
end
|
80
|
+
def when_growl_available(&block)
|
81
|
+
block.call if defined?(Growl)
|
83
82
|
end
|
84
83
|
|
85
84
|
def log(msg)
|
data/lib/sheepsafe/installer.rb
CHANGED
@@ -2,21 +2,20 @@ module Sheepsafe
|
|
2
2
|
class Installer
|
3
3
|
PLIST_FILE = File.expand_path("~/Library/LaunchAgents/sheepsafe.plist")
|
4
4
|
|
5
|
-
attr_reader :config, :
|
5
|
+
attr_reader :config, :network, :controller
|
6
6
|
|
7
|
-
def initialize
|
7
|
+
def initialize(config = nil, network = nil, controller = nil)
|
8
8
|
require 'highline/import'
|
9
|
-
@config
|
10
|
-
@
|
11
|
-
@controller = Sheepsafe::Controller.new
|
12
|
-
|
9
|
+
@config = config || (File.readable?(Sheepsafe::Config::FILE) ? Sheepsafe::Config.new : Sheepsafe::Config.new({}))
|
10
|
+
@network = network || Sheepsafe::Network.new(@config)
|
11
|
+
@controller = controller || Sheepsafe::Controller.new(@config, @network, Logger.new(Sheepsafe::Controller::LOG_FILE))
|
12
|
+
update_config_with_network
|
13
13
|
end
|
14
14
|
|
15
|
-
def
|
15
|
+
def install
|
16
16
|
intro_message
|
17
17
|
config_prompts
|
18
|
-
|
19
|
-
setup_untrusted_location
|
18
|
+
setup_network_location
|
20
19
|
write_config
|
21
20
|
write_launchd_plist
|
22
21
|
register_launchd_task
|
@@ -53,20 +52,19 @@ MSG
|
|
53
52
|
q.default = config.trusted_location
|
54
53
|
end
|
55
54
|
|
56
|
-
config.trusted_names = ask "Next, one or more network names (
|
57
|
-
q.
|
58
|
-
end
|
59
|
-
config.trusted_names = @names if config.trusted_names.empty?
|
55
|
+
config.trusted_names = ask "Next, one or more trusted network names/SSIDs (comma-separated) >\n" do |q|
|
56
|
+
q.default = @names.join(',')
|
57
|
+
end.split(",").map(&:strip)
|
60
58
|
end
|
61
59
|
|
62
|
-
def
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
60
|
+
def setup_network_location
|
61
|
+
if `networksetup -listlocations` !~ /Untrusted/m &&
|
62
|
+
agree("Next, I'll create and switch to the \"Untrusted\" location in Network Preferences. OK\? (yes/no)\n")
|
63
|
+
system "networksetup -createlocation Untrusted populate"
|
64
|
+
end
|
67
65
|
|
68
|
-
def setup_untrusted_location
|
69
66
|
if agree "Next, I'll set up the SOCKS proxy in the \"Untrusted\" location for you. OK\? (yes/no)\n"
|
67
|
+
system "networksetup -switchtolocation Untrusted"
|
70
68
|
system "networksetup -setsocksfirewallproxy AirPort localhost #{config.socks_port}"
|
71
69
|
end
|
72
70
|
end
|
@@ -134,12 +132,18 @@ PLIST
|
|
134
132
|
say "Uninstall finished."
|
135
133
|
end
|
136
134
|
|
135
|
+
def update
|
136
|
+
system "launchctl unload #{PLIST_FILE}"
|
137
|
+
write_launchd_plist
|
138
|
+
register_launchd_task
|
139
|
+
end
|
140
|
+
|
137
141
|
private
|
138
|
-
def
|
142
|
+
def update_config_with_network
|
139
143
|
unless config.trusted_location
|
140
|
-
config.trusted_location =
|
144
|
+
config.trusted_location = network.current_location
|
141
145
|
end
|
142
|
-
@names = [
|
146
|
+
@names = [network.ssid, network.bssid]
|
143
147
|
end
|
144
148
|
|
145
149
|
def sheepsafe_bin_path
|
data/lib/sheepsafe/network.rb
CHANGED
@@ -1,24 +1,26 @@
|
|
1
1
|
module Sheepsafe
|
2
2
|
class Network
|
3
|
+
attr_reader :current_location
|
4
|
+
|
3
5
|
def initialize(config = nil)
|
6
|
+
@current_location = `networksetup -getcurrentlocation`.chomp
|
4
7
|
@data = YAML.load(`/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I`.gsub(/^\s*([^:]+)/, '"\1"'))
|
5
8
|
@config = config || Sheepsafe::Config.new({})
|
6
9
|
end
|
7
10
|
|
8
11
|
def trusted?
|
9
|
-
@config.trusted_names.include?(
|
10
|
-
@config.trusted_names.include?(current_bssid)
|
12
|
+
@config.trusted_names.include?(ssid) || @config.trusted_names.include?(bssid)
|
11
13
|
end
|
12
14
|
|
13
15
|
def up?
|
14
16
|
@data['AirPort'] != false
|
15
17
|
end
|
16
18
|
|
17
|
-
def
|
19
|
+
def ssid
|
18
20
|
@data['SSID']
|
19
21
|
end
|
20
22
|
|
21
|
-
def
|
23
|
+
def bssid
|
22
24
|
@data['BSSID']
|
23
25
|
end
|
24
26
|
end
|
data/lib/sheepsafe.rb
CHANGED
data/sheepsafe.gemspec
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'sheepsafe'
|
5
|
-
s.version = '0.
|
6
|
-
s.date = '2010-10-
|
5
|
+
s.version = '0.2.0'
|
6
|
+
s.date = '2010-10-27'
|
7
7
|
|
8
8
|
s.rubyforge_project = %q{caldersphere}
|
9
9
|
|
@@ -28,6 +28,9 @@ Welcome to Sheepsafe!
|
|
28
28
|
If this is your first time using Sheepsafe, you probably want to set it up.
|
29
29
|
|
30
30
|
To do that, run \`sheepsafe install\' now.
|
31
|
+
|
32
|
+
If you\'re updating to a new version of Sheepsafe and want to keep your
|
33
|
+
current configuration, run \`sheepsafe update\'.
|
31
34
|
===========================================================================
|
32
35
|
]
|
33
36
|
|
@@ -38,14 +41,11 @@ To do that, run \`sheepsafe install\' now.
|
|
38
41
|
README.md
|
39
42
|
Rakefile
|
40
43
|
bin/sheepsafe
|
41
|
-
doc/add-untrusted-apply.jpg
|
42
|
-
doc/edit-locations.jpg
|
43
44
|
lib/sheepsafe.rb
|
44
45
|
lib/sheepsafe/config.rb
|
45
46
|
lib/sheepsafe/controller.rb
|
46
47
|
lib/sheepsafe/installer.rb
|
47
48
|
lib/sheepsafe/network.rb
|
48
|
-
lib/sheepsafe/status.rb
|
49
49
|
sheepsafe.gemspec
|
50
50
|
spec/sheepsafe_spec.rb
|
51
51
|
]
|
@@ -53,7 +53,6 @@ To do that, run \`sheepsafe install\' now.
|
|
53
53
|
|
54
54
|
s.test_files = s.files.select { |path| path =~ /^spec\/.*spec.*\.rb/ }
|
55
55
|
|
56
|
-
s.add_dependency(%q<growl>, ["~> 1.0"])
|
57
56
|
s.add_dependency(%q<highline>, ["~> 1.6"])
|
58
57
|
s.add_dependency(%q<daemons>, ["~> 1.1"])
|
59
58
|
s.add_development_dependency(%q<rspec>, ["~> 2.0"])
|
data/spec/sheepsafe_spec.rb
CHANGED
@@ -3,48 +3,46 @@ require 'sheepsafe'
|
|
3
3
|
|
4
4
|
describe Sheepsafe::Controller do
|
5
5
|
let(:config) do
|
6
|
-
|
6
|
+
double("config", :trusted_location => "trusted_location", :untrusted_location => "untrusted_location",
|
7
7
|
:last_network= => nil, :write => nil)
|
8
8
|
end
|
9
9
|
|
10
|
-
let (:
|
11
|
-
|
10
|
+
let (:network) do
|
11
|
+
double("network", :up? => true, :ssid => "current", :bssid => "current_bssid")
|
12
12
|
end
|
13
13
|
|
14
14
|
let(:controller) do
|
15
15
|
# Stub out logging
|
16
|
-
Sheepsafe::Controller.new(config,
|
17
|
-
c.stub
|
18
|
-
c.stub
|
16
|
+
Sheepsafe::Controller.new(config, network, double("logger", :info => nil)).tap do |c|
|
17
|
+
c.stub(:notify_ok)
|
18
|
+
c.stub(:notify_warning)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
22
|
context "#network_changed?" do
|
23
23
|
it "is when the current_network is different than the last_network" do
|
24
|
-
config.should_receive(:last_network).and_return "
|
25
|
-
status.should_receive(:current_network).and_return "current_network"
|
24
|
+
config.should_receive(:last_network).and_return double("network", :ssid => "last", :bssid => nil)
|
26
25
|
controller.network_changed?.should be_true
|
27
26
|
end
|
28
27
|
end
|
29
28
|
|
30
29
|
context "#switch_to_trusted?" do
|
31
30
|
it "is when the current network is trusted" do
|
32
|
-
|
31
|
+
network.stub :trusted? => true
|
33
32
|
controller.switch_to_trusted?.should be_true
|
34
33
|
end
|
35
34
|
end
|
36
35
|
|
37
36
|
context "#switch_to_untrusted?" do
|
38
37
|
it "is when the current network is trusted" do
|
39
|
-
|
38
|
+
network.stub :trusted? => false
|
40
39
|
controller.switch_to_untrusted?.should be_true
|
41
40
|
end
|
42
41
|
end
|
43
42
|
|
44
43
|
context "network didn't change" do
|
45
44
|
before :each do
|
46
|
-
config.
|
47
|
-
status.should_receive(:current_network).and_return "last_network"
|
45
|
+
config.stub :last_network => network
|
48
46
|
end
|
49
47
|
|
50
48
|
it "does nothing" do
|
@@ -55,7 +53,7 @@ describe Sheepsafe::Controller do
|
|
55
53
|
|
56
54
|
context "network is down" do
|
57
55
|
it "does nothing" do
|
58
|
-
|
56
|
+
network.should_receive(:up?).and_return false
|
59
57
|
config.should_not_receive(:write)
|
60
58
|
controller.run
|
61
59
|
end
|
@@ -63,14 +61,12 @@ describe Sheepsafe::Controller do
|
|
63
61
|
|
64
62
|
context "network changed" do
|
65
63
|
before :each do
|
66
|
-
controller.stub
|
67
|
-
|
68
|
-
controller.stub!(:switch_to_untrusted?).and_return false
|
64
|
+
controller.stub(:network_changed? => true, :switch_to_trusted? => false,
|
65
|
+
:switch_to_untrusted? => false)
|
69
66
|
end
|
70
67
|
|
71
68
|
it "writes the last network to the configuration" do
|
72
|
-
|
73
|
-
config.should_receive(:last_network=).with("current_network").ordered
|
69
|
+
config.should_receive(:last_network=).ordered
|
74
70
|
config.should_receive(:write).ordered
|
75
71
|
controller.run
|
76
72
|
end
|
@@ -95,25 +91,18 @@ describe Sheepsafe::Controller do
|
|
95
91
|
end
|
96
92
|
end
|
97
93
|
|
98
|
-
describe Sheepsafe::Status do
|
99
|
-
let(:status) { Sheepsafe::Status.new }
|
100
|
-
|
101
|
-
its(:current_location) { should_not be_nil }
|
102
|
-
its(:current_network) { should_not be_nil }
|
103
|
-
end
|
104
|
-
|
105
94
|
describe Sheepsafe::Network do
|
106
95
|
let(:current_network) { Sheepsafe::Network.new }
|
107
96
|
|
108
97
|
context "with trusted SSID" do
|
109
|
-
let(:config) { Sheepsafe::Config.new({"trusted_names" => [current_network.
|
98
|
+
let(:config) { Sheepsafe::Config.new({"trusted_names" => [current_network.ssid]}) }
|
110
99
|
subject { Sheepsafe::Network.new(config) }
|
111
100
|
|
112
101
|
it { should be_trusted }
|
113
102
|
end
|
114
103
|
|
115
104
|
context "with trusted BSSID" do
|
116
|
-
let(:config) { Sheepsafe::Config.new({"trusted_names" => [current_network.
|
105
|
+
let(:config) { Sheepsafe::Config.new({"trusted_names" => [current_network.bssid]}) }
|
117
106
|
subject { Sheepsafe::Network.new(config) }
|
118
107
|
|
119
108
|
it { should be_trusted }
|
@@ -125,3 +114,43 @@ describe Sheepsafe::Network do
|
|
125
114
|
it { should_not be_trusted }
|
126
115
|
end
|
127
116
|
end
|
117
|
+
|
118
|
+
describe Sheepsafe::Installer do
|
119
|
+
let(:config) { double("config").as_null_object }
|
120
|
+
let(:network) { double("network", :up? => true, :ssid => "current", :bssid => "current_bssid") }
|
121
|
+
let(:controller) { double "controller" }
|
122
|
+
let (:installer) do
|
123
|
+
@messages = []
|
124
|
+
@commands = []
|
125
|
+
Sheepsafe::Installer.new(config, network, controller).tap do |ins|
|
126
|
+
ins.stub(:say).and_return do |msg|
|
127
|
+
@messages << msg
|
128
|
+
end
|
129
|
+
ins.stub(:ask).and_return do |msg,*rest|
|
130
|
+
@messages << msg
|
131
|
+
""
|
132
|
+
end
|
133
|
+
ins.stub(:agree).and_return do |msg|
|
134
|
+
@messages << msg
|
135
|
+
true
|
136
|
+
end
|
137
|
+
ins.stub(:system).and_return do |cmd|
|
138
|
+
@commands << cmd
|
139
|
+
nil
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
before :each do
|
145
|
+
$?.stub :success? => true
|
146
|
+
end
|
147
|
+
|
148
|
+
it "asks questions, runs commands, writes the config to disk and runs the controller" do
|
149
|
+
config.should_receive(:write)
|
150
|
+
controller.should_receive(:run)
|
151
|
+
installer.should_receive(:write_launchd_plist) # don't want to actually touch plist file
|
152
|
+
installer.install
|
153
|
+
@messages.should_not be_empty
|
154
|
+
@commands.should_not be_empty
|
155
|
+
end
|
156
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sheepsafe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 2
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Nick Sieger
|
@@ -15,28 +15,13 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-10-
|
18
|
+
date: 2010-10-27 00:00:00 -05:00
|
19
19
|
default_executable: sheepsafe
|
20
20
|
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
22
|
-
name: growl
|
23
|
-
prerelease: false
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
hash: 15
|
30
|
-
segments:
|
31
|
-
- 1
|
32
|
-
- 0
|
33
|
-
version: "1.0"
|
34
|
-
type: :runtime
|
35
|
-
version_requirements: *id001
|
36
21
|
- !ruby/object:Gem::Dependency
|
37
22
|
name: highline
|
38
23
|
prerelease: false
|
39
|
-
requirement: &
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
40
25
|
none: false
|
41
26
|
requirements:
|
42
27
|
- - ~>
|
@@ -47,11 +32,11 @@ dependencies:
|
|
47
32
|
- 6
|
48
33
|
version: "1.6"
|
49
34
|
type: :runtime
|
50
|
-
version_requirements: *
|
35
|
+
version_requirements: *id001
|
51
36
|
- !ruby/object:Gem::Dependency
|
52
37
|
name: daemons
|
53
38
|
prerelease: false
|
54
|
-
requirement: &
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
55
40
|
none: false
|
56
41
|
requirements:
|
57
42
|
- - ~>
|
@@ -62,11 +47,11 @@ dependencies:
|
|
62
47
|
- 1
|
63
48
|
version: "1.1"
|
64
49
|
type: :runtime
|
65
|
-
version_requirements: *
|
50
|
+
version_requirements: *id002
|
66
51
|
- !ruby/object:Gem::Dependency
|
67
52
|
name: rspec
|
68
53
|
prerelease: false
|
69
|
-
requirement: &
|
54
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
70
55
|
none: false
|
71
56
|
requirements:
|
72
57
|
- - ~>
|
@@ -77,7 +62,7 @@ dependencies:
|
|
77
62
|
- 0
|
78
63
|
version: "2.0"
|
79
64
|
type: :development
|
80
|
-
version_requirements: *
|
65
|
+
version_requirements: *id003
|
81
66
|
description: Automatically toggle network locations and start a SOCKS proxy on untrusted networks. Mac OS X only.
|
82
67
|
email: nick@nicksieger.com
|
83
68
|
executables:
|
@@ -93,14 +78,11 @@ files:
|
|
93
78
|
- README.md
|
94
79
|
- Rakefile
|
95
80
|
- bin/sheepsafe
|
96
|
-
- doc/add-untrusted-apply.jpg
|
97
|
-
- doc/edit-locations.jpg
|
98
81
|
- lib/sheepsafe.rb
|
99
82
|
- lib/sheepsafe/config.rb
|
100
83
|
- lib/sheepsafe/controller.rb
|
101
84
|
- lib/sheepsafe/installer.rb
|
102
85
|
- lib/sheepsafe/network.rb
|
103
|
-
- lib/sheepsafe/status.rb
|
104
86
|
- sheepsafe.gemspec
|
105
87
|
- spec/sheepsafe_spec.rb
|
106
88
|
has_rdoc: true
|
@@ -112,7 +94,9 @@ post_install_message: "\n\
|
|
112
94
|
Welcome to Sheepsafe!\n\n\
|
113
95
|
=8P <=== (That's a sheep emoji.)\n\n\
|
114
96
|
If this is your first time using Sheepsafe, you probably want to set it up.\n\n\
|
115
|
-
To do that, run `sheepsafe install' now.\n\
|
97
|
+
To do that, run `sheepsafe install' now.\n\n\
|
98
|
+
If you're updating to a new version of Sheepsafe and want to keep your\n\
|
99
|
+
current configuration, run `sheepsafe update'.\n\
|
116
100
|
===========================================================================\n "
|
117
101
|
rdoc_options:
|
118
102
|
- --charset=UTF-8
|
data/doc/add-untrusted-apply.jpg
DELETED
Binary file
|
data/doc/edit-locations.jpg
DELETED
Binary file
|
data/lib/sheepsafe/status.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
module Sheepsafe
|
2
|
-
class Status
|
3
|
-
attr_reader :current_location, :current_network
|
4
|
-
|
5
|
-
def initialize(config = nil)
|
6
|
-
@current_location = `networksetup -getcurrentlocation`.chomp
|
7
|
-
@current_network = Network.new config
|
8
|
-
end
|
9
|
-
|
10
|
-
def network_up?
|
11
|
-
@current_network.up?
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|