recon 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest +15 -0
- data/README.rdoc +3 -0
- data/Rakefile +15 -0
- data/bin/recon +3 -0
- data/lib/recon.rb +10 -0
- data/lib/recon/connection.rb +17 -0
- data/lib/recon/console.rb +23 -0
- data/lib/recon/infrastructure.rb +20 -0
- data/lib/recon/machine.rb +5 -0
- data/lib/recon/machine/remote.rb +22 -0
- data/lib/recon/tasks.rb +2 -0
- data/lib/recon/tasks/infrastructure.rake +4 -0
- data/recon.gemspec +32 -0
- metadata +81 -0
data/Manifest
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
CHANGELOG
|
2
|
+
LICENSE
|
3
|
+
README.rdoc
|
4
|
+
Rakefile
|
5
|
+
bin/recon
|
6
|
+
lib/recon.rb
|
7
|
+
lib/recon/connection.rb
|
8
|
+
lib/recon/console.rb
|
9
|
+
lib/recon/infrastructure.rb
|
10
|
+
lib/recon/machine.rb
|
11
|
+
lib/recon/machine/remote.rb
|
12
|
+
lib/recon/tasks.rb
|
13
|
+
lib/recon/tasks/infrastructure.rake
|
14
|
+
recon.gemspec
|
15
|
+
Manifest
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'echoe'
|
4
|
+
|
5
|
+
Echoe.new('recon', '0.0.1') do |p|
|
6
|
+
p.description = 'Infrastructure Console'
|
7
|
+
p.summary = 'Exposes your infrastructure locally as Ruby objects'
|
8
|
+
p.url = 'http://github.com/khy/recon'
|
9
|
+
p.author = 'Kevin Hyland'
|
10
|
+
p.email = 'khy@me.com'
|
11
|
+
p.ignore_pattern = ['tmp/*']
|
12
|
+
p.development_dependencies = []
|
13
|
+
end
|
14
|
+
|
15
|
+
Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
|
data/bin/recon
ADDED
data/lib/recon.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'net/ssh'
|
2
|
+
|
3
|
+
module Recon
|
4
|
+
class Connection
|
5
|
+
def initialize(host, user, password = nil)
|
6
|
+
@raw_connection = Net::SSH.start(host, user, :password => password)
|
7
|
+
end
|
8
|
+
|
9
|
+
def raw
|
10
|
+
@raw_connection
|
11
|
+
end
|
12
|
+
|
13
|
+
def execute(command)
|
14
|
+
@raw_connection.exec!(command)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
require 'irb'
|
3
|
+
require 'irb/completion'
|
4
|
+
|
5
|
+
module Recon
|
6
|
+
module Console
|
7
|
+
def self.start
|
8
|
+
options = {}
|
9
|
+
|
10
|
+
OptionParser.new do |opt|
|
11
|
+
opt.banner = 'Usage: recon [options]'
|
12
|
+
opt.on('-d', '--directory', 'Specify infrastructure load directory') { |v| options[:directory] = v }
|
13
|
+
opt.parse!(ARGV)
|
14
|
+
end
|
15
|
+
|
16
|
+
puts 'Loading infrastructure environment'
|
17
|
+
Recon::Infrastructure.load(options[:directory])
|
18
|
+
|
19
|
+
ARGV << '--simple-prompt'
|
20
|
+
IRB.start
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Recon
|
2
|
+
module Infrastructure
|
3
|
+
LOAD_FILES = %w|config infrastructure|
|
4
|
+
|
5
|
+
def self.load(load_path = nil)
|
6
|
+
[load_path, '~/.reconrc', Dir.pwd].each{|path| load_directory(path) if path}
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.load_directory(path)
|
10
|
+
LOAD_FILES.each do |file|
|
11
|
+
full_path = File.join(File.expand_path(path), file)
|
12
|
+
require("#{full_path}.rb") if File.exists?("#{full_path}.rb")
|
13
|
+
|
14
|
+
if File.directory? full_path
|
15
|
+
Dir[File.join(full_path, '*.rb')].each{|sub_file| require sub_file}
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Recon
|
2
|
+
module Machine
|
3
|
+
module Remote
|
4
|
+
def self.included(base)
|
5
|
+
base.class_eval do
|
6
|
+
attr_accessor :host, :user, :password
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def execute(command)
|
11
|
+
connection.execute(command)
|
12
|
+
end
|
13
|
+
alias_method :exec, :execute
|
14
|
+
alias_method :/, :execute
|
15
|
+
|
16
|
+
protected
|
17
|
+
def connection
|
18
|
+
@connection ||= Recon::Connection.new(@host, @user, @password)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/recon/tasks.rb
ADDED
data/recon.gemspec
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{recon}
|
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 = ["Kevin Hyland"]
|
9
|
+
s.date = %q{2010-03-13}
|
10
|
+
s.default_executable = %q{recon}
|
11
|
+
s.description = %q{Infrastructure Console}
|
12
|
+
s.email = %q{khy@me.com}
|
13
|
+
s.executables = ["recon"]
|
14
|
+
s.extra_rdoc_files = ["README.rdoc", "bin/recon", "lib/recon.rb", "lib/recon/connection.rb", "lib/recon/console.rb", "lib/recon/infrastructure.rb", "lib/recon/machine.rb", "lib/recon/machine/remote.rb", "lib/recon/tasks.rb", "lib/recon/tasks/infrastructure.rake"]
|
15
|
+
s.files = ["Manifest", "README.rdoc", "Rakefile", "bin/recon", "lib/recon.rb", "lib/recon/connection.rb", "lib/recon/console.rb", "lib/recon/infrastructure.rb", "lib/recon/machine.rb", "lib/recon/machine/remote.rb", "lib/recon/tasks.rb", "lib/recon/tasks/infrastructure.rake", "recon.gemspec"]
|
16
|
+
s.homepage = %q{http://github.com/khy/recon}
|
17
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Recon", "--main", "README.rdoc"]
|
18
|
+
s.require_paths = ["lib"]
|
19
|
+
s.rubyforge_project = %q{recon}
|
20
|
+
s.rubygems_version = %q{1.3.5}
|
21
|
+
s.summary = %q{Exposes your infrastructure locally as Ruby objects}
|
22
|
+
|
23
|
+
if s.respond_to? :specification_version then
|
24
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
25
|
+
s.specification_version = 3
|
26
|
+
|
27
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
28
|
+
else
|
29
|
+
end
|
30
|
+
else
|
31
|
+
end
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: recon
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kevin Hyland
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2010-03-13 00:00:00 -05:00
|
13
|
+
default_executable: recon
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: Infrastructure Console
|
17
|
+
email: khy@me.com
|
18
|
+
executables:
|
19
|
+
- recon
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- README.rdoc
|
24
|
+
- bin/recon
|
25
|
+
- lib/recon.rb
|
26
|
+
- lib/recon/connection.rb
|
27
|
+
- lib/recon/console.rb
|
28
|
+
- lib/recon/infrastructure.rb
|
29
|
+
- lib/recon/machine.rb
|
30
|
+
- lib/recon/machine/remote.rb
|
31
|
+
- lib/recon/tasks.rb
|
32
|
+
- lib/recon/tasks/infrastructure.rake
|
33
|
+
files:
|
34
|
+
- Manifest
|
35
|
+
- README.rdoc
|
36
|
+
- Rakefile
|
37
|
+
- bin/recon
|
38
|
+
- lib/recon.rb
|
39
|
+
- lib/recon/connection.rb
|
40
|
+
- lib/recon/console.rb
|
41
|
+
- lib/recon/infrastructure.rb
|
42
|
+
- lib/recon/machine.rb
|
43
|
+
- lib/recon/machine/remote.rb
|
44
|
+
- lib/recon/tasks.rb
|
45
|
+
- lib/recon/tasks/infrastructure.rake
|
46
|
+
- recon.gemspec
|
47
|
+
has_rdoc: true
|
48
|
+
homepage: http://github.com/khy/recon
|
49
|
+
licenses: []
|
50
|
+
|
51
|
+
post_install_message:
|
52
|
+
rdoc_options:
|
53
|
+
- --line-numbers
|
54
|
+
- --inline-source
|
55
|
+
- --title
|
56
|
+
- Recon
|
57
|
+
- --main
|
58
|
+
- README.rdoc
|
59
|
+
require_paths:
|
60
|
+
- lib
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: "0"
|
66
|
+
version:
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: "1.2"
|
72
|
+
version:
|
73
|
+
requirements: []
|
74
|
+
|
75
|
+
rubyforge_project: recon
|
76
|
+
rubygems_version: 1.3.5
|
77
|
+
signing_key:
|
78
|
+
specification_version: 3
|
79
|
+
summary: Exposes your infrastructure locally as Ruby objects
|
80
|
+
test_files: []
|
81
|
+
|