diff --git a/modules/exploits/windows/smb/ms10_061_spoolss.rb b/modules/exploits/windows/smb/ms10_061_spoolss.rb index 97ce9f5620..626eb3b263 100644 --- a/modules/exploits/windows/smb/ms10_061_spoolss.rb +++ b/modules/exploits/windows/smb/ms10_061_spoolss.rb @@ -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