Sha256: 410710fefcb72e0ffc9a5dbd476ce80945436d774494ac8275742689d96e5196

Contents?: true

Size: 828 Bytes

Versions: 3

Compression:

Stored size: 828 Bytes

Contents

%w(custom_directories).each do |required|
  require "cms_scanner/target/platform/wordpress/#{required}"
end

module CMSScanner
  class Target < WebSite
    module Platform
      # Some WordPress specific implementation
      module WordPress
        include PHP

        WORDPRESS_PATTERN = %r{/(?:(?:wp-content/(?:themes|plugins|uploads))|wp-includes)/}i

        def wordpress?
          NS::Browser.get(url).html.css('script, link').each do |tag|
            tag_url = tag.attribute('href').to_s

            next unless in_scope?(tag_url)

            tag_uri = Addressable::URI.parse(tag_url)

            return true if tag_uri.path =~ WORDPRESS_PATTERN
          end
          false
        end

        def wordpress_hosted?
          uri.host =~ /wordpress.com$/i ? true : false
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cms_scanner-0.0.9 lib/cms_scanner/target/platform/wordpress.rb
cms_scanner-0.0.8 lib/cms_scanner/target/platform/wordpress.rb
cms_scanner-0.0.7 lib/cms_scanner/target/platform/wordpress.rb