Files
metasploit-gs/modules/auxiliary/scanner/printer/printer_ready_message.rb
T
Tod Beardsley b3b51eb48c Pre-release fixup
* Updated descriptions to be a little more descriptive.

  * Updated store_loot calls to inform the user where the
loot is stored.

  * Removed newlines in print_* statments -- these will screw
up Scanner output when dealing with multiple hosts.

Of the fixed newlines, I haven't see any output, so I'm not sure what
the actual message is going to look like -- I expect it's a whole bunch
of newlines in there so it'll be kinda ugly as is (not a blocker for
this but should clean up eventually)
2014-01-21 13:29:08 -06:00

75 lines
1.8 KiB
Ruby

##
# 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 Ready Message Scanner",
"Description" => %q{
This module scans for and optionally changes the printer ready message on
a set of printers using the Printer Job Language (PJL) protocol.
},
"Author" => [
"wvu", # This implementation
"sinn3r", # RSpec tests
"MC", # Independent implementation
"YGN" # Independent implementation
],
"References" => [
["URL", "https://en.wikipedia.org/wiki/Printer_Job_Language"]
],
"License" => MSF_LICENSE
))
register_options([
Opt::RPORT(Rex::Proto::PJL::DEFAULT_PORT),
OptBool.new("CHANGE", [false, "Change ready message", false]),
OptBool.new("RESET", [false, "Reset ready message (CHANGE must be true)", false]),
OptString.new("MESSAGE", [false, "Ready message", "PC LOAD LETTER"])
], self.class)
end
def run_host(ip)
connect
pjl = Rex::Proto::PJL::Client.new(sock)
pjl.begin_job
if datastore["CHANGE"]
if datastore["RESET"]
message = ""
else
message = datastore["MESSAGE"]
end
pjl.set_rdymsg(message)
end
rdymsg = pjl.get_rdymsg
pjl.end_job
disconnect
if rdymsg
print_good("#{ip}:#{rport} - #{rdymsg}")
report_note({
:host => ip,
:port => rport,
:proto => "tcp",
:type => "printer.rdymsg",
:data => rdymsg
})
end
end
end