yawast 0.2.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +21 -0
- data/.ruby-version +1 -0
- data/.travis.yml +7 -0
- data/README.md +454 -0
- data/Rakefile +9 -0
- data/bin/yawast +69 -0
- data/lib/commands/cms.rb +10 -0
- data/lib/commands/head.rb +12 -0
- data/lib/commands/scan.rb +11 -0
- data/lib/commands/ssl.rb +11 -0
- data/lib/commands/utils.rb +36 -0
- data/lib/resources/common.txt +1960 -0
- data/lib/scanner/apache.rb +72 -0
- data/lib/scanner/cms.rb +14 -0
- data/lib/scanner/core.rb +95 -0
- data/lib/scanner/generic.rb +323 -0
- data/lib/scanner/iis.rb +63 -0
- data/lib/scanner/nginx.rb +13 -0
- data/lib/scanner/obj_presence.rb +63 -0
- data/lib/scanner/php.rb +19 -0
- data/lib/scanner/ssl.rb +237 -0
- data/lib/scanner/ssl_labs.rb +491 -0
- data/lib/shared/http.rb +67 -0
- data/lib/string_ext.rb +16 -0
- data/lib/uri_ext.rb +5 -0
- data/lib/util.rb +25 -0
- data/lib/yawast.rb +57 -0
- data/test/base.rb +43 -0
- data/test/data/apache_server_info.txt +486 -0
- data/test/data/apache_server_status.txt +184 -0
- data/test/data/cms_none_body.txt +242 -0
- data/test/data/cms_wordpress_body.txt +467 -0
- data/test/data/iis_server_header.txt +13 -0
- data/test/data/tomcat_release_notes.txt +172 -0
- data/test/data/wordpress_readme_html.txt +86 -0
- data/test/test_cmd_util.rb +35 -0
- data/test/test_helper.rb +5 -0
- data/test/test_object_presence.rb +36 -0
- data/test/test_scan_apache_banner.rb +58 -0
- data/test/test_scan_apache_server_info.rb +22 -0
- data/test/test_scan_apache_server_status.rb +22 -0
- data/test/test_scan_cms.rb +27 -0
- data/test/test_scan_iis_headers.rb +40 -0
- data/test/test_scan_nginx_banner.rb +18 -0
- data/test/test_shared_http.rb +40 -0
- data/test/test_shared_util.rb +44 -0
- data/test/test_string_ext.rb +15 -0
- data/test/test_yawast.rb +17 -0
- data/yawast.gemspec +35 -0
- metadata +283 -0
@@ -0,0 +1,172 @@
|
|
1
|
+
================================================================================
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one or more
|
3
|
+
contributor license agreements. See the NOTICE file distributed with
|
4
|
+
this work for additional information regarding copyright ownership.
|
5
|
+
The ASF licenses this file to You under the Apache License, Version 2.0
|
6
|
+
(the "License"); you may not use this file except in compliance with
|
7
|
+
the License. You may obtain a copy of the License at
|
8
|
+
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
See the License for the specific language governing permissions and
|
15
|
+
limitations under the License.
|
16
|
+
================================================================================
|
17
|
+
|
18
|
+
|
19
|
+
Apache Tomcat Version 8.0.30
|
20
|
+
Release Notes
|
21
|
+
|
22
|
+
|
23
|
+
=========
|
24
|
+
CONTENTS:
|
25
|
+
=========
|
26
|
+
|
27
|
+
* Dependency Changes
|
28
|
+
* API Stability
|
29
|
+
* Bundled APIs
|
30
|
+
* Web application reloading and static fields in shared libraries
|
31
|
+
* Security manager URLs
|
32
|
+
* Symlinking static resources
|
33
|
+
* Viewing the Tomcat Change Log
|
34
|
+
* Cryptographic software notice
|
35
|
+
* When all else fails
|
36
|
+
|
37
|
+
|
38
|
+
===================
|
39
|
+
Dependency Changes:
|
40
|
+
===================
|
41
|
+
Tomcat 8.0 is designed to run on Java SE 7 and later.
|
42
|
+
|
43
|
+
|
44
|
+
==============
|
45
|
+
API Stability:
|
46
|
+
==============
|
47
|
+
|
48
|
+
The public interfaces for the following classes are fixed and will not be
|
49
|
+
changed at all during the remaining lifetime of the 8.x series:
|
50
|
+
- All classes in the javax namespace
|
51
|
+
|
52
|
+
The public interfaces for the following classes may be added to in order to
|
53
|
+
resolve bugs and/or add new features. No existing interface method will be
|
54
|
+
removed or changed although it may be deprecated.
|
55
|
+
- org.apache.catalina.* (excluding sub-packages)
|
56
|
+
|
57
|
+
Note: As Tomcat 8 matures, the above list will be added to. The list is not
|
58
|
+
considered complete at this time.
|
59
|
+
|
60
|
+
The remaining classes are considered part of the Tomcat internals and may change
|
61
|
+
without notice between point releases.
|
62
|
+
|
63
|
+
|
64
|
+
=============
|
65
|
+
Bundled APIs:
|
66
|
+
=============
|
67
|
+
A standard installation of Tomcat 8.0 makes all of the following APIs available
|
68
|
+
for use by web applications (by placing them in "lib"):
|
69
|
+
* annotations-api.jar (Annotations package)
|
70
|
+
* catalina.jar (Tomcat Catalina implementation)
|
71
|
+
* catalina-ant.jar (Tomcat Catalina Ant tasks)
|
72
|
+
* catalina-ha.jar (High availability package)
|
73
|
+
* catalina-storeconfig.jar (Generation of XML configuration from current state)
|
74
|
+
* catalina-tribes.jar (Group communication)
|
75
|
+
* ecj-4.4.2.jar (Eclipse JDT Java compiler)
|
76
|
+
* el-api.jar (EL 3.0 API)
|
77
|
+
* jasper.jar (Jasper 2 Compiler and Runtime)
|
78
|
+
* jasper-el.jar (Jasper 2 EL implementation)
|
79
|
+
* jsp-api.jar (JSP 2.3 API)
|
80
|
+
* servlet-api.jar (Servlet 3.1 API)
|
81
|
+
* tomcat-api.jar (Interfaces shared by Catalina and Jasper)
|
82
|
+
* tomcat-coyote.jar (Tomcat connectors and utility classes)
|
83
|
+
* tomcat-dbcp.jar (package renamed database connection pool based on Commons DBCP)
|
84
|
+
* tomcat-jdbc.jar (Tomcat's database connection pooling solution)
|
85
|
+
* tomcat-jni.jar (Interface to the native component of the APR/native connector)
|
86
|
+
* tomcat-util.jar (Various utilities)
|
87
|
+
* tomcat-websocket.jar (WebSocket 1.1 implementation)
|
88
|
+
* websocket-api.jar (WebSocket 1.1 API)
|
89
|
+
|
90
|
+
You can make additional APIs available to all of your web applications by
|
91
|
+
putting unpacked classes into a "classes" directory (not created by default),
|
92
|
+
or by placing them in JAR files in the "lib" directory.
|
93
|
+
|
94
|
+
To override the XML parser implementation or interfaces, use the endorsed
|
95
|
+
mechanism of the JVM. The default configuration defines JARs located in
|
96
|
+
"endorsed" as endorsed.
|
97
|
+
|
98
|
+
|
99
|
+
================================================================
|
100
|
+
Web application reloading and static fields in shared libraries:
|
101
|
+
================================================================
|
102
|
+
Some shared libraries (many are part of the JDK) keep references to objects
|
103
|
+
instantiated by the web application. To avoid class loading related problems
|
104
|
+
(ClassCastExceptions, messages indicating that the classloader
|
105
|
+
is stopped, etc.), the shared libraries state should be reinitialized.
|
106
|
+
|
107
|
+
Something which might help is to avoid putting classes which would be
|
108
|
+
referenced by a shared static field in the web application classloader,
|
109
|
+
and putting them in the shared classloader instead (JARs should be put in the
|
110
|
+
"lib" folder, and classes should be put in the "classes" folder).
|
111
|
+
|
112
|
+
|
113
|
+
======================
|
114
|
+
Security manager URLs:
|
115
|
+
======================
|
116
|
+
In order to grant security permissions to JARs located inside the
|
117
|
+
web application repository, use URLs of of the following format
|
118
|
+
in your policy file:
|
119
|
+
|
120
|
+
file:${catalina.base}/webapps/examples/WEB-INF/lib/driver.jar
|
121
|
+
|
122
|
+
|
123
|
+
============================
|
124
|
+
Symlinking static resources:
|
125
|
+
============================
|
126
|
+
By default, Unix symlinks will not work when used in a web application to link
|
127
|
+
resources located outside the web application root directory.
|
128
|
+
|
129
|
+
This behavior is optional, and the "allowLinking" flag may be used to disable
|
130
|
+
the check.
|
131
|
+
|
132
|
+
|
133
|
+
==============================
|
134
|
+
Viewing the Tomcat Change Log:
|
135
|
+
==============================
|
136
|
+
The full change log is available from http://tomcat.apache.org and is also
|
137
|
+
included in the documentation web application.
|
138
|
+
|
139
|
+
|
140
|
+
=============================
|
141
|
+
Cryptographic software notice
|
142
|
+
=============================
|
143
|
+
This distribution includes cryptographic software. The country in
|
144
|
+
which you currently reside may have restrictions on the import,
|
145
|
+
possession, use, and/or re-export to another country, of
|
146
|
+
encryption software. BEFORE using any encryption software, please
|
147
|
+
check your country's laws, regulations and policies concerning the
|
148
|
+
import, possession, or use, and re-export of encryption software, to
|
149
|
+
see if this is permitted. See <http://www.wassenaar.org/> for more
|
150
|
+
information.
|
151
|
+
|
152
|
+
The U.S. Government Department of Commerce, Bureau of Industry and
|
153
|
+
Security (BIS), has classified this software as Export Commodity
|
154
|
+
Control Number (ECCN) 5D002.C.1, which includes information security
|
155
|
+
software using or performing cryptographic functions with asymmetric
|
156
|
+
algorithms. The form and manner of this Apache Software Foundation
|
157
|
+
distribution makes it eligible for export under the License Exception
|
158
|
+
ENC Technology Software Unrestricted (TSU) exception (see the BIS
|
159
|
+
Export Administration Regulations, Section 740.13) for both object
|
160
|
+
code and source code.
|
161
|
+
|
162
|
+
The following provides more details on the included cryptographic
|
163
|
+
software:
|
164
|
+
- Tomcat includes code designed to work with JSSE
|
165
|
+
- Tomcat includes code designed to work with OpenSSL
|
166
|
+
|
167
|
+
|
168
|
+
====================
|
169
|
+
When all else fails:
|
170
|
+
====================
|
171
|
+
See the FAQ
|
172
|
+
http://tomcat.apache.org/faq/
|
@@ -0,0 +1,86 @@
|
|
1
|
+
|
2
|
+
<!DOCTYPE html>
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta name="viewport" content="width=device-width"/>
|
6
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
7
|
+
<title>WordPress › ReadMe</title>
|
8
|
+
<link rel="stylesheet" href="wp-admin/css/install.css?ver=20100228" type="text/css"/>
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
<h1 id="logo">
|
12
|
+
<a href="https://wordpress.org/"><img alt="WordPress" src="wp-admin/images/wordpress-logo.png"/></a>
|
13
|
+
<br/> Version 4.5.3
|
14
|
+
</h1>
|
15
|
+
<p style="text-align: center">Semantic Personal Publishing Platform</p>
|
16
|
+
<h2>First Things First</h2>
|
17
|
+
<p>Welcome. WordPress is a very special project to me. Every developer and contributor adds something unique to the mix, and together we create something beautiful that I’m proud to be a part of. Thousands of hours have gone into WordPress, and we’re dedicated to making it better every day. Thank you for making it part of your world.</p>
|
18
|
+
<p style="text-align: right">— Matt Mullenweg</p>
|
19
|
+
<h2>Installation: Famous 5-minute install</h2>
|
20
|
+
<ol>
|
21
|
+
<li>Unzip the package in an empty directory and upload everything.</li>
|
22
|
+
<li>Open <span class="file"><a href="wp-admin/install.php">wp-admin/install.php</a></span> in your browser. It will take you through the process to set up a <code>wp-config.php</code> file with your database connection details.
|
23
|
+
<ol>
|
24
|
+
<li>If for some reason this doesn’t work, don’t worry. It doesn’t work on all web hosts. Open up <code>wp-config-sample.php</code> with a text editor like WordPad or similar and fill in your database connection details.</li>
|
25
|
+
<li>Save the file as <code>wp-config.php</code> and upload it.</li>
|
26
|
+
<li>Open <span class="file"><a href="wp-admin/install.php">wp-admin/install.php</a></span> in your browser.</li>
|
27
|
+
</ol>
|
28
|
+
</li>
|
29
|
+
<li>Once the configuration file is set up, the installer will set up the tables needed for your blog. If there is an error, double check your <code>wp-config.php</code> file, and try again. If it fails again, please go to the <a href="https://wordpress.org/support/" title="WordPress support">support forums</a> with as much data as you can gather.</li>
|
30
|
+
<li><strong>If you did not enter a password, note the password given to you.</strong> If you did not provide a username, it will be <code>admin</code>.</li>
|
31
|
+
<li>The installer should then send you to the <a href="wp-login.php">login page</a>. Sign in with the username and password you chose during the installation. If a password was generated for you, you can then click on “Profile” to change the password.</li>
|
32
|
+
</ol>
|
33
|
+
<h2>Updating</h2>
|
34
|
+
<h3>Using the Automatic Updater</h3>
|
35
|
+
<p>If you are updating from version 2.7 or higher, you can use the automatic updater:</p>
|
36
|
+
<ol>
|
37
|
+
<li>Open <span class="file"><a href="wp-admin/update-core.php">wp-admin/update-core.php</a></span> in your browser and follow the instructions.</li>
|
38
|
+
<li>You wanted more, perhaps? That’s it!</li>
|
39
|
+
</ol>
|
40
|
+
<h3>Updating Manually</h3>
|
41
|
+
<ol>
|
42
|
+
<li>Before you update anything, make sure you have backup copies of any files you may have modified such as <code>index.php</code>.</li>
|
43
|
+
<li>Delete your old WordPress files, saving ones you’ve modified.</li>
|
44
|
+
<li>Upload the new files.</li>
|
45
|
+
<li>Point your browser to <span class="file"><a href="wp-admin/upgrade.php">/wp-admin/upgrade.php</a>.</span></li>
|
46
|
+
</ol>
|
47
|
+
<h2>Migrating from other systems</h2>
|
48
|
+
<p>WordPress can <a href="https://codex.wordpress.org/Importing_Content">import from a number of systems</a>. First you need to get WordPress installed and working as described above, before using <a href="wp-admin/import.php" title="Import to WordPress">our import tools</a>.</p>
|
49
|
+
<h2>System Requirements</h2>
|
50
|
+
<ul>
|
51
|
+
<li><a href="http://php.net/">PHP</a> version <strong>5.2.4</strong> or higher.</li>
|
52
|
+
<li><a href="http://www.mysql.com/">MySQL</a> version <strong>5.0</strong> or higher.</li>
|
53
|
+
</ul>
|
54
|
+
<h3>Recommendations</h3>
|
55
|
+
<ul>
|
56
|
+
<li><a href="http://php.net/">PHP</a> version <strong>5.6</strong> or higher.</li>
|
57
|
+
<li><a href="http://www.mysql.com/">MySQL</a> version <strong>5.6</strong> or higher.</li>
|
58
|
+
<li>The <a href="http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html">mod_rewrite</a> Apache module.</li>
|
59
|
+
<li>A link to <a href="https://wordpress.org/">wordpress.org</a> on your site.</li>
|
60
|
+
</ul>
|
61
|
+
<h2>Online Resources</h2>
|
62
|
+
<p>If you have any questions that aren’t addressed in this document, please take advantage of WordPress’ numerous online resources:</p>
|
63
|
+
<dl>
|
64
|
+
<dt><a href="https://codex.wordpress.org/">The WordPress Codex</a></dt>
|
65
|
+
<dd>The Codex is the encyclopedia of all things WordPress. It is the most comprehensive source of information for WordPress available.</dd>
|
66
|
+
<dt><a href="https://wordpress.org/news/">The WordPress Blog</a></dt>
|
67
|
+
<dd>This is where you’ll find the latest updates and news related to WordPress. Recent WordPress news appears in your administrative dashboard by default.</dd>
|
68
|
+
<dt><a href="https://planet.wordpress.org/">WordPress Planet</a></dt>
|
69
|
+
<dd>The WordPress Planet is a news aggregator that brings together posts from WordPress blogs around the web.</dd>
|
70
|
+
<dt><a href="https://wordpress.org/support/">WordPress Support Forums</a></dt>
|
71
|
+
<dd>If you’ve looked everywhere and still can’t find an answer, the support forums are very active and have a large community ready to help. To help them help you be sure to use a descriptive thread title and describe your question in as much detail as possible.</dd>
|
72
|
+
<dt><a href="https://codex.wordpress.org/IRC">WordPress <abbr title="Internet Relay Chat">IRC</abbr> Channel</a></dt>
|
73
|
+
<dd>There is an online chat channel that is used for discussion among people who use WordPress and occasionally support topics. The above wiki page should point you in the right direction. (<a href="irc://irc.freenode.net/wordpress">irc.freenode.net #wordpress</a>)</dd>
|
74
|
+
</dl>
|
75
|
+
<h2>Final Notes</h2>
|
76
|
+
<ul>
|
77
|
+
<li>If you have any suggestions, ideas, or comments, or if you (gasp!) found a bug, join us in the <a href="https://wordpress.org/support/">Support Forums</a>.</li>
|
78
|
+
<li>WordPress has a robust plugin <abbr title="application programming interface">API</abbr> that makes extending the code easy. If you are a developer interested in utilizing this, see the <a href="https://codex.wordpress.org/Plugin_API" title="WordPress plugin API">plugin documentation in the Codex</a>. You shouldn’t modify any of the core code.</li>
|
79
|
+
</ul>
|
80
|
+
<h2>Share the Love</h2>
|
81
|
+
<p>WordPress has no multi-million dollar marketing campaign or celebrity sponsors, but we do have something even better—you. If you enjoy WordPress please consider telling a friend, setting it up for someone less knowledgable than yourself, or writing the author of a media article that overlooks us.</p>
|
82
|
+
<p>WordPress is the official continuation of <a href="http://cafelog.com/">b2/cafélog</a>, which came from Michel V. The work has been continued by the <a href="https://wordpress.org/about/">WordPress developers</a>. If you would like to support WordPress, please consider <a href="https://wordpress.org/donate/" title="Donate to WordPress">donating</a>.</p>
|
83
|
+
<h2>License</h2>
|
84
|
+
<p>WordPress is free software, and is released under the terms of the <abbr title="GNU General Public License">GPL</abbr> version 2 or (at your option) any later version. See <a href="license.txt">license.txt</a>.</p>
|
85
|
+
</body>
|
86
|
+
</html>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require './lib/yawast'
|
3
|
+
require './test/base'
|
4
|
+
|
5
|
+
class TestCommandUtils < Minitest::Test
|
6
|
+
include TestBase
|
7
|
+
|
8
|
+
def test_valid_url
|
9
|
+
args = ['http://www.apple.com']
|
10
|
+
uri = Yawast::Commands::Utils.extract_uri args
|
11
|
+
assert_equal uri.to_s, 'http://www.apple.com/'
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_partial_url
|
15
|
+
args = ['www.apple.com']
|
16
|
+
uri = Yawast::Commands::Utils.extract_uri args
|
17
|
+
assert_equal uri.to_s, 'http://www.apple.com/'
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_invalid_url
|
21
|
+
args = ['xxx:\invalid']
|
22
|
+
|
23
|
+
assert_raises URI::InvalidURIError do
|
24
|
+
Yawast::Commands::Utils.extract_uri args
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_unresolvable_url
|
29
|
+
args = ['http://www.gjhgjhbmnbmnvgccf.com']
|
30
|
+
|
31
|
+
assert_raises ArgumentError do
|
32
|
+
Yawast::Commands::Utils.extract_uri args
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require 'webrick'
|
3
|
+
require './lib/yawast'
|
4
|
+
require './test/base'
|
5
|
+
|
6
|
+
class TestScannerApacheServerStatus < Minitest::Test
|
7
|
+
include TestBase
|
8
|
+
|
9
|
+
def test_readme_html_present
|
10
|
+
port = rand(60000) + 1024 # pick a random port number
|
11
|
+
server = start_web_server 'test/data/wordpress_readme_html.txt', 'readme.html', port
|
12
|
+
|
13
|
+
override_stdout
|
14
|
+
uri = Yawast::Commands::Utils.extract_uri(["http://localhost:#{port}"])
|
15
|
+
Yawast::Scanner::ObjectPresence.check_readme_html uri
|
16
|
+
|
17
|
+
assert stdout_value.include?('\'/readme.html\' found:'), 'readme.html page warning not found'
|
18
|
+
|
19
|
+
server.exit
|
20
|
+
restore_stdout
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_release_notes_txt_present
|
24
|
+
port = rand(60000) + 1024 # pick a random port number
|
25
|
+
server = start_web_server 'test/data/tomcat_release_notes.txt', 'RELEASE-NOTES.txt', port
|
26
|
+
|
27
|
+
override_stdout
|
28
|
+
uri = Yawast::Commands::Utils.extract_uri(["http://localhost:#{port}"])
|
29
|
+
Yawast::Scanner::ObjectPresence.check_release_notes_txt uri
|
30
|
+
|
31
|
+
assert stdout_value.include?('\'/RELEASE-NOTES.txt\' found:'), 'RELEASE-NOTES.txt page warning not found'
|
32
|
+
|
33
|
+
server.exit
|
34
|
+
restore_stdout
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require './lib/yawast'
|
3
|
+
require './test/base'
|
4
|
+
|
5
|
+
class TestScannerApacheBanner < Minitest::Test
|
6
|
+
include TestBase
|
7
|
+
|
8
|
+
def test_apache_basic_banner_no_version
|
9
|
+
server = 'Apache'
|
10
|
+
override_stdout
|
11
|
+
Yawast::Scanner::Apache.check_banner server
|
12
|
+
|
13
|
+
assert stdout_value.include?("Apache Server: #{server}"), "Unexpected banner: #{stdout_value}"
|
14
|
+
|
15
|
+
restore_stdout
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_apache_basic_banner
|
19
|
+
server = 'Apache/2.4.7'
|
20
|
+
override_stdout
|
21
|
+
Yawast::Scanner::Apache.check_banner server
|
22
|
+
|
23
|
+
assert stdout_value.include?("Apache Server: #{server}"), "Unexpected banner: #{stdout_value}"
|
24
|
+
|
25
|
+
restore_stdout
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_apache_basic_banner_distro
|
29
|
+
server = 'Apache/2.4.7 (Ubuntu)'
|
30
|
+
override_stdout
|
31
|
+
Yawast::Scanner::Apache.check_banner server
|
32
|
+
|
33
|
+
assert stdout_value.include?("Apache Server: #{server}"), "Unexpected banner: #{stdout_value}"
|
34
|
+
|
35
|
+
restore_stdout
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_apache_one_module
|
39
|
+
server = 'Apache/2.4.6 (FreeBSD) PHP/5.4.23'
|
40
|
+
override_stdout
|
41
|
+
Yawast::Scanner::Apache.check_banner server
|
42
|
+
|
43
|
+
assert stdout_value.include?('Apache Server: Module listing enabled'), 'Module listing missing'
|
44
|
+
|
45
|
+
restore_stdout
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_apache_openssl_module
|
49
|
+
server = 'Apache/2.4.6 (FreeBSD) PHP/5.4.23 OpenSSL/0.9.8n'
|
50
|
+
override_stdout
|
51
|
+
Yawast::Scanner::Apache.check_banner server
|
52
|
+
|
53
|
+
assert stdout_value.include?('Apache Server: Module listing enabled'), 'Module listing missing'
|
54
|
+
assert stdout_value.include?('OpenSSL Version Disclosure'), 'OpenSSL version warning missing'
|
55
|
+
|
56
|
+
restore_stdout
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require 'webrick'
|
3
|
+
require './lib/yawast'
|
4
|
+
require './test/base'
|
5
|
+
|
6
|
+
class TestScannerApacheServerInfo < Minitest::Test
|
7
|
+
include TestBase
|
8
|
+
|
9
|
+
def test_server_info_present
|
10
|
+
port = rand(60000) + 1024 # pick a random port number
|
11
|
+
server = start_web_server 'test/data/apache_server_info.txt', 'server-info', port
|
12
|
+
|
13
|
+
override_stdout
|
14
|
+
uri = Yawast::Commands::Utils.extract_uri(["http://localhost:#{port}"])
|
15
|
+
Yawast::Scanner::Apache.check_server_info uri
|
16
|
+
|
17
|
+
assert stdout_value.include?('Apache Server Info page found'), 'Apache Server Info page warning not found'
|
18
|
+
|
19
|
+
server.exit
|
20
|
+
restore_stdout
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require 'webrick'
|
3
|
+
require './lib/yawast'
|
4
|
+
require './test/base'
|
5
|
+
|
6
|
+
class TestScannerApacheServerStatus < Minitest::Test
|
7
|
+
include TestBase
|
8
|
+
|
9
|
+
def test_server_status_present
|
10
|
+
port = rand(60000) + 1024 # pick a random port number
|
11
|
+
server = start_web_server 'test/data/apache_server_status.txt', 'server-status', port
|
12
|
+
|
13
|
+
override_stdout
|
14
|
+
uri = Yawast::Commands::Utils.extract_uri(["http://localhost:#{port}"])
|
15
|
+
Yawast::Scanner::Apache.check_server_status uri
|
16
|
+
|
17
|
+
assert stdout_value.include?('Apache Server Status page found'), 'Apache Server Status page warning not found'
|
18
|
+
|
19
|
+
server.exit
|
20
|
+
restore_stdout
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require './lib/yawast'
|
3
|
+
require './test/base'
|
4
|
+
|
5
|
+
class TestScannerCms < Minitest::Test
|
6
|
+
include TestBase
|
7
|
+
|
8
|
+
def test_generator_tag_valid
|
9
|
+
body = File.read('test/data/cms_wordpress_body.txt')
|
10
|
+
override_stdout
|
11
|
+
Yawast::Scanner::Cms.get_generator body
|
12
|
+
|
13
|
+
assert stdout_value.include?('WordPress'), "Unexpected generator tag: #{stdout_value}"
|
14
|
+
|
15
|
+
restore_stdout
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_generator_tag_invalid
|
19
|
+
body = File.read('test/data/cms_none_body.txt')
|
20
|
+
override_stdout
|
21
|
+
Yawast::Scanner::Cms.get_generator body
|
22
|
+
|
23
|
+
assert stdout_value == '', "Unexpected generator tag: #{stdout_value}"
|
24
|
+
|
25
|
+
restore_stdout
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require './lib/yawast'
|
3
|
+
require './test/base'
|
4
|
+
|
5
|
+
class TestScannerIisHeaders < Minitest::Test
|
6
|
+
include TestBase
|
7
|
+
|
8
|
+
def test_iis_basic_banner
|
9
|
+
server = 'Microsoft-IIS/8.5'
|
10
|
+
|
11
|
+
override_stdout
|
12
|
+
Yawast::Scanner::Iis.check_banner server
|
13
|
+
|
14
|
+
assert stdout_value.include?("IIS Version: #{server}"), "Unexpected banner: #{stdout_value}"
|
15
|
+
|
16
|
+
restore_stdout
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_asp_version
|
20
|
+
headers = parse_headers_from_file 'test/data/iis_server_header.txt'
|
21
|
+
|
22
|
+
override_stdout
|
23
|
+
Yawast::Scanner::Iis.check_asp_banner headers
|
24
|
+
|
25
|
+
assert stdout_value.include?('ASP.NET Version'), 'ASP.NET Version warning not found.'
|
26
|
+
|
27
|
+
restore_stdout
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_mvc_version
|
31
|
+
headers = parse_headers_from_file 'test/data/iis_server_header.txt'
|
32
|
+
|
33
|
+
override_stdout
|
34
|
+
Yawast::Scanner::Iis.check_mvc_version headers
|
35
|
+
|
36
|
+
assert stdout_value.include?('ASP.NET MVC Version'), 'ASP.NET MVC Version warning not found.'
|
37
|
+
|
38
|
+
restore_stdout
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require './lib/yawast'
|
3
|
+
require './test/base'
|
4
|
+
|
5
|
+
class TestScannerNginxHeaders < Minitest::Test
|
6
|
+
include TestBase
|
7
|
+
|
8
|
+
def test_nginx_basic_banner
|
9
|
+
server = 'nginx/1.8.1'
|
10
|
+
|
11
|
+
override_stdout
|
12
|
+
Yawast::Scanner::Nginx.check_banner server
|
13
|
+
|
14
|
+
assert stdout_value.include?("nginx Version: #{server}"), "Unexpected banner: #{stdout_value}"
|
15
|
+
|
16
|
+
restore_stdout
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require './lib/yawast'
|
3
|
+
require './test/base'
|
4
|
+
|
5
|
+
class TestSharedHttp < Minitest::Test
|
6
|
+
include TestBase
|
7
|
+
|
8
|
+
def setup
|
9
|
+
@uri = URI::Parser.new.parse 'http://www.apple.com/library/test/success.html'
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_get_apple_success
|
13
|
+
body = Yawast::Shared::Http.get @uri
|
14
|
+
|
15
|
+
assert body.include?('Success'), 'Failed to receive "Success" message from Apple.com'
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_status_apple_success
|
19
|
+
status = Yawast::Shared::Http.get_status_code @uri
|
20
|
+
|
21
|
+
assert_equal status, '200'
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_status_apple_failure
|
25
|
+
uri = @uri
|
26
|
+
uri.path += '.404'
|
27
|
+
status = Yawast::Shared::Http.get_status_code uri
|
28
|
+
|
29
|
+
assert_equal status, '404'
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_head_apple_success
|
33
|
+
head = Yawast::Shared::Http.head @uri
|
34
|
+
head.each do |k, v|
|
35
|
+
if k.downcase == 'server'
|
36
|
+
assert_equal v, 'Apache'
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require './lib/yawast'
|
3
|
+
require './test/base'
|
4
|
+
require 'colorize'
|
5
|
+
|
6
|
+
class TestSharedUtils < Minitest::Test
|
7
|
+
include TestBase
|
8
|
+
|
9
|
+
def test_puts_error
|
10
|
+
override_stdout
|
11
|
+
|
12
|
+
Yawast::Utilities.puts_error 'test'
|
13
|
+
assert_equal stdout_value, '[E]'.red + " test\n"
|
14
|
+
|
15
|
+
restore_stdout
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_puts_vuln
|
19
|
+
override_stdout
|
20
|
+
|
21
|
+
Yawast::Utilities.puts_vuln 'test'
|
22
|
+
assert_equal stdout_value, '[V]'.magenta + " test\n"
|
23
|
+
|
24
|
+
restore_stdout
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_puts_warn
|
28
|
+
override_stdout
|
29
|
+
|
30
|
+
Yawast::Utilities.puts_warn 'test'
|
31
|
+
assert_equal stdout_value, '[W]'.yellow + " test\n"
|
32
|
+
|
33
|
+
restore_stdout
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_puts_info
|
37
|
+
override_stdout
|
38
|
+
|
39
|
+
Yawast::Utilities.puts_info 'test'
|
40
|
+
assert_equal stdout_value, '[I]'.green + " test\n"
|
41
|
+
|
42
|
+
restore_stdout
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require './lib/yawast'
|
3
|
+
require './test/base'
|
4
|
+
|
5
|
+
class TestStringExtensions < Minitest::Test
|
6
|
+
include TestBase
|
7
|
+
|
8
|
+
def test_valid_number
|
9
|
+
assert_equal '42'.is_number?, true
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_invalid_number
|
13
|
+
assert_equal '4two'.is_number?, false
|
14
|
+
end
|
15
|
+
end
|
data/test/test_yawast.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require './lib/yawast'
|
3
|
+
require './test/base'
|
4
|
+
|
5
|
+
class TestYawast < Minitest::Test
|
6
|
+
include TestBase
|
7
|
+
|
8
|
+
def test_header
|
9
|
+
override_stdout
|
10
|
+
|
11
|
+
Yawast.header
|
12
|
+
header = stdout_value
|
13
|
+
assert header.include?('Copyright'), 'Header not found'
|
14
|
+
|
15
|
+
restore_stdout
|
16
|
+
end
|
17
|
+
end
|