Metasploit mailing list archives

Re: Catching exploit exceptions in rc script


From: birchfresh <birchfresh () tormail org>
Date: Tue, 26 Jun 2012 19:30:09 +0000

yeah, this works for me

<ruby>
      run_single("use exploit/windows/smb/psexec")
      run_single("set RHOST 1.1.1.1") # <-- this host doesn't exist
      begin
              run_single("exploit -j")
      rescue
      end
</ruby>

Well hot damn. I had WfsDelay set to something high which, not
unreasonably, kept the exploit/job on life support. With that unset,
my original code works.

Though it turns out that begin/rescue around run_single("exploit -z")
cannot actually catch any exceptions. They must come up through some
other path. At least they don't obstruct the flow of the rc script, but
it would still be nice to find out what went wrong with the exploit.
Any ideas? Otherwise, I might have to monkey-patch print_status and
inspect the exploit's messages... eew!

In any case, thanks Josh for walking me through this.
_______________________________________________
https://mail.metasploit.com/mailman/listinfo/framework


Current thread: