msfrpc-client 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 14c301494182443a6cce774a0675842d64dfc54b
4
+ data.tar.gz: 17cc3034daf076037e04415bd8fd9055c5cceffb
5
+ SHA512:
6
+ metadata.gz: 3af090f2e26dd7e55d634f4a952375d4e9ac10914362273dc2e10ffc597a2ad19c806388cfa0d2e60d15510e2dd262edf99a449db8389fe73cf744cda8835a28
7
+ data.tar.gz: 8d7f91c179e046d1089aa78d7b3844a42cfc0ad14c55627dc5206bc76d6423e84d46f66f88e49fbe522a04437e48e2b1327e606b562210d059386cce6c51a2f6
data/LICENSE ADDED
@@ -0,0 +1,10 @@
1
+ Copyright (c) 2012-2014, Rapid7 LLC
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5
+
6
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7
+
8
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9
+
10
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -24,18 +24,18 @@ class Client
24
24
  #
25
25
  # Create a new RPC Client instance
26
26
  #
27
- def initialize(info={})
27
+ def initialize(config={})
28
+
28
29
  self.info = {
29
30
  :host => '127.0.0.1',
30
31
  :port => 3790,
31
- :uri => '/api/',
32
+ :uri => '/api/' + Msf::RPC::API_VERSION,
32
33
  :ssl => true,
33
34
  :ssl_version => 'SSLv3',
34
35
  :context => {}
35
- }.merge(info)
36
-
37
- info[:port] = info[:port].to_i
36
+ }.merge(config)
38
37
 
38
+ # Set the token
39
39
  self.token = self.info[:token]
40
40
 
41
41
  if not self.token and (info[:user] and info[:pass])
@@ -185,7 +185,14 @@ class Client
185
185
  yaml = ::YAML.load(yaml_data) rescue nil
186
186
  if yaml and yaml.kind_of?(::Hash) and yaml['options']
187
187
  yaml['options'].each_pair do |k,v|
188
- options[k.intern] = v
188
+ case k
189
+ when 'ssl'
190
+ options[k.intern] = !!(v.to_s =~ /^(t|y|1)/i)
191
+ when 'port'
192
+ options[k.intern] = v.to_i
193
+ else
194
+ options[k.intern] = v
195
+ end
189
196
  end
190
197
  else
191
198
  $stderr.puts "[-] Could not parse configuration file: #{config_file}"
@@ -202,7 +209,7 @@ class Client
202
209
  end
203
210
 
204
211
  if options[:ssl]
205
- options[:ssl] = (options[:ssl] =~ /(1|Y|T)/i ? true : false )
212
+ options[:ssl] = !!(options[:ssl].to_s =~ /^(t|y|1)/i)
206
213
  end
207
214
 
208
215
  options
@@ -0,0 +1,27 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $LOAD_PATH.push File.expand_path('../lib', __FILE__)
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = 'msfrpc-client'
6
+ s.version = '1.0.2'
7
+ s.authors = [
8
+ 'HD Moore'
9
+ ]
10
+ s.email = [
11
+ 'hdm@rapid7.com'
12
+ ]
13
+ s.homepage = "http://www.metasploit.com/"
14
+ s.summary = %q{Ruby API for the Rapid7 Metasploit Pro RPC service}
15
+ s.description = %q{
16
+ This gem provides a Ruby client API to access the Rapid7 Metasploit Pro RPC service.
17
+ }.gsub(/\s+/, ' ').strip
18
+
19
+ s.files = `git ls-files`.split("\n")
20
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
21
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
22
+ s.require_paths = ['lib']
23
+ s.licenses = ['BSD-2-Clause']
24
+
25
+ s.add_runtime_dependency 'msgpack', '~> 0.5.8', '>= 0.5.8'
26
+ s.add_runtime_dependency 'librex', '~> 0.0.70','>= 0.0.70'
27
+ end
metadata CHANGED
@@ -1,107 +1,95 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: msfrpc-client
3
- version: !ruby/object:Gem::Version
4
- hash: 21
5
- prerelease:
6
- segments:
7
- - 1
8
- - 0
9
- - 1
10
- version: 1.0.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.2
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - HD Moore
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2011-10-18 00:00:00 -05:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
11
+ date: 2014-07-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
22
14
  name: msgpack
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.5.8
27
20
  - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 5
30
- segments:
31
- - 0
32
- - 4
33
- - 5
34
- version: 0.4.5
21
+ - !ruby/object:Gem::Version
22
+ version: 0.5.8
35
23
  type: :runtime
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- name: librex
39
24
  prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: 0.5.8
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 0.5.8
33
+ - !ruby/object:Gem::Dependency
34
+ name: librex
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: 0.0.70
43
40
  - - ">="
44
- - !ruby/object:Gem::Version
45
- hash: 95
46
- segments:
47
- - 0
48
- - 0
49
- - 32
50
- version: 0.0.32
41
+ - !ruby/object:Gem::Version
42
+ version: 0.0.70
51
43
  type: :runtime
52
- version_requirements: *id002
53
- description: This gem provides a Ruby client API to access the Rapid7 Metasploit Pro RPC service.
54
- email:
55
- - hdm@metasploit.com
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: 0.0.70
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 0.0.70
53
+ description: This gem provides a Ruby client API to access the Rapid7 Metasploit Pro
54
+ RPC service.
55
+ email:
56
+ - hdm@rapid7.com
56
57
  executables: []
57
-
58
58
  extensions: []
59
-
60
- extra_rdoc_files:
59
+ extra_rdoc_files: []
60
+ files:
61
+ - LICENSE
61
62
  - README.markdown
62
- files:
63
63
  - Rakefile
64
- - README.markdown
65
- - lib/msfrpc-client/client.rb
66
- - lib/msfrpc-client/constants.rb
67
- - lib/msfrpc-client.rb
68
64
  - examples/msfrpc_irb.rb
69
65
  - examples/msfrpc_pro_report.rb
70
- has_rdoc: true
66
+ - lib/msfrpc-client.rb
67
+ - lib/msfrpc-client/client.rb
68
+ - lib/msfrpc-client/constants.rb
69
+ - msfrpc-client.gemspec
71
70
  homepage: http://www.metasploit.com/
72
- licenses:
73
- - BSD
71
+ licenses:
72
+ - BSD-2-Clause
73
+ metadata: {}
74
74
  post_install_message:
75
75
  rdoc_options: []
76
-
77
- require_paths:
76
+ require_paths:
78
77
  - lib
79
- required_ruby_version: !ruby/object:Gem::Requirement
80
- none: false
81
- requirements:
78
+ required_ruby_version: !ruby/object:Gem::Requirement
79
+ requirements:
82
80
  - - ">="
83
- - !ruby/object:Gem::Version
84
- hash: 57
85
- segments:
86
- - 1
87
- - 8
88
- - 7
89
- version: 1.8.7
90
- required_rubygems_version: !ruby/object:Gem::Requirement
91
- none: false
92
- requirements:
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
+ requirements:
93
85
  - - ">="
94
- - !ruby/object:Gem::Version
95
- hash: 3
96
- segments:
97
- - 0
98
- version: "0"
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
99
88
  requirements: []
100
-
101
89
  rubyforge_project:
102
- rubygems_version: 1.4.2
90
+ rubygems_version: 2.2.2
103
91
  signing_key:
104
- specification_version: 3
92
+ specification_version: 4
105
93
  summary: Ruby API for the Rapid7 Metasploit Pro RPC service
106
94
  test_files: []
107
-
95
+ has_rdoc: