google_safe_browsing 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/lib/google_safe_browsing.rb +4 -4
- data/lib/google_safe_browsing/add_shavar.rb +2 -0
- data/lib/google_safe_browsing/chunk_helper.rb +0 -14
- data/lib/google_safe_browsing/chunk_list.rb +20 -0
- data/lib/google_safe_browsing/response_helper.rb +6 -6
- data/lib/google_safe_browsing/shavar.rb +7 -0
- data/lib/google_safe_browsing/sub_shavar.rb +2 -1
- data/lib/google_safe_browsing/version.rb +1 -1
- metadata +39 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d946ae1600f648b9fc8a7c0768e0b7705e24f223
|
4
|
+
data.tar.gz: c34af8e761bea301d64a65cfa078f1449713d7f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05d832d303bb171aa3c0f4d71e9d23e3263e95ca74b976213f1b4c7e337ce67dfab6d64b860764c7f6fb3c06e99e57fd2b4fbc1f9b36085b40393a661f751d0f
|
7
|
+
data.tar.gz: 8ff8c417be266b6fb170ea84a5044f8295ea9693d692639f46de0c8b0b470095476cdd169fdceb2b4200d47301bdb5da51519d71e3f7781cafa0a4f765dbb379
|
data/README.md
CHANGED
@@ -5,6 +5,8 @@ into Rails 3 apps.
|
|
5
5
|
|
6
6
|
[![Build
|
7
7
|
Status](https://travis-ci.org/mobiledefense/google_safe_browsing.png)](https://travis-ci.org//mobiledefense/google_safe_browsing)
|
8
|
+
[![Code
|
9
|
+
Climate](https://codeclimate.com/github/mobiledefense/google_safe_browsing.png)](https://codeclimate.com/github/mobiledefense/google_safe_browsing)
|
8
10
|
|
9
11
|
It includes:
|
10
12
|
|
@@ -55,7 +57,7 @@ You can run an update manually
|
|
55
57
|
|
56
58
|
$ rake google_safe_browsing:update
|
57
59
|
|
58
|
-
> Note: The full database is not
|
60
|
+
> Note: The full database is not guaranteed to be returned after a single update.
|
59
61
|
In fact, you aren't likely to have the full database even after several
|
60
62
|
updates. You will know that you have the full database when an update does
|
61
63
|
not return any new Add or Sub Shavars.
|
data/lib/google_safe_browsing.rb
CHANGED
@@ -10,6 +10,7 @@ require 'google_safe_browsing/api_v2'
|
|
10
10
|
require 'google_safe_browsing/binary_helper'
|
11
11
|
require 'google_safe_browsing/canonicalize'
|
12
12
|
require 'google_safe_browsing/chunk_helper'
|
13
|
+
require 'google_safe_browsing/chunk_list'
|
13
14
|
require 'google_safe_browsing/hash_helper'
|
14
15
|
require 'google_safe_browsing/http_helper'
|
15
16
|
require 'google_safe_browsing/invalid_mac_validation'
|
@@ -17,6 +18,7 @@ require 'google_safe_browsing/key_helper'
|
|
17
18
|
require 'google_safe_browsing/response_helper'
|
18
19
|
require 'google_safe_browsing/top_level_domain'
|
19
20
|
|
21
|
+
require 'google_safe_browsing/shavar'
|
20
22
|
require 'google_safe_browsing/add_shavar'
|
21
23
|
require 'google_safe_browsing/sub_shavar'
|
22
24
|
require 'google_safe_browsing/full_hash'
|
@@ -24,7 +26,6 @@ require 'google_safe_browsing/full_hash'
|
|
24
26
|
require 'google_safe_browsing/rescheduler'
|
25
27
|
|
26
28
|
module GoogleSafeBrowsing
|
27
|
-
|
28
29
|
# Handles the configuration values for the module
|
29
30
|
class Config
|
30
31
|
attr_accessor :client, :app_ver, :p_ver, :host, :current_lists, :api_key,
|
@@ -35,8 +36,8 @@ module GoogleSafeBrowsing
|
|
35
36
|
@app_ver = VERSION
|
36
37
|
@p_ver = '2.2'
|
37
38
|
@host = 'http://safebrowsing.clients.google.com/safebrowsing'
|
38
|
-
@rekey_host
|
39
|
-
@current_lists = [
|
39
|
+
@rekey_host = 'https://sb-ssl.google.com/safebrowsing'
|
40
|
+
@current_lists = ['googpub-phish-shavar', 'goog-malware-shavar']
|
40
41
|
@mac_required = true
|
41
42
|
end
|
42
43
|
|
@@ -60,7 +61,6 @@ module GoogleSafeBrowsing
|
|
60
61
|
Resque.enqueue(Rescheduler)
|
61
62
|
end
|
62
63
|
|
63
|
-
|
64
64
|
# Converts the official Google list name into the name to return
|
65
65
|
#
|
66
66
|
# @param (String) list the 'official' list name
|
@@ -55,19 +55,5 @@ module GoogleSafeBrowsing
|
|
55
55
|
|
56
56
|
num_strings.join(',')
|
57
57
|
end
|
58
|
-
|
59
|
-
def self.chunklist_to_sql(chunk_list)
|
60
|
-
ret_array = []
|
61
|
-
chunk_list.split(',').each do |s|
|
62
|
-
if s.index('-')
|
63
|
-
range = s.split('-')
|
64
|
-
ret_array << "chunk_number between #{range[0]} and #{range[1]}"
|
65
|
-
else
|
66
|
-
ret_array << "chunk_number = #{s}"
|
67
|
-
end
|
68
|
-
end
|
69
|
-
ret_array.join(" or ")
|
70
|
-
end
|
71
|
-
|
72
58
|
end
|
73
59
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module GoogleSafeBrowsing
|
2
|
+
class ChunkList
|
3
|
+
def initialize(raw_chunks)
|
4
|
+
@raw_chunk_list = raw_chunks
|
5
|
+
end
|
6
|
+
|
7
|
+
def to_a
|
8
|
+
list = []
|
9
|
+
@raw_chunk_list.split(',').each do |item|
|
10
|
+
if item.index('-')
|
11
|
+
range = item.split('-')
|
12
|
+
list += Array(range[0]..range[1])
|
13
|
+
else
|
14
|
+
list << item
|
15
|
+
end
|
16
|
+
end
|
17
|
+
list
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -39,16 +39,16 @@ module GoogleSafeBrowsing
|
|
39
39
|
when 'r'
|
40
40
|
# reset (delete all data and try again)
|
41
41
|
when 'ad'
|
42
|
-
# vals[1] is a CHUNKLIST
|
42
|
+
# vals[1] is a CHUNKLIST representing add chunks to delete
|
43
43
|
# we can also delete the associated Shavar Hashes
|
44
44
|
# we no longer have to report that we received these chunks
|
45
|
-
|
46
|
-
|
45
|
+
AddShavar.delete_chunks_from_list(current_list,
|
46
|
+
ChunkList.new(vals[1]))
|
47
47
|
when 'sd'
|
48
|
-
# vals[1] is a CHUNKLIST
|
48
|
+
# vals[1] is a CHUNKLIST representing sub chunks to delete
|
49
49
|
# we no longer have to report that we received these chunks
|
50
|
-
|
51
|
-
|
50
|
+
SubShavar.delete_chunks_from_list(current_list,
|
51
|
+
ChunkList.new(vals[1]))
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
metadata
CHANGED
@@ -1,111 +1,125 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google_safe_browsing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Marshall
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: ruby-ip
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: activerecord
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: sqlite3
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec-rails
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: generator_spec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: webmock
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: codeclimate-test-reporter
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
109
123
|
- !ruby/object:Gem::Version
|
110
124
|
version: '0'
|
111
125
|
description: Rails 3 plugin using Google's Safe Browsing API for url lookup against
|
@@ -116,13 +130,18 @@ executables: []
|
|
116
130
|
extensions: []
|
117
131
|
extra_rdoc_files: []
|
118
132
|
files:
|
133
|
+
- APACHE-LICENSE
|
134
|
+
- README.md
|
135
|
+
- Rakefile
|
119
136
|
- lib/generators/install_generator.rb
|
120
137
|
- lib/generators/templates/create_google_safe_browsing_tables.rb
|
138
|
+
- lib/google_safe_browsing.rb
|
121
139
|
- lib/google_safe_browsing/add_shavar.rb
|
122
140
|
- lib/google_safe_browsing/api_v2.rb
|
123
141
|
- lib/google_safe_browsing/binary_helper.rb
|
124
142
|
- lib/google_safe_browsing/canonicalize.rb
|
125
143
|
- lib/google_safe_browsing/chunk_helper.rb
|
144
|
+
- lib/google_safe_browsing/chunk_list.rb
|
126
145
|
- lib/google_safe_browsing/effective_tld_names.dat.txt
|
127
146
|
- lib/google_safe_browsing/full_hash.rb
|
128
147
|
- lib/google_safe_browsing/google_safe_browsing_railtie.rb
|
@@ -132,14 +151,11 @@ files:
|
|
132
151
|
- lib/google_safe_browsing/key_helper.rb
|
133
152
|
- lib/google_safe_browsing/rescheduler.rb
|
134
153
|
- lib/google_safe_browsing/response_helper.rb
|
154
|
+
- lib/google_safe_browsing/shavar.rb
|
135
155
|
- lib/google_safe_browsing/sub_shavar.rb
|
136
156
|
- lib/google_safe_browsing/top_level_domain.rb
|
137
157
|
- lib/google_safe_browsing/version.rb
|
138
|
-
- lib/google_safe_browsing.rb
|
139
158
|
- lib/tasks/google_safe_browsing_tasks.rake
|
140
|
-
- APACHE-LICENSE
|
141
|
-
- Rakefile
|
142
|
-
- README.md
|
143
159
|
homepage: https://github.com/mobiledefense/google_safe_browsing
|
144
160
|
licenses: []
|
145
161
|
metadata: {}
|
@@ -149,17 +165,17 @@ require_paths:
|
|
149
165
|
- lib
|
150
166
|
required_ruby_version: !ruby/object:Gem::Requirement
|
151
167
|
requirements:
|
152
|
-
- -
|
168
|
+
- - ">="
|
153
169
|
- !ruby/object:Gem::Version
|
154
170
|
version: '0'
|
155
171
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
172
|
requirements:
|
157
|
-
- -
|
173
|
+
- - ">="
|
158
174
|
- !ruby/object:Gem::Version
|
159
175
|
version: '0'
|
160
176
|
requirements: []
|
161
177
|
rubyforge_project:
|
162
|
-
rubygems_version: 2.
|
178
|
+
rubygems_version: 2.2.2
|
163
179
|
signing_key:
|
164
180
|
specification_version: 4
|
165
181
|
summary: Rails 3 plugin for Google's Safe Browsing API v2
|