Sha256: d278dfc45799a8e5fefa853e1065271b148a9f5fbcb15a0390008088aafe26ed

Contents?: true

Size: 1.92 KB

Versions: 1

Compression:

Stored size: 1.92 KB

Contents

#!/usr/bin/env ruby

require 'optparse'
require 'methadone'
require 'mechanize'
require 'website_inspector.rb'
require 'website_inspector/website'

class App
    include Methadone::Main
    include Methadone::CLILogging
    include Methadone::SH
    include WebsiteInspector

    main do |website_url, *search_terms|
        Website.start website_url, search_terms
        if options[:page_object]
            Website.search_type "PAGE"
        elsif options[:title]
            Website.search_type "TITLE"
        elsif options[:html]
            Website.search_type "HTML/XML"
        elsif options[:source]
            Website.search_type "WEBPAGE SOURCE"
        elsif options[:hyperlinks]
            Website.search_type "HYPERLINKS"
        elsif options[:images]
            Website.search_type "IMAGES"
        elsif options[:image_hyperlinks]
            Website.search_type "IMAGE URLS"
        elsif options[:page_forms]
            Website.search_type "PAGE FORMS"
        else
            Website.search_all
        end
        puts "\n"
        info "Website Inspector has finished running"
    end

    version WebsiteInspector::VERSION
    description 'Provides a command line interface to quickly search and inspect a website for specific content or search terms, if search type option is not provided, it will default to searching all data source types'

    on("--page_object", "Search the page object")
    on("--title", "Search title only")
    on("--html", "Search page html/xml only")
    on("--source", "Search page source only")
    on("--hyperlinks", "Search listed hyperlinks only")
    on("--images", "Search images only")
    on("--image_hyperlinks", "Search image urls only")
    on("--page_forms", "Search page forms only")

    arg :website_url, "URL of the website to inspect and scan for specified search terms"
    arg :search_terms, "An array of terms to search for in the specified websites"

    use_log_level_option

    go!
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
website_inspector-0.0.4 bin/website_inspector