yawast 0.6.0.beta5 → 0.6.0.beta6

Sign up to get free protection for your applications and to get access to all the features.
@@ -16,6 +16,12 @@ class TestCommandUtils < Minitest::Test
16
16
  assert_equal uri.to_s, 'http://www.apple.com/'
17
17
  end
18
18
 
19
+ def test_partial_path_url
20
+ args = ['www.apple.com/ipad']
21
+ uri = Yawast::Commands::Utils.extract_uri args
22
+ assert_equal uri.to_s, 'http://www.apple.com/ipad/'
23
+ end
24
+
19
25
  def test_invalid_url
20
26
  args = ['xxx:\invalid']
21
27
 
@@ -8,6 +8,29 @@ class TestSharedHttp < Minitest::Test
8
8
  @uri = URI::Parser.new.parse 'https://www.apple.com/library/test/success.html'
9
9
  end
10
10
 
11
+ def test_setup
12
+ override_stdout
13
+
14
+ Yawast::Shared::Http.setup '127.0.0.1:8080', '1=2'
15
+
16
+ assert stdout_value.include?('Using Proxy: 127.0.0.1:8080'), "Proxy notice not found: #{stdout_value}"
17
+ assert stdout_value.include?('Using Cookie: 1=2'), "Cookie notice not found: #{stdout_value}"
18
+
19
+ # run setup again to make sure things are reset
20
+ Yawast::Shared::Http.setup nil, nil
21
+
22
+ restore_stdout
23
+ end
24
+
25
+ def test_get_headers
26
+ Yawast::Shared::Http.setup nil, '1=2'
27
+ header = { 'Test' => 1 }
28
+
29
+ ret = Yawast::Shared::Http.get_headers header
30
+
31
+ assert ret != nil, 'Headers are nil'
32
+ end
33
+
11
34
  def test_get_apple_success
12
35
  Yawast::Shared::Http.setup nil, nil
13
36
  body = Yawast::Shared::Http.get @uri
data/test/test_ssl.rb CHANGED
@@ -40,4 +40,35 @@ class TestSSLLabsAnalyze < Minitest::Test
40
40
 
41
41
  restore_stdout
42
42
  end
43
+
44
+ def test_check_ssl_redir
45
+ uri = URI::Parser.new.parse 'http://adamcaudill.com/'
46
+ ret = Yawast::Scanner::Plugins::SSL::SSL.check_for_ssl_redirect uri
47
+
48
+ assert ret.to_s == 'https://adamcaudill.com/', "Redirect incorrect: #{ret}"
49
+ end
50
+
51
+ def test_check_no_ssl_redir
52
+ uri = URI::Parser.new.parse 'http://example.com/'
53
+ ret = Yawast::Scanner::Plugins::SSL::SSL.check_for_ssl_redirect uri
54
+
55
+ assert ret == nil, "Redirect incorrect: #{ret}"
56
+ end
57
+
58
+ def test_set_ossl_opts
59
+ # this is *awful* - all it does is run the code without checking anything
60
+ Yawast::Scanner::Plugins::SSL::SSL.set_openssl_options
61
+ end
62
+
63
+ def test_ossl_info
64
+ uri = URI::Parser.new.parse 'https://adamcaudill.com/'
65
+
66
+ override_stdout
67
+
68
+ Yawast::Scanner::Plugins::SSL::SSL.ssl_connection_info uri
69
+
70
+ assert stdout_value.include?('SSL-Session'), "SSL-Session not found in #{stdout_value}"
71
+
72
+ restore_stdout
73
+ end
43
74
  end
@@ -74,4 +74,34 @@ class TestSSLLabsAnalyze < Minitest::Test
74
74
 
75
75
  restore_stdout
76
76
  end
77
+
78
+ def test_process_data_act_is
79
+ override_stdout
80
+
81
+ uri = URI.parse 'https://activationservice1.installshield.com/'
82
+ body = JSON.parse(File.read(File.dirname(__FILE__) + '/data/ssl_labs_analyze_data_activationservice1_installshield_com.json'))
83
+
84
+ Yawast::Scanner::SslLabs.process_results uri, body, false
85
+
86
+ assert stdout_value.include?('installshield.com'), "domain name not found in #{stdout_value}"
87
+ assert stdout_value.include?('Root Stores: Mozilla (trusted)'), "root store name not found in #{stdout_value}"
88
+ assert !stdout_value.include?('[E]'), "Error message found in #{stdout_value}"
89
+
90
+ restore_stdout
91
+ end
92
+
93
+ def test_process_data_forest_gov
94
+ override_stdout
95
+
96
+ uri = URI.parse 'https://www.forest.gov.tw/'
97
+ body = JSON.parse(File.read(File.dirname(__FILE__) + '/data/ssl_labs_analyze_data_forest_gov_tw.json'))
98
+
99
+ Yawast::Scanner::SslLabs.process_results uri, body, false
100
+
101
+ assert stdout_value.include?('www.forest.gov.tw'), "domain name not found in #{stdout_value}"
102
+ assert stdout_value.include?('Root Stores: Apple (trusted) Windows (trusted)'), "root store name not found in #{stdout_value}"
103
+ assert !stdout_value.include?('[E]'), "Error message found in #{stdout_value}"
104
+
105
+ restore_stdout
106
+ end
77
107
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yawast
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0.beta5
4
+ version: 0.6.0.beta6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Caudill
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-23 00:00:00.000000000 Z
11
+ date: 2018-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander
@@ -200,7 +200,9 @@ files:
200
200
  - test/data/hsts_server_header.txt
201
201
  - test/data/iis_server_header.txt
202
202
  - test/data/ssl_labs_analyze_data.json
203
+ - test/data/ssl_labs_analyze_data_activationservice1_installshield_com.json
203
204
  - test/data/ssl_labs_analyze_data_file_zetlab_com.json
205
+ - test/data/ssl_labs_analyze_data_forest_gov_tw.json
204
206
  - test/data/ssl_labs_analyze_data_parivahan_gov_in.json
205
207
  - test/data/ssl_labs_analyze_start.json
206
208
  - test/data/ssl_labs_info.json
@@ -248,7 +250,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
248
250
  version: 1.3.1
249
251
  requirements: []
250
252
  rubyforge_project: yawast
251
- rubygems_version: 2.4.8
253
+ rubygems_version: 2.6.14
252
254
  signing_key:
253
255
  specification_version: 4
254
256
  summary: The YAWAST Antecedent Web Application Security Toolkit
@@ -262,7 +264,9 @@ test_files:
262
264
  - test/data/hsts_server_header.txt
263
265
  - test/data/iis_server_header.txt
264
266
  - test/data/ssl_labs_analyze_data.json
267
+ - test/data/ssl_labs_analyze_data_activationservice1_installshield_com.json
265
268
  - test/data/ssl_labs_analyze_data_file_zetlab_com.json
269
+ - test/data/ssl_labs_analyze_data_forest_gov_tw.json
266
270
  - test/data/ssl_labs_analyze_data_parivahan_gov_in.json
267
271
  - test/data/ssl_labs_analyze_start.json
268
272
  - test/data/ssl_labs_info.json