AutoCheck
Msf::Exploit::Remote::AutoCheck は、exploit / run の前に check を自動実行します。include ではなく prepend します。実装は lib/msf/core/exploit/remote/auto_check.rb です。
class MetasploitModule < Msf::Exploit::Remote prepend Msf::Exploit::Remote::AutoCheck include Msf::Exploit::Remote::HttpClient
def check CheckCode::Appears('service detected') end
def exploit # AutoCheck が先に check する endendinclude すると明示的に失敗します。
AutoCheckが true(default)ならcheckを実行。Vulnerable/Appears→ 続行。必要ならreport_vuln。Detected→ 警告のうえ続行。Safeなど → 失敗扱い。ForceExploit trueなら強行可能。
| オプション | 意味 |
|---|---|
AutoCheck | 自動 check の有無 |
ForceExploit | check 結果を無視して実行 |
set AutoCheck falseset ForceExploit true書くときの注意
Section titled “書くときの注意”check内ではfail_withよりCheckCodeを返す。- check は破壊的すぎないこと(DoS で Vulnerable を証明しない)。
- Scanner では
check_hostを使う。
関連: 入口メソッド

