yawast 0.4.0.beta2 → 0.4.0.beta3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0bd401e7dfb0ed1202b3649590c6188004f32d89
4
- data.tar.gz: 349a07e700f68ffaf4cb2c3b2d73723b838eaa63
3
+ metadata.gz: c657b676e6fb2fab6ddf48ac8c7b9a8a8606e1b7
4
+ data.tar.gz: 24071878a0ea703638f5ce1587524505489a9cfb
5
5
  SHA512:
6
- metadata.gz: 08980226efef51d1c4bd02b943fd63ff09b759bc4b921e544e2684f695682867214970d14e7ea31e22a97ce79720db1cb03de3a143fefa5ed0dc7652d8d1e96b
7
- data.tar.gz: 77de689186f88cbb65b6ec5dc072c50013696b4f50420cd982afd0b6eb1c2be888cf7e99c09bc8dd8d8c7978c9c9014b471f19a5a214acf6f8be190822ed103b
6
+ metadata.gz: df6f61d22b221f9dccaff5ef22fdc0708793034368d1101762fdb41338c8a5472fd1ba81cf2ec746a3c76521e5a9ae288e4b39c5196426ca66d59d580eb1cb70
7
+ data.tar.gz: 571fff42d3a0a67c5c1c8ec7a1d30994e91a73ba1a186f150b120a7f3edb83149a591ca631377cb69f49b1e590dd5de30a19bc2c9fc0e7d021b847e59a33c9a9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,7 @@
1
1
  ## 0.4.0 - In Development
2
2
 
3
+ * [#66](https://github.com/adamcaudill/yawast/issues/66) - Thread directory search for better performance
4
+ * [#67](https://github.com/adamcaudill/yawast/issues/67) - Make "Found Redirect" optional
3
5
  * [#65](https://github.com/adamcaudill/yawast/issues/65) - Bug: Output redirection doesn't work correctly
4
6
 
5
7
  ## 0.3.0 - 2016-09-15
data/README.md CHANGED
@@ -207,7 +207,7 @@ This mode is the most comprehensive, and contains far more data than the Interna
207
207
 
208
208
  ### Usage
209
209
 
210
- * Standard scan: `./yawast scan <url> [--internalssl] [--tdessessioncount] [--nossl] [--nociphers] [--dir] [--proxy localhost:8080] [--cookie SESSIONID=12345]`
210
+ * Standard scan: `./yawast scan <url> [--internalssl] [--tdessessioncount] [--nossl] [--nociphers] [--dir] [--dirrecursive] [--dirlistredir] [--proxy localhost:8080] [--cookie SESSIONID=12345]`
211
211
  * HEAD-only scan: `./yawast head <url> [--internalssl] [--tdessessioncount] [--nossl] [--nociphers] [--proxy localhost:8080] [--cookie SESSIONID=12345]`
212
212
  * SSL information: `./yawast ssl <url> [--internalssl] [--tdessessioncount] [--nociphers]`
213
213
  * CMS detection: `./yawast cms <url> [--proxy localhost:8080] [--cookie SESSIONID=12345]`
data/bin/yawast CHANGED
@@ -19,6 +19,7 @@ command :scan do |c|
19
19
  c.option '--tdessessioncount', 'Counts the number of messages that can be sent in a single session'
20
20
  c.option '--dir', 'Enables directory search'
21
21
  c.option '--dirrecursive', 'Recursive directory search (only with --dir)'
22
+ c.option '--dirlistredir', 'Show 301 redirects (only with --dir)'
22
23
  c.option '--proxy STRING', String, 'HTTP Proxy Server (such as Burp Suite)'
23
24
  c.option '--cookie STRING', String, 'Session cookie'
24
25
 
data/lib/scanner/cert.rb CHANGED
@@ -21,7 +21,7 @@ module Yawast
21
21
 
22
22
  content = File.readlines options.input
23
23
 
24
- pool_size = 16
24
+ pool_size = 32
25
25
  jobs = Queue.new
26
26
  @results = Queue.new
27
27
 
@@ -66,7 +66,7 @@ module Yawast
66
66
  return if domain == ''
67
67
 
68
68
  begin
69
- socket = Socket.tcp(domain, 443, opts={connect_timeout: 3})
69
+ socket = Socket.tcp(domain, 443, opts={connect_timeout: 8})
70
70
 
71
71
  ctx = OpenSSL::SSL::SSLContext.new
72
72
  ctx.ciphers = OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:ciphers]
@@ -74,7 +74,7 @@ module Yawast
74
74
  ssl = OpenSSL::SSL::SSLSocket.new(socket, ctx)
75
75
  ssl.hostname = domain
76
76
 
77
- Timeout::timeout(5) {
77
+ Timeout::timeout(16) {
78
78
  ssl.connect
79
79
  }
80
80
 
data/lib/scanner/core.rb CHANGED
@@ -63,7 +63,7 @@ module Yawast
63
63
 
64
64
  #check for common directories
65
65
  if options.dir
66
- Yawast::Scanner::Generic.directory_search(@uri, options.dirrecursive)
66
+ Yawast::Scanner::Plugins::Http::DirectorySearch.search @uri, options.dirrecursive, options.dirlistredir
67
67
  end
68
68
 
69
69
  get_cms(@uri, options)
@@ -212,45 +212,6 @@ module Yawast
212
212
  end
213
213
  end
214
214
 
215
- def self.directory_search(uri, recursive, banner = true)
216
- if banner
217
- if recursive
218
- puts 'Recursively searching for common directories (this will take a while)...'
219
- else
220
- puts 'Searching for common directories...'
221
- end
222
- end
223
-
224
- begin
225
- req = Yawast::Shared::Http.get_http(uri)
226
- req.use_ssl = uri.scheme == 'https'
227
- req.keep_alive_timeout = 600
228
- headers = Yawast::Shared::Http.get_headers
229
-
230
- req.start do |http|
231
- File.open(File.dirname(__FILE__) + '/../resources/common.txt', "r") do |f|
232
- f.each_line do |line|
233
- check = uri.copy
234
- check.path = check.path + "#{line.strip}/"
235
-
236
- res = http.head(check, headers)
237
-
238
- if res.code == '200'
239
- Yawast::Utilities.puts_info "\tFound: '#{check.to_s}'"
240
- directory_search check, recursive, false if recursive
241
- elsif res.code == '301'
242
- Yawast::Utilities.puts_info "\tFound Redirect: '#{check.to_s} -> '#{res['Location']}'"
243
- end
244
- end
245
- end
246
- end
247
- rescue => e
248
- Yawast::Utilities.puts_error "Error searching for directories (#{e.message})"
249
- end
250
-
251
- puts '' if banner
252
- end
253
-
254
215
  def self.check_options(uri)
255
216
  begin
256
217
  req = Yawast::Shared::Http.get_http(uri)
@@ -0,0 +1,91 @@
1
+ module Yawast
2
+ module Scanner
3
+ module Plugins
4
+ module Http
5
+ class DirectorySearch
6
+ def self.search(uri, recursive, list_redirects)
7
+ @recursive = recursive
8
+ @list_redirects = list_redirects
9
+
10
+ if recursive
11
+ puts 'Recursively searching for common directories (this will take a while)...'
12
+ else
13
+ puts 'Searching for common directories...'
14
+ end
15
+
16
+ begin
17
+ pool_size = 16
18
+ @jobs = Queue.new
19
+ @results = Queue.new
20
+
21
+ #load the queue, starting at /
22
+ base = uri.copy
23
+ base.path = '/'
24
+ load_queue base
25
+
26
+ workers = (pool_size).times.map do
27
+ Thread.new do
28
+ begin
29
+ while (check = @jobs.pop(true))
30
+ process check
31
+ end
32
+ rescue ThreadError
33
+ #do nothing
34
+ end
35
+ end
36
+ end
37
+
38
+ results = Thread.new do
39
+ begin
40
+ while true
41
+ if @results.length > 0
42
+ out = @results.pop(true)
43
+ Yawast::Utilities.puts_info out
44
+ end
45
+ end
46
+ rescue ThreadError
47
+ #do nothing
48
+ end
49
+ end
50
+
51
+ workers.map(&:join)
52
+ results.terminate
53
+ rescue => e
54
+ Yawast::Utilities.puts_error "Error searching for directories (#{e.message})"
55
+ end
56
+
57
+ puts
58
+ end
59
+
60
+ def self.load_queue(uri)
61
+ File.open(File.dirname(__FILE__) + '/../../../resources/common.txt', "r") do |f|
62
+ f.each_line do |line|
63
+ check = uri.copy
64
+ check.path = check.path + "#{line.strip}/"
65
+
66
+ #add the job to the queue
67
+ @jobs.push check
68
+ end
69
+ end
70
+ end
71
+
72
+ def self.process(uri)
73
+ begin
74
+ res = Yawast::Shared::Http.head uri
75
+
76
+ if res.code == '200'
77
+ @results.push "\tFound: '#{uri.to_s}'"
78
+
79
+ load_queue uri if @recursive
80
+ elsif res.code == '301' && @list_redirects
81
+ @results.push "\tFound Redirect: '#{uri.to_s} -> '#{res['Location']}'"
82
+ end
83
+ rescue => e
84
+ Yawast::Utilities.puts_error "Error searching for directories (#{e.message})"
85
+ end
86
+ end
87
+ end
88
+ end
89
+ end
90
+ end
91
+ end
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Yawast
2
- VERSION = '0.4.0.beta2'
2
+ VERSION = '0.4.0.beta3'
3
3
  end
data/lib/yawast.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # path - The String relative path from here to the directory.
4
4
  def require_all(path)
5
- glob = File.join(File.dirname(__FILE__), path, '*.rb')
5
+ glob = File.join(File.dirname(__FILE__), path + '/**/', '*.rb')
6
6
  Dir[glob].each do |f|
7
7
  require f
8
8
  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.4.0.beta2
4
+ version: 0.4.0.beta3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Caudill
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-21 00:00:00.000000000 Z
11
+ date: 2016-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ssllabs
@@ -126,6 +126,7 @@ files:
126
126
  - lib/scanner/nginx.rb
127
127
  - lib/scanner/obj_presence.rb
128
128
  - lib/scanner/php.rb
129
+ - lib/scanner/plugins/http/directory_search.rb
129
130
  - lib/scanner/ssl.rb
130
131
  - lib/scanner/ssl_labs.rb
131
132
  - lib/shared/http.rb