simple_whatweb 0.2.0 → 0.2.1

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: 74949bba132a54310d0734e532ea57ea10df193d42748826bb1ec8f0a94ce704
4
- data.tar.gz: dff1cb823b0c7f36e38524eeba7433267d06120f23bd7c64df696d917b93a6a6
3
+ metadata.gz: fa93fc00fb8c3719932816eda5f66233849319c2c97536b74a9fd3590864f3ab
4
+ data.tar.gz: a24e458f6488eeb31b5ca814b14af6662363b807d8f72f57053fe364f8f6aa41
5
5
  SHA512:
6
- metadata.gz: 78c15492948ebae1399a703f0e57072881e0fbf57451f4f8ac79ef350ca2f325108618207724f0eee36db8479a3c91b3effaeab7b4e66b051d7f8e54aad14cf3
7
- data.tar.gz: a3e404817a1d41a34b54972bc534a4ffc86cdb6b4112c6ab23468b1f4410da5fa9e1db26713f05ddcdc64ac5540422530cfb8a4b9bd0a9d5441101fd4e7c4669
6
+ metadata.gz: d42ceb9c118d0081712d4e5551b6899d0ec774af54ed3cf623744dbb59be8321ecdd785b32f3531a0a17ba7e4d0f77daa976bbf3fd1ea958b9bc84750a72d0a9
7
+ data.tar.gz: 98609d498e9a948cf813d80031864f8d346905fecfa3e551497e970b2dff8f7525bb49b24d135baa67b97c3af523fc2b7701d00ab7fd3d7d1c95d721c8df9824
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
32
32
  spec.add_development_dependency "webmock", "~> 3.4"
33
33
 
34
34
  spec.add_dependency "http", "~> 3.3"
35
+ spec.add_dependency "oga", "~> 2.15"
35
36
  spec.add_dependency "require_all", "~> 2.0"
36
- spec.add_dependency "sanitize", "~> 4.6"
37
37
  spec.add_dependency "thor", "~> 0.19"
38
38
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "digest/md5"
4
- require "sanitize"
4
+ require "oga"
5
5
 
6
6
  module WhatWeb
7
7
  module Helper
@@ -10,8 +10,11 @@ module WhatWeb
10
10
  Digest::MD5.hexdigest(body.to_s)
11
11
  end
12
12
 
13
- def sanitized_body
14
- Sanitize.document(body.to_s, elements: ["html"])
13
+ def text
14
+ doc = Oga.parse_html(body.to_s.force_encoding('UTF-8'))
15
+ path = /\A<body(?:\s|>)/i.match?(body.to_s) ? '/html/body' : '/html/body/node()'
16
+ nodes = doc.xpath(path)
17
+ nodes.map(&:text).join
15
18
  end
16
19
 
17
20
  def tag_pattern
@@ -45,10 +45,10 @@ module WhatWeb
45
45
  # does it start with a - ?
46
46
  if w[0] == '-'
47
47
  # reverse true/false if it begins with a -
48
- !target.sanitized_body.match? /#{Regexp.escape(w[1..-1])}/i
48
+ !target.text.match? /#{Regexp.escape(w[1..-1])}/i
49
49
  else
50
50
  w = w[1..-1] if w[0] == '+' # if it starts with +, ignore the 1st char
51
- target.sanitized_body.match? /#{Regexp.escape(w)}/i
51
+ target.text.match? /#{Regexp.escape(w)}/i
52
52
  end
53
53
  end
54
54
  end
@@ -1,4 +1,3 @@
1
- # coding: ascii-8bit
2
1
  # frozen_string_literal: true
3
2
 
4
3
  ##
@@ -1,4 +1,3 @@
1
- # coding: ascii-8bit
2
1
  # frozen_string_literal: true
3
2
 
4
3
  ##
@@ -1,4 +1,3 @@
1
- # coding: ascii-8bit
2
1
  # frozen_string_literal: true
3
2
 
4
3
  ##
@@ -1,4 +1,3 @@
1
- # coding: ascii-8bit
2
1
  # frozen_string_literal: true
3
2
 
4
3
  ##
@@ -1,4 +1,3 @@
1
- # coding: ascii-8bit
2
1
  # frozen_string_literal: true
3
2
 
4
3
  ##
@@ -1,4 +1,3 @@
1
- # coding: ascii-8bit
2
1
  # frozen_string_literal: true
3
2
 
4
3
  ##
@@ -1,4 +1,3 @@
1
- # coding: ascii-8bit
2
1
  # frozen_string_literal: true
3
2
 
4
3
  ##
@@ -1,4 +1,3 @@
1
- # coding: ascii-8bit
2
1
  # frozen_string_literal: true
3
2
 
4
3
  ##
@@ -1,4 +1,3 @@
1
- # coding: ascii-8bit
2
1
  # frozen_string_literal: true
3
2
 
4
3
  ##
@@ -12,7 +12,7 @@
12
12
  # Version 0.2
13
13
  # removed :certainty=>100
14
14
 
15
- require "nokogiri"
15
+ require "oga"
16
16
 
17
17
  WhatWeb::Plugin.define "Title" do
18
18
  @author = "Andrew Horton"
@@ -22,8 +22,8 @@ WhatWeb::Plugin.define "Title" do
22
22
  def passive(target)
23
23
  m = []
24
24
 
25
- html = Nokogiri.parse(target.body)
26
- title = html.css("title")
25
+ html = Oga.parse_html(target.body)
26
+ title = html.at_css("title")
27
27
  if title
28
28
  # Give warining if title element contains newline(s)
29
29
  m << { name: "WARNING", module: "Title element contains newline(s)!" } if title.text.include? "\n"
@@ -40,8 +40,8 @@ module WhatWeb
40
40
  @tag_pattern ||= response.tag_pattern
41
41
  end
42
42
 
43
- def sanitized_body
44
- @sanitized_body ||= response.sanitized_body
43
+ def text
44
+ @text ||= response.text
45
45
  end
46
46
 
47
47
  def self.meta_refresh_regex
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WhatWeb
4
- VERSION = "0.2.0".freeze
4
+ VERSION = "0.2.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_whatweb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manabu Niseki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-08-19 00:00:00.000000000 Z
11
+ date: 2018-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -109,33 +109,33 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '3.3'
111
111
  - !ruby/object:Gem::Dependency
112
- name: require_all
112
+ name: oga
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '2.0'
117
+ version: '2.15'
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '2.0'
124
+ version: '2.15'
125
125
  - !ruby/object:Gem::Dependency
126
- name: sanitize
126
+ name: require_all
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '4.6'
131
+ version: '2.0'
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: '4.6'
138
+ version: '2.0'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: thor
141
141
  requirement: !ruby/object:Gem::Requirement