Module: Wmap

Defined in:
lib/wmap/utils/utils.rb,
lib/wmap.rb,
lib/wmap/utils/logger.rb,
lib/wmap/utils/url_magic.rb,
lib/wmap/utils/domain_root.rb,
lib/wmap/domain_tracker/sub_domain.rb,
lib/wmap/host_tracker/primary_host.rb,
lib/wmap/site_tracker/deactivated_site.rb

Overview

Class to trace de-activated site. This is need for basic state tracking for our sites.

Defined Under Namespace

Modules: Utils Classes: CidrTracker, DnsBruter, DomainTracker, GeoIPTracker, GoogleSearchScraper, HostTracker, NetworkProfiler, PortScanner, SiteTracker, UrlChecker, UrlCrawler, Whois, WpTracker

Constant Summary collapse

NAME =
"Wmap"
GEM =
"wmap"
VERSION =
File.dirname(__FILE__) + "/../version.txt"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.known_internet_domainsObject

Returns the value of attribute known_internet_domains.



36
37
38
# File 'lib/wmap.rb', line 36

def known_internet_domains
  @known_internet_domains
end

.verbose=(value) ⇒ Object (writeonly)

Sets the attribute verbose

Parameters:

  • value

    the value to set the attribute verbose to.



37
38
39
# File 'lib/wmap.rb', line 37

def verbose=(value)
  @verbose = value
end

Class Method Details

Project banner in ASCII Art ‘soft’ format, courtesy to patorjk.com/software/taag/



58
59
60
61
62
63
64
65
66
67
# File 'lib/wmap.rb', line 58

def banner
	ver=read_ver
	art=",--.   ,--.       ,--.       ,--.   ,--.
|  |   |  | ,---. |  |-.     |   `.'   | ,--,--. ,---.  ,---.  ,---. ,--.--.
|  |.'.|  || .-. :| .-. '    |  |'.'|  |' ,-.  || .-. || .-. || .-. :|  .--'
|   ,'.   |\   --.| `-' |    |  |   |  |\ '-'  || '-' '| '-' '\   --.|  |
'--'   '--' `----' `---'     `--'   `--' `--`--'|  |-' |  |-'  `----'`--'
                                               `--'   `--'                  "
	string = "-"*80 + "\n" + art + "\n" + "Version: " + ver["version"] + "\tRelease Date: " + ver["date"] + "\nDesigned and developed by: " + ver["author"] + "\nEmail: " + ver["email"] + "\tLinkedIn: " + ver["linkedin"] + "\n" + "-"*80
end

.check(url) ⇒ Object

URL checker - check the status of the remote URL



112
113
114
115
# File 'lib/wmap.rb', line 112

def check(url)
	checker=Wmap::UrlChecker.new(:verbose=>false)
	checker.url_worker(url)
end

.crawl(url) ⇒ Object

Crawler to search url contents for new sites



76
77
78
79
# File 'lib/wmap.rb', line 76

def crawl(url)
	crawler=Wmap::UrlCrawler.new
	crawler.crawl(url)
end

.dns_brute(domain) ⇒ Object

DNS Brute Forcer



148
149
150
151
# File 'lib/wmap.rb', line 148

def dns_brute(domain)
	bruter=Wmap::DnsBruter.new
	bruter.query(domain)
end

.domain_known?(domain) ⇒ Boolean

Domain Tracking - check with the trust domain seed file locally, to determine if it’s a new internet domain NOT to confuse with the Internet ‘whois’ lookup

Returns:

  • (Boolean)


125
126
127
128
# File 'lib/wmap.rb', line 125

def domain_known?(domain)
	tracker=Wmap::DomainTracker.new
	tracker.domain_known?(domain)
end

.domain_root(host) ⇒ Object

Retrieve root domain from a host



154
155
156
# File 'lib/wmap.rb', line 154

def domain_root(host)
	Wmap::Utils.get_domain_root(host)
end

.dump(file) ⇒ Object

Dump out the unique sites into a plain file



181
182
183
184
# File 'lib/wmap.rb', line 181

def dump(file)
		store=Wmap::SiteTracker.new(:verbose=>true)
		store.save_uniq_sites(file)
end

.dump_xml(file) ⇒ Object

Dump out the unique sites into a XML file



187
188
189
190
# File 'lib/wmap.rb', line 187

def dump_xml(file)
		store=Wmap::SiteTracker.new
		store.save_uniq_sites_xml(file)
end

.geoip(host) ⇒ Object

GeoIP Tracking - check the host / IP against the GeoIP data repository, return the Geographic information if found



106
107
108
109
# File 'lib/wmap.rb', line 106

def geoip(host)
	tracker=Wmap::GeoIPTracker.new
	tracker.query(host)
end

.googleObject

Search the Google engines and sort out sites known by Google



207
208
209
# File 'lib/wmap.rb', line 207

def google
	sites=Wmap::GoogleSearchScraper.new.workers.keys
end

.host_known?(host) ⇒ Boolean

Host Tracking - check local hosts file to see if this is a hostname known from the host seed file NOT to confuse with a regular DNS lookup over the internet

Returns:

  • (Boolean)


132
133
134
# File 'lib/wmap.rb', line 132

def host_known?(host)
	tracker=Wmap::HostTracker.new.host_known?(host)
end

.ip_known?(ip) ⇒ Boolean

IP Tracking - check local hosts file to see if this is an IP known from the seed file NOT to confuse with a regular reverse DNS lookup over the internet

Returns:

  • (Boolean)


143
144
145
# File 'lib/wmap.rb', line 143

def ip_known?(ip)
	tracker=Wmap::HostTracker.new.ip_known?(ip)
end

.ip_trusted?(ip) ⇒ Boolean

Check if the IP is within the range of the known CIDR blocks

Returns:

  • (Boolean)


118
119
120
121
# File 'lib/wmap.rb', line 118

def ip_trusted?(ip)
	tracker=Wmap::CidrTracker.new
	tracker.ip_trusted?(ip)
end

.mutation(host) ⇒ Object

Host-name mutation for catch easily guessable hostname, i.e. “ww1.example.com” => [“ww1,example.com”,“ww2.example.com”,…]



164
165
166
# File 'lib/wmap.rb', line 164

def mutation (host)
	Wmap::DnsBruter.new.hostname_mutation(host)
end

Print a site’s full information from the repository



212
213
214
215
# File 'lib/wmap.rb', line 212

def print(site)
	searcher=Wmap::SiteTracker.new
	searcher.print_site(site)
end

Print a site’s full information from the repository



218
219
220
221
# File 'lib/wmap.rb', line 218

def print_all
	searcher=Wmap::SiteTracker.new
	searcher.print_all_sites
end

.read_verObject

Simple parser for the project version file



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/wmap.rb', line 40

def read_ver
	ver=Hash.new
	f=File.open(VERSION,'r')
	f.each do |line|
		line.chomp!
		case line
		when /^(\s)*#/
			next
		when /\=/
			entry=line.split("=").map! {|x| x.strip}
			ver[entry[0]]=entry[1]
		end
	end
	f.close
	return ver
end

.refresh(site) ⇒ Object

Refresh the site information in the local data repository



193
194
195
196
197
# File 'lib/wmap.rb', line 193

def refresh(site)
		store=Wmap::SiteTracker.new
		store.refresh(site)
		store.save!
end

.refresh_allObject

Refresh the site information in the local data repository



200
201
202
203
204
# File 'lib/wmap.rb', line 200

def refresh_all
		store=Wmap::SiteTracker.new
		store.refresh_all
		store.save!
end

.response_code(url) ⇒ Object

Check URL/Site response code



169
170
171
172
# File 'lib/wmap.rb', line 169

def response_code(url)
	checker=Wmap::UrlChecker.new
	checker.response_code(url)
end

.scan(host) ⇒ Object

Fast tcp port scanner on a single host or IP



88
89
90
91
# File 'lib/wmap.rb', line 88

def scan(host)
	scanner=Wmap::PortScanner.new
	scanner.scan(host)
end

.scans(target_list) ⇒ Object

Fast multi-processes tcp port scanner on a list of targets



94
95
96
97
# File 'lib/wmap.rb', line 94

def scans(target_list)
	scanner=Wmap::PortScanner.new
	scanner.scans(target_list)
end

.search(pattern) ⇒ Object

Search the site repository for all entries that match the pattern



175
176
177
178
# File 'lib/wmap.rb', line 175

def search(pattern)
	searcher=Wmap::SiteTracker.new
	searcher.search(pattern)
end

.sub_domain_known?(host) ⇒ Boolean

Sub-domain tracking - check local hosts file to see if the sub-domain is already known

Returns:

  • (Boolean)


137
138
139
# File 'lib/wmap.rb', line 137

def sub_domain_known?(host)
	tracker=Wmap::HostTracker.new.sub_domain_known?(host)
end

.track(host) ⇒ Object

CIDR Tracking - check the host against the local CIDR seed file, return the CIDR tracking path if found



100
101
102
103
# File 'lib/wmap.rb', line 100

def track(host)
	tracker=Wmap::CidrTracker.new
	tracker.cidr_worker(host)
end

.whois(domain) ⇒ Object

whois query and sort the result into structured data



82
83
84
85
# File 'lib/wmap.rb', line 82

def whois(domain)
	whois=Wmap::Whois.new(:verbose=>false)
	whois.query(domain)
end

.wlog(msg, agent, log_file) ⇒ Object

Log the information into file



159
160
161
# File 'lib/wmap.rb', line 159

def wlog(msg,agent,log_file)
	Wmap::Utils.wlog(msg,agent,log_file)
end

.wmap(seed) ⇒ Object

Explorer to discover and inventory web application / service automatically



70
71
72
73
# File 'lib/wmap.rb', line 70

def wmap(seed)
	cmd="bin/wmap" + " " + seed
	system(cmd)
end