metasploit-framework/modules/auxiliary/scanner/printer/printer_ready_message.rb

76 lines
1.9 KiB
Ruby
Raw Normal View History

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 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.
2013-12-05 03:46:45 +00:00
},
2014-01-15 19:49:37 +00:00
"Author" => [
"wvu", # Rex::Proto::PJL and modules
2014-01-15 19:49:37 +00:00
"sinn3r", # RSpec tests
"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 06:28:53 +00:00
OptBool.new("CHANGE", [false, "Change ready message", false]),
OptBool.new("RESET", [false, "Reset ready message if CHANGE", false]),
2013-12-05 06:28:53 +00:00
OptString.new("MESSAGE", [false, "Ready message", "PC LOAD LETTER"])
2013-12-05 03:46:45 +00:00
], self.class)
end
def run_host(ip)
connect
pjl = Rex::Proto::PJL::Client.new(sock)
pjl.begin_job
2014-01-15 19:49:37 +00:00
2013-12-05 06:28:53 +00:00
if datastore["CHANGE"]
2014-01-15 19:49:37 +00:00
if datastore["RESET"]
message = ""
else
message = datastore["MESSAGE"]
end
2013-12-05 16:25:04 +00:00
pjl.set_rdymsg(message)
2013-12-05 03:46:45 +00:00
end
2014-01-15 19:49:37 +00:00
2013-12-09 20:02:16 +00:00
rdymsg = pjl.get_rdymsg
2014-01-15 19:49:37 +00:00
pjl.end_job
2013-12-05 03:46:45 +00:00
disconnect
if rdymsg
2013-12-16 17:46:24 +00:00
print_good("#{ip}:#{rport} - #{rdymsg}")
report_note(
2013-12-05 03:46:45 +00:00
:host => ip,
:port => rport,
:proto => "tcp",
:type => "printer.rdymsg",
2013-12-05 03:46:45 +00:00
:data => rdymsg
)
2013-12-05 03:46:45 +00:00
end
end
end