2014-01-16 19:21:33 +00:00
|
|
|
##
|
2014-10-17 16:47:33 +00:00
|
|
|
# This module requires Metasploit: http://metasploit.com/download
|
2014-01-16 19:21:33 +00:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
|
|
|
##
|
|
|
|
|
|
|
|
require "msf/core"
|
|
|
|
require "rex/proto/pjl"
|
|
|
|
|
2016-03-08 13:02:44 +00:00
|
|
|
class MetasploitModule < Msf::Auxiliary
|
2014-01-16 19:21:33 +00:00
|
|
|
|
|
|
|
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{
|
2014-01-21 19:29:08 +00:00
|
|
|
This module scans for printer environment variables using the
|
|
|
|
Printer Job Language (PJL) protocol.
|
2014-01-16 19:21:33 +00:00
|
|
|
},
|
|
|
|
"Author" => [
|
2014-01-25 23:36:08 +00:00
|
|
|
"wvu", # Rex::Proto::PJL and modules
|
2014-01-16 19:21:33 +00:00
|
|
|
"sinn3r", # RSpec tests
|
2014-01-25 23:36:08 +00:00
|
|
|
"MC", # Independent mixin and modules
|
|
|
|
"Myo Soe", # Independent modules
|
|
|
|
"Matteo Cantoni" # Independent modules
|
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
|
2014-01-21 19:29:08 +00:00
|
|
|
print_good("#{ip}:#{rport} - #{env_vars}")
|
2014-03-28 07:15:38 +00:00
|
|
|
report_note(
|
2014-01-16 19:21:33 +00:00
|
|
|
:host => ip,
|
|
|
|
:port => rport,
|
|
|
|
:proto => "tcp",
|
|
|
|
:type => "printer.env.vars",
|
|
|
|
:data => env_vars
|
2014-03-28 07:15:38 +00:00
|
|
|
)
|
2014-01-16 19:21:33 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|