-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathport_scan.rb
41 lines (37 loc) · 988 Bytes
/
port_scan.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
require "msf/core"
require "nmap/program"
class MetasploitModule < Msf::Auxiliary
include Msf::Auxiliary::Report
include Msf::Auxiliary::Scanner
Rank = GreatRanking
def initialize(info = {})
super(update_info(info,
'Name' => 'Port scanner',
'Description' => %q{
port scanner auxiliary
},
'Author' => ['Abd El Rahman HSN <abdelrahmanhsn1@gmail.com>'],
'License' => MSF_LICENSE,
'Version' => '1.0'))
register_options(
[
#OptString.new('TARGETS',[true,'targets ips']),
OptString.new('PORTS',[true,'ports for scan']),
OptString.new('XMLFILE',[true,'xml file for saving']),
],self.class)
end
def run
$targets = datastore['RHOSTS']
$ports = datastore['PORTS']
$xmlfile = datastore['XMLFILE']
print_status("starting scan")
Nmap::Program.scan do |nmap|
nmap.syn_scan = true
nmap.service_scan = true
nmap.os_fingerprint = true
nmap.xml = $xmlfile
nmap.ports = [$ports]
nmap.targets = $targets
end
end
end