msfrpc-client 1.1.1 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: eae20060bcf4dfb1bdbfa1fc3f530ed7a7421e8b
4
- data.tar.gz: d07865830b68e642d3b4d90a3a91da825050eea7
2
+ SHA256:
3
+ metadata.gz: a74d99283250678a38ed24fec054aa04eea762b29013ac9cbed948b6a3bcd057
4
+ data.tar.gz: cda8be470c197df8257a5c915909cc0982a7f3a176c6ce675fb73c5476f6ef02
5
5
  SHA512:
6
- metadata.gz: af9827831127544c74d2ffdad8f2d7f5b3dda6e8f9ca42e0a2635d147b0ef886eb68ed188afde445ef3afa36d575256da07798c087470f7252f6efaa94e64a77
7
- data.tar.gz: 9aa9459aab5fc8bdb85ef015641688f7f3b91c3c8383cc4ad50dc2000fb7420dc4a122b7da449594a804c62a6596e47d5e692c7d50d68d0288bf324462768090
6
+ metadata.gz: d980b0207db2824c10c44deb6ce9f7613b9dc3b344e66df0b9b04db64057849accac556f56bae38004e95676b457ec67b4d71be19685e59f706396a502772dcb
7
+ data.tar.gz: 21fd86631a416094c7260e03d370187b14ee1b64f29e4d0866f70693f053e618ae3f06245e8d8890f92ea344c8726bc1d008544ad88e59bcdf1d91f9a326ee55
@@ -1 +1 @@
1
- 2.4.1
1
+ 2.5.1
@@ -1,48 +1,28 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- msfrpc-client (1.1.1)
4
+ msfrpc-client (1.1.2)
5
5
  msgpack (~> 1)
6
- rex (~> 2)
7
6
 
8
7
  GEM
9
8
  remote: https://rubygems.org/
10
9
  specs:
11
10
  diff-lcs (1.3)
12
- filesize (0.1.1)
13
- jsobfu (0.4.2)
14
- rkelly-remix
15
- json (2.1.0)
16
- metasm (1.0.3)
17
- mini_portile2 (2.2.0)
18
- msgpack (1.1.0)
19
- nokogiri (1.8.0)
20
- mini_portile2 (~> 2.2.0)
21
- rake (12.0.0)
22
- rb-readline (0.5.4)
23
- rex (2.0.11)
24
- filesize
25
- jsobfu (~> 0.4.1)
26
- json
27
- metasm (~> 1.0.2)
28
- nokogiri
29
- rb-readline
30
- robots
31
- rkelly-remix (0.0.7)
32
- robots (0.10.1)
33
- rspec (3.6.0)
34
- rspec-core (~> 3.6.0)
35
- rspec-expectations (~> 3.6.0)
36
- rspec-mocks (~> 3.6.0)
37
- rspec-core (3.6.0)
38
- rspec-support (~> 3.6.0)
39
- rspec-expectations (3.6.0)
11
+ msgpack (1.2.4)
12
+ rake (12.3.1)
13
+ rspec (3.8.0)
14
+ rspec-core (~> 3.8.0)
15
+ rspec-expectations (~> 3.8.0)
16
+ rspec-mocks (~> 3.8.0)
17
+ rspec-core (3.8.0)
18
+ rspec-support (~> 3.8.0)
19
+ rspec-expectations (3.8.2)
40
20
  diff-lcs (>= 1.2.0, < 2.0)
41
- rspec-support (~> 3.6.0)
42
- rspec-mocks (3.6.0)
21
+ rspec-support (~> 3.8.0)
22
+ rspec-mocks (3.8.0)
43
23
  diff-lcs (>= 1.2.0, < 2.0)
44
- rspec-support (~> 3.6.0)
45
- rspec-support (3.6.0)
24
+ rspec-support (~> 3.8.0)
25
+ rspec-support (3.8.0)
46
26
 
47
27
  PLATFORMS
48
28
  ruby
@@ -54,4 +34,4 @@ DEPENDENCIES
54
34
  rspec (~> 3)
55
35
 
56
36
  BUNDLED WITH
57
- 1.15.1
37
+ 1.17.1
@@ -3,8 +3,6 @@
3
3
  require 'rubygems'
4
4
  require 'optparse'
5
5
  require 'msfrpc-client'
6
- require 'rex/ui'
7
-
8
6
 
9
7
  # Use the RPC option parser to handle standard flags
10
8
  opts = {}
@@ -23,4 +21,31 @@ if rpc.token
23
21
  end
24
22
 
25
23
  $stdout.puts "[*] Starting IRB shell..."
26
- Rex::Ui::Text::IrbShell.new(binding).run
24
+
25
+ load('irb.rb')
26
+
27
+ IRB.setup(nil)
28
+ IRB.conf[:PROMPT_MODE] = :SIMPLE
29
+
30
+ # Create a new IRB instance
31
+ irb = IRB::Irb.new(IRB::WorkSpace.new(binding))
32
+
33
+ # Set the primary irb context so that exit and other intrinsic
34
+ # commands will work.
35
+ IRB.conf[:MAIN_CONTEXT] = irb.context
36
+
37
+ # Trap interrupt
38
+ old_sigint = trap("SIGINT") do
39
+ begin
40
+ irb.signal_handle
41
+ rescue RubyLex::TerminateLineInput
42
+ irb.eval_input
43
+ end
44
+ end
45
+
46
+ # Keep processing input until the cows come home...
47
+ catch(:IRB_EXIT) do
48
+ irb.eval_input
49
+ end
50
+
51
+ trap("SIGINT", old_sigint)
@@ -1,5 +1,8 @@
1
1
  # -*- coding: binary -*-
2
2
 
3
+ require 'net/http'
4
+ require 'openssl'
5
+
3
6
  # MessagePack for data encoding (http://www.msgpack.org/)
4
7
  require 'msgpack'
5
8
 
@@ -9,10 +12,6 @@ require 'optparse'
9
12
  # Parse configuration file
10
13
  require 'yaml'
11
14
 
12
- # Rex library from the Metasploit Framework
13
- require 'rex'
14
- require 'rex/proto/http'
15
-
16
15
  # Constants used by this client
17
16
  require 'msfrpc-client/constants'
18
17
 
@@ -44,7 +43,6 @@ module Msf
44
43
  uri: '/api/',
45
44
  ssl: true,
46
45
  ssl_version: 'TLS1.2',
47
- context: {}
48
46
  }.merge(info)
49
47
 
50
48
  self.token = self.info[:token]
@@ -126,8 +124,6 @@ module Msf
126
124
  else
127
125
  raise e
128
126
  end
129
- ensure
130
- @cli.close if @cli
131
127
  end
132
128
  end
133
129
 
@@ -135,9 +131,6 @@ module Msf
135
131
  #
136
132
  # @return [void]
137
133
  def close
138
- if @cli && @cli.conn?
139
- @cli.close
140
- end
141
134
  @cli = nil
142
135
  end
143
136
 
@@ -253,28 +246,25 @@ module Msf
253
246
 
254
247
  def send_rpc_request(args)
255
248
  unless @cli
256
- @cli = Rex::Proto::Http::Client.new(info[:host], info[:port], info[:context], info[:ssl], info[:ssl_version])
257
- @cli.set_config(
258
- vhost: info[:host],
259
- agent: "Metasploit RPC Client/#{API_VERSION}",
260
- read_max_data: 1024 * 1024 * 512
261
- )
249
+ @cli = Net::HTTP.new(info[:host], info[:port])
250
+ @cli.use_ssl = info[:ssl]
251
+ @cli.verify_mode = OpenSSL::SSL::VERIFY_NONE
262
252
  end
263
253
 
264
- req = @cli.request_cgi(
265
- 'method' => 'POST',
266
- 'uri' => self.info[:uri],
267
- 'ctype' => 'binary/message-pack',
268
- 'data' => args.to_msgpack
254
+ req = Net::HTTP::Post.new(self.info[:uri], initheader = {
255
+ 'User-Agent' => "Metasploit RPC Client/#{API_VERSION}",
256
+ 'Content-Type' => 'binary/message-pack'
257
+ }
269
258
  )
259
+ req.body = args.to_msgpack
270
260
 
271
261
  begin
272
- res = @cli.send_recv(req)
262
+ res = @cli.request(req)
273
263
  rescue => e
274
264
  raise Msf::RPC::ServerException.new(000, e.message, e.class)
275
265
  end
276
266
 
277
- if res && [200, 401, 403, 500].include?(res.code)
267
+ if res && [200, 401, 403, 500].include?(res.code.to_i)
278
268
  resp = MessagePack.unpack(res.body)
279
269
 
280
270
  # Boolean true versus truthy check required here;
@@ -1,5 +1,5 @@
1
1
  module Msf
2
2
  module RPC
3
- VERSION = "1.1.1"
3
+ VERSION = "1.1.2"
4
4
  end
5
5
  end
@@ -26,7 +26,6 @@ Gem::Specification.new do |spec|
26
26
  spec.licenses = ['BSD-2-Clause']
27
27
 
28
28
  spec.add_runtime_dependency 'msgpack', '~> 1'
29
- spec.add_runtime_dependency 'rex', '~> 2'
30
29
 
31
30
  spec.add_development_dependency "bundler", '~> 1'
32
31
  spec.add_development_dependency "rake", '~> 12'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: msfrpc-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - HD Moore
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-08-03 00:00:00.000000000 Z
12
+ date: 2018-11-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: msgpack
@@ -25,20 +25,6 @@ dependencies:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
27
  version: '1'
28
- - !ruby/object:Gem::Dependency
29
- name: rex
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - "~>"
33
- - !ruby/object:Gem::Version
34
- version: '2'
35
- type: :runtime
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - "~>"
40
- - !ruby/object:Gem::Version
41
- version: '2'
42
28
  - !ruby/object:Gem::Dependency
43
29
  name: bundler
44
30
  requirement: !ruby/object:Gem::Requirement
@@ -129,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
115
  version: '0'
130
116
  requirements: []
131
117
  rubyforge_project:
132
- rubygems_version: 2.6.11
118
+ rubygems_version: 2.7.6
133
119
  signing_key:
134
120
  specification_version: 4
135
121
  summary: Ruby API for the Rapid7 Metasploit RPC service