use Msf::WindowsError, see #2214
git-svn-id: file:///home/svn/framework3/trunk@10607 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
parent
d6f8b689ee
commit
ede859f60e
|
@ -10,6 +10,7 @@
|
||||||
##
|
##
|
||||||
|
|
||||||
require 'msf/core'
|
require 'msf/core'
|
||||||
|
require 'msf/windows_error'
|
||||||
|
|
||||||
class Metasploit3 < Msf::Exploit::Remote
|
class Metasploit3 < Msf::Exploit::Remote
|
||||||
Rank = ExcellentRanking
|
Rank = ExcellentRanking
|
||||||
|
@ -141,7 +142,7 @@ class Metasploit3 < Msf::Exploit::Remote
|
||||||
# Open the printer
|
# Open the printer
|
||||||
status,ph = open_printer_ex(pname)
|
status,ph = open_printer_ex(pname)
|
||||||
if status != 0
|
if status != 0
|
||||||
raise RuntimeError, ('Unable to open printer: %d' % status)
|
raise RuntimeError, "Unable to open printer: #{Msf::WindowsError.description(status)}"
|
||||||
end
|
end
|
||||||
print_status("Printer handle: %s" % ph.unpack('H*'))
|
print_status("Printer handle: %s" % ph.unpack('H*'))
|
||||||
|
|
||||||
|
@ -176,7 +177,7 @@ class Metasploit3 < Msf::Exploit::Remote
|
||||||
# ClosePrinter
|
# ClosePrinter
|
||||||
status,ph = close_printer(ph)
|
status,ph = close_printer(ph)
|
||||||
if status != 0
|
if status != 0
|
||||||
raise RuntimeError, ('Failed to close printer: %d' % status)
|
raise RuntimeError, "Failed to close printer: #{Msf::WindowsError.description(status)}"
|
||||||
end
|
end
|
||||||
|
|
||||||
break if session_created?
|
break if session_created?
|
||||||
|
@ -201,7 +202,7 @@ class Metasploit3 < Msf::Exploit::Remote
|
||||||
# StartDocPrinter
|
# StartDocPrinter
|
||||||
status,jobid = start_doc_printer(ph, doc, fname)
|
status,jobid = start_doc_printer(ph, doc, fname)
|
||||||
if status != 0 or jobid < 0
|
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
|
end
|
||||||
print_status("Job started: 0x%x" % jobid)
|
print_status("Job started: 0x%x" % jobid)
|
||||||
|
|
||||||
|
@ -215,7 +216,7 @@ class Metasploit3 < Msf::Exploit::Remote
|
||||||
# EndDocPrinter
|
# EndDocPrinter
|
||||||
status = end_doc_printer(ph)
|
status = end_doc_printer(ph)
|
||||||
if status != 0
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -231,7 +232,7 @@ class Metasploit3 < Msf::Exploit::Remote
|
||||||
# StartDocPrinter
|
# StartDocPrinter
|
||||||
status,jobid = start_doc_printer(ph, doc, at_pipe)
|
status,jobid = start_doc_printer(ph, doc, at_pipe)
|
||||||
if status != 0 or jobid < 0
|
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
|
end
|
||||||
print_status("Job started: 0x%x" % jobid)
|
print_status("Job started: 0x%x" % jobid)
|
||||||
|
|
||||||
|
@ -276,7 +277,7 @@ class Metasploit3 < Msf::Exploit::Remote
|
||||||
# EndDocPrinter
|
# EndDocPrinter
|
||||||
status = end_doc_printer(ph)
|
status = end_doc_printer(ph)
|
||||||
if status != 0
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue