miteru 0.14.5 → 0.14.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1cf6445b9388cdcfb797cdb8c91615a288757508874d0550bab8c6b052c375d6
4
- data.tar.gz: dd9f428317a0f325c2c467234dda21f05bb7cd616114f49adeec9374a4680451
3
+ metadata.gz: 4e33e427231064c47dd4e1358e71e009ebc9418af15350e1f9c7f833ea02205f
4
+ data.tar.gz: cf3e3f1608a6be63b7b5b93f1e12a8264935da1e059bfbda7437f91a8009bf63
5
5
  SHA512:
6
- metadata.gz: 5f740f27cacdb1020a49bc787aa8486cbe6b6ac6fe5e4ad3093af0601928dcd12c78895c39c548a28de18fc35766dbb89507687c81e2bb162d6e69e111242fbd
7
- data.tar.gz: a110c028b6129a2d0bc903962d1f945be96426b8c909ae6e34bb1955d3ca657b1c9ef5a48bc1e147c54f992517cc86c0ca18047a79cdcb2b2a95bda5c5148caa
6
+ metadata.gz: e26651ad45bfc20c22b6584b3ea6f8419f99801f36e6673835034c4a77da3ea5ec2502273265fae8f89590551c4bd3eb42f33bc66a6fb3b873422b57e5136d40
7
+ data.tar.gz: f582e8422d5d33a97b8f9d3ae7aa58fe1346fc68284b867c0139f7bb908107b3b8eb8081f1bcdc3bbfb678427d318e6eaf269ce1d28647d317ec7dd8ed49a7d8
@@ -1,4 +1,4 @@
1
- FROM ruby:2.6-alpine3.10
1
+ FROM ruby:2.7-alpine3.10
2
2
  RUN apk --no-cache add git build-base ruby-dev \
3
3
  && cd /tmp/ \
4
4
  && git clone https://github.com/ninoseki/miteru.git \
@@ -10,12 +10,23 @@ module Miteru
10
10
 
11
11
  attr_reader :url
12
12
 
13
+ attr_reader :status
14
+ attr_reader :content_length
15
+ attr_reader :mime_type
16
+
13
17
  def initialize(url)
14
18
  @url = url
19
+
20
+ @content_length = nil
21
+ @mime_type = nil
22
+ @status = nil
15
23
  end
16
24
 
17
25
  def valid?;
18
- valid_ext? && reachable_and_valid_mime_type?
26
+ # make a HEAD request for the validation
27
+ before_validation
28
+
29
+ valid_ext? && reachable? && valid_mime_type? && valid_content_length?
19
30
  end
20
31
 
21
32
  def extname
@@ -70,20 +81,25 @@ module Miteru
70
81
  VALID_EXTENSIONS.include? extname
71
82
  end
72
83
 
73
- def reachable?(response)
74
- response.status.success?
84
+ def before_validation
85
+ res = HTTPClient.head(url)
86
+ @content_length = res.content_length
87
+ @mime_type = res.content_type.mime_type.to_s
88
+ @status = res.status
89
+ rescue StandardError
90
+ # do nothing
75
91
  end
76
92
 
77
- def valid_mime_type?(response)
78
- mime_type = response.content_type.mime_type.to_s
93
+ def reachable?
94
+ status&.success?
95
+ end
96
+
97
+ def valid_mime_type?
79
98
  VALID_MIME_TYPES.include? mime_type
80
99
  end
81
100
 
82
- def reachable_and_valid_mime_type?
83
- res = HTTPClient.head(url)
84
- reachable?(res) && valid_mime_type?(res)
85
- rescue StandardError
86
- false
101
+ def valid_content_length?
102
+ content_length.to_i > 0
87
103
  end
88
104
  end
89
105
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Miteru
4
- VERSION = "0.14.5"
4
+ VERSION = "0.14.6"
5
5
  end
@@ -30,14 +30,14 @@ Gem::Specification.new do |spec|
30
30
  spec.add_development_dependency "rake", "~> 13.0"
31
31
  spec.add_development_dependency "rspec", "~> 3.9"
32
32
  spec.add_development_dependency "vcr", "~> 6.0"
33
- spec.add_development_dependency "webmock", "~> 3.8"
33
+ spec.add_development_dependency "webmock", "~> 3.9"
34
34
 
35
35
  spec.add_dependency "colorize", "~> 0.8"
36
- spec.add_dependency "down", "~> 5.1"
36
+ spec.add_dependency "down", "~> 5.2"
37
37
  spec.add_dependency "http", "~> 4.4"
38
- spec.add_dependency "oga", "~> 3.2"
38
+ spec.add_dependency "oga", "~> 3.3"
39
39
  spec.add_dependency "parallel", "~> 1.19"
40
40
  spec.add_dependency "slack-notifier", "~> 2.3"
41
41
  spec.add_dependency "thor", "~> 1.0"
42
- spec.add_dependency "urlscan", "~> 0.5"
42
+ spec.add_dependency "urlscan", "~> 0.6"
43
43
  end
@@ -0,0 +1,5 @@
1
+ {
2
+ "extends": [
3
+ "config:base"
4
+ ]
5
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: miteru
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.5
4
+ version: 0.14.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manabu Niseki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-30 00:00:00.000000000 Z
11
+ date: 2020-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '3.8'
103
+ version: '3.9'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '3.8'
110
+ version: '3.9'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: colorize
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '5.1'
131
+ version: '5.2'
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '5.1'
138
+ version: '5.2'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: http
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -156,14 +156,14 @@ dependencies:
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: '3.2'
159
+ version: '3.3'
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: '3.2'
166
+ version: '3.3'
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: parallel
169
169
  requirement: !ruby/object:Gem::Requirement
@@ -212,14 +212,14 @@ dependencies:
212
212
  requirements:
213
213
  - - "~>"
214
214
  - !ruby/object:Gem::Version
215
- version: '0.5'
215
+ version: '0.6'
216
216
  type: :runtime
217
217
  prerelease: false
218
218
  version_requirements: !ruby/object:Gem::Requirement
219
219
  requirements:
220
220
  - - "~>"
221
221
  - !ruby/object:Gem::Version
222
- version: '0.5'
222
+ version: '0.6'
223
223
  description: An experimental phishing kit detector
224
224
  email:
225
225
  - manabu.niseki@gmail.com
@@ -259,6 +259,7 @@ files:
259
259
  - lib/miteru/version.rb
260
260
  - lib/miteru/website.rb
261
261
  - miteru.gemspec
262
+ - renovate.json
262
263
  - screenshots/slack.png
263
264
  homepage: https://github.com/ninoseki/miteru
264
265
  licenses: