sniffles 0.1.5 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +3 -3
  3. data/Gemfile +2 -8
  4. data/Guardfile +1 -1
  5. data/README.md +12 -13
  6. data/lib/sniffles.rb +9 -9
  7. data/lib/sniffles/html.rb +3 -3
  8. data/lib/sniffles/sniffers/advertising/adsense.rb +8 -14
  9. data/lib/sniffles/sniffers/advertising/kontera.rb +6 -6
  10. data/lib/sniffles/sniffers/analytics/chartbeat.rb +7 -7
  11. data/lib/sniffles/sniffers/analytics/facebook_insights.rb +7 -7
  12. data/lib/sniffles/sniffers/analytics/google_analytics.rb +8 -8
  13. data/lib/sniffles/sniffers/analytics/kissmetrics.rb +7 -7
  14. data/lib/sniffles/sniffers/analytics/mixpanel.rb +7 -7
  15. data/lib/sniffles/sniffers/analytics/quantcast.rb +6 -6
  16. data/lib/sniffles/sniffers/cms/cscart.rb +6 -6
  17. data/lib/sniffles/sniffers/{advertising/gumgum.rb → cms/ghost.rb} +8 -8
  18. data/lib/sniffles/sniffers/cms/invision.rb +9 -9
  19. data/lib/sniffles/sniffers/cms/joomla.rb +7 -7
  20. data/lib/sniffles/sniffers/cms/movabletype.rb +8 -8
  21. data/lib/sniffles/sniffers/cms/mybb.rb +6 -6
  22. data/lib/sniffles/sniffers/cms/phpbb.rb +7 -7
  23. data/lib/sniffles/sniffers/cms/shopify.rb +7 -7
  24. data/lib/sniffles/sniffers/cms/tumblr.rb +7 -7
  25. data/lib/sniffles/sniffers/cms/vanilla.rb +8 -8
  26. data/lib/sniffles/sniffers/cms/vbulletin.rb +10 -10
  27. data/lib/sniffles/sniffers/cms/wordpress.rb +12 -12
  28. data/lib/sniffles/sniffers/{advertising/admeld.rb → cms/xcart.rb} +3 -2
  29. data/lib/sniffles/sniffers/cms/zencart.rb +6 -6
  30. data/lib/sniffles/sniffers/javascript/jquery.rb +6 -6
  31. data/lib/sniffles/text.rb +4 -4
  32. data/lib/sniffles/version.rb +1 -1
  33. data/sniffles.gemspec +2 -2
  34. data/spec/cassettes/beenverified_com.yml +644 -784
  35. data/spec/cassettes/blackhatworld_com.yml +2298 -3292
  36. data/spec/cassettes/blog_mixpanel_com.yml +1351 -0
  37. data/spec/cassettes/community_invisionpower_com.yml +836 -2771
  38. data/spec/cassettes/cxxvi_com.yml +311 -0
  39. data/spec/cassettes/demo-store_prestashop_com.yml +897 -813
  40. data/spec/cassettes/demo_cs-cart_com.yml +2996 -1146
  41. data/spec/cassettes/demo_oscommerce_com.yml +136 -408
  42. data/spec/cassettes/digital-photography-school_com.yml +656 -0
  43. data/spec/cassettes/downlopedia_com.yml +1262 -1321
  44. data/spec/cassettes/drupal.yml +1540 -1507
  45. data/spec/cassettes/exprodirect_com.yml +1888 -0
  46. data/spec/cassettes/facebook_insights.yml +544 -474
  47. data/spec/cassettes/flatpress_org_home_blog.yml +287 -317
  48. data/spec/cassettes/foursquare_com.yml +1901 -348
  49. data/spec/cassettes/geomagik_com.yml +475 -0
  50. data/spec/cassettes/ghost_org.yml +207 -0
  51. data/spec/cassettes/google_blogspot_com.yml +574 -1059
  52. data/spec/cassettes/guistyles_com.yml +705 -1292
  53. data/spec/cassettes/installatron_com.yml +286 -0
  54. data/spec/cassettes/invisionmodding_com.yml +1124 -2442
  55. data/spec/cassettes/joomla.yml +280 -0
  56. data/spec/cassettes/kissmetrics_com.yml +165 -0
  57. data/spec/cassettes/lancelhoff_com.yml +637 -0
  58. data/spec/cassettes/magento.yml +459 -459
  59. data/spec/cassettes/metafilter_com.yml +1449 -1230
  60. data/spec/cassettes/movabletype_com_blog.yml +175 -1221
  61. data/spec/cassettes/ocbfashionjewelry_com.yml +588 -0
  62. data/spec/cassettes/pandoramoa_com.yml +290 -608
  63. data/spec/cassettes/pearsonified_com.yml +433 -435
  64. data/spec/cassettes/phpbb_com.yml +438 -416
  65. data/spec/cassettes/sitefinity_com.yml +443 -418
  66. data/spec/cassettes/sixflags_com.yml +560 -1014
  67. data/spec/cassettes/soulemama_typepad_com.yml +2378 -2581
  68. data/spec/cassettes/stackoverflow_com.yml +4762 -0
  69. data/spec/cassettes/staff_tumblr_com.yml +1956 -1658
  70. data/spec/cassettes/topix_com.yml +1748 -1417
  71. data/spec/cassettes/wellmedicated_com.yml +801 -0
  72. data/spec/cassettes/wordpress_com.yml +238 -863
  73. data/spec/cassettes/xenforo_com.yml +1143 -1933
  74. data/spec/sniffles/html_spec.rb +6 -6
  75. data/spec/sniffles/sniffers/advertising/adsense_spec.rb +7 -8
  76. data/spec/sniffles/sniffers/advertising/buysellads_spec.rb +5 -5
  77. data/spec/sniffles/sniffers/advertising/casale_spec.rb +5 -5
  78. data/spec/sniffles/sniffers/advertising/kontera_spec.rb +6 -6
  79. data/spec/sniffles/sniffers/advertising/thedeck_spec.rb +5 -5
  80. data/spec/sniffles/sniffers/advertising/tribalfusion_spec.rb +5 -5
  81. data/spec/sniffles/sniffers/analytics/chartbeat_spec.rb +3 -3
  82. data/spec/sniffles/sniffers/analytics/clicky_spec.rb +3 -3
  83. data/spec/sniffles/sniffers/analytics/facebook_insights_spec.rb +6 -6
  84. data/spec/sniffles/sniffers/analytics/google_analytics_spec.rb +7 -19
  85. data/spec/sniffles/sniffers/analytics/kissmetrics_spec.rb +5 -5
  86. data/spec/sniffles/sniffers/analytics/mixpanel_spec.rb +9 -9
  87. data/spec/sniffles/sniffers/analytics/quantcast_spec.rb +7 -7
  88. data/spec/sniffles/sniffers/cms/cscart_spec.rb +8 -8
  89. data/spec/sniffles/sniffers/cms/ghost_spec.rb +18 -0
  90. data/spec/sniffles/sniffers/cms/invision_spec.rb +9 -9
  91. data/spec/sniffles/sniffers/cms/joomla_spec.rb +9 -9
  92. data/spec/sniffles/sniffers/cms/movabletype_spec.rb +8 -8
  93. data/spec/sniffles/sniffers/cms/mybb_spec.rb +9 -9
  94. data/spec/sniffles/sniffers/cms/phpbb_spec.rb +8 -8
  95. data/spec/sniffles/sniffers/cms/shopify_spec.rb +9 -9
  96. data/spec/sniffles/sniffers/cms/tumblr_spec.rb +7 -7
  97. data/spec/sniffles/sniffers/cms/vanilla_spec.rb +9 -9
  98. data/spec/sniffles/sniffers/cms/vbulletin_spec.rb +11 -17
  99. data/spec/sniffles/sniffers/cms/wordpress_spec.rb +12 -12
  100. data/spec/sniffles/sniffers/cms/xcart_spec.rb +18 -0
  101. data/spec/sniffles/sniffers/cms/zencart_spec.rb +9 -9
  102. data/spec/sniffles/sniffers/javascript/jquery_spec.rb +8 -8
  103. data/spec/sniffles/sniffers_spec.rb +1 -1
  104. data/spec/sniffles_spec.rb +17 -17
  105. data/spec/spec_helper.rb +7 -3
  106. data/spec/support/helpers.rb +2 -2
  107. metadata +39 -39
  108. data/lib/sniffles/sniffers/cms/posterous.rb +0 -28
  109. data/spec/cassettes/blog_posterous_com.yml +0 -5015
  110. data/spec/cassettes/demo_forum-software_org_mybb.yml +0 -385
  111. data/spec/cassettes/forum-software_org_vanilla.yml +0 -223
  112. data/spec/cassettes/humemes_com.yml +0 -496
  113. data/spec/cassettes/joomla_org.yml +0 -733
  114. data/spec/cassettes/orangecrushbeads_com.yml +0 -751
  115. data/spec/cassettes/shop_angrybirds_com.yml +0 -455
  116. data/spec/cassettes/softpedia_com.yml +0 -3196
  117. data/spec/cassettes/squidoo_com.yml +0 -532
  118. data/spec/cassettes/tmz_com.yml +0 -2927
  119. data/spec/cassettes/vbulletin_com.yml +0 -2983
  120. data/spec/cassettes/wundergroud_com.yml +0 -907
  121. data/spec/sniffles/sniffers/advertising/admeld_spec.rb +0 -17
  122. data/spec/sniffles/sniffers/advertising/gumgum_spec.rb +0 -18
  123. data/spec/sniffles/sniffers/cms/posterous_spec.rb +0 -18
@@ -2,23 +2,23 @@ module Sniffles
2
2
  module Sniffers
3
3
  class Cscart
4
4
  include HTML
5
-
5
+
6
6
  attr_accessor :doc
7
7
  attr_reader :output
8
-
8
+
9
9
  def initialize(response_body)
10
- @output = {}
10
+ @output = {}
11
11
  parse(response_body) && process_document
12
12
  end
13
-
13
+
14
14
  def process_document
15
15
  @output[:found] = found?
16
16
  end
17
-
17
+
18
18
  private
19
19
  def found?
20
20
  !!(@doc.text =~ /Powered by CS\-Cart/)
21
21
  end
22
22
  end
23
23
  end
24
- end
24
+ end
@@ -1,24 +1,24 @@
1
1
  module Sniffles
2
2
  module Sniffers
3
- class Gumgum
3
+ class Ghost
4
4
  include Text
5
-
5
+
6
6
  attr_accessor :doc
7
7
  attr_reader :output
8
-
8
+
9
9
  def initialize(response_body)
10
- @output = {}
10
+ @output = {}
11
11
  parse(response_body) && process_document
12
12
  end
13
-
13
+
14
14
  def process_document
15
15
  @output[:found] = found?
16
16
  end
17
-
17
+
18
18
  private
19
19
  def found?
20
- match? /cdn\.gumgum\.com/
20
+ match? /content="Ghost ([\d\.]*)"/
21
21
  end
22
22
  end
23
23
  end
24
- end
24
+ end
@@ -2,34 +2,34 @@ module Sniffles
2
2
  module Sniffers
3
3
  class Invision
4
4
  include HTML
5
-
5
+
6
6
  attr_accessor :doc
7
7
  attr_reader :output
8
-
8
+
9
9
  def initialize(response_body)
10
- @output = {}
10
+ @output = {}
11
11
  parse(response_body) && process_document
12
12
  end
13
-
13
+
14
14
  def process_document
15
15
  if @output[:found] = found?
16
16
  parse_version
17
17
  end
18
18
  end
19
-
19
+
20
20
  private
21
21
  def found?
22
22
  !!(copyright_link =~ /Forum Software by IP\.Board/)
23
23
  end
24
-
24
+
25
25
  def parse_version
26
- version_capture = (copyright_link.match /Software by IP\.Board ([\d]+\.[\d]+\.[\d]+(?: Beta [\d]+))/)
26
+ version_capture = (copyright_link.match(/Software by IP\.Board ([\d]+\.[\d]+\.[\d]+)/))
27
27
  @output[:version] = version_capture ? version_capture[1] : false
28
28
  end
29
-
29
+
30
30
  def copyright_link
31
31
  text_at("//p[@id='copyright']/a")
32
32
  end
33
33
  end
34
34
  end
35
- end
35
+ end
@@ -2,26 +2,26 @@ module Sniffles
2
2
  module Sniffers
3
3
  class Joomla
4
4
  include HTML
5
-
5
+
6
6
  attr_accessor :doc
7
7
  attr_reader :output
8
-
8
+
9
9
  def initialize(response_body)
10
- @output = {}
10
+ @output = {}
11
11
  parse(response_body) && process_document
12
12
  end
13
-
13
+
14
14
  def process_document
15
15
  if @output[:found] = found?
16
16
  parse_version
17
17
  end
18
18
  end
19
-
19
+
20
20
  private
21
21
  def found?
22
22
  !!(meta_generator_content =~ /Joomla!/)
23
23
  end
24
-
24
+
25
25
  def parse_version
26
26
  @output[:version] = (meta_generator_content =~ /Joomla! ([\d]+\.[\d]+)/ ? $1 : false)
27
27
  end
@@ -31,4 +31,4 @@ module Sniffles
31
31
  end
32
32
  end
33
33
  end
34
- end
34
+ end
@@ -2,27 +2,27 @@ module Sniffles
2
2
  module Sniffers
3
3
  class Movabletype
4
4
  include HTML
5
-
5
+
6
6
  attr_accessor :doc
7
7
  attr_reader :output
8
-
8
+
9
9
  def initialize(response_body)
10
- @output = {}
10
+ @output = {}
11
11
  parse(response_body) && process_document
12
12
  end
13
-
13
+
14
14
  def process_document
15
15
  @output[:found] = found?
16
16
  end
17
-
17
+
18
18
  private
19
19
  def found?
20
- !!(meta_generator_content =~ /Movable Type/)
20
+ !!(meta_generator_content =~ /mt-static/)
21
21
  end
22
22
 
23
23
  def meta_generator_content
24
- text_at("//meta[@name='generator']/@content")
24
+ text_at("//link[@rel='icon']/@href")
25
25
  end
26
26
  end
27
27
  end
28
- end
28
+ end
@@ -2,23 +2,23 @@ module Sniffles
2
2
  module Sniffers
3
3
  class Mybb
4
4
  include HTML
5
-
5
+
6
6
  attr_accessor :doc
7
7
  attr_reader :output
8
-
8
+
9
9
  def initialize(response_body)
10
- @output = {}
10
+ @output = {}
11
11
  parse(response_body) && process_document
12
12
  end
13
-
13
+
14
14
  def process_document
15
15
  @output[:found] = found?
16
16
  end
17
-
17
+
18
18
  private
19
19
  def found?
20
20
  !!(@doc.text =~ /Powered By MyBB/)
21
21
  end
22
22
  end
23
23
  end
24
- end
24
+ end
@@ -4,24 +4,24 @@ module Sniffles
4
4
  include HTML
5
5
  attr_accessor :doc
6
6
  attr_reader :output
7
-
7
+
8
8
  def initialize(response_body)
9
- @output = {}
9
+ @output = {}
10
10
  parse(response_body) && process_document
11
11
  end
12
-
12
+
13
13
  def process_document
14
14
  @output[:found] = found?
15
15
  end
16
-
16
+
17
17
  private
18
18
  def found?
19
19
  @doc.text.include?("Powered by phpBB") && phpbb_meta?
20
- end
21
-
20
+ end
21
+
22
22
  def phpbb_meta?
23
23
  !@doc.xpath("//meta[@name='resource-type']").empty? && !@doc.xpath("//meta[@name='distribution']").empty?
24
24
  end
25
25
  end
26
26
  end
27
- end
27
+ end
@@ -2,23 +2,23 @@ module Sniffles
2
2
  module Sniffers
3
3
  class Shopify
4
4
  include Text
5
-
5
+
6
6
  attr_accessor :doc
7
7
  attr_reader :output
8
-
8
+
9
9
  def initialize(response_body)
10
- @output = {}
10
+ @output = {}
11
11
  parse(response_body) && process_document
12
12
  end
13
-
13
+
14
14
  def process_document
15
15
  @output[:found] = found?
16
16
  end
17
-
17
+
18
18
  private
19
19
  def found?
20
- match? /cdn\.shopify\.com/
20
+ match?(/cdn\.shopify\.com/)
21
21
  end
22
22
  end
23
23
  end
24
- end
24
+ end
@@ -2,23 +2,23 @@ module Sniffles
2
2
  module Sniffers
3
3
  class Tumblr
4
4
  include Text
5
-
5
+
6
6
  attr_accessor :doc
7
7
  attr_reader :output
8
-
8
+
9
9
  def initialize(response_body)
10
- @output = {}
10
+ @output = {}
11
11
  parse(response_body) && process_document
12
12
  end
13
-
13
+
14
14
  def process_document
15
15
  @output[:found] = found?
16
16
  end
17
-
17
+
18
18
  private
19
19
  def found?
20
- match?(/assets\.tumblr\.com\/iframe/) && match?(/<!-- BEGIN TUMBLR CODE -->/)
20
+ match?(/assets\.tumblr\.com\/assets/) && match?(/<!-- BEGIN TUMBLR CODE -->/)
21
21
  end
22
22
  end
23
23
  end
24
- end
24
+ end
@@ -1,24 +1,24 @@
1
1
  module Sniffles
2
2
  module Sniffers
3
3
  class Vanilla
4
- include Text
5
-
4
+ include HTML
5
+
6
6
  attr_accessor :doc
7
7
  attr_reader :output
8
-
8
+
9
9
  def initialize(response_body)
10
- @output = {}
10
+ @output = {}
11
11
  parse(response_body) && process_document
12
12
  end
13
-
13
+
14
14
  def process_document
15
15
  @output[:found] = found?
16
16
  end
17
-
17
+
18
18
  private
19
19
  def found?
20
- match? /Powered by Vanilla/
20
+ text_match?('//a[@href="http://vanillaforums.org/"]/text()', 'Vanilla Forums')
21
21
  end
22
22
  end
23
23
  end
24
- end
24
+ end
@@ -2,31 +2,31 @@ module Sniffles
2
2
  module Sniffers
3
3
  class Vbulletin
4
4
  include HTML
5
-
5
+
6
6
  attr_accessor :doc
7
7
  attr_reader :output
8
-
8
+
9
9
  def initialize(response_body)
10
- @output = {}
10
+ @output = {}
11
11
  parse(response_body) && process_document
12
12
  end
13
-
13
+
14
14
  def process_document
15
15
  if @output[:found] = found?
16
16
  parse_version
17
17
  parse_feed
18
18
  end
19
19
  end
20
-
20
+
21
21
  private
22
22
  def found?
23
23
  !!(js_initialization? || meta_generator_content =~ /vBulletin/)
24
24
  end
25
-
25
+
26
26
  def parse_feed
27
27
  @output[:feed] = text_at("//link[@type='application/rss+xml']/@href")
28
28
  end
29
-
29
+
30
30
  def parse_version
31
31
  if meta_generator_content
32
32
  @output[:version] = (meta_generator_content.match(/([\d]+\.[\d]+\.[\d]+)/) ? $1 : false)
@@ -34,14 +34,14 @@ module Sniffles
34
34
  @output[:version] = false
35
35
  end
36
36
  end
37
-
37
+
38
38
  def meta_generator_content
39
39
  text_at("//meta[@name='generator']/@content")
40
40
  end
41
-
41
+
42
42
  def js_initialization?
43
43
  @doc.xpath("//script[contains(text(),'vBulletin_init()')]").any?
44
44
  end
45
45
  end
46
46
  end
47
- end
47
+ end
@@ -4,12 +4,12 @@ module Sniffles
4
4
  include HTML
5
5
  attr_accessor :doc
6
6
  attr_reader :name, :group, :output, :response
7
-
7
+
8
8
  def initialize(response_body)
9
- @output = {}
9
+ @output = {}
10
10
  parse(response_body) && process_document
11
11
  end
12
-
12
+
13
13
  def process_document
14
14
  if @output[:found] = found?
15
15
  parse_version
@@ -18,37 +18,37 @@ module Sniffles
18
18
  parse_pingback
19
19
  end
20
20
  end
21
-
21
+
22
22
  private
23
23
  def found?
24
24
  @doc.xpath('//link[contains(@href,"wp-content")]').any?
25
- end
26
-
25
+ end
26
+
27
27
  def parse_feed
28
28
  @output[:feed] = text_at("//link[@rel='alternate' and @type='application/rss+xml']/@href")
29
29
  end
30
-
30
+
31
31
  def parse_theme
32
32
  theme_uri = text_at("//link[@rel='stylesheet' and contains(@href,'wp-content/themes/')][1]/@href")
33
33
  @output[:theme] = (theme_uri ? clean_theme_uri(theme_uri)[1] : false)
34
34
  end
35
-
35
+
36
36
  def parse_version
37
37
  version_meta_tag = text_at("//meta[@name='generator']/@content")
38
38
  @output[:version] = (version_meta_tag ? extract_version(version_meta_tag)[1] : version_meta_tag)
39
39
  end
40
-
40
+
41
41
  def parse_pingback
42
42
  @output[:pingback] = text_at("//link[@rel='pingback']/@href")
43
43
  end
44
-
44
+
45
45
  def clean_theme_uri(uri)
46
46
  /wp-content\/themes\/([^\/]*)\//i.match uri
47
47
  end
48
-
48
+
49
49
  def extract_version(string)
50
50
  /([\d]+\.[\d]+[\.]?[\d]?)/.match string
51
51
  end
52
52
  end
53
53
  end
54
- end
54
+ end