zergling 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1 @@
1
+ v0.0.1. Claims the 'zergling' gem name.
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2008 Victor Costan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,10 @@
1
+ lib/zergling.rb
2
+ lib/zergling/process.rb
3
+ ext/zergling_geminstall_hook/extconf.rb
4
+ CHANGELOG
5
+ LICENSE
6
+ bin/zerglingd
7
+ bin/zergling
8
+ README
9
+ Rakefile
10
+ Manifest
data/README ADDED
@@ -0,0 +1,61 @@
1
+ INSTALL
2
+ -
3
+
4
+ on server and local machine:
5
+
6
+ `gem sources -a http://gems.github.com`
7
+
8
+ `sudo gem install coderrr-rtunnel`
9
+
10
+ If you don't have root access on server, you can use either the rtunnel_server_linux binary (only works with linux), or extract the .tar.gz and use `rtunnel_server.rb` (all function the same)
11
+
12
+ USAGE
13
+ -
14
+
15
+ on server (myserver.com):
16
+
17
+ `rtunnel_server`
18
+
19
+ on your local machine:
20
+
21
+ `rtunnel_client -c myserver.com -f 4000 -t 3000`
22
+
23
+ This would reverse tunnel myserver.com:4000 to localhost:3000 so that if you had a web server running at port 3000 on your local machine, anyone on the internet could access it by going to http://myserver.com:4000
24
+
25
+ **News**
26
+
27
+ * 0.3.6 released, new protocol
28
+ * created gem for easier installation
29
+ * 0.2.1 released, minor bugfix, cmdline options change
30
+ * 0.2.0 released, much simpler
31
+ * 0.1.2 released
32
+ * Created rtunnel_server binary for linux so you don't need Ruby installed on the host you want to reverse tunnel from
33
+ * 0.1.1 released
34
+ * Added default control port of 19050, no longer have to specify this on client or server unless you care to change it
35
+
36
+ RTunnel?
37
+ -
38
+
39
+ This client/server allow you to reverse tunnel traffic. Reverse tunneling is useful if you want to run a server behind a NAT and you do not have the ability use port forwarding. The specific reason I created this program was to reduce the pain of Facebook App development on a crappy internet connection that drops often. ssh -R was not cutting it.
40
+
41
+ **How does reverse tunneling work?**
42
+
43
+ * tunnel\_client makes connection to tunnel\_server (through NAT)
44
+ * tunnel_server listens on port X
45
+ * internet_user connects to port X on tunnel server
46
+ * tunnel\_server uses existing connection to tunnel internet user's request back to tunnel\_client
47
+ * tunnel_client connects to local server on port Y
48
+ * tunnel_client tunnels internet users connection through to local server
49
+
50
+ or:
51
+
52
+ * establish connection: tunnel\_client --NAT--> tunnel\_server
53
+ * reverse tunnel: internet\_user -> tunnel_server --(NAT)--> tunnel\_client -> server\_running\_behind\_nat
54
+
55
+ **How is this different than normal tunneling?**
56
+
57
+ With tunneling, usually your connections are made in the same direction you create the tunnel connection. With reverse tunneling, you tunnel your connections the opposite direction of which you made the tunnel connection. So you initiate the tunnel with A -> B, but connections are tunneled from B -> A.
58
+
59
+ **Why not just use ssh -R?**
60
+
61
+ The same thing can be achieved with ssh -R, why not just use it? A lot of ssh servers don't have the GatewayPorts sshd option set up to allow you to reverse tunnel. If you are not in control of the server and it is not setup correctly then you are SOL. RTunnel does not require you are in control of the server. ssh -R has other annoyances. When your connection drops and you try to re-initiate the reverse tunnel sometimes you get an address already in use error because the old tunnel process is still laying around. This requires you to kill the existing sshd process. RTunnel does not have this problem.
@@ -0,0 +1,25 @@
1
+ require 'rubygems'
2
+ gem 'echoe'
3
+ require 'echoe'
4
+
5
+ Echoe.new('zergling') do |p|
6
+ p.project = 'rails-pwnage' # rubyforge project
7
+
8
+ p.author = 'Victor Costan'
9
+ p.email = 'victor@zergling.net'
10
+ p.summary = 'Umbrella for the software driving a computer in the Zerg system.'
11
+ p.url = 'http://www.zergling.net'
12
+ p.dependencies = ['zerg_support >=0.0.1']
13
+ p.eval = proc do |p|
14
+ p.default_executable = 'bin/zergling'
15
+ end
16
+
17
+ p.need_tar_gz = true
18
+ p.need_zip = true
19
+ p.rdoc_pattern = /^(lib|bin|tasks|ext)|^BUILD|^README|^CHANGELOG|^TODO|^LICENSE|^COPYING$/
20
+ end
21
+
22
+ if $0 == __FILE__
23
+ Rake.application = Rake::Application.new
24
+ Rake.application.run
25
+ end
File without changes
File without changes
@@ -0,0 +1,13 @@
1
+ # this file is invoked when the gem is installed
2
+ # rubygems expects it to build a gem, so we need to work around that
3
+
4
+ require 'rubygems'
5
+ gem 'zerg_support'
6
+ require 'zerg_support'
7
+
8
+ Zerg::Support::Gems.ensure_on_path 'zergling'
9
+ Zerg::Support::Gems.ensure_on_path 'zerglingd'
10
+ # we really shouldn't be abusing rubygems' root; then again, the Debian
11
+ # maintainers shouldn't be abusing the patience of Ruby developers
12
+
13
+ Zerg::Support::Gems.emulate_extension_install 'zerg_setup'
File without changes
@@ -0,0 +1,52 @@
1
+ # Zerg process mangement
2
+
3
+ begin
4
+ require 'sys/proctable'
5
+ rescue Exception
6
+ # mock the sys-proctable gem if it is not available
7
+
8
+ module Sys
9
+ end
10
+
11
+ module Sys::ProcTable
12
+ class ProcInfo
13
+ def initialize(pid, cmdline)
14
+ @pid = pid
15
+ @cmdline = cmdline
16
+ end
17
+ attr_reader :pid, :cmdline
18
+ end
19
+
20
+ def self.ps
21
+ retval = []
22
+ ps_output = `ps ax`
23
+ ps_output.each_line do |pline|
24
+ pdata = pline.split(nil, 5)
25
+ pinfo = ProcInfo.new(pdata[0].strip, pdata[4].strip)
26
+ retval << pinfo
27
+ end
28
+ return retval
29
+ end
30
+ end
31
+ end
32
+
33
+ module RailsPwnage::Base
34
+ # returns information about a process
35
+ def process_info(pid = nil)
36
+ info = Hash.new
37
+ Sys::ProcTable.ps.each do |process|
38
+ item = { :cmdline => process.cmdline, :pid => process.pid.to_s }
39
+
40
+ if pid.nil?
41
+ info[process.pid.to_s] = item
42
+ else
43
+ return item if item.pid.to_s == pid.to_s
44
+ end
45
+ end
46
+ if pid.nil?
47
+ return info
48
+ else
49
+ return nil
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,40 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{zergling}
5
+ s.version = "0.0.1"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Victor Costan"]
9
+ s.date = %q{2008-11-24}
10
+ s.default_executable = %q{bin/zergling}
11
+ s.description = %q{Umbrella for the software driving a computer in the Zerg system.}
12
+ s.email = %q{victor@zergling.net}
13
+ s.executables = ["zerglingd", "zergling"]
14
+ s.extensions = ["ext/zergling_geminstall_hook/extconf.rb"]
15
+ s.extra_rdoc_files = ["lib/zergling.rb", "lib/zergling/process.rb", "ext/zergling_geminstall_hook/extconf.rb", "CHANGELOG", "LICENSE", "bin/zerglingd", "bin/zergling", "README"]
16
+ s.files = ["lib/zergling.rb", "lib/zergling/process.rb", "ext/zergling_geminstall_hook/extconf.rb", "CHANGELOG", "LICENSE", "bin/zerglingd", "bin/zergling", "README", "Rakefile", "Manifest", "zergling.gemspec"]
17
+ s.has_rdoc = true
18
+ s.homepage = %q{http://www.zergling.net}
19
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Zergling", "--main", "README"]
20
+ s.require_paths = ["lib", "ext"]
21
+ s.rubyforge_project = %q{rails-pwnage}
22
+ s.rubygems_version = %q{1.3.1}
23
+ s.summary = %q{Umbrella for the software driving a computer in the Zerg system.}
24
+
25
+ if s.respond_to? :specification_version then
26
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
27
+ s.specification_version = 2
28
+
29
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
30
+ s.add_runtime_dependency(%q<zerg_support>, [">= 0.0.1"])
31
+ s.add_development_dependency(%q<echoe>, [">= 0"])
32
+ else
33
+ s.add_dependency(%q<zerg_support>, [">= 0.0.1"])
34
+ s.add_dependency(%q<echoe>, [">= 0"])
35
+ end
36
+ else
37
+ s.add_dependency(%q<zerg_support>, [">= 0.0.1"])
38
+ s.add_dependency(%q<echoe>, [">= 0"])
39
+ end
40
+ end
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: zergling
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Victor Costan
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-11-24 00:00:00 -05:00
13
+ default_executable: bin/zergling
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: zerg_support
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.0.1
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: echoe
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "0"
34
+ version:
35
+ description: Umbrella for the software driving a computer in the Zerg system.
36
+ email: victor@zergling.net
37
+ executables:
38
+ - zerglingd
39
+ - zergling
40
+ extensions:
41
+ - ext/zergling_geminstall_hook/extconf.rb
42
+ extra_rdoc_files:
43
+ - lib/zergling.rb
44
+ - lib/zergling/process.rb
45
+ - ext/zergling_geminstall_hook/extconf.rb
46
+ - CHANGELOG
47
+ - LICENSE
48
+ - bin/zerglingd
49
+ - bin/zergling
50
+ - README
51
+ files:
52
+ - lib/zergling.rb
53
+ - lib/zergling/process.rb
54
+ - ext/zergling_geminstall_hook/extconf.rb
55
+ - CHANGELOG
56
+ - LICENSE
57
+ - bin/zerglingd
58
+ - bin/zergling
59
+ - README
60
+ - Rakefile
61
+ - Manifest
62
+ - zergling.gemspec
63
+ has_rdoc: true
64
+ homepage: http://www.zergling.net
65
+ post_install_message:
66
+ rdoc_options:
67
+ - --line-numbers
68
+ - --inline-source
69
+ - --title
70
+ - Zergling
71
+ - --main
72
+ - README
73
+ require_paths:
74
+ - lib
75
+ - ext
76
+ required_ruby_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: "0"
81
+ version:
82
+ required_rubygems_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: "1.2"
87
+ version:
88
+ requirements: []
89
+
90
+ rubyforge_project: rails-pwnage
91
+ rubygems_version: 1.3.1
92
+ signing_key:
93
+ specification_version: 2
94
+ summary: Umbrella for the software driving a computer in the Zerg system.
95
+ test_files: []
96
+