use Msf::WindowsError, see #2214

git-svn-id: file:///home/svn/framework3/trunk@10607 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
Joshua Drake 2010-10-08 19:51:50 +00:00
parent d6f8b689ee
commit ede859f60e
1 changed files with 7 additions and 6 deletions

View File

@ -10,6 +10,7 @@
##
require 'msf/core'
require 'msf/windows_error'
class Metasploit3 < Msf::Exploit::Remote
Rank = ExcellentRanking
@ -141,7 +142,7 @@ class Metasploit3 < Msf::Exploit::Remote
# Open the printer
status,ph = open_printer_ex(pname)
if status != 0
raise RuntimeError, ('Unable to open printer: %d' % status)
raise RuntimeError, "Unable to open printer: #{Msf::WindowsError.description(status)}"
end
print_status("Printer handle: %s" % ph.unpack('H*'))
@ -176,7 +177,7 @@ class Metasploit3 < Msf::Exploit::Remote
# ClosePrinter
status,ph = close_printer(ph)
if status != 0
raise RuntimeError, ('Failed to close printer: %d' % status)
raise RuntimeError, "Failed to close printer: #{Msf::WindowsError.description(status)}"
end
break if session_created?
@ -201,7 +202,7 @@ class Metasploit3 < Msf::Exploit::Remote
# StartDocPrinter
status,jobid = start_doc_printer(ph, doc, fname)
if status != 0 or jobid < 0
raise RuntimeError, ('Unable to start print job: %d' % status)
raise RuntimeError, "Unable to start print job: #{Msf::WindowsError.description(status)}"
end
print_status("Job started: 0x%x" % jobid)
@ -215,7 +216,7 @@ class Metasploit3 < Msf::Exploit::Remote
# EndDocPrinter
status = end_doc_printer(ph)
if status != 0
raise RuntimeError, ('Failed to end print job: %d' % status)
raise RuntimeError, "Failed to end print job: #{Msf::WindowsError.description(status)}"
end
end
@ -231,7 +232,7 @@ class Metasploit3 < Msf::Exploit::Remote
# StartDocPrinter
status,jobid = start_doc_printer(ph, doc, at_pipe)
if status != 0 or jobid < 0
raise RuntimeError, ('Unable to start printer: %d' % status)
raise RuntimeError, "Unable to start printer: #{Msf::WindowsError.description(status)}"
end
print_status("Job started: 0x%x" % jobid)
@ -276,7 +277,7 @@ class Metasploit3 < Msf::Exploit::Remote
# EndDocPrinter
status = end_doc_printer(ph)
if status != 0
raise RuntimeError, ('Failed to end print job: %d' % status)
raise RuntimeError, "Failed to end print job: #{Msf::WindowsError.description(status)}"
end
end