refactor: use Rex built-in encoders
parent
c9ab44234a
commit
6d4ad57beb
|
@ -59,20 +59,12 @@ class MetasploitModule < Msf::Exploit::Remote
|
|||
deregister_options('URIPATH', 'SSL', 'SSLCert', 'SRVPORT', 'SRVHOST')
|
||||
end
|
||||
|
||||
def bin_to_hex(s)
|
||||
s.each_byte.map { |b| b.to_s(16) }.join
|
||||
end
|
||||
|
||||
def hex_to_bin(s)
|
||||
s.scan(/../).map { |x| x.hex.chr }.join
|
||||
end
|
||||
|
||||
def execute_command(cmd, opts = {})
|
||||
case target['Platform']
|
||||
when 'linux'
|
||||
cmd = bin_to_hex(cmd)
|
||||
cmd = Rex::Text.to_hex(cmd, '')
|
||||
when 'windows'
|
||||
cmd = bin_to_hex(cmd_psh_payload(payload.encoded, payload_instance.arch.first))
|
||||
cmd = Rex::Text.to_hex(cmd_psh_payload(payload.encoded, payload_instance.arch.first), '')
|
||||
end
|
||||
case target['Platform']
|
||||
when 'linux'
|
||||
|
@ -130,7 +122,7 @@ class MetasploitModule < Msf::Exploit::Remote
|
|||
if not hex
|
||||
return Exploit::CheckCode::Safe
|
||||
end
|
||||
str = hex_to_bin(hex)
|
||||
str = Rex::Text.hex_to_raw(hex)
|
||||
if str.include?('WARNING')
|
||||
return Exploit::CheckCode::Vulnerable
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue