CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/auxiliary/scanner/imap/imap_version.rb
Views: 11623
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
class MetasploitModule < Msf::Auxiliary
7
include Msf::Exploit::Remote::Imap
8
include Msf::Auxiliary::Scanner
9
include Msf::Auxiliary::Report
10
11
def initialize
12
super(
13
'Name' => 'IMAP4 Banner Grabber',
14
'Description' => 'IMAP4 Banner Grabber',
15
'Author' => 'hdm',
16
'License' => MSF_LICENSE
17
)
18
end
19
20
def run_host(ip)
21
begin
22
connect
23
banner_sanitized = Rex::Text.to_hex_ascii(banner.to_s)
24
print_good("#{ip}:#{rport} IMAP #{banner_sanitized}")
25
report_service(:host => rhost, :port => rport, :name => "imap", :info => banner)
26
rescue ::Rex::ConnectionError
27
rescue ::EOFError
28
print_error("#{ip}:#{rport} - The service failed to respond")
29
rescue ::Exception => e
30
print_error("#{ip}:#{rport} - #{e} #{e.backtrace}")
31
end
32
end
33
end
34
35