Class: Ronin::Web::CLI::Commands::Html Private
- Inherits:
-
Xml
- Object
- Core::CLI::Command
- Ronin::Web::CLI::Command
- Xml
- Ronin::Web::CLI::Commands::Html
- Defined in:
- lib/ronin/web/cli/commands/html.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Performs XPath/CSS-path queries on a URL or HTML file.
Usage
ronin-web html [options] {URL | FILE} [XPATH | CSS-path]
Options
-X, --xpath XPATH XPath query
-C, --css-path CSSPath CSS-path query
-t, --text Prints the inner-text
-M, --meta-tags Searches for all <meta ...> tags
-l, --links Searches for all <a href="..."> URLs
-S, --style Dumps all <style> tags
-s, --stylesheet-urls Searches for all <link type="text/css" href="..."/> URLs
-J, --javascript Dumps all javascript source code
-j, --javascript-urls Searches for all <script src="..."> URLs
-f, --form-urls Searches for all <form action="..."> URLS
-u, --urls Dumps all URLs in the page
-F, --first Only print the first match
-h, --help Print help information
Arguments
URL | FILE The URL or FILE to search
[XPATH | CSS-path] The XPath or CSS-path query
Instance Attribute Summary collapse
-
#query ⇒ String?
readonly
private
The XPath or CSS-path query.
Instance Method Summary collapse
-
#parse(html) ⇒ Nokogiri::HTML::Document
private
Parses the HTML source code.
-
#run(source, query = @query) ⇒ Object
private
Runs the
ronin-web xpath
command.
Methods inherited from Xml
Instance Attribute Details
#query ⇒ String? (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The XPath or CSS-path query.
126 127 128 |
# File 'lib/ronin/web/cli/commands/html.rb', line 126 def query @query end |
Instance Method Details
#parse(html) ⇒ Nokogiri::HTML::Document
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Parses the HTML source code.
155 156 157 |
# File 'lib/ronin/web/cli/commands/html.rb', line 155 def parse(html) Nokogiri::HTML(html) end |
#run(source, query = @query) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Runs the ronin-web xpath
command.
137 138 139 140 141 142 143 144 |
# File 'lib/ronin/web/cli/commands/html.rb', line 137 def run(source,query=@query) unless query print_error "must specify --xpath, --css-path, or an XPath/CSS-path argument" exit(-1) end super(source,query) end |