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

64 lines
1.5 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::Report
include Msf::Auxiliary::Scanner
2013-12-05 03:46:45 +00:00
def initialize(info = {})
super(update_info(info,
2013-12-05 06:28:53 +00:00
'Name' => "Printer Ready Message Scanner",
2013-12-05 03:46:45 +00:00
'Description' => %q{
This module scans for and can change printer ready messages using PJL.
},
2013-12-05 06:28:53 +00:00
'Author' => [
"wvu", # Author
"MC", # Comrade
"YGN" # Comrade
],
2013-12-05 03:46:45 +00:00
'References' => [
["URL", "https://en.wikipedia.org/wiki/Printer_Job_Language"]
],
'License' => MSF_LICENSE
))
register_options([
Opt::RPORT(9100),
2013-12-05 06:28:53 +00:00
OptBool.new("CHANGE", [false, "Change ready message", false]),
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)
2013-12-05 16:25:04 +00:00
rdymsg = pjl.get_rdymsg
2013-12-05 06:28:53 +00:00
if datastore["CHANGE"]
2013-12-05 03:46:45 +00:00
message = datastore["MESSAGE"]
2013-12-05 16:25:04 +00:00
pjl.set_rdymsg(message)
rdymsg = pjl.get_rdymsg
2013-12-05 03:46:45 +00:00
end
disconnect
if rdymsg
print_good("#{ip} #{rdymsg}")
report_note({
:host => ip,
:port => rport,
:proto => "tcp",
:type => "printer_ready_message",
:data => rdymsg
})
end
end
end