2014-01-16 19:21:33 +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
|
|
|
|
include Msf::Auxiliary::Scanner
|
|
|
|
include Msf::Auxiliary::Report
|
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
|
|
|
"Name" => "Printer Environment Variables Scanner",
|
|
|
|
"Description" => %q{
|
|
|
|
This module scans for printer environment variables using PJL.
|
|
|
|
},
|
|
|
|
"Author" => [
|
|
|
|
"wvu", # This implementation
|
|
|
|
"sinn3r", # RSpec tests
|
|
|
|
"MC", # Independent implementation
|
2014-01-24 01:02:43 +00:00
|
|
|
"Myo Soe" # Independent implementation
|
2014-01-16 19:21:33 +00:00
|
|
|
],
|
|
|
|
"References" => [
|
|
|
|
["URL", "https://en.wikipedia.org/wiki/Printer_Job_Language"]
|
|
|
|
],
|
|
|
|
"License" => MSF_LICENSE
|
|
|
|
))
|
|
|
|
|
|
|
|
register_options([
|
|
|
|
Opt::RPORT(Rex::Proto::PJL::DEFAULT_PORT),
|
|
|
|
], self.class)
|
|
|
|
end
|
|
|
|
|
|
|
|
def run_host(ip)
|
|
|
|
connect
|
|
|
|
pjl = Rex::Proto::PJL::Client.new(sock)
|
|
|
|
pjl.begin_job
|
|
|
|
|
|
|
|
env_vars = pjl.info_variables
|
|
|
|
|
|
|
|
pjl.end_job
|
|
|
|
disconnect
|
|
|
|
|
|
|
|
if env_vars
|
|
|
|
print_good("#{ip}:#{rport}\n#{env_vars}")
|
|
|
|
report_note({
|
|
|
|
:host => ip,
|
|
|
|
:port => rport,
|
|
|
|
:proto => "tcp",
|
|
|
|
:type => "printer.env.vars",
|
|
|
|
:data => env_vars
|
|
|
|
})
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|