sniffles 0.1.1 → 0.1.2
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.
- data/.gitignore +1 -0
- data/README.md +53 -2
- data/lib/sniffles/sniffers/advertising/admeld.rb +24 -0
- data/lib/sniffles/sniffers/advertising/adsense.rb +30 -0
- data/lib/sniffles/sniffers/advertising/buysellads.rb +24 -0
- data/lib/sniffles/sniffers/advertising/casale.rb +24 -0
- data/lib/sniffles/sniffers/analytics/chartbeat.rb +24 -0
- data/lib/sniffles/sniffers/analytics/clicky.rb +24 -0
- data/lib/sniffles/sniffers/analytics/google_analytics.rb +4 -3
- data/lib/sniffles/sniffers/analytics/kissmetrics.rb +24 -0
- data/lib/sniffles/sniffers/analytics/mixpanel.rb +2 -2
- data/lib/sniffles/sniffers/analytics/quantcast.rb +2 -2
- data/lib/sniffles/sniffers/cms/blogger.rb +28 -0
- data/lib/sniffles/sniffers/cms/cscart.rb +24 -0
- data/lib/sniffles/sniffers/cms/movabletype.rb +28 -0
- data/lib/sniffles/sniffers/cms/oscommerce.rb +24 -0
- data/lib/sniffles/sniffers/cms/phpbb.rb +27 -0
- data/lib/sniffles/sniffers/cms/posterous.rb +28 -0
- data/lib/sniffles/sniffers/cms/tumblr.rb +24 -0
- data/lib/sniffles/sniffers/cms/vanilla.rb +24 -0
- data/lib/sniffles/sniffers/cms/vbulletin.rb +39 -0
- data/lib/sniffles/sniffers/cms/wordpress.rb +7 -6
- data/lib/sniffles/sniffers/cms/xenforo.rb +28 -0
- data/lib/sniffles/sniffers/cms/zencart.rb +28 -0
- data/lib/sniffles/sniffers/javascript/jquery.rb +2 -2
- data/lib/sniffles/version.rb +1 -1
- data/lib/sniffles.rb +1 -1
- data/spec/cassettes/beenverified_com.yml +798 -0
- data/spec/cassettes/blog_posterous_com.yml +5015 -0
- data/spec/cassettes/demo_cs-cart_com.yml +1167 -0
- data/spec/cassettes/demo_oscommerce_com.yml +422 -0
- data/spec/cassettes/forum-software_org_vanilla.yml +223 -0
- data/spec/cassettes/foursquare_com.yml +363 -0
- data/spec/cassettes/google_blogspot_com.yml +1073 -0
- data/spec/cassettes/guistyles_com.yml +1306 -0
- data/spec/cassettes/humemes_com.yml +2 -2
- data/spec/cassettes/movabletype_com_blog.yml +1234 -0
- data/spec/cassettes/orangecrushbeads_com.yml +751 -0
- data/spec/cassettes/pearsonified_com.yml +11 -11
- data/spec/cassettes/phpbb_com.yml +466 -0
- data/spec/cassettes/squidoo_com.yml +466 -458
- data/spec/cassettes/staff_tumblr_com.yml +1673 -0
- data/spec/cassettes/topix_com.yml +1431 -0
- data/spec/cassettes/vbulletin_com.yml +2983 -0
- data/spec/cassettes/wordpress_com.yml +879 -0
- data/spec/cassettes/wundergroud_com.yml +907 -0
- data/spec/cassettes/xenforo_com.yml +1947 -0
- data/spec/sniffles/sniffers/advertising/admeld_spec.rb +17 -0
- data/spec/sniffles/sniffers/advertising/adsense_spec.rb +19 -0
- data/spec/sniffles/sniffers/advertising/buysellads_spec.rb +18 -0
- data/spec/sniffles/sniffers/advertising/casale_spec.rb +18 -0
- data/spec/sniffles/sniffers/analytics/chartbeat_spec.rb +17 -0
- data/spec/sniffles/sniffers/analytics/clicky_spec.rb +17 -0
- data/spec/sniffles/sniffers/analytics/google_analytics_spec.rb +11 -31
- data/spec/sniffles/sniffers/analytics/kissmetrics_spec.rb +17 -0
- data/spec/sniffles/sniffers/analytics/mixpanel_spec.rb +8 -13
- data/spec/sniffles/sniffers/analytics/quantcast_spec.rb +7 -12
- data/spec/sniffles/sniffers/cms/blogger_spec.rb +18 -0
- data/spec/sniffles/sniffers/cms/cscart_spec.rb +18 -0
- data/spec/sniffles/sniffers/cms/movabletype_spec.rb +18 -0
- data/spec/sniffles/sniffers/cms/oscommerce_spec.rb +18 -0
- data/spec/sniffles/sniffers/cms/phpbb_spec.rb +18 -0
- data/spec/sniffles/sniffers/cms/posterous_spec.rb +18 -0
- data/spec/sniffles/sniffers/cms/tumblr_spec.rb +18 -0
- data/spec/sniffles/sniffers/cms/vanilla_spec.rb +18 -0
- data/spec/sniffles/sniffers/cms/vbulletin_spec.rb +21 -0
- data/spec/sniffles/sniffers/cms/wordpress_spec.rb +17 -48
- data/spec/sniffles/sniffers/cms/xenforo_spec.rb +18 -0
- data/spec/sniffles/sniffers/cms/zencart_spec.rb +18 -0
- data/spec/sniffles/sniffers/javascript/jquery_spec.rb +8 -15
- data/spec/sniffles/sniffers_spec.rb +8 -19
- data/spec/sniffles_spec.rb +14 -41
- data/spec/spec_helper.rb +1 -10
- data/spec/support/helpers.rb +12 -0
- metadata +106 -14
- data/Gemfile.lock +0 -44
- data/spec/cassettes/google_com.yml +0 -784
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -17,5 +17,56 @@ Bundler:
|
|
17
17
|
require 'sniffles'
|
18
18
|
require 'typhoeus' # Optional: Use your favorite HTTP client.
|
19
19
|
|
20
|
-
response = Typhoeus::Request.get("http://www.
|
21
|
-
|
20
|
+
response = Typhoeus::Request.get("http://www.squidoo.com/")
|
21
|
+
|
22
|
+
You can pass in a single sniffer:
|
23
|
+
|
24
|
+
Sniffles.sniff(response.body, :google_analytics)
|
25
|
+
# => { :google_analytics=> { :found=>true, :ua=>"UA-185209-2" } }
|
26
|
+
|
27
|
+
Or multiple sniffers:
|
28
|
+
|
29
|
+
Sniffles.sniff(response.body, :google_analytics, :kissmetrics)
|
30
|
+
# => {:google_analytics=>{:found=>true, :ua=>"UA-185209-2"}, :kissmetrics=>{:found=>false}}
|
31
|
+
|
32
|
+
Or an entire group of sniffers:
|
33
|
+
|
34
|
+
Sniffles.sniff(response.body, :analytics)
|
35
|
+
# => {:chartbeat=>{:found=>false},
|
36
|
+
# :clicky=>{:found=>false},
|
37
|
+
# :google_analytics=>{:found=>true, :ua=>"UA-185209-2"},
|
38
|
+
# :kissmetrics=>{:found=>false},
|
39
|
+
# :mixpanel=>{:found=>true},
|
40
|
+
# :quantcast=>{:found=>true}}
|
41
|
+
|
42
|
+
## Sniffers (v0.1.2)
|
43
|
+
### Advertising
|
44
|
+
* AdMeld
|
45
|
+
* AdSense
|
46
|
+
* BuySellAds
|
47
|
+
* Casale
|
48
|
+
|
49
|
+
### Analytics
|
50
|
+
* ChartBeat
|
51
|
+
* Clicky
|
52
|
+
* Google Analytics
|
53
|
+
* KISSMetrics
|
54
|
+
* MixPanel
|
55
|
+
* Quantcast
|
56
|
+
|
57
|
+
### CMS
|
58
|
+
* Blogger
|
59
|
+
* CS-Cart
|
60
|
+
* MovableType
|
61
|
+
* osCommerce
|
62
|
+
* phpBB
|
63
|
+
* Posterous
|
64
|
+
* Tumblr
|
65
|
+
* Vanilla
|
66
|
+
* vBulletin
|
67
|
+
* WordPress
|
68
|
+
* XenForo
|
69
|
+
* ZenCart
|
70
|
+
|
71
|
+
### Javascript
|
72
|
+
* jQuery
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Sniffles
|
2
|
+
module Sniffers
|
3
|
+
class Admeld
|
4
|
+
include Text
|
5
|
+
|
6
|
+
attr_accessor :doc
|
7
|
+
attr_reader :output
|
8
|
+
|
9
|
+
def initialize(response_body)
|
10
|
+
@output = {}
|
11
|
+
parse(response_body) && process_document
|
12
|
+
end
|
13
|
+
|
14
|
+
def process_document
|
15
|
+
@output[:found] = found?
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
def found?
|
20
|
+
match? /js\.admeld\.com/
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Sniffles
|
2
|
+
module Sniffers
|
3
|
+
class Adsense
|
4
|
+
include Text
|
5
|
+
|
6
|
+
attr_accessor :doc
|
7
|
+
attr_reader :output
|
8
|
+
|
9
|
+
def initialize(response_body)
|
10
|
+
@output = {}
|
11
|
+
parse(response_body) && process_document
|
12
|
+
end
|
13
|
+
|
14
|
+
def process_document
|
15
|
+
if @output[:found] = found?
|
16
|
+
parse_publisher_id
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
def found?
|
22
|
+
match? /googleAddAdSenseService/
|
23
|
+
end
|
24
|
+
|
25
|
+
def parse_publisher_id
|
26
|
+
@output[:publisher_id] = capture(/googleAddAdSenseService\(["|']+([a-z]+\-pub\-[\d]+)["|']+\)/)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Sniffles
|
2
|
+
module Sniffers
|
3
|
+
class Buysellads
|
4
|
+
include Text
|
5
|
+
|
6
|
+
attr_accessor :doc
|
7
|
+
attr_reader :output
|
8
|
+
|
9
|
+
def initialize(response_body)
|
10
|
+
@output = {}
|
11
|
+
parse(response_body) && process_document
|
12
|
+
end
|
13
|
+
|
14
|
+
def process_document
|
15
|
+
@output[:found] = found?
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
def found?
|
20
|
+
match? /s3\.buysellads\.com/
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Sniffles
|
2
|
+
module Sniffers
|
3
|
+
class Casale
|
4
|
+
include Text
|
5
|
+
|
6
|
+
attr_accessor :doc
|
7
|
+
attr_reader :output
|
8
|
+
|
9
|
+
def initialize(response_body)
|
10
|
+
@output = {}
|
11
|
+
parse(response_body) && process_document
|
12
|
+
end
|
13
|
+
|
14
|
+
def process_document
|
15
|
+
@output[:found] = found?
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
def found?
|
20
|
+
match? /as\.casalemedia\.com/
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Sniffles
|
2
|
+
module Sniffers
|
3
|
+
class Chartbeat
|
4
|
+
include Text
|
5
|
+
|
6
|
+
attr_accessor :doc
|
7
|
+
attr_reader :output
|
8
|
+
|
9
|
+
def initialize(response_body)
|
10
|
+
@output = {}
|
11
|
+
parse(response_body) && process_document
|
12
|
+
end
|
13
|
+
|
14
|
+
def process_document
|
15
|
+
@output[:found] = found?
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
def found?
|
20
|
+
match? /static\.chartbeat\.com\/js\/chartbeat\.js/
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Sniffles
|
2
|
+
module Sniffers
|
3
|
+
class Clicky
|
4
|
+
include Text
|
5
|
+
|
6
|
+
attr_accessor :doc
|
7
|
+
attr_reader :output
|
8
|
+
|
9
|
+
def initialize(response_body)
|
10
|
+
@output = {}
|
11
|
+
parse(response_body) && process_document
|
12
|
+
end
|
13
|
+
|
14
|
+
def process_document
|
15
|
+
@output[:found] = found?
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
def found?
|
20
|
+
match? /static\.getclicky\.com/
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -12,12 +12,13 @@ module Sniffles
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def process_document
|
15
|
-
@output[:found] =
|
16
|
-
|
15
|
+
if @output[:found] = found?
|
16
|
+
parse_google_analytics_ua
|
17
|
+
end
|
17
18
|
end
|
18
19
|
|
19
20
|
private
|
20
|
-
def
|
21
|
+
def found?
|
21
22
|
match?(/\.google\-analytics\.com|urchinTracker/i)
|
22
23
|
end
|
23
24
|
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Sniffles
|
2
|
+
module Sniffers
|
3
|
+
class Kissmetrics
|
4
|
+
include Text
|
5
|
+
|
6
|
+
attr_accessor :doc
|
7
|
+
attr_reader :output
|
8
|
+
|
9
|
+
def initialize(response_body)
|
10
|
+
@output = {}
|
11
|
+
parse(response_body) && process_document
|
12
|
+
end
|
13
|
+
|
14
|
+
def process_document
|
15
|
+
@output[:found] = found?
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
def found?
|
20
|
+
match? /i\.kissmetrics\.com/
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Sniffles
|
2
|
+
module Sniffers
|
3
|
+
class Blogger
|
4
|
+
include HTML
|
5
|
+
|
6
|
+
attr_accessor :doc
|
7
|
+
attr_reader :output
|
8
|
+
|
9
|
+
def initialize(response_body)
|
10
|
+
@output = {}
|
11
|
+
parse(response_body) && process_document
|
12
|
+
end
|
13
|
+
|
14
|
+
def process_document
|
15
|
+
@output[:found] = found?
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
def found?
|
20
|
+
meta_generator_content == "blogger"
|
21
|
+
end
|
22
|
+
|
23
|
+
def meta_generator_content
|
24
|
+
text_at("//meta[@name='generator']/@content")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Sniffles
|
2
|
+
module Sniffers
|
3
|
+
class Cscart
|
4
|
+
include HTML
|
5
|
+
|
6
|
+
attr_accessor :doc
|
7
|
+
attr_reader :output
|
8
|
+
|
9
|
+
def initialize(response_body)
|
10
|
+
@output = {}
|
11
|
+
parse(response_body) && process_document
|
12
|
+
end
|
13
|
+
|
14
|
+
def process_document
|
15
|
+
@output[:found] = found?
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
def found?
|
20
|
+
!!(@doc.text =~ /Powered by CS\-Cart/)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Sniffles
|
2
|
+
module Sniffers
|
3
|
+
class Movabletype
|
4
|
+
include HTML
|
5
|
+
|
6
|
+
attr_accessor :doc
|
7
|
+
attr_reader :output
|
8
|
+
|
9
|
+
def initialize(response_body)
|
10
|
+
@output = {}
|
11
|
+
parse(response_body) && process_document
|
12
|
+
end
|
13
|
+
|
14
|
+
def process_document
|
15
|
+
@output[:found] = found?
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
def found?
|
20
|
+
!!(meta_generator_content =~ /Movable Type/)
|
21
|
+
end
|
22
|
+
|
23
|
+
def meta_generator_content
|
24
|
+
text_at("//meta[@name='generator']/@content")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Sniffles
|
2
|
+
module Sniffers
|
3
|
+
class Oscommerce
|
4
|
+
include HTML
|
5
|
+
|
6
|
+
attr_accessor :doc
|
7
|
+
attr_reader :output
|
8
|
+
|
9
|
+
def initialize(response_body)
|
10
|
+
@output = {}
|
11
|
+
parse(response_body) && process_document
|
12
|
+
end
|
13
|
+
|
14
|
+
def process_document
|
15
|
+
@output[:found] = found?
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
def found?
|
20
|
+
!!(@doc.text =~ /Powered by osCommerce/)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Sniffles
|
2
|
+
module Sniffers
|
3
|
+
class Phpbb
|
4
|
+
include HTML
|
5
|
+
attr_accessor :doc
|
6
|
+
attr_reader :output
|
7
|
+
|
8
|
+
def initialize(response_body)
|
9
|
+
@output = {}
|
10
|
+
parse(response_body) && process_document
|
11
|
+
end
|
12
|
+
|
13
|
+
def process_document
|
14
|
+
@output[:found] = found?
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
def found?
|
19
|
+
@doc.text.include?("Powered by phpBB") && phpbb_meta?
|
20
|
+
end
|
21
|
+
|
22
|
+
def phpbb_meta?
|
23
|
+
!@doc.xpath("//meta[@name='resource-type']").empty? && !@doc.xpath("//meta[@name='distribution']").empty?
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Sniffles
|
2
|
+
module Sniffers
|
3
|
+
class Posterous
|
4
|
+
include HTML
|
5
|
+
|
6
|
+
attr_accessor :doc
|
7
|
+
attr_reader :output
|
8
|
+
|
9
|
+
def initialize(response_body)
|
10
|
+
@output = {}
|
11
|
+
parse(response_body) && process_document
|
12
|
+
end
|
13
|
+
|
14
|
+
def process_document
|
15
|
+
@output[:found] = found?
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
def found?
|
20
|
+
meta_generator_content == "Posterous"
|
21
|
+
end
|
22
|
+
|
23
|
+
def meta_generator_content
|
24
|
+
text_at("//meta[@name='generator']/@content")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Sniffles
|
2
|
+
module Sniffers
|
3
|
+
class Tumblr
|
4
|
+
include Text
|
5
|
+
|
6
|
+
attr_accessor :doc
|
7
|
+
attr_reader :output
|
8
|
+
|
9
|
+
def initialize(response_body)
|
10
|
+
@output = {}
|
11
|
+
parse(response_body) && process_document
|
12
|
+
end
|
13
|
+
|
14
|
+
def process_document
|
15
|
+
@output[:found] = found?
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
def found?
|
20
|
+
match?(/assets\.tumblr\.com\/iframe/) && match?(/<!-- BEGIN TUMBLR CODE -->/)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Sniffles
|
2
|
+
module Sniffers
|
3
|
+
class Vanilla
|
4
|
+
include Text
|
5
|
+
|
6
|
+
attr_accessor :doc
|
7
|
+
attr_reader :output
|
8
|
+
|
9
|
+
def initialize(response_body)
|
10
|
+
@output = {}
|
11
|
+
parse(response_body) && process_document
|
12
|
+
end
|
13
|
+
|
14
|
+
def process_document
|
15
|
+
@output[:found] = found?
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
def found?
|
20
|
+
match? /Powered by Vanilla/
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Sniffles
|
2
|
+
module Sniffers
|
3
|
+
class Vbulletin
|
4
|
+
include HTML
|
5
|
+
|
6
|
+
attr_accessor :doc
|
7
|
+
attr_reader :output
|
8
|
+
|
9
|
+
def initialize(response_body)
|
10
|
+
@output = {}
|
11
|
+
parse(response_body) && process_document
|
12
|
+
end
|
13
|
+
|
14
|
+
def process_document
|
15
|
+
if @output[:found] = found?
|
16
|
+
parse_version
|
17
|
+
parse_feed
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
def found?
|
23
|
+
!!(meta_generator_content =~ /vBulletin/)
|
24
|
+
end
|
25
|
+
|
26
|
+
def parse_feed
|
27
|
+
@output[:feed] = text_at("//link[@type='application/rss+xml']/@href")
|
28
|
+
end
|
29
|
+
|
30
|
+
def parse_version
|
31
|
+
@output[:version] = (meta_generator_content.match(/([\d]+\.[\d]+\.[\d]+)/) ? $1 : false)
|
32
|
+
end
|
33
|
+
|
34
|
+
def meta_generator_content
|
35
|
+
text_at("//meta[@name='generator']/@content")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -11,15 +11,16 @@ module Sniffles
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def process_document
|
14
|
-
@output[:found] =
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
if @output[:found] = found?
|
15
|
+
parse_version
|
16
|
+
parse_feed
|
17
|
+
parse_theme
|
18
|
+
parse_pingback
|
19
|
+
end
|
19
20
|
end
|
20
21
|
|
21
22
|
private
|
22
|
-
def
|
23
|
+
def found?
|
23
24
|
@doc.xpath('//link[contains(@href,"wp-content")]').any?
|
24
25
|
end
|
25
26
|
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Sniffles
|
2
|
+
module Sniffers
|
3
|
+
class Xenforo
|
4
|
+
include HTML
|
5
|
+
|
6
|
+
attr_accessor :doc
|
7
|
+
attr_reader :output
|
8
|
+
|
9
|
+
def initialize(response_body)
|
10
|
+
@output = {}
|
11
|
+
parse(response_body) && process_document
|
12
|
+
end
|
13
|
+
|
14
|
+
def process_document
|
15
|
+
@output[:found] = found?
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
def found?
|
20
|
+
meta_description_content == "Forum software by XenForo"
|
21
|
+
end
|
22
|
+
|
23
|
+
def meta_description_content
|
24
|
+
text_at("//meta[@name='description']/@content")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Sniffles
|
2
|
+
module Sniffers
|
3
|
+
class Zencart
|
4
|
+
include HTML
|
5
|
+
|
6
|
+
attr_accessor :doc
|
7
|
+
attr_reader :output
|
8
|
+
|
9
|
+
def initialize(response_body)
|
10
|
+
@output = {}
|
11
|
+
parse(response_body) && process_document
|
12
|
+
end
|
13
|
+
|
14
|
+
def process_document
|
15
|
+
@output[:found] = found?
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
def found?
|
20
|
+
!!(meta_generator_content =~ /by Zen Cart/)
|
21
|
+
end
|
22
|
+
|
23
|
+
def meta_generator_content
|
24
|
+
text_at("//meta[@name='generator']/@content")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/sniffles/version.rb
CHANGED
data/lib/sniffles.rb
CHANGED