atechtools 1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/bin/atechroutes +26 -0
  2. metadata +55 -0
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ if `whoami`.chomp != 'root'
4
+ puts "You must be root to do this..."
5
+ Process.exit(1)
6
+ end
7
+
8
+ GATEWAY = "10.85.0.1"
9
+
10
+ require 'net/http'
11
+
12
+ bod = Net::HTTP.start('gist.github.com', 80) {|http| http.get('/288908') }.body
13
+ if bod =~ /\<a href\=\"(\/raw\/.*)\">raw\<\/a\>/
14
+ raw_url = $1
15
+ routes = Net::HTTP.start("gist.github.com", 80) {|http| http.get(raw_url) }.body
16
+ for route in routes.split("\n")
17
+ if route =~ /(\d+\.\d+\.\d+\.\d+\/\d+)\s+\[(.*)\]/
18
+ network, name = $1, $2
19
+ system("route add #{network} #{GATEWAY}")
20
+ puts "Added route for '#{name}' to #{network}"
21
+ end
22
+ end
23
+ else
24
+ puts "No raw link found"
25
+ Process.exit(1)
26
+ end
metadata ADDED
@@ -0,0 +1,55 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: atechtools
3
+ version: !ruby/object:Gem::Version
4
+ version: "1.0"
5
+ platform: ruby
6
+ authors:
7
+ - Adam Cooke
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-01-28 00:00:00 +00:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description:
17
+ email: adam@atechmedia.com
18
+ executables:
19
+ - atechroutes
20
+ extensions: []
21
+
22
+ extra_rdoc_files: []
23
+
24
+ files:
25
+ - bin/atechroutes
26
+ has_rdoc: true
27
+ homepage: http://www.atechmedia.com
28
+ licenses: []
29
+
30
+ post_install_message:
31
+ rdoc_options: []
32
+
33
+ require_paths:
34
+ - lib
35
+ required_ruby_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: "0"
40
+ version:
41
+ required_rubygems_version: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: "0"
46
+ version:
47
+ requirements: []
48
+
49
+ rubyforge_project:
50
+ rubygems_version: 1.3.5
51
+ signing_key:
52
+ specification_version: 3
53
+ summary: Tools for aTech employees, if you aren't an aTech employee this gem will be mostly useless.
54
+ test_files: []
55
+