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
Constant Summary collapse
- NAME =
"Wmap"- GEM =
"wmap"- VERSION =
File.dirname(__FILE__) + "/../version.txt"
Class Attribute Summary collapse
-
.known_internet_domains ⇒ Object
Returns the value of attribute known_internet_domains.
-
.verbose ⇒ Object
writeonly
Sets the attribute verbose.
Class Method Summary collapse
-
.banner ⇒ Object
Project banner in ASCII Art ‘soft’ format, courtesy to patorjk.com/software/taag/.
-
.check(url) ⇒ Object
URL checker - check the status of the remote URL.
-
.crawl(url) ⇒ Object
Crawler to search url contents for new sites.
-
.dns_brute(domain) ⇒ Object
DNS Brute Forcer.
-
.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.
-
.domain_root(host) ⇒ Object
Retrieve root domain from a host.
-
.dump(file) ⇒ Object
Dump out the unique sites into a plain file.
-
.dump_xml(file) ⇒ Object
Dump out the unique sites into a XML file.
-
.geoip(host) ⇒ Object
GeoIP Tracking - check the host / IP against the GeoIP data repository, return the Geographic information if found.
-
.google ⇒ Object
Search the Google engines and sort out sites known by Google.
-
.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.
-
.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.
-
.ip_trusted?(ip) ⇒ Boolean
Check if the IP is within the range of the known CIDR blocks.
-
.mutation(host) ⇒ Object
Host-name mutation for catch easily guessable hostname, i.e.
-
.print(site) ⇒ Object
Print a site’s full information from the repository.
-
.print_all ⇒ Object
Print a site’s full information from the repository.
-
.read_ver ⇒ Object
Simple parser for the project version file.
-
.refresh(site) ⇒ Object
Refresh the site information in the local data repository.
-
.refresh_all ⇒ Object
Refresh the site information in the local data repository.
-
.response_code(url) ⇒ Object
Check URL/Site response code.
-
.scan(host) ⇒ Object
Fast tcp port scanner on a single host or IP.
-
.scans(target_list) ⇒ Object
Fast multi-processes tcp port scanner on a list of targets.
-
.search(pattern) ⇒ Object
Search the site repository for all entries that match the pattern.
-
.sub_domain_known?(host) ⇒ Boolean
Sub-domain tracking - check local hosts file to see if the sub-domain is already known.
-
.track(host) ⇒ Object
CIDR Tracking - check the host against the local CIDR seed file, return the CIDR tracking path if found.
-
.whois(domain) ⇒ Object
whois query and sort the result into structured data.
-
.wlog(msg, agent, log_file) ⇒ Object
Log the information into file.
-
.wmap(seed) ⇒ Object
Explorer to discover and inventory web application / service automatically.
Class Attribute Details
.known_internet_domains ⇒ Object
Returns the value of attribute known_internet_domains.
35 36 37 |
# File 'lib/wmap.rb', line 35 def known_internet_domains @known_internet_domains end |
.verbose=(value) ⇒ Object (writeonly)
Sets the attribute verbose
36 37 38 |
# File 'lib/wmap.rb', line 36 def verbose=(value) @verbose = value end |
Class Method Details
.banner ⇒ Object
Project banner in ASCII Art ‘soft’ format, courtesy to patorjk.com/software/taag/
57 58 59 60 61 62 63 64 65 66 |
# File 'lib/wmap.rb', line 57 def 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
111 112 113 114 |
# File 'lib/wmap.rb', line 111 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
75 76 77 78 |
# File 'lib/wmap.rb', line 75 def crawl(url) crawler=Wmap::UrlCrawler.new crawler.crawl(url) end |
.dns_brute(domain) ⇒ Object
DNS Brute Forcer
147 148 149 150 |
# File 'lib/wmap.rb', line 147 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
124 125 126 127 |
# File 'lib/wmap.rb', line 124 def domain_known?(domain) tracker=Wmap::DomainTracker.new tracker.domain_known?(domain) end |
.domain_root(host) ⇒ Object
Retrieve root domain from a host
153 154 155 |
# File 'lib/wmap.rb', line 153 def domain_root(host) Wmap::Utils.get_domain_root(host) end |
.dump(file) ⇒ Object
Dump out the unique sites into a plain file
180 181 182 183 |
# File 'lib/wmap.rb', line 180 def dump(file) store=Wmap::SiteTracker.new store.save_uniq_sites(file) end |
.dump_xml(file) ⇒ Object
Dump out the unique sites into a XML file
186 187 188 189 |
# File 'lib/wmap.rb', line 186 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
105 106 107 108 |
# File 'lib/wmap.rb', line 105 def geoip(host) tracker=Wmap::GeoIPTracker.new tracker.query(host) end |
.google ⇒ Object
Search the Google engines and sort out sites known by Google
206 207 208 |
# File 'lib/wmap.rb', line 206 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
131 132 133 |
# File 'lib/wmap.rb', line 131 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
142 143 144 |
# File 'lib/wmap.rb', line 142 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
117 118 119 120 |
# File 'lib/wmap.rb', line 117 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”,…]
163 164 165 |
# File 'lib/wmap.rb', line 163 def mutation (host) Wmap::DnsBruter.new.hostname_mutation(host) end |
.print(site) ⇒ Object
Print a site’s full information from the repository
211 212 213 214 |
# File 'lib/wmap.rb', line 211 def print(site) searcher=Wmap::SiteTracker.new searcher.print_site(site) end |
.print_all ⇒ Object
Print a site’s full information from the repository
217 218 219 220 |
# File 'lib/wmap.rb', line 217 def print_all searcher=Wmap::SiteTracker.new searcher.print_all_sites end |
.read_ver ⇒ Object
Simple parser for the project version file
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/wmap.rb', line 39 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
192 193 194 195 196 |
# File 'lib/wmap.rb', line 192 def refresh(site) store=Wmap::SiteTracker.new store.refresh(site) store.save! end |
.refresh_all ⇒ Object
Refresh the site information in the local data repository
199 200 201 202 203 |
# File 'lib/wmap.rb', line 199 def refresh_all store=Wmap::SiteTracker.new store.refresh_all store.save! end |
.response_code(url) ⇒ Object
Check URL/Site response code
168 169 170 171 |
# File 'lib/wmap.rb', line 168 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
87 88 89 90 |
# File 'lib/wmap.rb', line 87 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
93 94 95 96 |
# File 'lib/wmap.rb', line 93 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
174 175 176 177 |
# File 'lib/wmap.rb', line 174 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
136 137 138 |
# File 'lib/wmap.rb', line 136 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
99 100 101 102 |
# File 'lib/wmap.rb', line 99 def track(host) tracker=Wmap::CidrTracker.new tracker.cidr_worker(host) end |
.whois(domain) ⇒ Object
whois query and sort the result into structured data
81 82 83 84 |
# File 'lib/wmap.rb', line 81 def whois(domain) whois=Wmap::Whois.new(:verbose=>false) whois.query(domain) end |
.wlog(msg, agent, log_file) ⇒ Object
Log the information into file
158 159 160 |
# File 'lib/wmap.rb', line 158 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
69 70 71 72 |
# File 'lib/wmap.rb', line 69 def wmap(seed) cmd="bin/wmap" + " " + seed system(cmd) end |