psrp 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +3 -0
- data/DemoDLL_RemoteProcess.dll +0 -0
- data/Invoke-ReflectivePEInjection.ps1 +2952 -0
- data/LICENSE +202 -0
- data/README.md +16 -0
- data/lib/psrp.rb +175 -0
- data/lib/response_handler.rb +134 -0
- data/lib/transport.rb +208 -0
- data/lib/version.rb +7 -0
- data/lib/wsmv/command_output_processor.rb +153 -0
- data/lib/wsmv/commands/base.rb +293 -0
- data/lib/wsmv/commands/close_shell.rb +48 -0
- data/lib/wsmv/commands/create_pipeline.rb +64 -0
- data/lib/wsmv/commands/init_runspace_pool.rb +92 -0
- data/lib/wsmv/commands/receive.rb +81 -0
- data/lib/wsmv/commands/send_data.rb +64 -0
- data/lib/wsmv/psrp_message.rb +289 -0
- data/lib/wsmv/templates/create_pipeline.xml.erb +93 -0
- data/lib/wsmv/templates/init_runspacepool.xml.erb +221 -0
- data/lib/wsmv/templates/runspace_availability.xml.erb +5 -0
- data/lib/wsmv/templates/session_capability.xml.erb +7 -0
- data/psrp.gemspec +39 -0
- data/script.ps1 +2945 -0
- data/test_psrp.rb +32 -0
- metadata +181 -0
@@ -0,0 +1,93 @@
|
|
1
|
+
<Obj RefId="0">
|
2
|
+
<MS>
|
3
|
+
<Obj N="PowerShell" RefId="1">
|
4
|
+
<MS>
|
5
|
+
<Obj N="Cmds" RefId="2">
|
6
|
+
<TN RefId="0">
|
7
|
+
<T>System.Collections.Generic.List`1[[System.Management.Automation.PSObject, System.Management.Automation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]</T>
|
8
|
+
<T>System.Object</T>
|
9
|
+
</TN>
|
10
|
+
<LST>
|
11
|
+
<Obj RefId="3">
|
12
|
+
<MS>
|
13
|
+
<S N="Cmd">Invoke-Expression</S>
|
14
|
+
<B N="IsScript">false</B>
|
15
|
+
<Nil N="UseLocalScope"/>
|
16
|
+
<Obj N="MergeMyResult" RefId="4">
|
17
|
+
<TN RefId="1">
|
18
|
+
<T>System.Management.Automation.Runspaces.PipelineResultTypes</T>
|
19
|
+
<T>System.Enum</T>
|
20
|
+
<T>System.ValueType</T>
|
21
|
+
<T>System.Object</T>
|
22
|
+
</TN>
|
23
|
+
<ToString>None</ToString>
|
24
|
+
<I32>0</I32>
|
25
|
+
</Obj>
|
26
|
+
<Obj N="MergeToResult" RefId="5">
|
27
|
+
<TNRef RefId="1"/>
|
28
|
+
<ToString>None</ToString>
|
29
|
+
<I32>0</I32>
|
30
|
+
</Obj>
|
31
|
+
<Obj N="MergePreviousResults" RefId="6">
|
32
|
+
<TNRef RefId="1"/>
|
33
|
+
<ToString>None</ToString>
|
34
|
+
<I32>0</I32>
|
35
|
+
</Obj>
|
36
|
+
<Obj N="Args" RefId="7">
|
37
|
+
<TNRef RefId="0"/>
|
38
|
+
<LST>
|
39
|
+
<Obj RefId="8">
|
40
|
+
<MS>
|
41
|
+
<S N="N">-Command</S>
|
42
|
+
<Nil N="V"/>
|
43
|
+
</MS>
|
44
|
+
</Obj>
|
45
|
+
<Obj RefId="9">
|
46
|
+
<MS>
|
47
|
+
<Nil N="N"/>
|
48
|
+
<S N="V"><%= command %></S>
|
49
|
+
</MS>
|
50
|
+
</Obj>
|
51
|
+
</LST>
|
52
|
+
</Obj>
|
53
|
+
</MS>
|
54
|
+
</Obj>
|
55
|
+
</LST>
|
56
|
+
</Obj>
|
57
|
+
<B N="IsNested">false</B>
|
58
|
+
<Nil N="History"/>
|
59
|
+
<B N="RedirectShellErrorOutputPipe">true</B>
|
60
|
+
</MS>
|
61
|
+
</Obj>
|
62
|
+
<B N="NoInput">true</B>
|
63
|
+
<Obj N="ApartmentState" RefId="10">
|
64
|
+
<TN RefId="2">
|
65
|
+
<T>System.Threading.ApartmentState</T>
|
66
|
+
<T>System.Enum</T>
|
67
|
+
<T>System.ValueType</T>
|
68
|
+
<T>System.Object</T>
|
69
|
+
</TN>
|
70
|
+
<ToString>Unknown</ToString>
|
71
|
+
<I32>2</I32>
|
72
|
+
</Obj>
|
73
|
+
<Obj N="RemoteStreamOptions" RefId="11">
|
74
|
+
<TN RefId="3">
|
75
|
+
<T>System.Management.Automation.RemoteStreamOptions</T>
|
76
|
+
<T>System.Enum</T>
|
77
|
+
<T>System.ValueType</T>
|
78
|
+
<T>System.Object</T>
|
79
|
+
</TN>
|
80
|
+
<ToString>0</ToString>
|
81
|
+
<I32>0</I32>
|
82
|
+
</Obj>
|
83
|
+
<B N="AddToHistory">true</B>
|
84
|
+
<Obj N="HostInfo" RefId="12">
|
85
|
+
<MS>
|
86
|
+
<B N="_isHostNull">true</B>
|
87
|
+
<B N="_isHostUINull">true</B>
|
88
|
+
<B N="_isHostRawUINull">true</B>
|
89
|
+
<B N="_useRunspaceHost">true</B>
|
90
|
+
</MS>
|
91
|
+
</Obj>
|
92
|
+
</MS>
|
93
|
+
</Obj>
|
@@ -0,0 +1,221 @@
|
|
1
|
+
<Obj RefId="0">
|
2
|
+
<MS>
|
3
|
+
<I32 N="MinRunspaces">1</I32>
|
4
|
+
<I32 N="MaxRunspaces">1</I32>
|
5
|
+
<Obj N="PSThreadOptions" RefId="1">
|
6
|
+
<TN RefId="0">
|
7
|
+
<T>System.Management.Automation.Runspaces.PSThreadOptions</T>
|
8
|
+
<T>System.Enum</T>
|
9
|
+
<T>System.ValueType</T>
|
10
|
+
<T>System.Object</T>
|
11
|
+
</TN>
|
12
|
+
<ToString>Default</ToString>
|
13
|
+
<I32>0</I32>
|
14
|
+
</Obj>
|
15
|
+
<Obj N="ApartmentState" RefId="2">
|
16
|
+
<TN RefId="1">
|
17
|
+
<T>System.Threading.ApartmentState</T>
|
18
|
+
<T>System.Enum</T>
|
19
|
+
<T>System.ValueType</T>
|
20
|
+
<T>System.Object</T>
|
21
|
+
</TN>
|
22
|
+
<ToString>Unknown</ToString>
|
23
|
+
<I32>2</I32>
|
24
|
+
</Obj>
|
25
|
+
<Obj N="ApplicationArguments" RefId="3">
|
26
|
+
<TN RefId="2">
|
27
|
+
<T>System.Management.Automation.PSPrimitiveDictionary</T>
|
28
|
+
<T>System.Collections.Hashtable</T>
|
29
|
+
<T>System.Object</T>
|
30
|
+
</TN>
|
31
|
+
<DCT>
|
32
|
+
<En>
|
33
|
+
<S N="Key">PSVersionTable</S>
|
34
|
+
<Obj N="Value" RefId="4">
|
35
|
+
<TNRef RefId="2" />
|
36
|
+
<DCT>
|
37
|
+
<En>
|
38
|
+
<S N="Key">CLRVersion</S>
|
39
|
+
<Version N="Value">2.0.50727.5420</Version>
|
40
|
+
</En>
|
41
|
+
<En>
|
42
|
+
<S N="Key">BuildVersion</S>
|
43
|
+
<Version N="Value">6.1.7601.17514</Version>
|
44
|
+
</En>
|
45
|
+
<En>
|
46
|
+
<S N="Key">PSVersion</S>
|
47
|
+
<Version N="Value">2.0</Version>
|
48
|
+
</En>
|
49
|
+
<En>
|
50
|
+
<S N="Key">WSManStackVersion</S>
|
51
|
+
<Version N="Value">2.0</Version>
|
52
|
+
</En>
|
53
|
+
<En>
|
54
|
+
<S N="Key">PSCompatibleVersions</S>
|
55
|
+
<Obj N="Value" RefId="5">
|
56
|
+
<TN RefId="3">
|
57
|
+
<T>System.Version[]</T>
|
58
|
+
<T>System.Array</T>
|
59
|
+
<T>System.Object</T>
|
60
|
+
</TN>
|
61
|
+
<LST>
|
62
|
+
<Version>1.0</Version>
|
63
|
+
<Version>2.0</Version>
|
64
|
+
</LST>
|
65
|
+
</Obj>
|
66
|
+
</En>
|
67
|
+
<En>
|
68
|
+
<S N="Key">SerializationVersion</S>
|
69
|
+
<Version N="Value">1.1.0.1</Version>
|
70
|
+
</En>
|
71
|
+
<En>
|
72
|
+
<S N="Key">PSRemotingProtocolVersion</S>
|
73
|
+
<Version N="Value">2.1</Version>
|
74
|
+
</En>
|
75
|
+
</DCT>
|
76
|
+
</Obj>
|
77
|
+
</En>
|
78
|
+
</DCT>
|
79
|
+
</Obj>
|
80
|
+
<Obj N="HostInfo" RefId="6">
|
81
|
+
<MS>
|
82
|
+
<Obj N="_hostDefaultData" RefId="7">
|
83
|
+
<MS>
|
84
|
+
<Obj N="data" RefId="8">
|
85
|
+
<TN RefId="4">
|
86
|
+
<T>System.Collections.Hashtable</T>
|
87
|
+
<T>System.Object</T>
|
88
|
+
</TN>
|
89
|
+
<DCT>
|
90
|
+
<En>
|
91
|
+
<I32 N="Key">9</I32>
|
92
|
+
<Obj N="Value" RefId="9">
|
93
|
+
<MS>
|
94
|
+
<S N="T">System.String</S>
|
95
|
+
<S N="V">Administrator: Windows PowerShell</S>
|
96
|
+
</MS>
|
97
|
+
</Obj>
|
98
|
+
</En>
|
99
|
+
<En>
|
100
|
+
<I32 N="Key">8</I32>
|
101
|
+
<Obj N="Value" RefId="10">
|
102
|
+
<MS>
|
103
|
+
<S N="T">System.Management.Automation.Host.Size</S>
|
104
|
+
<Obj N="V" RefId="11">
|
105
|
+
<MS>
|
106
|
+
<I32 N="width">128</I32>
|
107
|
+
<I32 N="height">58</I32>
|
108
|
+
</MS>
|
109
|
+
</Obj>
|
110
|
+
</MS>
|
111
|
+
</Obj>
|
112
|
+
</En>
|
113
|
+
<En>
|
114
|
+
<I32 N="Key">7</I32>
|
115
|
+
<Obj N="Value" RefId="12">
|
116
|
+
<MS>
|
117
|
+
<S N="T">System.Management.Automation.Host.Size</S>
|
118
|
+
<Obj N="V" RefId="13">
|
119
|
+
<MS>
|
120
|
+
<I32 N="width">120</I32>
|
121
|
+
<I32 N="height">58</I32>
|
122
|
+
</MS>
|
123
|
+
</Obj>
|
124
|
+
</MS>
|
125
|
+
</Obj>
|
126
|
+
</En>
|
127
|
+
<En>
|
128
|
+
<I32 N="Key">6</I32>
|
129
|
+
<Obj N="Value" RefId="14">
|
130
|
+
<MS>
|
131
|
+
<S N="T">System.Management.Automation.Host.Size</S>
|
132
|
+
<Obj N="V" RefId="15">
|
133
|
+
<MS>
|
134
|
+
<I32 N="width">120</I32>
|
135
|
+
<I32 N="height">49</I32>
|
136
|
+
</MS>
|
137
|
+
</Obj>
|
138
|
+
</MS>
|
139
|
+
</Obj>
|
140
|
+
</En>
|
141
|
+
<En>
|
142
|
+
<I32 N="Key">5</I32>
|
143
|
+
<Obj N="Value" RefId="16">
|
144
|
+
<MS>
|
145
|
+
<S N="T">System.Management.Automation.Host.Size</S>
|
146
|
+
<Obj N="V" RefId="17">
|
147
|
+
<MS>
|
148
|
+
<I32 N="width">120</I32>
|
149
|
+
<I32 N="height">3000</I32>
|
150
|
+
</MS>
|
151
|
+
</Obj>
|
152
|
+
</MS>
|
153
|
+
</Obj>
|
154
|
+
</En>
|
155
|
+
<En>
|
156
|
+
<I32 N="Key">4</I32>
|
157
|
+
<Obj N="Value" RefId="18">
|
158
|
+
<MS>
|
159
|
+
<S N="T">System.Int32</S>
|
160
|
+
<I32 N="V">25</I32>
|
161
|
+
</MS>
|
162
|
+
</Obj>
|
163
|
+
</En>
|
164
|
+
<En>
|
165
|
+
<I32 N="Key">3</I32>
|
166
|
+
<Obj N="Value" RefId="19">
|
167
|
+
<MS>
|
168
|
+
<S N="T">System.Management.Automation.Host.Coordinates</S>
|
169
|
+
<Obj N="V" RefId="20">
|
170
|
+
<MS>
|
171
|
+
<I32 N="x">0</I32>
|
172
|
+
<I32 N="y">323</I32>
|
173
|
+
</MS>
|
174
|
+
</Obj>
|
175
|
+
</MS>
|
176
|
+
</Obj>
|
177
|
+
</En>
|
178
|
+
<En>
|
179
|
+
<I32 N="Key">2</I32>
|
180
|
+
<Obj N="Value" RefId="21">
|
181
|
+
<MS>
|
182
|
+
<S N="T">System.Management.Automation.Host.Coordinates</S>
|
183
|
+
<Obj N="V" RefId="22">
|
184
|
+
<MS>
|
185
|
+
<I32 N="x">0</I32>
|
186
|
+
<I32 N="y">371</I32>
|
187
|
+
</MS>
|
188
|
+
</Obj>
|
189
|
+
</MS>
|
190
|
+
</Obj>
|
191
|
+
</En>
|
192
|
+
<En>
|
193
|
+
<I32 N="Key">1</I32>
|
194
|
+
<Obj N="Value" RefId="23">
|
195
|
+
<MS>
|
196
|
+
<S N="T">System.ConsoleColor</S>
|
197
|
+
<I32 N="V">5</I32>
|
198
|
+
</MS>
|
199
|
+
</Obj>
|
200
|
+
</En>
|
201
|
+
<En>
|
202
|
+
<I32 N="Key">0</I32>
|
203
|
+
<Obj N="Value" RefId="24">
|
204
|
+
<MS>
|
205
|
+
<S N="T">System.ConsoleColor</S>
|
206
|
+
<I32 N="V">6</I32>
|
207
|
+
</MS>
|
208
|
+
</Obj>
|
209
|
+
</En>
|
210
|
+
</DCT>
|
211
|
+
</Obj>
|
212
|
+
</MS>
|
213
|
+
</Obj>
|
214
|
+
<B N="_isHostNull">false</B>
|
215
|
+
<B N="_isHostUINull">false</B>
|
216
|
+
<B N="_isHostRawUINull">false</B>
|
217
|
+
<B N="_useRunspaceHost">false</B>
|
218
|
+
</MS>
|
219
|
+
</Obj>
|
220
|
+
</MS>
|
221
|
+
</Obj>
|
data/psrp.gemspec
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
require 'date'
|
3
|
+
require File.expand_path('../lib/version', __FILE__)
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.platform = Gem::Platform::RUBY
|
7
|
+
s.name = 'psrp'
|
8
|
+
s.version = PSRP::VERSION
|
9
|
+
s.date = Date.today.to_s
|
10
|
+
|
11
|
+
s.author = ['Sam Oluwalana']
|
12
|
+
s.email = ['soluwalana@gmail.com']
|
13
|
+
s.homepage = 'http://github.com/soluwalana/PSRP-RB'
|
14
|
+
s.summary = 'Ruby library for PSRP'
|
15
|
+
|
16
|
+
s.description = <<-EOF
|
17
|
+
Ruby library for sending huge Powershell packets over Windows Remote Management
|
18
|
+
EOF
|
19
|
+
|
20
|
+
s.license = 'Apache-2.0'
|
21
|
+
|
22
|
+
s.files = `git ls-files`.split(/\n/)
|
23
|
+
s.require_path = 'lib'
|
24
|
+
s.extra_rdoc_files = %w(README.md LICENSE)
|
25
|
+
|
26
|
+
s.required_ruby_version = '>= 1.9.0'
|
27
|
+
s.add_runtime_dependency 'httpclient', '~> 2.2', '>= 2.2.0.2'
|
28
|
+
s.add_runtime_dependency 'rubyntlm', '~> 0.6.0'
|
29
|
+
s.add_runtime_dependency 'logging', ['>= 1.6.1', '< 3.0']
|
30
|
+
s.add_runtime_dependency 'nori', '~> 2.0'
|
31
|
+
s.add_runtime_dependency 'gyoku', '~> 1.0'
|
32
|
+
s.add_runtime_dependency 'builder', '>= 2.1.2'
|
33
|
+
s.add_runtime_dependency 'erubis', '~> 2.7'
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
|