legitbot 1.6.1 → 1.7.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/.github/workflows/autocorrect.yml +2 -2
- data/.github/workflows/build.yml +4 -4
- data/README.md +1 -0
- data/legitbot.gemspec +2 -3
- data/lib/legitbot/version.rb +1 -1
- data/lib/legitbot/you.rb +12 -0
- data/lib/legitbot.rb +2 -1
- data/test/you_test.rb +36 -0
- metadata +13 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a835b0a1636ec6a95b61ac14b299f480f48b251678bdfd3228769ba1f36d4160
|
4
|
+
data.tar.gz: 8d548e2d5584d4239f9d1f758a09fdf40f7d825cc31b74add702cea52438e4a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4bca3fd8614ff5bd73d733573dbf0ff23ab233682e2e7eb054638eb963b3d68ced441f0ed8faac418f6af125011da07b8ba767ed5819fcbcc571ae1c6253ab51
|
7
|
+
data.tar.gz: d3ef89deb8d0fd22915bbb503665ed7f805bbfa2bc61396f04792d5321b478a8eca79b5df4c9ec39a8bb6deec608711cec32f279fa155544f072e8d4e921c1a3
|
@@ -13,13 +13,13 @@ jobs:
|
|
13
13
|
ruby: [ 3.0 ]
|
14
14
|
|
15
15
|
steps:
|
16
|
-
- uses: actions/checkout@
|
16
|
+
- uses: actions/checkout@v3
|
17
17
|
- name: Set up Ruby
|
18
18
|
uses: ruby/setup-ruby@v1
|
19
19
|
with:
|
20
20
|
ruby-version: ${{ matrix.ruby }}
|
21
21
|
- name: Cache dependencies
|
22
|
-
uses: actions/cache@
|
22
|
+
uses: actions/cache@v3
|
23
23
|
with:
|
24
24
|
path: vendor/bundle
|
25
25
|
key: ${{ runner.os }}-${{ matrix.ruby }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
data/.github/workflows/build.yml
CHANGED
@@ -14,13 +14,13 @@ jobs:
|
|
14
14
|
ruby: [ jruby, 2.6, 2.7, 3.0 ]
|
15
15
|
|
16
16
|
steps:
|
17
|
-
- uses: actions/checkout@
|
17
|
+
- uses: actions/checkout@v3
|
18
18
|
- name: Set up Ruby
|
19
19
|
uses: ruby/setup-ruby@v1
|
20
20
|
with:
|
21
21
|
ruby-version: ${{ matrix.ruby }}
|
22
22
|
- name: Cache dependencies
|
23
|
-
uses: actions/cache@
|
23
|
+
uses: actions/cache@v3
|
24
24
|
with:
|
25
25
|
path: vendor/bundle
|
26
26
|
key: ${{ runner.os }}-${{ matrix.ruby }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
@@ -42,13 +42,13 @@ jobs:
|
|
42
42
|
ruby: [ 3.0 ]
|
43
43
|
|
44
44
|
steps:
|
45
|
-
- uses: actions/checkout@
|
45
|
+
- uses: actions/checkout@v3
|
46
46
|
- name: Set up Ruby
|
47
47
|
uses: ruby/setup-ruby@v1
|
48
48
|
with:
|
49
49
|
ruby-version: ${{ matrix.ruby }}
|
50
50
|
- name: Cache dependencies
|
51
|
-
uses: actions/cache@
|
51
|
+
uses: actions/cache@v3
|
52
52
|
with:
|
53
53
|
path: vendor/bundle
|
54
54
|
key: ${{ runner.os }}-${{ matrix.ruby }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
data/README.md
CHANGED
@@ -62,6 +62,7 @@ end
|
|
62
62
|
* [Pinterest](https://help.pinterest.com/en/articles/about-pinterest-crawler-0)
|
63
63
|
* [Twitterbot](https://developer.twitter.com/en/docs/tweets/optimize-with-cards/guides/getting-started), the list of IPs is in the [Troubleshooting page](https://developer.twitter.com/en/docs/tweets/optimize-with-cards/guides/troubleshooting-cards)
|
64
64
|
* [Yandex robots](https://yandex.com/support/webmaster/robot-workings/check-yandex-robots.xml)
|
65
|
+
* [You.com](https://about.you.com/youbot/)
|
65
66
|
|
66
67
|
## License
|
67
68
|
|
data/legitbot.gemspec
CHANGED
@@ -28,10 +28,9 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_development_dependency 'minitest-hooks', '~> 1.5', '>= 1.5.0'
|
29
29
|
spec.add_development_dependency 'nokogiri', '~> 1.13.0', '>= 1.13.0'
|
30
30
|
spec.add_development_dependency 'rake', '~> 13.0', '>= 13.0.0'
|
31
|
-
spec.add_development_dependency 'rubocop', '~> 1.
|
32
|
-
spec.add_development_dependency 'rubocop-minitest', '~> 0.
|
31
|
+
spec.add_development_dependency 'rubocop', '~> 1.31.0', '>= 1.31.0'
|
32
|
+
spec.add_development_dependency 'rubocop-minitest', '~> 0.20.0', '>= 0.20.0'
|
33
33
|
|
34
34
|
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
35
35
|
spec.rdoc_options = ['--charset=UTF-8']
|
36
|
-
spec.test_files = Dir.glob('test/**/*').reject { |f| f.start_with? 'test/lib' }
|
37
36
|
end
|
data/lib/legitbot/version.rb
CHANGED
data/lib/legitbot/you.rb
ADDED
data/lib/legitbot.rb
CHANGED
@@ -13,7 +13,8 @@ require_relative 'legitbot/duckduckgo'
|
|
13
13
|
require_relative 'legitbot/facebook'
|
14
14
|
require_relative 'legitbot/google'
|
15
15
|
require_relative 'legitbot/oracle'
|
16
|
+
require_relative 'legitbot/petalbot'
|
16
17
|
require_relative 'legitbot/pinterest'
|
17
18
|
require_relative 'legitbot/twitter'
|
18
19
|
require_relative 'legitbot/yandex'
|
19
|
-
require_relative 'legitbot/
|
20
|
+
require_relative 'legitbot/you'
|
data/test/you_test.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'minitest/autorun'
|
4
|
+
require 'legitbot'
|
5
|
+
|
6
|
+
class YouTest < Minitest::Test
|
7
|
+
def test_malicious_ip
|
8
|
+
ip = '20.59.41.22'
|
9
|
+
match = Legitbot::You.new ip
|
10
|
+
refute_predicate match, :valid?
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_valid_ip
|
14
|
+
ip = '20.59.40.22'
|
15
|
+
match = Legitbot::You.new ip
|
16
|
+
assert_predicate match, :valid?
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_malicious_ua
|
20
|
+
bot = Legitbot.bot(
|
21
|
+
'Mozilla/5.0 (compatible; YouBot/1.0; +https://about.you.com/youbot/)',
|
22
|
+
'20.59.41.22'
|
23
|
+
)
|
24
|
+
assert bot
|
25
|
+
refute_predicate bot, :valid?
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_valid_ua
|
29
|
+
bot = Legitbot.bot(
|
30
|
+
'Mozilla/5.0 (compatible; YouBot/1.0; +https://about.you.com/youbot/)',
|
31
|
+
'20.59.40.22'
|
32
|
+
)
|
33
|
+
assert bot
|
34
|
+
assert_predicate bot, :valid?
|
35
|
+
end
|
36
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: legitbot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Azarov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fast_interval_tree
|
@@ -176,40 +176,40 @@ dependencies:
|
|
176
176
|
requirements:
|
177
177
|
- - "~>"
|
178
178
|
- !ruby/object:Gem::Version
|
179
|
-
version: 1.
|
179
|
+
version: 1.31.0
|
180
180
|
- - ">="
|
181
181
|
- !ruby/object:Gem::Version
|
182
|
-
version: 1.
|
182
|
+
version: 1.31.0
|
183
183
|
type: :development
|
184
184
|
prerelease: false
|
185
185
|
version_requirements: !ruby/object:Gem::Requirement
|
186
186
|
requirements:
|
187
187
|
- - "~>"
|
188
188
|
- !ruby/object:Gem::Version
|
189
|
-
version: 1.
|
189
|
+
version: 1.31.0
|
190
190
|
- - ">="
|
191
191
|
- !ruby/object:Gem::Version
|
192
|
-
version: 1.
|
192
|
+
version: 1.31.0
|
193
193
|
- !ruby/object:Gem::Dependency
|
194
194
|
name: rubocop-minitest
|
195
195
|
requirement: !ruby/object:Gem::Requirement
|
196
196
|
requirements:
|
197
197
|
- - "~>"
|
198
198
|
- !ruby/object:Gem::Version
|
199
|
-
version: 0.
|
199
|
+
version: 0.20.0
|
200
200
|
- - ">="
|
201
201
|
- !ruby/object:Gem::Version
|
202
|
-
version: 0.
|
202
|
+
version: 0.20.0
|
203
203
|
type: :development
|
204
204
|
prerelease: false
|
205
205
|
version_requirements: !ruby/object:Gem::Requirement
|
206
206
|
requirements:
|
207
207
|
- - "~>"
|
208
208
|
- !ruby/object:Gem::Version
|
209
|
-
version: 0.
|
209
|
+
version: 0.20.0
|
210
210
|
- - ">="
|
211
211
|
- !ruby/object:Gem::Version
|
212
|
-
version: 0.
|
212
|
+
version: 0.20.0
|
213
213
|
description: Does Web request come from a real search engine or from an impersonating
|
214
214
|
agent?
|
215
215
|
email: self@alaz.me
|
@@ -249,6 +249,7 @@ files:
|
|
249
249
|
- lib/legitbot/validators/ip_ranges.rb
|
250
250
|
- lib/legitbot/version.rb
|
251
251
|
- lib/legitbot/yandex.rb
|
252
|
+
- lib/legitbot/you.rb
|
252
253
|
- lib/rubocop/cop/custom.rb
|
253
254
|
- lib/rubocop/cop/custom/ip_ranges.rb
|
254
255
|
- rakelib/bump.rake
|
@@ -270,6 +271,7 @@ files:
|
|
270
271
|
- test/petalbot_test.rb
|
271
272
|
- test/pinterest_test.rb
|
272
273
|
- test/twitter_test.rb
|
274
|
+
- test/you_test.rb
|
273
275
|
homepage: https://github.com/alaz/legitbot
|
274
276
|
licenses:
|
275
277
|
- Apache-2.0
|
@@ -295,18 +297,4 @@ rubygems_version: 3.2.32
|
|
295
297
|
signing_key:
|
296
298
|
specification_version: 4
|
297
299
|
summary: 'Validate requests from Web crawlers: impersonating or not?'
|
298
|
-
test_files:
|
299
|
-
- test/ahrefs_test.rb
|
300
|
-
- test/alexa_test.rb
|
301
|
-
- test/amazon_test.rb
|
302
|
-
- test/apple_test.rb
|
303
|
-
- test/botmatch_test.rb
|
304
|
-
- test/facebook_test.rb
|
305
|
-
- test/google_test.rb
|
306
|
-
- test/legitbot/validators/domains_test.rb
|
307
|
-
- test/legitbot/validators/ip_ranges_test.rb
|
308
|
-
- test/legitbot_test.rb
|
309
|
-
- test/oracle_test.rb
|
310
|
-
- test/petalbot_test.rb
|
311
|
-
- test/pinterest_test.rb
|
312
|
-
- test/twitter_test.rb
|
300
|
+
test_files: []
|