ronin-web
Description
ronin-web is a Ruby library that provides common web security commands and additional libraries.
ronin-web is part of the ronin-rb project, a Ruby toolkit for security research and development.
Features
- HTML/XML parsing/building (using Nokogiri).
- Also provides additional extensions to Nokogiri using nokogiri-ext.
- Supports diffing HTML/XML documents using nokogiri-diff.
- Automated Web Browsing using Mechanize.
- Supports random
User-Agent
generation using ronin-web-user_agents. - Provides an easy to use Sinatra based web server using ronin-web-server.
- Provides an easy to use web spider using ronin-web-spider.
- Provides a CLI for common web related tasks.
- Has 98% documentation coverage.
- Has 89% test coverage.
Synopsis
Usage: ronin-web [options] [COMMAND [ARGS...]]
Options:
-h, --help Print help information
Arguments:
[COMMAND] The command name to run
[ARGS ...] Additional arguments for the command
Commands:
diff
help
html
irb
new
reverse-proxy
server
spider
Examples
Get a web-page:
Web.get('http://www.rubyinside.com/')
Get only the body of the web-page:
Web.get_body('http://www.rubyinside.com/')
Get a Mechanize agent:
agent = Web.agent
Parse HTML:
HTML.parse(open('some_file.html'))
# => <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
# <html>
# <head>
# <script type="text/javascript" src="redirect.js"></script>
# </head>
# </html>
Build a HTML document:
doc = HTML.build do
html {
head {
script(:type => 'text/javascript', :src => 'redirect.js')
}
}
end
puts doc.to_html
# <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
# <html><head><script src="redirect.js" type="text/javascript"></script></head></html>
Parse XML:
XML.parse(some_text)
# => <?xml version="1.0"?>
# <users>
# <user>
# <name>admin</name>
# <password>0mni</password>
# </user>
# </users>
Build a XML document:
doc = XML.build do
playlist {
mp3 {
file { text('02 THE WAIT.mp3') }
artist { text('Evil Nine') }
track { text('The Wait feat David Autokratz') }
duration { text('1000000000') }
}
}
end
puts doc.to_xml
# <?xml version="1.0"?>
# <playlist>
# <mp3>
# <file>02 THE WAIT.mp3</file>
# <artist>Evil Nine</artist>
# <track>The Wait feat David Autokratz</track>
# <duration>1000000000</duration>
# </mp3>
# </playlist>
Requirements
- Ruby >= 3.0.0
- nokogiri ~> 1.4
- nokogiri-ext ~> 0.1
- nokogiri-diff ~> 0.2
- mechanize ~> 2.0
- open_namespace ~> 0.4
- ronin-support ~> 1.0
- ronin-web-server ~> 0.1
- ronin-web-spider ~> 0.1
- ronin-web-user_agents ~> 0.1
- ronin-core ~> 0.1
Install
$ gem install ronin-web
Development
- Fork It!
- Clone It!
cd ronin-web
bundle install
git checkout -b my_feature
- Code It!
bundle exec rake spec
git push origin my_feature
License
ronin-web - A collection of useful web helper methods and commands.
Copyright (c) 2006-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
ronin-web is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
ronin-web is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with ronin-web. If not, see https://www.gnu.org/licenses/.