psrp 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/lib/psrp.rb +4 -1
  3. data/lib/version.rb +1 -1
  4. data/test_psrp.rb +1 -8
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1c0eb58f46fa0b746b0d8f1fe2157764c22c8586
4
- data.tar.gz: ad6ab72fdf78ead6c2b1a0a22497ef546529574d
3
+ metadata.gz: c907a84bd02d8bf0c7ae45e3579079a9910279d5
4
+ data.tar.gz: 1daf946d7ff1b5dd533c121a3741f0fcf76e6ce7
5
5
  SHA512:
6
- metadata.gz: 3f0c16ebb4d24c80d0c13efff3f7a6cd0e6d5f0ff12d850bb2c15fc8750edbafd2afb66efe6bff8970d7fe4a5771619cd233d9339d7008e013866b9583e61357
7
- data.tar.gz: 7df6cac6ea30fbf62dd765a5aa5d51872ed70df2a216b6fe8ee9c1b2fe0cebda19cc2c1390cf0de98b8315e96e74723b9f1b432b0722e5a980d7294168232716
6
+ metadata.gz: 0855e51e7d0b9bbcd1401e08ee0e0823fb481f0b967dc77507316f6bc81d0f30084fffb9839e89443dff77344a0832e32a85660dd5f484f2a3922a73585816a8
7
+ data.tar.gz: 78450e8fb8d2fb9ea86fd8037254600ebc921ff1fd3711fbb69edcb890e55bcc91d5f4800abfd5a360f1443dd7714adfe780f187c1799e9a2e758bdaf7bae53a
data/lib/psrp.rb CHANGED
@@ -117,7 +117,7 @@ module PSRP
117
117
  # the server. After each received wxf:ReceiveResponse message (section 3.2.5.3.8), the client sends another
118
118
  # wxf:Receive message until the RunspacePool transitions to a Closed or Broken state.
119
119
  if not @opened
120
- raise PSRPError.new('This psrp instance is not connected, call .open ')
120
+ open
121
121
  end
122
122
 
123
123
  out_processor = PSRP::WSMV::CommandOutputProcessor.new(@session_opts, @xfer)
@@ -185,6 +185,9 @@ module PSRP
185
185
  end
186
186
 
187
187
  def close
188
+ if not @opened
189
+ return nil
190
+ end
188
191
  @opened = false
189
192
  @logger.debug("Closing shell")
190
193
  msg = PSRP::WSMV::CloseShell.new(@session_opts, @shell_id)
data/lib/version.rb CHANGED
@@ -3,5 +3,5 @@
3
3
  # PSRP module
4
4
  module PSRP
5
5
  # The version of the PSRP library
6
- VERSION = '0.0.3'
6
+ VERSION = '0.0.4'
7
7
  end
data/test_psrp.rb CHANGED
@@ -38,16 +38,9 @@ puts psrp.run_ps(File.read('script.ps1'))
38
38
  psrp.close
39
39
 
40
40
  endpoint = 'http://192.168.142.232:5985/wsman'
41
- begin
42
- psrp = PSRP::PSRPService.new(endpoint, :user => 'samo-range', :pass => 'somethinglonger12345!', :log_level => :debug)
43
- psrp.run_ps('ipconfig')
44
- rescue PSRP::PSRPError
45
- puts 'You should see this'
46
- end
41
+ psrp = PSRP::PSRPService.new(endpoint, :user => 'samo-range', :pass => 'somethinglonger12345!', :log_level => :debug)
47
42
 
48
43
  begin
49
- psrp = PSRP::PSRPService.new(endpoint, :user => 'samo-range', :pass => 'somethinglonger12345!', :log_level => :debug)
50
- psrp.open
51
44
  psrp.run_ps('ipconfig')
52
45
  rescue HTTPClient::ConnectTimeoutError
53
46
  puts 'Should See A Timeout on Not Able to Connect.'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: psrp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Oluwalana