wmap 2.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +141 -0
- data/LICENSE.txt +15 -0
- data/README.rdoc +98 -0
- data/TODO +13 -0
- data/bin/deprime +21 -0
- data/bin/distrust +38 -0
- data/bin/googleBot +23 -0
- data/bin/prime +21 -0
- data/bin/refresh +26 -0
- data/bin/run_tests +16 -0
- data/bin/spiderBot +26 -0
- data/bin/trust +38 -0
- data/bin/updateAll +57 -0
- data/bin/wadd +25 -0
- data/bin/wadds +26 -0
- data/bin/wcheck +28 -0
- data/bin/wdel +25 -0
- data/bin/wdump +21 -0
- data/bin/wmap +151 -0
- data/bin/wscan +32 -0
- data/data/cidrs +2 -0
- data/data/deactivated_sites +1 -0
- data/data/domains +2 -0
- data/data/hosts +1 -0
- data/data/prime_hosts +1 -0
- data/data/sites +2 -0
- data/data/sub_domains +2 -0
- data/demos/bruter.rb +27 -0
- data/demos/dns_brutes.rb +28 -0
- data/demos/filter_cidr.rb +18 -0
- data/demos/filter_crawls.rb +5 -0
- data/demos/filter_domain.rb +25 -0
- data/demos/filter_geoip.rb +26 -0
- data/demos/filter_known_services.rb +59 -0
- data/demos/filter_netinfo.rb +23 -0
- data/demos/filter_prime.rb +25 -0
- data/demos/filter_profiler.rb +3 -0
- data/demos/filter_redirection.rb +19 -0
- data/demos/filter_site.rb +40 -0
- data/demos/filter_siteip.rb +31 -0
- data/demos/filter_status.rb +17 -0
- data/demos/filter_timestamp.rb +23 -0
- data/demos/filter_url.rb +19 -0
- data/demos/new_fnd.rb +66 -0
- data/demos/nmap_parser.pl +138 -0
- data/demos/site_format.rb +18 -0
- data/demos/whois_domain.rb +78 -0
- data/dicts/GeoIP.dat +0 -0
- data/dicts/GeoIPASNum.dat +0 -0
- data/dicts/GeoLiteCity.dat +0 -0
- data/dicts/ccsld.txt +2646 -0
- data/dicts/cctld.txt +243 -0
- data/dicts/gtld.txt +25 -0
- data/dicts/hostnames-dict.big +1402 -0
- data/dicts/hostnames-dict.txt +101 -0
- data/lib/wmap/cidr_tracker.rb +327 -0
- data/lib/wmap/dns_bruter.rb +308 -0
- data/lib/wmap/domain_tracker/sub_domain.rb +142 -0
- data/lib/wmap/domain_tracker.rb +342 -0
- data/lib/wmap/geoip_tracker.rb +72 -0
- data/lib/wmap/google_search_scraper.rb +177 -0
- data/lib/wmap/host_tracker/primary_host.rb +130 -0
- data/lib/wmap/host_tracker.rb +550 -0
- data/lib/wmap/network_profiler.rb +144 -0
- data/lib/wmap/port_scanner.rb +208 -0
- data/lib/wmap/site_tracker/deactivated_site.rb +85 -0
- data/lib/wmap/site_tracker.rb +937 -0
- data/lib/wmap/url_checker.rb +314 -0
- data/lib/wmap/url_crawler.rb +381 -0
- data/lib/wmap/utils/domain_root.rb +184 -0
- data/lib/wmap/utils/logger.rb +53 -0
- data/lib/wmap/utils/url_magic.rb +343 -0
- data/lib/wmap/utils/utils.rb +333 -0
- data/lib/wmap/whois.rb +76 -0
- data/lib/wmap.rb +227 -0
- data/logs/wmap.log +17 -0
- data/ruby_whois_patches/base_cocca2.rb +149 -0
- data/ruby_whois_patches/kero.yachay.pe.rb +120 -0
- data/ruby_whois_patches/whois.PublicDomainRegistry.com.rb +124 -0
- data/ruby_whois_patches/whois.above.com.rb +61 -0
- data/ruby_whois_patches/whois.adamsnames.tc.rb +107 -0
- data/ruby_whois_patches/whois.aeda.net.ae.rb +105 -0
- data/ruby_whois_patches/whois.ai.rb +112 -0
- data/ruby_whois_patches/whois.arnes.si.rb +121 -0
- data/ruby_whois_patches/whois.ascio.com.rb +91 -0
- data/ruby_whois_patches/whois.cnnic.cn.rb +123 -0
- data/ruby_whois_patches/whois.corporatedomains.com.rb +67 -0
- data/ruby_whois_patches/whois.crsnic.net.rb +108 -0
- data/ruby_whois_patches/whois.denic.de.rb +174 -0
- data/ruby_whois_patches/whois.dk-hostmaster.dk.rb +120 -0
- data/ruby_whois_patches/whois.dns.be.rb +134 -0
- data/ruby_whois_patches/whois.dns.lu.rb +129 -0
- data/ruby_whois_patches/whois.dns.pl.rb +150 -0
- data/ruby_whois_patches/whois.dns.pt.rb +119 -0
- data/ruby_whois_patches/whois.domain.kg.rb +126 -0
- data/ruby_whois_patches/whois.domainregistry.my.rb +123 -0
- data/ruby_whois_patches/whois.domreg.lt.rb +110 -0
- data/ruby_whois_patches/whois.dot.tk.rb +140 -0
- data/ruby_whois_patches/whois.hkirc.hk.rb +121 -0
- data/ruby_whois_patches/whois.isnic.is.rb +130 -0
- data/ruby_whois_patches/whois.je.rb +119 -0
- data/ruby_whois_patches/whois.jprs.jp.rb +137 -0
- data/ruby_whois_patches/whois.kenic.or.ke.rb +140 -0
- data/ruby_whois_patches/whois.markmonitor.com.rb +118 -0
- data/ruby_whois_patches/whois.melbourneit.com.rb +58 -0
- data/ruby_whois_patches/whois.nic.as.rb +96 -0
- data/ruby_whois_patches/whois.nic.at.rb +109 -0
- data/ruby_whois_patches/whois.nic.ch.rb +141 -0
- data/ruby_whois_patches/whois.nic.cl.rb +117 -0
- data/ruby_whois_patches/whois.nic.ec.rb +157 -0
- data/ruby_whois_patches/whois.nic.im.rb +120 -0
- data/ruby_whois_patches/whois.nic.it.rb +170 -0
- data/ruby_whois_patches/whois.nic.lv.rb +116 -0
- data/ruby_whois_patches/whois.nic.ly.rb +127 -0
- data/ruby_whois_patches/whois.nic.mu.rb +27 -0
- data/ruby_whois_patches/whois.nic.mx.rb +123 -0
- data/ruby_whois_patches/whois.nic.net.sa.rb +111 -0
- data/ruby_whois_patches/whois.nic.or.kr.rb +101 -0
- data/ruby_whois_patches/whois.nic.tel.rb +129 -0
- data/ruby_whois_patches/whois.nic.tr.rb +133 -0
- data/ruby_whois_patches/whois.nic.us.rb +129 -0
- data/ruby_whois_patches/whois.nic.ve.rb +135 -0
- data/ruby_whois_patches/whois.norid.no.rb +127 -0
- data/ruby_whois_patches/whois.pandi.or.id.rb +118 -0
- data/ruby_whois_patches/whois.psi-usa.info.rb +63 -0
- data/ruby_whois_patches/whois.registro.br.rb +109 -0
- data/ruby_whois_patches/whois.registrygate.com.rb +55 -0
- data/ruby_whois_patches/whois.rrpproxy.net.rb +61 -0
- data/ruby_whois_patches/whois.sgnic.sg.rb +130 -0
- data/ruby_whois_patches/whois.srs.net.nz.rb +166 -0
- data/ruby_whois_patches/whois.tucows.com.rb +70 -0
- data/ruby_whois_patches/whois.twnic.net.tw.rb +133 -0
- data/settings/discovery_ports +24 -0
- data/settings/google_keywords.txt +9 -0
- data/settings/google_locator.txt +23 -0
- data/test/domain_tracker_test.rb +31 -0
- data/test/utils_test.rb +168 -0
- data/version.txt +13 -0
- data/wmap.gemspec +49 -0
- metadata +202 -0
data/demos/new_fnd.rb
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
###################
|
2
|
+
# Simple lookup function to check if a DMP vuln finding is new found
|
3
|
+
#
|
4
|
+
# Usage: ruby new_fnd.rb [old cweid:url pairs] [new cweid.url pair]
|
5
|
+
# sample input row: "297,https://157.83.142.100/"
|
6
|
+
# Example: ruby new_fnd.rb oldkeys.csv newkeys.csv > new.csv
|
7
|
+
|
8
|
+
require "wmap"
|
9
|
+
|
10
|
+
@verbose=false
|
11
|
+
|
12
|
+
def load_keys (file)
|
13
|
+
puts "Load the key map from file: #{file}" if @verbose
|
14
|
+
host_tracker=Wmap::HostTracker.new
|
15
|
+
my_keys=Hash.new
|
16
|
+
#begin
|
17
|
+
f_old=File.open(file)
|
18
|
+
f_old.each_line do |line|
|
19
|
+
entry=line.chomp.split(',')
|
20
|
+
|
21
|
+
abort "Error loading entry: #{entry}" if entry.size < 2
|
22
|
+
url=entry[1]
|
23
|
+
cveid=entry[0].to_s
|
24
|
+
host=host_tracker.url_2_host(url)
|
25
|
+
ip=String.new
|
26
|
+
if host_tracker.is_fqdn?(host)
|
27
|
+
ip=host_tracker.local_host_2_ip(host)
|
28
|
+
else
|
29
|
+
ip=host
|
30
|
+
end
|
31
|
+
unless host_tracker.is_ip?(ip)
|
32
|
+
ip=host_tracker.host_2_ip(ip)
|
33
|
+
end
|
34
|
+
url.sub!(host,ip) unless ip.nil?
|
35
|
+
entry=cveid+","+url
|
36
|
+
my_keys[entry]=true unless my_keys.key?(entry)
|
37
|
+
puts "Finishing loading key: #{entry}" if @verbose
|
38
|
+
end
|
39
|
+
f_old.close
|
40
|
+
host_tracker=nil
|
41
|
+
return my_keys
|
42
|
+
#rescue => ee
|
43
|
+
# abort "Error on method #{__method__}: #{ee}" if @verbose
|
44
|
+
#end
|
45
|
+
end
|
46
|
+
|
47
|
+
old_keys=load_keys(ARGV[0])
|
48
|
+
my_tracker=Wmap::HostTracker.new
|
49
|
+
f_new=File.open(ARGV[1],'r')
|
50
|
+
f_new.each_line do |line|
|
51
|
+
ent=line.chomp.split(',')
|
52
|
+
cve=ent[0]
|
53
|
+
url=ent[1]
|
54
|
+
host=my_tracker.url_2_host(url)
|
55
|
+
ip=my_tracker.local_host_2_ip(host)
|
56
|
+
url.sub!(host,ip) unless ip.nil?
|
57
|
+
entry=cve+","+url
|
58
|
+
if old_keys.key?(entry)
|
59
|
+
puts "#{entry},No"
|
60
|
+
else
|
61
|
+
puts "#{entry},Yes"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
f_new.close
|
65
|
+
my_tracker=nil
|
66
|
+
#puts new_keys.keys.count
|
@@ -0,0 +1,138 @@
|
|
1
|
+
#!/usr/bin/perl
|
2
|
+
########################################################################
|
3
|
+
# Functional Description:
|
4
|
+
#
|
5
|
+
# nmap.pl is designed to be a quick nmap port discovery parser for web_discovery
|
6
|
+
# the program input is NMAP discovery result XML file, the program output
|
7
|
+
# is a list of websites that ready for wmap modules
|
8
|
+
#
|
9
|
+
# For usage information, type in the following command:
|
10
|
+
# $ nmap_parser.pl -h
|
11
|
+
#
|
12
|
+
########################################################################
|
13
|
+
# Designed and developed by: Yang Li
|
14
|
+
#
|
15
|
+
# Change History:
|
16
|
+
# Last modification: 08/21/2013
|
17
|
+
# Version 0.1
|
18
|
+
use Getopt::Long qw/:config bundling_override no_ignore_case/;
|
19
|
+
use Nmap::Parser;
|
20
|
+
|
21
|
+
my $ver="0.1", $author="Yang Li"; # Program Version and Author
|
22
|
+
my $verbose; # Verbose mode for Maverick
|
23
|
+
my %opts;
|
24
|
+
GetOptions(
|
25
|
+
\%opts,
|
26
|
+
'help|h|?' => sub { &print_help and exit 0; }, # Print help
|
27
|
+
'version|v:s' => sub { &print_banner; exit 0;}, # Print program version information
|
28
|
+
'file|f:s', # Program input file (.xml, .nmap)
|
29
|
+
'output|o:s', # Optional, program output result file
|
30
|
+
'verbose+' => \$verbose, # Optional, program verbose mode for debugging
|
31
|
+
'vv+' => \$verbose, # Same as "-verbose", abbreviation "-vv"
|
32
|
+
);
|
33
|
+
|
34
|
+
sub parse_nmap_terse () {
|
35
|
+
#
|
36
|
+
## Parse nmap result in xml format. Only open ports are kept. Web services are further filtered out
|
37
|
+
#
|
38
|
+
# Check if the optional command switch "-output" is defined, and get ready for it if so.
|
39
|
+
if (defined $opts{output}) { open (OUT, ">", $opts{output}) || die " Can't open the file 8: $opts{output} : $!\n"; }
|
40
|
+
my $np=new Nmap::Parser;
|
41
|
+
$np->parsefile($opts{file});
|
42
|
+
my @HOST=$np->all_hosts("up"); # List of 'up' hosts
|
43
|
+
if (defined $opts{output}) {
|
44
|
+
print OUT "\nTable of Found Open Ports\n";
|
45
|
+
print OUT"IP Port Status Service OS Hostname\n";
|
46
|
+
for my $up_host (@HOST){
|
47
|
+
$os = $up_host->os_sig; $osname=$os->name;
|
48
|
+
my $ip=$up_host->addr; my $hostname=$up_host->hostname();
|
49
|
+
print OUT "$ip\t\t\t\t$osname\t$hostname,\n"; # Addr: $up_host->addr, OS: $up_host->os_sig\n";
|
50
|
+
my @p_tcp=$up_host->tcp_open_ports;
|
51
|
+
my @p_udp=$up_host->udp_open_ports;
|
52
|
+
foreach(@p_tcp) { # Print list of open tcp ports
|
53
|
+
my $state=$up_host->tcp_port_state($_);
|
54
|
+
my $svc = $up_host->tcp_service($_);
|
55
|
+
my $svc_name = $svc->name;
|
56
|
+
print OUT "\t$_\/tcp\t$state\t$svc_name\n";
|
57
|
+
}
|
58
|
+
foreach(@p_udp) { # Print list of open udp ports
|
59
|
+
my $state=$up_host->udp_port_state($_);
|
60
|
+
my $svc = $up_host->udp_service($_);
|
61
|
+
my $svc_name = $svc->name;
|
62
|
+
print OUT "\t$_\/udp\t$state\t$svc_name\n";
|
63
|
+
}
|
64
|
+
}
|
65
|
+
} else { # Redirect to stdout if '-output' command switch is not defined
|
66
|
+
print "List of found web services:\n";
|
67
|
+
#print "IP Port Status Service OS Hostname\n";
|
68
|
+
for my $up_host (@HOST){
|
69
|
+
$os = $up_host->os_sig; $osname=$os->name;
|
70
|
+
my $ip=$up_host->addr; my $hostname=$up_host->hostname();
|
71
|
+
#print "$ip\t\t\t\t$osname\t$hostname,\n"; # addr: $up_host->addr, OS: $up_host->os_sig\n";
|
72
|
+
my @p_tcp=$up_host->tcp_open_ports;
|
73
|
+
my @p_udp=$up_host->udp_open_ports;
|
74
|
+
foreach(@p_tcp) { # Print list of open tcp ports
|
75
|
+
my $port=$_;
|
76
|
+
my $state=$up_host->tcp_port_state($_);
|
77
|
+
my $svc = $up_host->tcp_service($_);
|
78
|
+
my $svc_name = $svc->name;
|
79
|
+
if ($svc_name =~ /https/i) {
|
80
|
+
if ($hostname) {
|
81
|
+
print "https://$hostname:$port/\n";
|
82
|
+
} else {
|
83
|
+
print "https://$ip:$port/\n";
|
84
|
+
}
|
85
|
+
} elsif ($svc_name =~ /http/i) {
|
86
|
+
if ($hostname) {
|
87
|
+
print "http://$hostname:$port/\n";
|
88
|
+
} else {
|
89
|
+
print "http://$ip:$port/\n"
|
90
|
+
}
|
91
|
+
}
|
92
|
+
#print "\t$_\/tcp\t$state\t$svc_name\n";
|
93
|
+
}
|
94
|
+
foreach(@p_udp) { # Print list of open udp ports
|
95
|
+
my $port=$_;
|
96
|
+
my $state=$up_host->udp_port_state($_);
|
97
|
+
my $svc = $up_host->udp_service($_);
|
98
|
+
my $svc_name = $svc->name;
|
99
|
+
if ($svc_name =~ /https/i) {
|
100
|
+
if ($hostname) {
|
101
|
+
print "https://$hostname:$port/\n";
|
102
|
+
} else {
|
103
|
+
print "https://$ip:$port/\n";
|
104
|
+
}
|
105
|
+
} elsif ($svc_name =~ /http/i) {
|
106
|
+
if ($hostname) {
|
107
|
+
print "http://$hostname:$port/\n";
|
108
|
+
} else {
|
109
|
+
print "http://$ip:$port/\n";
|
110
|
+
}
|
111
|
+
}
|
112
|
+
#print "\t$_\/udp\t$state\t$svc_name\n";
|
113
|
+
}
|
114
|
+
}
|
115
|
+
}
|
116
|
+
if (defined $opts{output}) {
|
117
|
+
close (OUT);
|
118
|
+
print "Done dumping out open ports table from $opts{file} to: $opts{output}.\n";
|
119
|
+
}
|
120
|
+
undef $np;
|
121
|
+
}
|
122
|
+
|
123
|
+
sub print_help {
|
124
|
+
my $header= "#" x 80;
|
125
|
+
print "$header\n nmap result quick parser.\n$header\n";
|
126
|
+
print "Usage: perl nmap.pl -f [nmap xml file] > [result file with found web services]\n";
|
127
|
+
print "Version: $ver, Developed by: $author\n"
|
128
|
+
|
129
|
+
}
|
130
|
+
|
131
|
+
|
132
|
+
############################################################
|
133
|
+
# Main Program start here
|
134
|
+
############################################################
|
135
|
+
|
136
|
+
&print_help;
|
137
|
+
unless ($opts{file}) { print "Error: unknown program input. Please check your file again. \n"; exit 1; }
|
138
|
+
parse_nmap_terse ();
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# filter to detect unknown internet domain
|
2
|
+
# Input is a list of URLs
|
3
|
+
# Output is an internet domain list that not currently tracked by the domain tracker
|
4
|
+
|
5
|
+
require "wmap"
|
6
|
+
|
7
|
+
k=Wmap::SiteTracker.new
|
8
|
+
f=File.open(ARGV[0],'r')
|
9
|
+
f.each do |line|
|
10
|
+
url=line.chomp.strip.downcase
|
11
|
+
if k.is_url?(url)
|
12
|
+
puts k.url_2_site(url)
|
13
|
+
else
|
14
|
+
puts url
|
15
|
+
end
|
16
|
+
end
|
17
|
+
f.close
|
18
|
+
k=nil
|
@@ -0,0 +1,78 @@
|
|
1
|
+
# Automated whois lookup for a list of valid domains
|
2
|
+
# Usage: ruby whois_domain.rb [file_hosts]
|
3
|
+
# Input file format: one line for each host (FQDN)
|
4
|
+
# Output file format: good old CSV format, with whois response parsed and sorted into structured fields.
|
5
|
+
require "wmap"
|
6
|
+
|
7
|
+
puts Wmap.banner
|
8
|
+
dis=Wmap::DomainTracker.new
|
9
|
+
dis.verbose=false
|
10
|
+
puts "Domain Whois Lookup Summary Report"
|
11
|
+
puts "Host | Domain | Primary Domain Name Server | Registrant Name | Registrant Oraganization | Registrant Address | Registrant Zip | Registrant City | Registrant State | Registration Country | Registration Contact Phone | Registration Contact Email | Technical Contact Name | Technical Contact Organization | Technical Contact Country | Technical Contract Phone | Technical Contact Email | Admin Contact Name | Admin Contact Organization | Domain Availability"
|
12
|
+
f_hosts = File.open(ARGV[0], 'r')
|
13
|
+
f_hosts.each do |line|
|
14
|
+
#next if line.chomp =~ /\d+\.\d+\.\d+\.\d+/
|
15
|
+
begin
|
16
|
+
host=line.chomp.split(',')[0]
|
17
|
+
#url=line.chomp.split(',')[0]
|
18
|
+
#host=dis.url_2_host(url)
|
19
|
+
domain=dis.domain_root(host)
|
20
|
+
record=Hash.new
|
21
|
+
if domain.nil?
|
22
|
+
puts "#{line.chomp} | Domain Unknown"
|
23
|
+
# elsif dis.domain_known?(domain)
|
24
|
+
# next
|
25
|
+
else
|
26
|
+
result=Wmap.whois(domain)
|
27
|
+
puts result if dis.verbose
|
28
|
+
record['ns'] = result.nameservers.first unless result.nameservers.nil?
|
29
|
+
unless result.registrant_contacts.nil?
|
30
|
+
result.registrant_contacts.each do |contact_r|
|
31
|
+
record['r_name']=contact_r['name']
|
32
|
+
record['r_org']=contact_r['organization']
|
33
|
+
record['r_addr']=contact_r['address'].gsub(/\n/,',').gsub(/\r/,' ') unless contact_r['address'].nil?
|
34
|
+
record['r_zip']=contact_r['zip']
|
35
|
+
record['r_city']=contact_r['city']
|
36
|
+
record['r_state']=contact_r['state']
|
37
|
+
record['r_country']=contact_r['country_code']
|
38
|
+
record['r_phone']=contact_r['phone']
|
39
|
+
record['r_email']=contact_r['email']
|
40
|
+
end
|
41
|
+
end
|
42
|
+
unless result.technical_contacts.nil?
|
43
|
+
result.technical_contacts.each do |contact_t|
|
44
|
+
record['t_name']=contact_t['name']
|
45
|
+
record['t_org']=contact_t['organization']
|
46
|
+
record['t_country']=contact_t['country_code']
|
47
|
+
record['t_phone']=contact_t['phone']
|
48
|
+
record['t_email']=contact_t['email']
|
49
|
+
end
|
50
|
+
end
|
51
|
+
unless result.admin_contacts.nil?
|
52
|
+
result.admin_contacts.each do |contact_a|
|
53
|
+
record['a_name']=contact_a['name']
|
54
|
+
record['a_org']=contact_a['organization']
|
55
|
+
end
|
56
|
+
end
|
57
|
+
if result.available?
|
58
|
+
record['availability']="true"
|
59
|
+
else
|
60
|
+
record['availability']="false"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
print "#{line.chomp} | #{domain} | "
|
64
|
+
if record.nil?
|
65
|
+
print " | Failure to parse the whois response. Please add it manually. "
|
66
|
+
else
|
67
|
+
print record['ns'], '|'
|
68
|
+
print record['r_name'], ' | ', record['r_org'],' | ', record['r_addr'],' | ', record['r_zip'],' | ', record['r_city'],' | ', record['r_state'],' | ', record['r_country'],' | ', record['r_phone'],' | ', record['r_email']
|
69
|
+
print ' | ', record['t_name'], ' | ', record['t_org'],' | ', record['t_country'],' | ', record['t_phone'],' | ', record['t_email']
|
70
|
+
print ' | ', record['a_name'], ' | ', record['a_org'],' | ', record['availability']
|
71
|
+
end
|
72
|
+
print "\n"
|
73
|
+
rescue => ee
|
74
|
+
puts "#{line.chomp} | #{domain} | #{ee}"
|
75
|
+
end
|
76
|
+
end
|
77
|
+
f_hosts.close
|
78
|
+
dis=nil
|
data/dicts/GeoIP.dat
ADDED
Binary file
|
Binary file
|
Binary file
|