deadfinder 1.4.4 → 1.5.1
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 +17 -10
- data/lib/deadfinder/version.rb +1 -1
- data/lib/deadfinder.rb +26 -2
- metadata +3 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ddb8f1182cbb94fdb1c270ff6d0af2ae176fdb2376a52496fc535c69a1c576c
|
4
|
+
data.tar.gz: 5f49781224441d738fade165e0fae6c851c6739de2959e8c32601ebd9495e16c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5875750e01d1b909390a566b94a4daeeee5e2df3da81528d2c2cf4f831ef92c5e1d46732bbe4425cf5b0ba751136faa9ac7cb0dffeb6beefa0a4fabfa805e2b7
|
7
|
+
data.tar.gz: bc62403a89307870b0166f530928f8ce1c951e131818b3ac55bc6d879e5e8273189dc120ee51740fccb3eaf2f473bc5d9bcfbb3441ae17c1793fe83f9c0de716
|
data/lib/deadfinder/logger.rb
CHANGED
@@ -4,44 +4,51 @@ require 'colorize'
|
|
4
4
|
|
5
5
|
class Logger
|
6
6
|
@silent = false
|
7
|
+
@mutex = Mutex.new
|
7
8
|
|
8
9
|
def self.set_silent
|
9
|
-
@silent = true
|
10
|
+
@mutex.synchronize { @silent = true }
|
10
11
|
end
|
11
12
|
|
12
13
|
def self.unset_silent
|
13
|
-
@silent = false
|
14
|
+
@mutex.synchronize { @silent = false }
|
14
15
|
end
|
15
16
|
|
16
17
|
def self.silent?
|
17
|
-
@silent
|
18
|
+
@mutex.synchronize { @silent }
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.log(prefix, text, color)
|
22
|
+
return if silent?
|
23
|
+
|
24
|
+
puts prefix.colorize(color) + text.to_s.colorize(:"light_#{color}")
|
18
25
|
end
|
19
26
|
|
20
27
|
def self.info(text)
|
21
|
-
|
28
|
+
log('ℹ ', text, :blue)
|
22
29
|
end
|
23
30
|
|
24
31
|
def self.error(text)
|
25
|
-
|
32
|
+
log('⚠︎ ', text, :red)
|
26
33
|
end
|
27
34
|
|
28
35
|
def self.target(text)
|
29
|
-
|
36
|
+
log('► ', text, :green)
|
30
37
|
end
|
31
38
|
|
32
39
|
def self.sub_info(text)
|
33
|
-
|
40
|
+
log(' ● ', text, :blue)
|
34
41
|
end
|
35
42
|
|
36
43
|
def self.sub_done(text)
|
37
|
-
|
44
|
+
log(' ✓ ', text, :blue)
|
38
45
|
end
|
39
46
|
|
40
47
|
def self.found(text)
|
41
|
-
|
48
|
+
log(' ✘ ', text, :red)
|
42
49
|
end
|
43
50
|
|
44
51
|
def self.verbose(text)
|
45
|
-
|
52
|
+
log(' ➜ ', text, :yellow)
|
46
53
|
end
|
47
54
|
end
|
data/lib/deadfinder/version.rb
CHANGED
data/lib/deadfinder.rb
CHANGED
@@ -23,6 +23,7 @@ class DeadFinderRunner
|
|
23
23
|
'timeout' => 10,
|
24
24
|
'output' => '',
|
25
25
|
'headers' => [],
|
26
|
+
'worker_headers' => [],
|
26
27
|
'silent' => true,
|
27
28
|
'verbose' => false,
|
28
29
|
'include30x' => false
|
@@ -81,11 +82,29 @@ class DeadFinderRunner
|
|
81
82
|
uri = URI.parse(j)
|
82
83
|
|
83
84
|
# Create HTTP request with timeout and headers
|
84
|
-
|
85
|
+
proxy_uri = URI.parse(options['proxy']) if options['proxy'] && !options['proxy'].empty?
|
86
|
+
http = if proxy_uri
|
87
|
+
Net::HTTP.new(uri.host, uri.port, proxy_uri.host, proxy_uri.port, proxy_uri.user, proxy_uri.password)
|
88
|
+
else
|
89
|
+
Net::HTTP.new(uri.host, uri.port)
|
90
|
+
end
|
85
91
|
http.use_ssl = (uri.scheme == 'https')
|
86
92
|
http.read_timeout = options['timeout'].to_i if options['timeout']
|
87
93
|
|
94
|
+
# Set SSL verification mode
|
95
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE if http.use_ssl?
|
96
|
+
|
88
97
|
request = Net::HTTP::Get.new(uri.request_uri)
|
98
|
+
|
99
|
+
# Add User-Agent header
|
100
|
+
request['User-Agent'] = options['user_agent']
|
101
|
+
|
102
|
+
# Add worker headers if provided
|
103
|
+
options['worker_headers']&.each do |header|
|
104
|
+
key, value = header.split(':', 2)
|
105
|
+
request[key.strip] = value.strip
|
106
|
+
end
|
107
|
+
|
89
108
|
response = http.request(request)
|
90
109
|
status_code = response.code.to_i
|
91
110
|
Logger.verbose "Status Code: #{status_code} for #{j}" if options['verbose']
|
@@ -178,7 +197,12 @@ class DeadFinder < Thor
|
|
178
197
|
class_option :concurrency, aliases: :c, default: 50, type: :numeric, desc: 'Number of concurrency'
|
179
198
|
class_option :timeout, aliases: :t, default: 10, type: :numeric, desc: 'Timeout in seconds'
|
180
199
|
class_option :output, aliases: :o, default: '', type: :string, desc: 'File to write JSON result'
|
181
|
-
class_option :headers, aliases: :H, default: [], type: :array,
|
200
|
+
class_option :headers, aliases: :H, default: [], type: :array,
|
201
|
+
desc: 'Custom HTTP headers to send with initial request'
|
202
|
+
class_option :worker_headers, default: [], type: :array, desc: 'Custom HTTP headers to send with worker requests'
|
203
|
+
class_option :user_agent, default: 'Mozilla/5.0 (compatible; DeadFinder/1.5.1;)', type: :string,
|
204
|
+
desc: 'User-Agent string to use for requests'
|
205
|
+
class_option :proxy, aliases: :p, default: '', type: :string, desc: 'Proxy server to use for requests'
|
182
206
|
class_option :silent, aliases: :s, default: false, type: :boolean, desc: 'Silent mode'
|
183
207
|
class_option :verbose, aliases: :v, default: false, type: :boolean, desc: 'Verbose mode'
|
184
208
|
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deadfinder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- hahwul
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date: 2024-
|
10
|
+
date: 2024-12-26 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: colorize
|
@@ -190,7 +189,6 @@ licenses:
|
|
190
189
|
metadata:
|
191
190
|
rubygems_mfa_required: 'true'
|
192
191
|
source_code_uri: https://github.com/hahwul/deadfinder
|
193
|
-
post_install_message:
|
194
192
|
rdoc_options: []
|
195
193
|
require_paths:
|
196
194
|
- lib
|
@@ -205,8 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
205
203
|
- !ruby/object:Gem::Version
|
206
204
|
version: '0'
|
207
205
|
requirements: []
|
208
|
-
rubygems_version: 3.
|
209
|
-
signing_key:
|
206
|
+
rubygems_version: 3.6.2
|
210
207
|
specification_version: 4
|
211
208
|
summary: Find dead-links (broken links)
|
212
209
|
test_files: []
|