2007-02-18 00:10:39 +00:00
|
|
|
##
|
2008-01-23 02:25:06 +00:00
|
|
|
# $Id$
|
2007-02-18 00:10:39 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
##
|
2010-04-30 08:40:19 +00:00
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
2007-02-18 00:10:39 +00:00
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
|
|
|
# Framework web site for more information on licensing and terms of use.
|
2009-04-13 14:33:26 +00:00
|
|
|
# http://metasploit.com/framework/
|
2007-02-18 00:10:39 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
|
2006-04-27 05:16:03 +00:00
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
class Metasploit3 < Msf::Auxiliary
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
include Msf::Auxiliary::Report
|
|
|
|
include Msf::Exploit::Remote::Tcp
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-04-27 05:16:03 +00:00
|
|
|
def initialize
|
|
|
|
super(
|
|
|
|
'Name' => 'Simple Recon Module Tester',
|
2007-02-18 00:10:39 +00:00
|
|
|
'Version' => '$Revision$',
|
2006-04-27 05:16:03 +00:00
|
|
|
'Description' => 'Simple Recon Module Tester',
|
|
|
|
'Author' => 'hdm',
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'Actions' =>
|
|
|
|
[
|
|
|
|
['Continuous Port Sweep']
|
|
|
|
],
|
2010-04-30 08:40:19 +00:00
|
|
|
'PassiveActions' =>
|
2006-04-27 05:16:03 +00:00
|
|
|
[
|
|
|
|
'Continuous Port Sweep'
|
|
|
|
]
|
|
|
|
)
|
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
Opt::RHOST,
|
|
|
|
Opt::RPORT,
|
2010-04-30 08:40:19 +00:00
|
|
|
], self.class)
|
2006-04-27 05:16:03 +00:00
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
def run
|
|
|
|
print_status("Running the simple recon module with action #{action.name}")
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-04-27 05:16:03 +00:00
|
|
|
case action.name
|
|
|
|
when 'Continuous Port Sweep'
|
|
|
|
while (true)
|
|
|
|
1.upto(65535) do |port|
|
|
|
|
datastore['RPORT'] = port
|
|
|
|
prober()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-04-27 05:16:03 +00:00
|
|
|
def prober
|
|
|
|
begin
|
|
|
|
connect
|
|
|
|
disconnect
|
|
|
|
report_host(:host => datastore['RHOST'])
|
|
|
|
report_service(
|
2010-04-30 08:40:19 +00:00
|
|
|
:host => datastore['RHOST'],
|
2006-04-27 05:16:03 +00:00
|
|
|
:port => datastore['RPORT'],
|
|
|
|
:proto => 'tcp'
|
|
|
|
)
|
|
|
|
rescue ::Exception => e
|
|
|
|
case e.to_s
|
|
|
|
when /connection was refused/
|
|
|
|
report_host(:host => datastore['RHOST'])
|
|
|
|
else
|
|
|
|
print_status(e.to_s)
|
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
end
|
2006-04-27 05:16:03 +00:00
|
|
|
end
|
|
|
|
|
2010-04-30 08:40:19 +00:00
|
|
|
end
|