deadfinder 1.3.6 → 1.4.0
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 +4 -4
- data/lib/deadfinder/logger.rb +4 -0
- data/lib/deadfinder/version.rb +1 -1
- data/lib/deadfinder.rb +21 -6
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf75290cf2187f96b42398ac743fd60fc203616a2cd763c4de85a179b6dc4ae6
|
4
|
+
data.tar.gz: cd894f1ac871e057ac3df4e1d0b89b6bf08c9625f9089c9a0213e94bc4f43010
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9e2c6ee268a3ce006c3a23c123852cf23e75b59218876aa0fd1a0ef779e07fb04994b781bb97d231b01db549903eb206c11b1a15774fcf8bce73423d7c1870b
|
7
|
+
data.tar.gz: dbe9ab7a014687e2fb34cb893cecb236c842c6d8dd3b9dcc5107c96630fe9b123684608e047db182a6f94eb9393281410b7c7831cb0c560d72ba529da11e49d1
|
data/lib/deadfinder/logger.rb
CHANGED
data/lib/deadfinder/version.rb
CHANGED
data/lib/deadfinder.rb
CHANGED
@@ -9,7 +9,6 @@ require 'deadfinder/logger'
|
|
9
9
|
require 'deadfinder/version'
|
10
10
|
require 'concurrent-edge'
|
11
11
|
require 'sitemap-parser'
|
12
|
-
require 'set'
|
13
12
|
require 'json'
|
14
13
|
|
15
14
|
Channel = Concurrent::Channel
|
@@ -24,7 +23,9 @@ class DeadFinderRunner
|
|
24
23
|
'timeout' => 10,
|
25
24
|
'output' => '',
|
26
25
|
'headers' => [],
|
27
|
-
'silent' => true
|
26
|
+
'silent' => true,
|
27
|
+
'verbose' => false,
|
28
|
+
'include30x' => false
|
28
29
|
}
|
29
30
|
end
|
30
31
|
|
@@ -77,14 +78,26 @@ class DeadFinderRunner
|
|
77
78
|
CacheSet[j] = true
|
78
79
|
begin
|
79
80
|
CacheQue[j] = true
|
80
|
-
URI.
|
81
|
-
|
82
|
-
|
83
|
-
|
81
|
+
uri = URI.parse(j)
|
82
|
+
|
83
|
+
# Create HTTP request with timeout and headers
|
84
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
85
|
+
http.use_ssl = (uri.scheme == 'https')
|
86
|
+
http.read_timeout = options['timeout'].to_i if options['timeout']
|
87
|
+
|
88
|
+
request = Net::HTTP::Get.new(uri.request_uri)
|
89
|
+
response = http.request(request)
|
90
|
+
status_code = response.code.to_i
|
91
|
+
Logger.verbose "Status Code: #{status_code} for #{j}" if options['verbose']
|
92
|
+
|
93
|
+
if status_code >= 400 || (status_code >= 300 && options['include30x'])
|
94
|
+
Logger.found "[#{status_code} #{response.message}] #{j}"
|
84
95
|
CacheQue[j] = false
|
85
96
|
Output[target] ||= []
|
86
97
|
Output[target] << j
|
87
98
|
end
|
99
|
+
rescue StandardError => e
|
100
|
+
Logger.verbose "[#{e}] #{j}" if options['verbose']
|
88
101
|
end
|
89
102
|
end
|
90
103
|
results << j
|
@@ -160,11 +173,13 @@ def gen_output(options)
|
|
160
173
|
end
|
161
174
|
|
162
175
|
class DeadFinder < Thor
|
176
|
+
class_option :include30x, aliases: :r, default: false, type: :boolean, desc: 'Include 30x redirections'
|
163
177
|
class_option :concurrency, aliases: :c, default: 50, type: :numeric, desc: 'Number of concurrency'
|
164
178
|
class_option :timeout, aliases: :t, default: 10, type: :numeric, desc: 'Timeout in seconds'
|
165
179
|
class_option :output, aliases: :o, default: '', type: :string, desc: 'File to write JSON result'
|
166
180
|
class_option :headers, aliases: :H, default: [], type: :array, desc: 'Custom HTTP headers to send with request'
|
167
181
|
class_option :silent, aliases: :s, default: false, type: :boolean, desc: 'Silent mode'
|
182
|
+
class_option :verbose, aliases: :v, default: false, type: :boolean, desc: 'Verbose mode'
|
168
183
|
|
169
184
|
desc 'pipe', 'Scan the URLs from STDIN. (e.g cat urls.txt | deadfinder pipe)'
|
170
185
|
def pipe
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deadfinder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- hahwul
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -198,14 +198,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
198
198
|
requirements:
|
199
199
|
- - ">="
|
200
200
|
- !ruby/object:Gem::Version
|
201
|
-
version:
|
201
|
+
version: 3.3.0
|
202
202
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
203
203
|
requirements:
|
204
204
|
- - ">="
|
205
205
|
- !ruby/object:Gem::Version
|
206
206
|
version: '0'
|
207
207
|
requirements: []
|
208
|
-
rubygems_version: 3.5.
|
208
|
+
rubygems_version: 3.5.16
|
209
209
|
signing_key:
|
210
210
|
specification_version: 4
|
211
211
|
summary: Find dead-links (broken links)
|