aquatone 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +12 -0
  3. data/CHANGELOG.md +18 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +21 -0
  6. data/README.md +168 -0
  7. data/Rakefile +10 -0
  8. data/aquatone.gemspec +29 -0
  9. data/aquatone.js +164 -0
  10. data/bin/console +14 -0
  11. data/bin/setup +8 -0
  12. data/exe/aquatone-discover +129 -0
  13. data/exe/aquatone-gather +55 -0
  14. data/exe/aquatone-scan +76 -0
  15. data/lib/aquatone.rb +43 -0
  16. data/lib/aquatone/assessment.rb +40 -0
  17. data/lib/aquatone/browser.rb +18 -0
  18. data/lib/aquatone/browser/drivers/nightmare.rb +52 -0
  19. data/lib/aquatone/collector.rb +106 -0
  20. data/lib/aquatone/collectors/dictionary.rb +20 -0
  21. data/lib/aquatone/collectors/dnsdb.rb +45 -0
  22. data/lib/aquatone/collectors/gtr.rb +58 -0
  23. data/lib/aquatone/collectors/hackertarget.rb +24 -0
  24. data/lib/aquatone/collectors/netcraft.rb +48 -0
  25. data/lib/aquatone/collectors/shodan.rb +45 -0
  26. data/lib/aquatone/collectors/threatcrowd.rb +25 -0
  27. data/lib/aquatone/collectors/virustotal.rb +24 -0
  28. data/lib/aquatone/command.rb +152 -0
  29. data/lib/aquatone/commands/discover.rb +187 -0
  30. data/lib/aquatone/commands/gather.rb +167 -0
  31. data/lib/aquatone/commands/scan.rb +108 -0
  32. data/lib/aquatone/domain.rb +33 -0
  33. data/lib/aquatone/http_client.rb +5 -0
  34. data/lib/aquatone/key_store.rb +72 -0
  35. data/lib/aquatone/port_lists.rb +36 -0
  36. data/lib/aquatone/report.rb +88 -0
  37. data/lib/aquatone/resolver.rb +47 -0
  38. data/lib/aquatone/thread_pool.rb +31 -0
  39. data/lib/aquatone/url_maker.rb +27 -0
  40. data/lib/aquatone/validation.rb +22 -0
  41. data/lib/aquatone/version.rb +3 -0
  42. data/subdomains.lst +8214 -0
  43. data/templates/default.html.erb +225 -0
  44. metadata +159 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d863c9389551c6e1e99644c5532a9765daba2d23
4
+ data.tar.gz: 3c21a3f09be1fce495168e11bc12bf93751e452a
5
+ SHA512:
6
+ metadata.gz: dc2a6d6eb9c151dffedbff14ec9c6f8c7ad797a83824c07df0720e323fb294abd5f7618fb33bd0d18820f43aae07a017d2a63670449fca237840198a03410c05
7
+ data.tar.gz: 5ebb3c53736201578dabb6998bab3db1347f03f8cc1d48f7e6dbb6c7336c4b3a76a36708d1802b02a09560992ad7a9465876b5a0e831151bc40067fe7a84b147
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /node_modules/
11
+ .ruby-version
12
+ .ruby-gemset
data/CHANGELOG.md ADDED
@@ -0,0 +1,18 @@
1
+ # Change Log
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ The format is based on [Keep a Changelog](http://keepachangelog.com/)
5
+ and this project adheres to [Semantic Versioning](http://semver.org/).
6
+
7
+ ## [Unreleased]
8
+ ### Added
9
+
10
+ ### Changed
11
+
12
+ ## 0.1.0
13
+ ### Added
14
+ - Initial release
15
+
16
+ ### Changed
17
+
18
+ [Unreleased]: https://github.com/michenriksen/aquatone/compare/v0.1.0...HEAD
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in aquatone.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Michael Henriksen
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,168 @@
1
+ # AQUATONE
2
+
3
+ AQUATONE is a set of tools for performing reconnaissance on domain names. It can
4
+ discover subdomains on a given domain by using open sources as well as the more
5
+ common subdomain dictionary brute force approach. After subdomain discovery,
6
+ AQUATONE can then scan the hosts for common web ports and HTTP headers, HTML
7
+ bodies and screenshots can be gathered and consolidated into a report for easy
8
+ analysis of the attack surface.
9
+
10
+ ## Installation
11
+
12
+ ### Dependencies
13
+
14
+ AQUATONE depends on [Node.js] and [NPM] package manager for its web page screenshotting capabilities. Follow [this guide] for Installation instructions.
15
+
16
+ You will also need a newer version of Ruby installed. If you plan to use AQUATONE in [Kali] Linux, you are already set up with this. If not, it is recommended to install Ruby with [RVM].
17
+
18
+ Finally, the tool itself can be installed with the following command in a terminal:
19
+
20
+ $ gem install aquatone
21
+
22
+ ## Usage
23
+
24
+ ### Discovery
25
+
26
+ The first stage of an AQUATONE assessment is the discovery stage where subdomains are discovered on the target domain using open sources, services and the more common dictionary brute force approach:
27
+
28
+ $ aquatone-discover --domain example.com
29
+
30
+ aquatone-discover will find the target's nameservers and shuffle DNS lookups between them. Should a lookup fail on the target domain's nameservers, aquatone-discover will fall back to using Google's public DNS servers to maximize discovery. The fallback DNS servers can be changed with the `--fallback-nameservers` option:
31
+
32
+ $ aquatone-discover --domain example.com --fallback-nameservers 87.98.175.85,5.9.49.12
33
+
34
+ #### Tuning
35
+
36
+ aquatone-discover will use 5 threads as default for concurrently performing DNS lookups. This provides reasonable performance but can be tuned to be more or less aggressive with the `--threads` option:
37
+
38
+ $ aquatone-discover --domain example.com --threads 25
39
+
40
+ Hammering a DNS server with failing lookups can potentially be picked up by intrusion detection systems, so if that is a concern for you, you can make aquatone-discover a bit more stealthy with the `--sleep` and `--jitter` options. `--sleep` accepts a number of seconds to sleep between each DNS lookup while `--jitter` accepts a percentage of the `--sleep` value to randomly add or subtract to or from the sleep interval in order to break the sleep pattern and make it less predictable.
41
+
42
+ $ aquatone-discover --domain example.com --sleep 5 --jitter 30
43
+
44
+ Please note that setting the `--sleep` option will force the thread count to one. The `--jitter` option will only be considered if the `--sleep` option has also been set.
45
+
46
+ #### API keys
47
+
48
+ Some of the passive collectors will require API keys or similar credentials in order to work. Setting these values can be done with the `--set-key` option:
49
+
50
+ $ aquatone-discover --set-key shodan o1hyw8pv59vSVjrZU3Qaz6ZQqgM91ihQ
51
+
52
+ All keys will be saved in `~/aquatone/.keys.yml`.
53
+
54
+ #### Results
55
+
56
+ When aquatone-discover is finished, it will create a `hosts.txt` file in the `~/aquatone/<domain>` folder, so for a scan of example.com it would be located at `~/aquatone/example.com/hosts.txt`. The format will be a comma-separated list of hostnames and their IP, for example:
57
+
58
+ example.com,93.184.216.34
59
+ www.example.com,93.184.216.34
60
+ secret.example.com,93.184.216.36
61
+ cdn.example.com,192.0.2.42
62
+ ...
63
+
64
+ In addition to the `hosts.txt` file, it will also generate a `hosts.json` which includes the same information but in JSON format. This format might be preferable if you want to use the information in custom scripts and tools. `hosts.json` will also be used by the aquatone-scan and aquatone-gather tools.
65
+
66
+ See `aquatone-discover --help` for more options.
67
+
68
+ ### Scanning
69
+
70
+ The scanning stage is where AQUATONE will enumerate the discovered hosts for open TCP ports that are commonly used for web services:
71
+
72
+ $ aquatone-scan --domain example.com
73
+
74
+ The `--domain` option will look for `hosts.json` in the domain's AQUATONE assessment directory, so in the example above it would look for `~/aquatone/example.com/hosts.json`. This file should be present if `aquatone-discover --domain example.com` has been run previously.
75
+
76
+ #### Ports
77
+
78
+ By default, aquatone-scan will scan the following TCP ports: 80, 443, 8000, 8080 and 8443. These are very common ports for web services and will provide a reasonable coverage. Should you want to specifiy your own list of ports, you can use the `--ports` option:
79
+
80
+ $ aquatone-scan --domain example.com --ports 80,443,3000,8080
81
+
82
+ Instead of a comma-separated list of ports, you can also specify one of the built-in list aliases:
83
+
84
+ * **small**: 80, 443
85
+ * **medium**: 80, 443, 8000, 8080, 8443 (same as default)
86
+ * **large**: 80, 81, 443, 591, 2082, 2095, 2096, 3000, 8000, 8001, 8008, 8080, 8083, 8443, 8834, 8888, 55672
87
+ * **huge**: 80, 81, 300, 443, 591, 593, 832, 981, 1010, 1311, 2082, 2095, 2096, 2480, 3000, 3128, 3333, 4243, 4567, 4711, 4712, 4993, 5000, 5104, 5108, 5280, 5281, 5800, 6543, 7000, 7396, 7474, 8000, 8001, 8008, 8014, 8042, 8069, 8080, 8081, 8083, 8088, 8090, 8091, 8118, 8123, 8172, 8222, 8243, 8280, 8281, 8333, 8337, 8443, 8500, 8834, 8880, 8888, 8983, 9000, 9043, 9060, 9080, 9090, 9091, 9200, 9443, 9800, 9981, 11371, 12443, 16080, 18091, 18092, 20720, 55672
88
+
89
+ **Example:**
90
+
91
+ $ aquatone-scan --domain example.com --ports large
92
+
93
+ #### Tuning
94
+
95
+ Like aquatone-discover, you can make the scanning more or less aggressive with the `--threads` option which accepts a number of threads for concurrent port scans. The default number of threads is 5.
96
+
97
+ $ aquatone-scan --domain example.com --threads 25
98
+
99
+ As aquatone-scan is performing port scanning, it can obviously be picked up by intrusion detection systems. While it will attempt to lessen the risk of detection by randomising hosts and ports, you can tune the stealthiness more with the `--sleep` and `--jitter` options which work just like the similarly named options for aquatone-discover. Keep in mind that setting the `--sleep` option will force the number of threads to one.
100
+
101
+ #### Results
102
+
103
+ When aquatone-scan is finished, it will create a `urls.txt` file in the `~/aquatone/<domain>` directory, so for a scan of example.com it would be located at `~/aquatone/example.com/urls.txt`. The format will be a list of URLs, for example:
104
+
105
+ http://example.com/
106
+ https://example.com/
107
+ http://www.example.com/
108
+ https://www.example.com/
109
+ http://secret.example.com:8001/
110
+ https://secret.example.com:8443/
111
+ http://cdn.example.com/
112
+ https://cdn.example.com/
113
+ ...
114
+
115
+ This file can be loaded into other tools such as [EyeWitness].
116
+
117
+ aquatone-scan will also generate a `open_ports.txt` file, which is a comma-separated list of hosts and their open ports, for example:
118
+
119
+ 93.184.216.34,80,443
120
+ 93.184.216.34,80
121
+ 93.184.216.36,80,443,8443
122
+ 192.0.2.42,80,8080
123
+ ...
124
+
125
+ See `aquatone-scan --help` for more options.
126
+
127
+ ### Gathering
128
+
129
+ The final stage is the gathering part where the results of the discovery and scanning stages are used to query the discovered web services in order to retrieve and save HTTP response headers and HTML bodies, as well as taking screenshots of how the web pages look like in a web browser to make analysis easier. The screenshotting is done with the [Nightmare.js] Node.js library. This library will be installed automatically if it's not present in the system.
130
+
131
+ $ aquatone-gather --domain example.com
132
+
133
+ aquatone-gather will look for `hosts.json` and `open_ports.txt` in the given domain's AQUATONE assessment directory and request and screenshot every IP address for each domain name for maximum coverage.
134
+
135
+ #### Tuning
136
+
137
+ Like aquatone-discover and aquatone-scan, you can make the gathering more or less aggressive with the `--threads` option which accepts a number of threads for concurrent requests. The default number of threads is 5.
138
+
139
+ $ aquatone-gather --domain example.com --threads 25
140
+
141
+ As aquatone-gather is interacting with web services, it can be picked up by intrusion detection systems. While it will attempt to lessen the risk of detection by randomising hosts and ports, you can tune the stealthiness more with the `--sleep` and `--jitter` options which work just like the similarly named options for aquatone-discover. Keep in mind that setting the `--sleep` option will force the number of threads to one.
142
+
143
+ #### Results
144
+
145
+ When aquatone-gather is finished, it will have created several directories in the domain's AQUATONE assessment directory:
146
+
147
+ * `headers/`: Contains text files with HTTP response headers from each web page
148
+ * `html/`: Contains text files with HTML response bodies from each web page
149
+ * `screenshots/`: Contains PNG images of how each web page looks like in a browser
150
+ * `report/` Contains report files in HTML displaying the gathered information for easy analysis
151
+
152
+
153
+ ## Contributing
154
+
155
+ Bug reports and pull requests are welcome on GitHub at https://github.com/michenriksen/aquatone.
156
+
157
+
158
+ ## License
159
+
160
+ AQUATONE is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
161
+
162
+ [Node.js]: https://nodejs.org/
163
+ [NPM]: https://www.npmjs.com/
164
+ [this guide]: https://docs.npmjs.com/getting-started/installing-node
165
+ [Kali]: https://kali.org/
166
+ [RVM]: https://rvm.io/
167
+ [Nightmare.js]: http://www.nightmarejs.org/
168
+ [EyeWitness]: https://www.christophertruncer.com/eyewitness-usage-guide/
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList['test/**/*_test.rb']
8
+ end
9
+
10
+ task :default => :test
data/aquatone.gemspec ADDED
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'aquatone/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "aquatone"
8
+ spec.version = Aquatone::VERSION
9
+ spec.authors = ["Michael Henriksen"]
10
+ spec.email = ["michenriksen@neomailbox.ch"]
11
+
12
+ spec.summary = %q{A tool for domain flyovers.}
13
+ spec.homepage = "https://github.com/michenriksen/aquatone"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
+ f.match(%r{^(test|spec|features)/})
18
+ end
19
+ spec.bindir = "exe"
20
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_dependency "httparty", "~> 0.14.0"
24
+ spec.add_dependency "childprocess", "~> 0.7.0"
25
+
26
+ spec.add_development_dependency "bundler", "~> 1.13"
27
+ spec.add_development_dependency "rake", "~> 10.0"
28
+ spec.add_development_dependency "minitest", "~> 5.0"
29
+ end
data/aquatone.js ADDED
@@ -0,0 +1,164 @@
1
+ var fs = require('fs');
2
+ var Nightmare = require('nightmare');
3
+ var nightmare = Nightmare({
4
+ width: 1024,
5
+ height: 768,
6
+ switches: {
7
+ 'ignore-certificate-errors': true
8
+ }
9
+ });
10
+
11
+ function debug(message) {
12
+ if (env["AQUATONE_DEBUG"]) {
13
+ console.log(message);
14
+ }
15
+ }
16
+
17
+ var USER_AGENTS = [
18
+ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36",
19
+ "Mozilla/5.0 (Windows NT 6.3; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0",
20
+ "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36",
21
+ "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0",
22
+ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.96 Safari/537.36",
23
+ "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.1 Safari/603.1.30",
24
+ "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36",
25
+ "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0",
26
+ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36",
27
+ "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36",
28
+ "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.96 Safari/537.36",
29
+ "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36",
30
+ "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0) Gecko/20100101 Firefox/53.0",
31
+ "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36",
32
+ "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/603.2.4 (KHTML, like Gecko) Version/10.1.1 Safari/603.2.4",
33
+ "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36",
34
+ "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko",
35
+ "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36",
36
+ "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36",
37
+ ];
38
+
39
+ var HTTP_RESPONSES = {
40
+ 100: "Continue",
41
+ 101: "Switching Protocols",
42
+ 200: "OK",
43
+ 201: "Created",
44
+ 202: "Accepted",
45
+ 203: "Non-Authoritative Information",
46
+ 204: "No Content",
47
+ 205: "Reset Content",
48
+ 206: "Partial Content",
49
+ 300: "Multiple Choices",
50
+ 301: "Moved Permanently",
51
+ 302: "Found",
52
+ 303: "See Other",
53
+ 304: "Not Modified",
54
+ 305: "Use Proxy",
55
+ 306: "(Unused)",
56
+ 307: "Temporary Redirect",
57
+ 400: "Bad Request",
58
+ 401: "Unauthorized",
59
+ 402: "Payment Required",
60
+ 403: "Forbidden",
61
+ 404: "Not Found",
62
+ 405: "Method Not Allowed",
63
+ 406: "Not Acceptable",
64
+ 407: "Proxy Authentication Required",
65
+ 408: "Request Timeout",
66
+ 409: "Conflict",
67
+ 410: "Gone",
68
+ 411: "Length Required",
69
+ 412: "Precondition Failed",
70
+ 413: "Request Entity Too Large",
71
+ 414: "Request-URI Too Long",
72
+ 415: "Unsupported Media Type",
73
+ 416: "Requested Range Not Satisfiable",
74
+ 417: "Expectation Failed",
75
+ 500: "Internal Server Error",
76
+ 501: "Not Implemented",
77
+ 502: "Bad Gateway",
78
+ 503: "Service Unavailable",
79
+ 504: "Gateway Timeout",
80
+ 505: "HTTP Version Not Supported"
81
+ };
82
+
83
+ function randomIpAddress() {
84
+ var result = [];
85
+ for (var i = 0; i < 4; i++) {
86
+ result[i] = Math.floor(Math.random() * (255 - 1 + 1)) + 1;
87
+ }
88
+ return result.join(".");
89
+ }
90
+
91
+ function prettyHeader(header) {
92
+ var words = header.split("-");
93
+ for (var i = 0; i < words.length; i++) {
94
+ words[i] = words[i].charAt(0).toUpperCase() + words[i].slice(1);
95
+ }
96
+ return words.join("-");
97
+ }
98
+
99
+ var url = process.argv[2];
100
+ var vhost = process.argv[3];
101
+ var htmlDestination = process.argv[4];
102
+ var headersDestination = process.argv[5];
103
+ var screenshotDestination = process.argv[6];
104
+ var visit = {
105
+ success: true,
106
+ url: url,
107
+ vhost: vhost
108
+ };
109
+
110
+ nightmare
111
+ .useragent(USER_AGENTS[Math.floor(Math.random() * USER_AGENTS.length)])
112
+ .goto(url, {
113
+ 'Host': vhost,
114
+ 'Accept-Language': 'en-US,en;q=0.8',
115
+ 'Accept-Encoding': '',
116
+ 'Via': '1.1 ' + randomIpAddress(),
117
+ 'X-Forwarded-For': randomIpAddress()
118
+ })
119
+ .then(function(result) {
120
+ visit.code = result.code;
121
+ visit.status = result.code + " " + (HTTP_RESPONSES[visit.code] || "(unknown)")
122
+ var headers = {};
123
+ for (var k in result.headers) {
124
+ headers[prettyHeader(k)] = result.headers[k].join(" ");
125
+ }
126
+ visit.headers = headers;
127
+ return nightmare
128
+ .wait(1000)
129
+ .evaluate(function() {
130
+ document.body.bgColor = 'white';
131
+ })
132
+ .html(htmlDestination, 'HTMLOnly')
133
+ .then(function(result) {
134
+ return nightmare
135
+ .screenshot(screenshotDestination, {
136
+ x: 0,
137
+ y: 0,
138
+ width: 1024,
139
+ height: 768
140
+ })
141
+ .end()
142
+ .then(function() {
143
+ headers = [];
144
+ for (var k in visit.headers) {
145
+ headers.push(k + ": " + visit.headers[k]);
146
+ }
147
+ fs.writeFile(headersDestination, headers.join("\r\n") + "\r\n", function(err) {
148
+ console.log(JSON.stringify(visit));
149
+ process.exit(0);
150
+ });
151
+ })
152
+ })
153
+ })
154
+ .catch(function(error) {
155
+ console.log(JSON.stringify({
156
+ success: false,
157
+ url: url,
158
+ vhost: vhost,
159
+ error: error.message,
160
+ code: error.code,
161
+ details: error.details
162
+ }));
163
+ process.exit(1);
164
+ });