psrp 0.0.1 → 0.0.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.
data/test_psrp.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'psrp'
1
+ require_relative 'lib/psrp'
2
2
 
3
3
  endpoint = 'http://192.168.142.231:5985/wsman'
4
4
  psrp = PSRP::PSRPService.new(endpoint, :user => 'samo-range', :pass => 'somethinglonger12345!', :log_level => :info)
@@ -12,21 +12,20 @@ puts psrp.run_ps('echo "' + "A" * (32725 + 1) * 30 + '" > C:\hello_A')
12
12
 
13
13
  puts psrp.run_ps('notepad')
14
14
 
15
- # dll = IO.binread('DemoDLL_RemoteProcess.dll')
16
-
17
- # ps_script = "$ProcName = notepad
18
- # $ComputerName = 192.168.142.231
19
- # $PEBytes = @("
20
-
21
- # for i in 0..(dll.length - 1)
22
- # ps_script += dll[i].ord.to_s
23
- # if i != dll.length - 1
24
- # ps_script += ','
25
- # end
26
- # end
27
- # ps_script += ")\n"
28
- # ps_script += File.read('Invoke-ReflectivePEInjection.ps1')
15
+ data = Base64.strict_encode64(IO.binread('DemoDLL_RemoteProcess-x64.dll'))
16
+ ps_script = "$ProcName = notepad\n"
17
+ ps_script += "$PEBytes = [System.Convert]::FromBase64String('" + data + "')\n"
18
+ ps_script += File.read('Invoke-ReflectivePEInjection.ps1')
19
+ ps_script += "\nInvoke-ReflectivePEInjection -PEBytes $PEBytes\n"
20
+ ps_script += "echo 'Command Reflected'\n"
21
+ IO.binwrite('script.ps1', ps_script)
22
+ puts psrp.run_ps(File.read('script.ps1'))
29
23
 
30
- # IO.binwrite('script.ps1', ps_script)
31
24
 
32
- puts psrp.run_ps(File.read('script.ps1'))
25
+ endpoint = 'http://192.168.142.232:5985/wsman'
26
+ begin
27
+ psrp = PSRP::PSRPService.new(endpoint, :user => 'samo-range', :pass => 'somethinglonger12345!', :log_level => :debug)
28
+ psrp.run_ps('ipconfig')
29
+ rescue HTTPClient::ConnectTimeoutError
30
+ puts 'Should See A Timeout on Not Able to Connect.'
31
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: psrp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Oluwalana
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-18 00:00:00.000000000 Z
11
+ date: 2016-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpclient
@@ -131,6 +131,7 @@ extra_rdoc_files:
131
131
  - LICENSE
132
132
  files:
133
133
  - ".gitignore"
134
+ - DemoDLL_RemoteProcess-x64.dll
134
135
  - DemoDLL_RemoteProcess.dll
135
136
  - Invoke-ReflectivePEInjection.ps1
136
137
  - LICENSE