ronin-web 0.3.0.rc1 → 1.0.0.beta2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. checksums.yaml +7 -0
  2. data/.editorconfig +11 -0
  3. data/.github/workflows/ruby.yml +31 -0
  4. data/.gitignore +13 -0
  5. data/.mailmap +1 -0
  6. data/.ruby-version +1 -0
  7. data/COPYING.txt +3 -3
  8. data/ChangeLog.md +115 -70
  9. data/Gemfile +42 -37
  10. data/README.md +160 -145
  11. data/Rakefile +12 -3
  12. data/bin/ronin-web +9 -17
  13. data/data/new/nokogiri.rb.erb +12 -0
  14. data/data/new/server.rb.erb +22 -0
  15. data/data/new/spider.rb.erb +26 -0
  16. data/data/new/webapp/.gitignore +15 -0
  17. data/data/new/webapp/.ruby-version.erb +1 -0
  18. data/data/new/webapp/Dockerfile.erb +11 -0
  19. data/data/new/webapp/Gemfile +6 -0
  20. data/data/new/webapp/app.rb.erb +15 -0
  21. data/data/new/webapp/config.ru +4 -0
  22. data/data/new/webapp/docker-compose.yml.erb +9 -0
  23. data/gemspec.yml +38 -16
  24. data/lib/ronin/web/cli/command.rb +36 -0
  25. data/lib/ronin/web/cli/commands/diff.rb +106 -0
  26. data/lib/ronin/web/cli/commands/html.rb +174 -0
  27. data/lib/ronin/web/cli/commands/irb.rb +56 -0
  28. data/lib/ronin/web/cli/commands/new/nokogiri.rb +85 -0
  29. data/lib/ronin/web/cli/commands/new/server.rb +96 -0
  30. data/lib/ronin/web/cli/commands/new/spider.rb +315 -0
  31. data/lib/ronin/web/cli/commands/new/webapp.rb +123 -0
  32. data/lib/ronin/web/cli/commands/new.rb +64 -0
  33. data/lib/ronin/web/cli/commands/reverse_proxy.rb +215 -0
  34. data/lib/ronin/web/cli/commands/server.rb +155 -0
  35. data/lib/ronin/web/cli/commands/spider.rb +822 -0
  36. data/lib/ronin/web/cli/ruby_shell.rb +50 -0
  37. data/lib/ronin/web/cli.rb +49 -0
  38. data/lib/ronin/web/html.rb +85 -0
  39. data/lib/ronin/web/mechanize.rb +34 -36
  40. data/lib/ronin/web/root.rb +27 -0
  41. data/lib/ronin/web/version.rb +7 -10
  42. data/lib/ronin/web/xml.rb +85 -0
  43. data/lib/ronin/web.rb +372 -13
  44. data/man/ronin-web-diff.1 +41 -0
  45. data/man/ronin-web-diff.1.md +30 -0
  46. data/man/ronin-web-html.1 +89 -0
  47. data/man/ronin-web-html.1.md +66 -0
  48. data/man/ronin-web-irb.1 +31 -0
  49. data/man/ronin-web-irb.1.md +22 -0
  50. data/man/ronin-web-new-nokogiri.1 +41 -0
  51. data/man/ronin-web-new-nokogiri.1.md +30 -0
  52. data/man/ronin-web-new-server.1 +45 -0
  53. data/man/ronin-web-new-server.1.md +33 -0
  54. data/man/ronin-web-new-spider.1 +173 -0
  55. data/man/ronin-web-new-spider.1.md +129 -0
  56. data/man/ronin-web-new-webapp.1 +53 -0
  57. data/man/ronin-web-new-webapp.1.md +39 -0
  58. data/man/ronin-web-new.1 +59 -0
  59. data/man/ronin-web-new.1.md +44 -0
  60. data/man/ronin-web-reverse-proxy.1 +63 -0
  61. data/man/ronin-web-reverse-proxy.1.md +47 -0
  62. data/man/ronin-web-server.1 +59 -0
  63. data/man/ronin-web-server.1.md +43 -0
  64. data/man/ronin-web-spider.1 +225 -0
  65. data/man/ronin-web-spider.1.md +168 -0
  66. data/man/ronin-web.1 +41 -0
  67. data/man/ronin-web.1.md +30 -0
  68. data/ronin-web.gemspec +39 -109
  69. data/spec/cli/ruby_shell_spec.rb +14 -0
  70. data/spec/html_spec.rb +43 -0
  71. data/spec/mechanize_spec.rb +72 -0
  72. data/spec/spec_helper.rb +5 -3
  73. data/spec/web_spec.rb +97 -0
  74. data/spec/xml_spec.rb +42 -0
  75. metadata +236 -224
  76. data/.gemtest +0 -0
  77. data/data/ronin/web/user_agents.yml +0 -247
  78. data/lib/ronin/network/mixins/web.rb +0 -258
  79. data/lib/ronin/web/config.rb +0 -34
  80. data/lib/ronin/web/extensions/nokogiri/xml/attr.rb +0 -47
  81. data/lib/ronin/web/extensions/nokogiri/xml/document.rb +0 -48
  82. data/lib/ronin/web/extensions/nokogiri/xml/element.rb +0 -57
  83. data/lib/ronin/web/extensions/nokogiri/xml/node.rb +0 -86
  84. data/lib/ronin/web/extensions/nokogiri/xml/text.rb +0 -47
  85. data/lib/ronin/web/extensions/nokogiri/xml.rb +0 -27
  86. data/lib/ronin/web/extensions/nokogiri.rb +0 -23
  87. data/lib/ronin/web/extensions.rb +0 -23
  88. data/lib/ronin/web/middleware/base.rb +0 -144
  89. data/lib/ronin/web/middleware/directories.rb +0 -179
  90. data/lib/ronin/web/middleware/files.rb +0 -144
  91. data/lib/ronin/web/middleware/filters/campaign_filter.rb +0 -77
  92. data/lib/ronin/web/middleware/filters/ip_filter.rb +0 -73
  93. data/lib/ronin/web/middleware/filters/path_filter.rb +0 -73
  94. data/lib/ronin/web/middleware/filters/referer_filter.rb +0 -71
  95. data/lib/ronin/web/middleware/filters/user_agent_filter.rb +0 -71
  96. data/lib/ronin/web/middleware/filters/vhost_filter.rb +0 -71
  97. data/lib/ronin/web/middleware/filters.rb +0 -28
  98. data/lib/ronin/web/middleware/helpers.rb +0 -145
  99. data/lib/ronin/web/middleware/proxy.rb +0 -265
  100. data/lib/ronin/web/middleware/proxy_request.rb +0 -262
  101. data/lib/ronin/web/middleware/request.rb +0 -79
  102. data/lib/ronin/web/middleware/response.rb +0 -33
  103. data/lib/ronin/web/middleware/router.rb +0 -167
  104. data/lib/ronin/web/middleware/rule.rb +0 -103
  105. data/lib/ronin/web/middleware.rb +0 -27
  106. data/lib/ronin/web/proxy/app.rb +0 -32
  107. data/lib/ronin/web/proxy/base.rb +0 -46
  108. data/lib/ronin/web/proxy/web.rb +0 -46
  109. data/lib/ronin/web/proxy.rb +0 -25
  110. data/lib/ronin/web/server/app.rb +0 -32
  111. data/lib/ronin/web/server/base.rb +0 -461
  112. data/lib/ronin/web/server/web.rb +0 -66
  113. data/lib/ronin/web/server.rb +0 -25
  114. data/lib/ronin/web/spider.rb +0 -120
  115. data/lib/ronin/web/user_agents.rb +0 -196
  116. data/lib/ronin/web/web.rb +0 -560
  117. data/spec/helpers/output.rb +0 -3
  118. data/spec/web/extensions/nokogiri_spec.rb +0 -38
  119. data/spec/web/helpers/rack_app.rb +0 -24
  120. data/spec/web/helpers/root/test1/index.html +0 -1
  121. data/spec/web/helpers/root/test1/test1.txt +0 -1
  122. data/spec/web/helpers/root/test1.txt +0 -1
  123. data/spec/web/helpers/root/test2/test2.txt +0 -1
  124. data/spec/web/helpers/root/test2.txt +0 -1
  125. data/spec/web/helpers/root/test3/test3.txt +0 -1
  126. data/spec/web/helpers/root/test3.txt +0 -1
  127. data/spec/web/helpers/root.rb +0 -15
  128. data/spec/web/mechanize_spec.rb +0 -62
  129. data/spec/web/middleware/directories_spec.rb +0 -86
  130. data/spec/web/middleware/files_spec.rb +0 -57
  131. data/spec/web/middleware/filters/campaign_filter_spec.rb +0 -30
  132. data/spec/web/middleware/filters/ip_filter_spec.rb +0 -25
  133. data/spec/web/middleware/filters/path_filter_spec.rb +0 -29
  134. data/spec/web/middleware/filters/referer_filter_spec.rb +0 -25
  135. data/spec/web/middleware/filters/user_agent_filter_spec.rb +0 -25
  136. data/spec/web/middleware/filters/vhost_filter_spec.rb +0 -23
  137. data/spec/web/middleware/proxy_spec.rb +0 -67
  138. data/spec/web/middleware/response_spec.rb +0 -20
  139. data/spec/web/middleware/router_spec.rb +0 -65
  140. data/spec/web/middleware/rule_spec.rb +0 -37
  141. data/spec/web/proxy/base_spec.rb +0 -8
  142. data/spec/web/server/base_spec.rb +0 -77
  143. data/spec/web/server/classes/public1/static1.txt +0 -1
  144. data/spec/web/server/classes/public2/static2.txt +0 -1
  145. data/spec/web/server/classes/sub_app.rb +0 -13
  146. data/spec/web/server/classes/test_app.rb +0 -20
  147. data/spec/web/user_agents_spec.rb +0 -56
  148. data/spec/web/web_spec.rb +0 -101
data/README.md CHANGED
@@ -1,199 +1,214 @@
1
- # Ronin Web
1
+ # ronin-web
2
2
 
3
- * [Source](http://github.com/ronin-ruby/ronin-web)
4
- * [Issues](http://github.com/ronin-ruby/ronin-web/issues)
5
- * [Documentation](http://rubydoc.info/github/ronin-ruby/ronin-web/frames)
6
- * [Mailing List](http://groups.google.com/group/ronin-ruby)
7
- * [irc.freenode.net #ronin](http://webchat.freenode.net/?channels=ronin&uio=Mj10cnVldd)
3
+ [![CI](https://github.com/ronin-rb/ronin-web/actions/workflows/ruby.yml/badge.svg)](https://github.com/ronin-rb/ronin-web/actions/workflows/ruby.yml)
4
+ [![Code Climate](https://codeclimate.com/github/ronin-rb/ronin-web.svg)](https://codeclimate.com/github/ronin-rb/ronin-web)
8
5
 
9
- ## Description
10
-
11
- Ronin Web is a Ruby library for Ronin that provides support for web
12
- scraping and spidering functionality.
13
-
14
- Ronin is a Ruby platform for exploit development and security research.
15
- Ronin allows for the rapid development and distribution of code, exploits
16
- or payloads over many common Source-Code-Management (SCM) systems.
17
-
18
- ### Ruby
6
+ * [Source](https://github.com/ronin-rb/ronin-web)
7
+ * [Issues](https://github.com/ronin-rb/ronin-web/issues)
8
+ * [Documentation](https://ronin-rb.dev/docs/ronin-web/frames)
9
+ * [Discord](https://discord.gg/6WAb3PsVX9) |
10
+ [Twitter](https://twitter.com/ronin_rb) |
11
+ [Mastodon](https://infosec.exchange/@ronin_rb)
19
12
 
20
- Ronin's Ruby environment allows security researchers to leverage Ruby with
21
- ease. The Ruby environment contains a multitude of convenience methods
22
- for working with data in Ruby, a Ruby Object Database, a customized Ruby
23
- Console and an extendable command-line interface.
24
-
25
- ### Extend
26
-
27
- Ronin's more specialized features are provided by additional Ronin
28
- libraries, which users can choose to install. These libraries can allow
29
- one to write and run Exploits and Payloads, scan for PHP vulnerabilities,
30
- perform Google Dorks or run 3rd party scanners.
13
+ ## Description
31
14
 
32
- ### Publish
15
+ ronin-web is a Ruby library that provides common web security commands and
16
+ additional libraries.
33
17
 
34
- Ronin allows users to publish and share code, exploits, payloads or other
35
- data via Overlays. Overlays are directories of code and data that can be
36
- hosted on any SVN, Hg, Git or Rsync server. Ronin makes it easy to create,
37
- install or update Overlays.
18
+ ronin-web is part of the [ronin-rb] project, a [Ruby] toolkit for security
19
+ research and development.
38
20
 
39
21
  ## Features
40
22
 
41
- * Provides popular [User Agent strings](https://github.com/ronin-ruby/ronin-web/blob/master/data/ronin/web/user_agents.yml).
42
- * Web access (utilizing [Mechanize](http://rubydoc.info/gems/mechanize/frames)
43
- and [Nokogiri](http://rubydoc.info/gems/nokogiri/frames).
44
- * Integrates [Spidr](http://github.com/postmodern/spidr#readme) into
45
- {Ronin::Web::Spider}.
46
- * Provides a collection of useful [Rack](http://rack.rubyforge.org/)
47
- Middleware:
48
- * {Ronin::Web::Middleware::Files}
49
- * {Ronin::Web::Middleware::Directories}
50
- * {Ronin::Web::Middleware::Proxy}
51
- * {Ronin::Web::Middleware::Router}
52
- * Provides {Ronin::Web::Server}, a [Sinatra](http://sinatrarb.com/) based
53
- Web Server.
54
- * Provides {Ronin::Web::Proxy}, a [Sinatra](http://sinatrarb.com/) based
55
- Web Proxy.
23
+ * HTML/XML parsing/building (using [Nokogiri][nokogiri]).
24
+ * Also provides additional extensions to [Nokogiri][nokogiri] using
25
+ [nokogiri-ext].
26
+ * Supports diffing HTML/XML documents using [nokogiri-diff].
27
+ * Automated Web Browsing using [Mechanize][mechanize].
28
+ * Supports random `User-Agent` generation using [ronin-web-user_agents].
29
+ * Provides an easy to use [Sinatra][sinatra] based web server using
30
+ [ronin-web-server].
31
+ * Provides an easy to use web spider using [ronin-web-spider].
32
+ * Provides a CLI for common web related tasks.
33
+ * Has 98% documentation coverage.
34
+ * Has 89% test coverage.
56
35
 
57
36
  ## Synopsis
58
37
 
59
- Start the Ronin console with Ronin Web preloaded:
38
+ ```
39
+ Usage: ronin-web [options] [COMMAND [ARGS...]]
60
40
 
61
- $ ronin-web
41
+ Options:
42
+ -h, --help Print help information
43
+
44
+ Arguments:
45
+ [COMMAND] The command name to run
46
+ [ARGS ...] Additional arguments for the command
47
+
48
+ Commands:
49
+ diff
50
+ help
51
+ html
52
+ irb
53
+ new
54
+ reverse-proxy
55
+ server
56
+ spider
57
+ ```
62
58
 
63
59
  ## Examples
64
60
 
65
61
  Get a web-page:
66
62
 
67
- Web.get('http://www.rubyinside.com/')
63
+ ```ruby
64
+ Web.get('http://www.rubyinside.com/')
65
+ ```
68
66
 
69
67
  Get only the body of the web-page:
70
68
 
71
- Web.get_body('http://www.rubyinside.com/')
69
+ ```ruby
70
+ Web.get_body('http://www.rubyinside.com/')
71
+ ```
72
72
 
73
- Get a [Mechanize agent](http://rubydoc.info/gems/mechanize/1.0.0/Mechanize):
73
+ Get a [Mechanize agent][mechanize]:
74
74
 
75
- agent = Web.agent
75
+ ```ruby
76
+ agent = Web.agent
77
+ ```
76
78
 
77
79
  Parse HTML:
78
80
 
79
- Web.html(open('some_file.html'))
80
- # => <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
81
- # <html>
82
- # <head>
83
- # <script type="text/javascript" src="redirect.js"></script>
84
- # </head>
85
- # </html>
81
+ ```ruby
82
+ HTML.parse(open('some_file.html'))
83
+ # => <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
84
+ # <html>
85
+ # <head>
86
+ # <script type="text/javascript" src="redirect.js"></script>
87
+ # </head>
88
+ # </html>
89
+ ```
86
90
 
87
91
  Build a HTML document:
88
92
 
89
- doc = Web.build_html do
90
- html {
91
- head {
92
- script(:type => 'text/javascript', :src => 'redirect.js')
93
- }
94
- }
95
- end
96
-
97
- puts doc.to_html
98
- # <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
99
- # <html><head><script src="redirect.js" type="text/javascript"></script></head></html>
93
+ ```ruby
94
+ doc = HTML.build do
95
+ html {
96
+ head {
97
+ script(:type => 'text/javascript', :src => 'redirect.js')
98
+ }
99
+ }
100
+ end
100
101
 
101
- Parse XML:
102
+ puts doc.to_html
103
+ # <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
104
+ # <html><head><script src="redirect.js" type="text/javascript"></script></head></html>
105
+ ```
102
106
 
103
- Web.xml(some_text)
104
- # => <?xml version="1.0"?>
105
- # <users>
106
- # <user>
107
- # <name>admin</name>
108
- # <password>0mni</password>
109
- # </user>
110
- # </users>
107
+ Parse XML:
111
108
 
109
+ ```ruby
110
+ XML.parse(some_text)
111
+ # => <?xml version="1.0"?>
112
+ # <users>
113
+ # <user>
114
+ # <name>admin</name>
115
+ # <password>0mni</password>
116
+ # </user>
117
+ # </users>
118
+ ```
112
119
 
113
120
  Build a XML document:
114
121
 
115
- doc = Web.build_xml do
116
- playlist {
117
- mp3 {
118
- file { text('02 THE WAIT.mp3') }
119
- artist { text('Evil Nine') }
120
- track { text('The Wait feat David Autokratz') }
121
- duration { text('1000000000') }
122
- }
123
- }
124
- end
125
-
126
- puts doc.to_xml
127
- # <?xml version="1.0"?>
128
- # <playlist>
129
- # <mp3>
130
- # <file>02 THE WAIT.mp3</file>
131
- # <artist>Evil Nine</artist>
132
- # <track>The Wait feat David Autokratz</track>
133
- # <duration>1000000000</duration>
134
- # </mp3>
135
- # </playlist>
136
-
137
- Spider a web site:
138
-
139
- Web::Spider.host('www.example.com') do |spider|
140
- spider.every_url do |url|
141
- # ...
142
- end
143
-
144
- spider.every_page do |page|
145
- # ...
146
- end
147
- end
148
-
149
- Serve files via a Web Server:
150
-
151
- require 'ronin/web/server'
152
-
153
- Web.server do
154
- file '/opensearch.xml', '/tmp/test.xml'
155
- directory '/download/', '/tmp/download/'
156
- end
157
-
158
- Web.server.get '/test' do
159
- 'Test 1 2 1 2'
160
- end
122
+ ```ruby
123
+ doc = XML.build do
124
+ playlist {
125
+ mp3 {
126
+ file { text('02 THE WAIT.mp3') }
127
+ artist { text('Evil Nine') }
128
+ track { text('The Wait feat David Autokratz') }
129
+ duration { text('1000000000') }
130
+ }
131
+ }
132
+ end
133
+
134
+ puts doc.to_xml
135
+ # <?xml version="1.0"?>
136
+ # <playlist>
137
+ # <mp3>
138
+ # <file>02 THE WAIT.mp3</file>
139
+ # <artist>Evil Nine</artist>
140
+ # <track>The Wait feat David Autokratz</track>
141
+ # <duration>1000000000</duration>
142
+ # </mp3>
143
+ # </playlist>
144
+ ```
161
145
 
162
146
  ## Requirements
163
147
 
164
- * [nokogiri](http://github.com/tenderlove/nokogiri) ~> 1.4
165
- * [libxml2](http://xmlsoft.org/)
166
- * [libxslt1](http://xmlsoft.org/XSLT/)
167
- * [mechanize](http://github.com/tenderlove/mechanize) ~> 1.0
168
- * [spidr](http://github.com/postmodern/spidr) ~> 0.2
169
- * [rack](http://github.com/rack/rack) ~> 1.3
170
- * [sinatra](http://github.com/sinatra/sinatra) ~> 1.2
171
- * [data_paths](http://github.com/postmodern/data_paths) ~> 0.3
172
- * [ronin-support](http://github.com/ronin-ruby/ronin-support) ~> 0.2
173
- * [ronin](http://github.com/ronin-ruby/ronin) ~> 1.1
148
+ * [Ruby] >= 3.0.0
149
+ * [nokogiri] ~> 1.4
150
+ * [libxml2]
151
+ * [libxslt1]
152
+ * [nokogiri-ext] ~> 0.1
153
+ * [nokogiri-diff] ~> 0.2
154
+ * [mechanize] ~> 2.0
155
+ * [open_namespace] ~> 0.4
156
+ * [ronin-support] ~> 1.0
157
+ * [ronin-web-server] ~> 0.1
158
+ * [ronin-web-spider] ~> 0.1
159
+ * [ronin-web-user_agents] ~> 0.1
160
+ * [ronin-core] ~> 0.1
174
161
 
175
162
  ## Install
176
163
 
177
- $ gem install ronin-web
164
+ ```shell
165
+ $ gem install ronin-web
166
+ ```
178
167
 
179
- ## License
168
+ ## Development
169
+
170
+ 1. [Fork It!](https://github.com/ronin-rb/ronin-web/fork)
171
+ 2. Clone It!
172
+ 3. `cd ronin-web`
173
+ 4. `bundle install`
174
+ 5. `git checkout -b my_feature`
175
+ 6. Code It!
176
+ 7. `bundle exec rake spec`
177
+ 8. `git push origin my_feature`
180
178
 
181
- Ronin Web - A Ruby library for Ronin that provides support for web
182
- scraping and spidering functionality.
179
+ ## License
183
180
 
184
- Copyright (c) 2006-2011 Hal Brodigan (postmodern.mod3 at gmail.com)
181
+ ronin-web - A collection of useful web helper methods and commands.
185
182
 
186
- This file is part of Ronin Web.
183
+ Copyright (c) 2006-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
187
184
 
188
- Ronin is free software: you can redistribute it and/or modify
185
+ ronin-web is free software: you can redistribute it and/or modify
189
186
  it under the terms of the GNU General Public License as published by
190
187
  the Free Software Foundation, either version 3 of the License, or
191
188
  (at your option) any later version.
192
189
 
193
- Ronin is distributed in the hope that it will be useful,
190
+ ronin-web is distributed in the hope that it will be useful,
194
191
  but WITHOUT ANY WARRANTY; without even the implied warranty of
195
192
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
196
193
  GNU General Public License for more details.
197
194
 
198
195
  You should have received a copy of the GNU General Public License
199
- along with Ronin. If not, see <http://www.gnu.org/licenses/>.
196
+ along with ronin-web. If not, see <https://www.gnu.org/licenses/>.
197
+
198
+ [ronin-rb]: https://ronin-rb.dev
199
+ [Ruby]: https://www.ruby-lang.org
200
+
201
+ [nokogiri]: https://nokogiri.org/
202
+ [nokogiri-ext]: https://github.com/postmodern/nokogiri-ext#readme
203
+ [nokogiri-diff]: https://github.com/postmodern/nokogiri-diff#readme
204
+ [libxml2]: http://xmlsoft.org/
205
+ [libxslt1]: http://xmlsoft.org/XSLT/
206
+ [mechanize]: https://github.com/sparklemotion/mechanize#readme
207
+ [open_namespace]: https://github.com/postmodern/open_namespace#readme
208
+ [ronin-support]: https://github.com/ronin-rb/ronin-support#readme
209
+ [ronin-core]: https://github.com/ronin-rb/ronin-core#readme
210
+ [ronin-web-server]: https://github.com/ronin-rb/ronin-web-server#readme
211
+ [ronin-web-spider]: https://github.com/ronin-rb/ronin-web-spider#readme
212
+ [ronin-web-user_agents]: https://github.com/ronin-rb/ronin-web-user_agents#readme
213
+ [ronin]: https://github.com/ronin-rb/ronin#readme
214
+ [sinatra]: https://sinatrarb.com/
data/Rakefile CHANGED
@@ -18,13 +18,22 @@ end
18
18
 
19
19
  require 'rake'
20
20
 
21
- require 'ore/tasks'
22
- Ore::Tasks.new
21
+ require 'rubygems/tasks'
22
+ Gem::Tasks.new(sign: {checksum: true, pgp: true})
23
23
 
24
24
  require 'rspec/core/rake_task'
25
25
  RSpec::Core::RakeTask.new
26
- task :test => :spec
26
+ task :test => :spec
27
27
  task :default => :spec
28
28
 
29
+ namespace :spec do
30
+ RSpec::Core::RakeTask.new(:network) do |t|
31
+ t.rspec_opts = '--tag network'
32
+ end
33
+ end
34
+
29
35
  require 'yard'
30
36
  YARD::Rake::YardocTask.new
37
+
38
+ require 'kramdown/man/task'
39
+ Kramdown::Man::Task.new
data/bin/ronin-web CHANGED
@@ -2,26 +2,18 @@
2
2
 
3
3
  require 'rubygems'
4
4
 
5
- root_dir = File.expand_path(File.join(File.dirname(__FILE__),'..'))
6
- if File.directory?(File.join(root_dir,'.git'))
7
- Dir.chdir(root_dir) do |path|
8
- require 'bundler'
9
-
5
+ root = File.expand_path(File.join(File.dirname(__FILE__),'..'))
6
+ if File.directory?(File.join(root,'.git'))
7
+ Dir.chdir(root) do
10
8
  begin
11
- Bundler.setup(:default)
12
- rescue Bundler::BundlerError => e
9
+ require 'bundler/setup'
10
+ rescue LoadError => e
13
11
  warn e.message
14
- warn "Run `bundle install` to install missing gems"
15
- exit e.status_code
12
+ warn "Run `gem install bundler` to install Bundler"
13
+ exit -1
16
14
  end
17
15
  end
18
16
  end
19
17
 
20
- lib_dir = File.join(root_dir,'lib')
21
- $LOAD_PATH << lib_dir unless $LOAD_PATH.include?(lib_dir)
22
-
23
- require 'ronin/ui/console'
24
- require 'ronin/ui/cli/commands/console'
25
-
26
- Ronin::UI::Console.auto_load << 'ronin/web'
27
- Ronin::UI::CLI::Commands::Console.start
18
+ require 'ronin/web/cli'
19
+ Ronin::Web::CLI.start
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'nokogiri'
4
+ require 'open-uri'
5
+
6
+ <%- if @url -%>
7
+ doc = Nokogiri::HTML(URI.open(<%= @url.inspect -%>))
8
+ <%- else -%>
9
+ doc = Nokogiri::HTML(URI.open(ARGV[0]))
10
+ <%- end -%>
11
+
12
+ puts doc.search('//a[@href]')
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'ronin/web/server'
4
+
5
+ class App < Ronin::Web::Server::Base
6
+ <%- if (@host || @port) -%>
7
+
8
+ <%- if @host -%>
9
+ set :host, <%= @host.inspect %>
10
+ <%- end -%>
11
+ <%- if @port -%>
12
+ set :port, <%= @port.inspect %>
13
+ <%- end -%>
14
+ <%- end -%>
15
+
16
+ get '/' do
17
+ "hello world"
18
+ end
19
+
20
+ end
21
+
22
+ App.run! if __FILE__ == $0
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'ronin/web/spider'
4
+
5
+ Ronin::Web::Spider.<%= entry_point_method -%>(<%= entry_point_argument -%>) do |agent|
6
+ <%- unless @callbacks.empty? -%>
7
+ <%- @callbacks.each_with_index do |(method,arguments,yield_arg),index| -%>
8
+ <%- unless arguments.empty? -%>
9
+ agent.<%= method -%>(<%= arguments.map(&:inspect).join(', ') -%>) do |<%= yield_arg -%>|
10
+ # ...
11
+ end
12
+ <%- else -%>
13
+ agent.<%= method -%> do |<%= yield_arg -%>|
14
+ # ...
15
+ end
16
+ <%- end -%>
17
+ <%- unless index == (@callbacks.length-1) -%>
18
+
19
+ <%- end -%>
20
+ <%- end -%>
21
+ <%- else -%>
22
+ agent.every_page do |page|
23
+ puts page.url
24
+ end
25
+ <%- end -%>
26
+ end
@@ -0,0 +1,15 @@
1
+ /Gemfile.lock
2
+ /vendor/bundle
3
+ /.bundle
4
+ .DS_Store
5
+ *.db
6
+ *.log
7
+ *.swp
8
+ *~
9
+ *.sqlite3
10
+ *.db
11
+ *.gz
12
+ *.bz2
13
+ *.xz
14
+ *.tar
15
+ *.zip
@@ -0,0 +1 @@
1
+ <%= @ruby_version -%>
@@ -0,0 +1,11 @@
1
+ FROM ruby:<%= @ruby_version -%>
2
+
3
+ RUN apt-get update -qq -y && gem update bundler
4
+
5
+ WORKDIR /app
6
+ COPY . /app
7
+ RUN bundle install
8
+
9
+ EXPOSE <%= @port -%>
10
+
11
+ CMD ["bundle", "exec", "rackup", "--host", "0.0.0.0", "-p", "<%= @port -%>"]
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'puma', '~> 6.0'
4
+
5
+ # gem 'ronin-support', '~> 1.0' #, github: 'ronin-rb/ronin-support'
6
+ gem 'ronin-web-server', '~> 0.1' #, github: 'ronin-rb/ronin-web-server'
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'ronin/web/server'
5
+ $LOAD_PATH.unshift(File.join(__dir__,'lib'))
6
+
7
+ class App < Ronin::Web::Server::Base
8
+
9
+ get '/' do
10
+ "hello world"
11
+ end
12
+
13
+ end
14
+
15
+ App.run! if __FILE__ == $0
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env rackup
2
+
3
+ require './app'
4
+ run App
@@ -0,0 +1,9 @@
1
+ version: "3.8"
2
+ services:
3
+ app:
4
+ build: .
5
+ command: bundle exec rackup --host 0.0.0.0 -p <%= @port -%>
6
+ ports:
7
+ - "<%= @port -%>:<%= @port -%>"
8
+ volumes:
9
+ - .:/app
data/gemspec.yml CHANGED
@@ -1,28 +1,50 @@
1
1
  name: ronin-web
2
- summary:
3
- A Ruby library for Ronin that provides support for web scraping and
4
- spidering functionality.
2
+ summary: A collection of common web security commands and libraries.
5
3
  description:
6
- Ronin Web is a Ruby library for Ronin that provides support for web
7
- scraping and spidering functionality.
4
+ ronin-web is a Ruby library that provides common web security commands and
5
+ additional libraries.
8
6
 
9
- license: GPL-3
7
+ license: GPL-3.0
10
8
  authors: Postmodern
11
9
  email: postmodern.mod3@gmail.com
12
- homepage: http://github.com/ronin-ruby/ronin-web
10
+ homepage: https://github.com/ronin-rb/ronin-web#readme
13
11
  has_yard: true
14
12
 
13
+ required_ruby_version: ">= 3.0.0"
14
+
15
+ metadata:
16
+ documentation_uri: https://ronin-rb.dev/docs/ronin-web
17
+ source_code_uri: https://github.com/ronin-rb/ronin-web
18
+ bug_tracker_uri: https://github.com/ronin-rb/ronin-web/issues
19
+ changelog_uri: https://github.com/ronin-rb/ronin-web/blob/main/ChangeLog.md
20
+ rubygems_mfa_required: 'true'
21
+
22
+ generated_files:
23
+ - man/ronin-web.1
24
+ - man/ronin-web-diff.1
25
+ - man/ronin-web-html.1
26
+ - man/ronin-web-irb.1
27
+ - man/ronin-web-new.1
28
+ - man/ronin-web-new-nokogiri.1
29
+ - man/ronin-web-new-server.1
30
+ - man/ronin-web-new-spider.1
31
+ - man/ronin-web-new-webapp.1
32
+ - man/ronin-web-server.1
33
+ - man/ronin-web-spider.1
34
+ - man/ronin-web-reverse-proxy.1
35
+
15
36
  dependencies:
16
37
  nokogiri: ~> 1.4
17
- mechanize: ~> 1.0
18
- spidr: ~> 0.2
19
- rack: ~> 1.3
20
- sinatra: ~> 1.2
21
- data_paths: ~> 0.3
38
+ nokogiri-ext: ~> 0.1
39
+ nokogiri-diff: ~> 0.2
40
+ mechanize: ~> 2.0
41
+ open_namespace: ~> 0.4
22
42
  # Ronin dependencies:
23
- ronin-support: ~> 0.2
24
- ronin: ~> 1.1
43
+ ronin-support: ~> 1.0.0.beta2
44
+ ronin-web-server: ~> 0.1.0.beta1
45
+ ronin-web-spider: ~> 0.1.0.beta2
46
+ ronin-web-user_agents: ~> 0.1.0.beta1
47
+ ronin-core: ~> 0.1.0.beta1
25
48
 
26
49
  development_dependencies:
27
- bundler: ~> 1.0.10
28
- yard: ~> 0.7.0
50
+ bundler: ~> 2.0
@@ -0,0 +1,36 @@
1
+ #
2
+ # ronin-web - A collection of useful web helper methods and commands.
3
+ #
4
+ # Copyright (c) 2006-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ #
6
+ # ronin-web is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # ronin-web is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with ronin-web. If not, see <https://www.gnu.org/licenses/>.
18
+ #
19
+
20
+ require 'ronin/web/root'
21
+
22
+ require 'ronin/core/cli/command'
23
+
24
+ module Ronin
25
+ module Web
26
+ class CLI
27
+ class Command < Core::CLI::Command
28
+
29
+ man_dir File.join(ROOT,'man')
30
+
31
+ bug_report_url 'https://github.com/ronin-rb/ronin-web/issues/new'
32
+
33
+ end
34
+ end
35
+ end
36
+ end