ronin-web-server 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b3dee3ef506c739a9e75e0e5055d5554759de129367000a5b87619e801d4fd2c
4
- data.tar.gz: 1695a44b07a156efff8b0611b148b585511fc9d3d844ad18b7834295e9bc3ec0
3
+ metadata.gz: 9155c2a628bcc7700944fd70ea163cb06470f6de45820c214731b4e90d911598
4
+ data.tar.gz: d9f67cd7014a6ac39fdaf6587ecde76ca44f9a398898ab1ee215fa900518ba33
5
5
  SHA512:
6
- metadata.gz: e192f8ec835cb380ef519ed2b6ddfba88a40b8213fd1fa3f7d5df9b20f6b23cc75fe21b85bea0663fa52a0009a33b9c5b011697c8fc404760cdee5ed11f2a97e
7
- data.tar.gz: 06a4928fd050e6c85fc17195739b9c9233ef6c7547e8532d2893fa2257276194e25bb3ac54f92a46fa62f225b51b021ccee84c6426203e4627e777111a60eeea
6
+ metadata.gz: ceb2d0e49978d96730d42b54a5a67a29c39a57c75f20f3bfbe1789c49aa01fc45474102b072abd244b49b92b4cdcb61d1170f1fe13de2582e2ffb25f4382ed5e
7
+ data.tar.gz: e024503b093c9c6e9a8ed8db5c6ee752c4d2fb825a50a0f5b08651707f2ae52d6eb9d493a4950566abc7f7263ffe044b180bb59a9f2bcf74cf468d68c2bf2793
@@ -12,11 +12,13 @@ jobs:
12
12
  - '3.0'
13
13
  - '3.1'
14
14
  - '3.2'
15
+ - '3.3'
16
+ - '3.4'
15
17
  - jruby
16
18
  - truffleruby
17
19
  name: Ruby ${{ matrix.ruby }}
18
20
  steps:
19
- - uses: actions/checkout@v2
21
+ - uses: actions/checkout@v4
20
22
  - name: Set up Ruby
21
23
  uses: ruby/setup-ruby@v1
22
24
  with:
@@ -31,7 +33,7 @@ jobs:
31
33
  rubocop:
32
34
  runs-on: ubuntu-latest
33
35
  steps:
34
- - uses: actions/checkout@v2
36
+ - uses: actions/checkout@v4
35
37
  - name: Set up Ruby
36
38
  uses: ruby/setup-ruby@v1
37
39
  with:
data/.rubocop.yml CHANGED
@@ -3,152 +3,12 @@ AllCops:
3
3
  SuggestExtensions: false
4
4
  TargetRubyVersion: 3.1
5
5
 
6
- #
7
- # our rules
8
- #
6
+ inherit_gem:
7
+ rubocop-ronin: rubocop.yml
9
8
 
10
- Layout/FirstArrayElementIndentation: { Exclude: ['spec/**/*'] }
11
- Layout/LineLength: { Enabled: false }
12
- Layout/SpaceAroundEqualsInParameterDefault: { EnforcedStyle: no_space }
13
- Lint/ConstantDefinitionInBlock: { Exclude: ['spec/**/*'] }
14
- Metrics: { Enabled: false }
15
- Style/SymbolArray: { EnforcedStyle: brackets }
16
- Style/IfInsideElse: { Enabled: false } # Offense count: 1
17
- Style/PercentLiteralDelimiters:
18
- Enabled: true
19
- PreferredDelimiters:
20
- default: '{}'
21
- '%i': '[]'
22
- '%I': '[]'
23
- '%w': '[]'
24
- '%W': '[]'
25
- Style/UnlessElse: { Enabled: false }
26
- Bundler/OrderedGems: { Enabled: false }
27
- Style/CaseEquality: { Exclude: ['lib/ronin/web/server/conditions.rb'] }
28
- Style/Next: { Enabled: false }
29
- Style/HashSyntax: { Enabled: false }
30
- Naming/BlockForwarding: { Enabled: false }
31
- Lint/ReturnInVoidContext: { Enabled: false }
32
- Gemspec/DeprecatedAttributeAssignment: { Enabled: false }
33
- Layout/EmptyLineAfterMagicComment: { Enabled: false }
34
-
35
- #
36
- # rules that are in flux
37
9
  #
38
-
39
- # consider enabling these and autocorrecting?
40
- # Layout/SpaceAfterComma
41
- # Layout/SpaceAroundKeyword
42
- # Layout/SpaceBeforeComma
43
- # Layout/SpaceInsideHashLiteralBraces
44
- # Layout/SpaceInsideParens
45
- # Layout/TrailingWhitespace
46
- # Lint/UnreachableLoop
47
- # Lint/UnusedBlockArgument
48
- # Style/ClassCheck
49
- # Style/Documentation
50
- # Style/ExpandPathArguments
51
- # Style/GlobalStdStream
52
- # Style/HashSyntax
53
- # Style/KeywordParametersOrder
54
- # Style/MethodCallWithoutArgsParentheses
55
- # Style/MutableConstant
56
- # Style/QuotedSymbols: { EnforcedStyle: double_quotes }
57
- # Style/RedundantReturn
58
- # Style/SafeNavigation
59
- # Style/SpecialGlobalVars
60
- # Style/StringLiterals: { EnforcedStyle: double_quotes }
61
- # Style/WordArray
62
-
63
- # these have been fixed
64
- # Gemspec/DuplicatedAssignment: { Enabled: false } # Offense count: 1
65
- # Layout/ElseAlignment: { Enabled: false } # Offense count: 1
66
- # Layout/EndAlignment: { Enabled: false } # Offense count: 1
67
- # Lint/DuplicateMethods: { Enabled: false } # Offense count: 1
68
- # Lint/UselessAssignment: { Enabled: false } # Offense count: 1
69
- # Style/Encoding: { Enabled: false } # Offense count: 2
70
- # Style/RedundantBegin: { Enabled: false } # Offense count: 2
71
- # Style/RedundantInterpolation: { Enabled: false } # Offense count: 1
72
- # Style/TrailingCommaInArrayLiteral: { Enabled: false } # Offense count: 1
73
-
10
+ # ronin-web-server specific exceptions
74
11
  #
75
- # This list was generated with:
76
- # bundle exec rubocop --auto-gen-config --exclude-limit 1
77
- #
78
-
79
- # > 10 violations
80
- Layout/AssignmentIndentation: { Enabled: false } # Offense count: 11
81
- Layout/EmptyLinesAroundClassBody: { Enabled: false } # Offense count: 76
82
- Layout/HashAlignment: { Enabled: false } # Offense count: 28
83
- Layout/SpaceAfterComma: { Enabled: false } # Offense count: 141
84
- Layout/SpaceInsideHashLiteralBraces: { Enabled: false } # Offense count: 57
85
- Layout/TrailingWhitespace: { Enabled: false } # Offense count: 50
86
- Naming/RescuedExceptionsVariableName: { Enabled: false } # Offense count: 11
87
- Style/BlockDelimiters: { Enabled: false } # Offense count: 17
88
- Style/ClassCheck: { Enabled: false } # Offense count: 10
89
- Style/ClassEqualityComparison: { Enabled: false } # Offense count: 16
90
- Style/FrozenStringLiteralComment: { Enabled: false } # Offense count: 77
91
- Style/GlobalStdStream: { Enabled: false } # Offense count: 13
92
- Style/GuardClause: { Enabled: false } # Offense count: 10
93
- Style/IfUnlessModifier: { Enabled: false } # Offense count: 13
94
- Style/MethodCallWithoutArgsParentheses: { Enabled: false } # Offense count: 10
95
- Style/SpecialGlobalVars: { Enabled: false } # Offense count: 28
96
- Style/StringLiterals: { Enabled: false } # Offense count: 774
97
- Lint/ElseLayout: { Enabled: false } # Offense count: 22
98
-
99
- # < 10 violations
100
- Layout/EmptyLinesAroundModuleBody: { Enabled: false } # Offense count: 5
101
- Layout/ExtraSpacing: { Enabled: false } # Offense count: 6
102
- Layout/FirstHashElementIndentation: { Enabled: false } # Offense count: 4
103
- Layout/ParameterAlignment: { Enabled: false } # Offense count: 9
104
- Layout/SpaceAroundKeyword: { Enabled: false } # Offense count: 7
105
- Layout/SpaceBeforeComma: { Enabled: false } # Offense count: 4
106
- Layout/SpaceInsideParens: { Enabled: false } # Offense count: 4
107
- Lint/EmptyClass: { Enabled: false } # Offense count: 3
108
- Lint/SuppressedException: { Enabled: false } # Offense count: 4
109
- Lint/UnusedMethodArgument: { Enabled: false } # Offense count: 5
110
- Style/AccessorGrouping: { Enabled: false } # Offense count: 7
111
- Style/Documentation: { Enabled: false } # Offense count: 3
112
- Style/ExpandPathArguments: { Enabled: false } # Offense count: 8
113
- Style/KeywordParametersOrder: { Enabled: false } # Offense count: 8
114
- Style/Lambda: { Enabled: false } # Offense count: 3
115
- Style/MutableConstant: { Enabled: false } # Offense count: 4
116
- Style/RaiseArgs: { Enabled: false } # Offense count: 4
117
- Style/RedundantReturn: { Enabled: false } # Offense count: 7
118
- Style/SafeNavigation: { Enabled: false } # Offense count: 5
119
- Style/StringConcatenation: { Enabled: false } # Offense count: 8
120
- Style/WordArray: { Enabled: false } # Offense count: 4
121
-
122
- # 1 or 2 violations
123
- Layout/ArgumentAlignment: { Enabled: false } # Offense count: 1
124
- Layout/BlockAlignment: { Enabled: false } # Offense count: 1
125
- Layout/IndentationWidth: { Enabled: false } # Offense count: 2
126
- Layout/SpaceAroundOperators: { Enabled: false } # Offense count: 1
127
- Layout/SpaceBeforeBlockBraces: { Enabled: false } # Offense count: 1
128
- Lint/MissingSuper: { Enabled: false } # Offense count: 2
129
- Lint/RescueException: { Enabled: false } # Offense count: 1
130
- Lint/UnreachableLoop: { Enabled: false } # Offense count: 1
131
- Lint/UnusedBlockArgument: { Enabled: false } # Offense count: 1
132
- Naming/MethodParameterName: { Enabled: false } # Offense count: 1
133
- Style/EmptyMethod: { Enabled: false } # Offense count: 2
134
- Style/HashConversion: { Enabled: false } # Offense count: 1
135
- Style/MultilineMemoization: { Enabled: false } # Offense count: 1
136
- Style/NumericPredicate: { Enabled: false } # Offense count: 1
137
- Style/OptionalArguments: { Enabled: false } # Offense count: 1
138
- Style/ParenthesesAroundCondition: { Enabled: false } # Offense count: 1
139
- Style/PreferredHashMethods: { Enabled: false } # Offense count: 1
140
- Style/QuotedSymbols: { Enabled: false } # Offense count: 1
141
- Style/RedundantException: { Enabled: false } # Offense count: 1
142
- Style/RedundantRegexpEscape: { Enabled: false } # Offense count: 1
143
- Style/RegexpLiteral: { Enabled: false } # Offense count: 1
144
- Style/RescueStandardError: { Enabled: false } # Offense count: 1
145
- Style/SoleNestedConditional: { Enabled: false } # Offense count: 1
146
- Style/TrailingCommaInHashLiteral: { Enabled: false } # Offense count: 2
147
-
148
- # rubocop cannot tell that rubygems_mfa_required is enabled in gemspec.yml
149
- Gemspec/RequireMFA: { Enabled: false }
150
-
151
- # make an exception for our gemspec code
152
- Gemspec/DuplicatedAssignment:
12
+ Style/CaseEquality:
153
13
  Exclude:
154
- - 'ronin-web-server.gemspec'
14
+ - 'lib/ronin/web/server/conditions.rb'
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-3.1
1
+ ruby-3.3
data/ChangeLog.md CHANGED
@@ -1,4 +1,16 @@
1
- ### 0.1.0 / 2023-XX-XX
1
+ ### 0.1.2 / 2025-02-14
2
+
3
+ * Use `require_relative` to improve load times.
4
+ * Documentation improvements.
5
+
6
+ ### 0.1.1 / 2023-03-01
7
+
8
+ * Correctly set the `bind` setting in {Ronin::Web::Server::Base} to ensure it
9
+ will always listen on `0.0.0.0`.
10
+ * Allow `directory` and `mount` to accept directory paths ending with a `/`.
11
+ * Increased test coverage.
12
+
13
+ ### 0.1.0 / 2023-02-01
2
14
 
3
15
  * Extracted and refactored from [ronin-web](https://github.com/ronin-rb/ronin-web/tree/v0.3.0.rc1).
4
16
  * Relicensed as LGPL-3.0.
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  gemspec
@@ -28,8 +30,9 @@ group :development do
28
30
  gem 'yard', '~> 0.9'
29
31
  gem 'yard-spellcheck', require: false
30
32
 
31
- gem 'dead_end', require: false
32
- gem 'sord', require: false, platform: :mri
33
- gem 'stackprof', require: false, platform: :mri
34
- gem 'rubocop', require: false
33
+ gem 'dead_end', require: false
34
+ gem 'sord', require: false, platform: :mri
35
+ gem 'stackprof', require: false, platform: :mri
36
+ gem 'rubocop', require: false, platform: :mri
37
+ gem 'rubocop-ronin', require: false, platform: :mri
35
38
  end
data/README.md CHANGED
@@ -9,7 +9,6 @@
9
9
  * [Issues](https://github.com/ronin-rb/ronin-web-server/issues)
10
10
  * [Documentation](https://ronin-rb.dev/docs/ronin-web-server/frames)
11
11
  * [Discord](https://discord.gg/6WAb3PsVX9) |
12
- [Twitter](https://twitter.com/ronin_rb) |
13
12
  [Mastodon](https://infosec.exchange/@ronin_rb)
14
13
 
15
14
  ## Description
@@ -59,7 +58,7 @@ security research and development.
59
58
  * [os_version][docs-os_version] - matches the OS version from the `User-Agent`
60
59
  header of the request.
61
60
  * Has 97% documentation coverage.
62
- * Has 85% test coverage.
61
+ * Has 90% test coverage.
63
62
 
64
63
  [docs-any]: https://ronin-rb.dev/docs/ronin-web-server/Ronin/Web/Server/Routing/ClassMethods.html#any-instance_method
65
64
  [docs-default]: https://ronin-rb.dev/docs/ronin-web-server/Ronin/Web/Server/Routing/ClassMethods.html#default-instance_method
@@ -183,7 +182,7 @@ gem 'ronin-web-server', '~> 0.1'
183
182
 
184
183
  ronin-web-server - A custom Ruby web server based on Sinatra.
185
184
 
186
- Copyright (c) 2006-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
185
+ Copyright (c) 2006-2025 Hal Brodigan (postmodern.mod3 at gmail.com)
187
186
 
188
187
  ronin-web-server is free software: you can redistribute it and/or modify
189
188
  it under the terms of the GNU Lesser General Public License as published
data/Rakefile CHANGED
@@ -1,4 +1,4 @@
1
- require 'rubygems'
1
+ # frozen_string_literal: true
2
2
 
3
3
  begin
4
4
  require 'bundler'
data/gemspec.yml CHANGED
@@ -4,7 +4,7 @@ description: |
4
4
  ronin-web-server is a custom Ruby web server based on Sinatra tailored for
5
5
  security research and development.
6
6
 
7
- license: LGPL-3.0
7
+ license: LGPL-3.0-or-later
8
8
  authors: Postmodern
9
9
  email: postmodern.mod3@gmail.com
10
10
  homepage: https://ronin-rb.dev/
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # ronin-web-server - A custom Ruby web server based on Sinatra.
4
4
  #
5
- # Copyright (c) 2006-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ # Copyright (c) 2006-2025 Hal Brodigan (postmodern.mod3 at gmail.com)
6
6
  #
7
7
  # ronin-web-server is free software: you can redistribute it and/or modify
8
8
  # it under the terms of the GNU Lesser General Public License as published
@@ -18,7 +18,7 @@
18
18
  # along with ronin-web-server. If not, see <https://www.gnu.org/licenses/>.
19
19
  #
20
20
 
21
- require 'ronin/web/server/base'
21
+ require_relative 'base'
22
22
 
23
23
  module Ronin
24
24
  module Web
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # ronin-web-server - A custom Ruby web server based on Sinatra.
4
4
  #
5
- # Copyright (c) 2006-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ # Copyright (c) 2006-2025 Hal Brodigan (postmodern.mod3 at gmail.com)
6
6
  #
7
7
  # ronin-web-server is free software: you can redistribute it and/or modify
8
8
  # it under the terms of the GNU Lesser General Public License as published
@@ -18,11 +18,11 @@
18
18
  # along with ronin-web-server. If not, see <https://www.gnu.org/licenses/>.
19
19
  #
20
20
 
21
- require 'ronin/web/server/request'
22
- require 'ronin/web/server/response'
23
- require 'ronin/web/server/routing'
24
- require 'ronin/web/server/helpers'
25
- require 'ronin/web/server/conditions'
21
+ require_relative 'request'
22
+ require_relative 'response'
23
+ require_relative 'routing'
24
+ require_relative 'helpers'
25
+ require_relative 'conditions'
26
26
 
27
27
  require 'rack'
28
28
  require 'sinatra/base'
@@ -94,28 +94,28 @@ module Ronin
94
94
  # based on the OS version within the `User-Agent` header.
95
95
  #
96
96
  # ## Examples
97
- #
97
+ #
98
98
  # require 'ronin/web/server'
99
- #
99
+ #
100
100
  # class App < Ronin::Web::Server::Base
101
- #
101
+ #
102
102
  # # mount a file
103
103
  # file '/sitemap.xml', './files/sitemap.xml'
104
104
  #
105
105
  # # mount a directory
106
106
  # directory '/downloads/', '/tmp/downloads/'
107
- #
107
+ #
108
108
  # get '/' do
109
109
  # # renders views/index.erb
110
110
  # erb :index
111
111
  # end
112
- #
112
+ #
113
113
  # get '/test' do
114
114
  # "raw text here"
115
115
  # end
116
- #
116
+ #
117
117
  # end
118
- #
118
+ #
119
119
  # App.run!
120
120
  #
121
121
  class Base < Sinatra::Base
@@ -132,7 +132,7 @@ module Ronin
132
132
 
133
133
  use Rack::UserAgent
134
134
 
135
- set :host, DEFAULT_HOST
135
+ set :bind, DEFAULT_HOST
136
136
  set :port, DEFAULT_PORT
137
137
 
138
138
  before do
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # ronin-web-server - A custom Ruby web server based on Sinatra.
4
4
  #
5
- # Copyright (c) 2006-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ # Copyright (c) 2006-2025 Hal Brodigan (postmodern.mod3 at gmail.com)
6
6
  #
7
7
  # ronin-web-server is free software: you can redistribute it and/or modify
8
8
  # it under the terms of the GNU Lesser General Public License as published
@@ -279,7 +279,7 @@ module Ronin
279
279
  #
280
280
  # @example Match versions of Chrome with known vulnerabilities:
281
281
  # vuln_versions = File.readlines('chrome_versions.txt', chomp: true)
282
- #
282
+ #
283
283
  # get '/path', browser: :chrome, browser_version: vuln_versions do
284
284
  # # ...
285
285
  # end
@@ -415,7 +415,7 @@ module Ronin
415
415
  #
416
416
  # @example Match versions of Android with known vulnerabilities:
417
417
  # vuln_versions = File.readlines('android_versions.txt', chomp: true)
418
- #
418
+ #
419
419
  # get '/path', os: :android, os_version: vuln_versions do
420
420
  # # ...
421
421
  # end
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # ronin-web-server - A custom Ruby web server based on Sinatra.
4
4
  #
5
- # Copyright (c) 2006-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ # Copyright (c) 2006-2025 Hal Brodigan (postmodern.mod3 at gmail.com)
6
6
  #
7
7
  # ronin-web-server is free software: you can redistribute it and/or modify
8
8
  # it under the terms of the GNU Lesser General Public License as published
@@ -28,7 +28,6 @@ module Ronin
28
28
  # Provides Sinatra routing and helper methods.
29
29
  #
30
30
  module Helpers
31
-
32
31
  include Rack::Utils
33
32
  include Sinatra::Helpers
34
33
 
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # ronin-web-server - A custom Ruby web server based on Sinatra.
4
4
  #
5
- # Copyright (c) 2006-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ # Copyright (c) 2006-2025 Hal Brodigan (postmodern.mod3 at gmail.com)
6
6
  #
7
7
  # ronin-web-server is free software: you can redistribute it and/or modify
8
8
  # it under the terms of the GNU Lesser General Public License as published
@@ -63,6 +63,7 @@ module Ronin
63
63
  if name =~ /^HTTP_/
64
64
  header_words = name[5..].split('_')
65
65
  header_words.each(&:capitalize!)
66
+
66
67
  header_name = header_words.join('-')
67
68
 
68
69
  headers[header_name] = value
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # ronin-web-server - A custom Ruby web server based on Sinatra.
4
4
  #
5
- # Copyright (c) 2006-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ # Copyright (c) 2006-2025 Hal Brodigan (postmodern.mod3 at gmail.com)
6
6
  #
7
7
  # ronin-web-server is free software: you can redistribute it and/or modify
8
8
  # it under the terms of the GNU Lesser General Public License as published
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # ronin-web-server - A custom Ruby web server based on Sinatra.
4
4
  #
5
- # Copyright (c) 2006-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ # Copyright (c) 2006-2025 Hal Brodigan (postmodern.mod3 at gmail.com)
6
6
  #
7
7
  # ronin-web-server is free software: you can redistribute it and/or modify
8
8
  # it under the terms of the GNU Lesser General Public License as published
@@ -18,7 +18,7 @@
18
18
  # along with ronin-web-server. If not, see <https://www.gnu.org/licenses/>.
19
19
  #
20
20
 
21
- require 'ronin/web/server/request'
21
+ require_relative '../request'
22
22
 
23
23
  module Ronin
24
24
  module Web
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # ronin-web-server - A custom Ruby web server based on Sinatra.
4
4
  #
5
- # Copyright (c) 2006-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ # Copyright (c) 2006-2025 Hal Brodigan (postmodern.mod3 at gmail.com)
6
6
  #
7
7
  # ronin-web-server is free software: you can redistribute it and/or modify
8
8
  # it under the terms of the GNU Lesser General Public License as published
@@ -18,7 +18,7 @@
18
18
  # along with ronin-web-server. If not, see <https://www.gnu.org/licenses/>.
19
19
  #
20
20
 
21
- require 'ronin/web/server/response'
21
+ require_relative '../response'
22
22
 
23
23
  module Ronin
24
24
  module Web
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # ronin-web-server - A custom Ruby web server based on Sinatra.
4
4
  #
5
- # Copyright (c) 2006-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ # Copyright (c) 2006-2025 Hal Brodigan (postmodern.mod3 at gmail.com)
6
6
  #
7
7
  # ronin-web-server is free software: you can redistribute it and/or modify
8
8
  # it under the terms of the GNU Lesser General Public License as published
@@ -18,10 +18,10 @@
18
18
  # along with ronin-web-server. If not, see <https://www.gnu.org/licenses/>.
19
19
  #
20
20
 
21
- require 'ronin/web/server/reverse_proxy/request'
22
- require 'ronin/web/server/reverse_proxy/response'
23
- require 'ronin/support/network/http'
21
+ require_relative 'reverse_proxy/request'
22
+ require_relative 'reverse_proxy/response'
24
23
 
24
+ require 'ronin/support/network/http'
25
25
  require 'rack'
26
26
 
27
27
  module Ronin
@@ -38,7 +38,7 @@ module Ronin
38
38
  # proxy.on_request do |request|
39
39
  # # ...
40
40
  # end
41
- #
41
+ #
42
42
  # proxy.on_response do |response|
43
43
  # # ...
44
44
  # end
@@ -48,9 +48,9 @@ module Ronin
48
48
  # ### App
49
49
  #
50
50
  # class App < Ronin::Web::Server::Base
51
- #
51
+ #
52
52
  # mount '/signin', Ronin::Web::Server::ReverseProxy.new
53
- #
53
+ #
54
54
  # end
55
55
  #
56
56
  # @api public
@@ -179,10 +179,11 @@ module Ronin
179
179
  headers = request.headers
180
180
  body = request.body.read
181
181
 
182
- http = connection_for(host,port, ssl: ssl)
182
+ http = connection_for(host,port, ssl: ssl)
183
183
  http_response = http.request(method,path, query: query,
184
184
  headers: headers,
185
185
  body: body)
186
+
186
187
  response_headers = {}
187
188
 
188
189
  http_response.each_capitalized do |name,value|
@@ -228,12 +229,12 @@ module Ronin
228
229
  def run!(host: DEFAULT_HOST, port: DEFAULT_PORT, server: DEFAULT_SERVER,
229
230
  **rack_options)
230
231
  server = Rack::Server.new(
231
- app: self,
232
- server: server,
233
- Host: host,
234
- Port: port,
235
- **rack_options
236
- )
232
+ app: self,
233
+ server: server,
234
+ Host: host,
235
+ Port: port,
236
+ **rack_options
237
+ )
237
238
 
238
239
  server.start do |handler|
239
240
  trap(:INT) { quit!(server,handler) }
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # ronin-web-server - A custom Ruby web server based on Sinatra.
4
4
  #
5
- # Copyright (c) 2006-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ # Copyright (c) 2006-2025 Hal Brodigan (postmodern.mod3 at gmail.com)
6
6
  #
7
7
  # ronin-web-server is free software: you can redistribute it and/or modify
8
8
  # it under the terms of the GNU Lesser General Public License as published
@@ -84,7 +84,7 @@ module Ronin
84
84
  # default do
85
85
  # status 200
86
86
  # content_type :html
87
- #
87
+ #
88
88
  # %{
89
89
  # <html>
90
90
  # <body>
@@ -120,7 +120,7 @@ module Ronin
120
120
  #
121
121
  def basic_auth(auth_user,auth_password, realm: 'Restricted')
122
122
  use Rack::Auth::Basic, realm do |user,password|
123
- user == auth_user && passwrd == auth_password
123
+ user == auth_user && password == auth_password
124
124
  end
125
125
  end
126
126
 
@@ -145,10 +145,10 @@ module Ronin
145
145
  #
146
146
  # Hosts the contents of a file.
147
147
  #
148
- # @param [String, Regexp] remote_path
148
+ # @param [String, Regexp] path
149
149
  # The path the web server will host the file at.
150
150
  #
151
- # @param [String] local_path
151
+ # @param [String] local_file
152
152
  # The path to the local file.
153
153
  #
154
154
  # @param [Hash{Symbol => Object}] conditions
@@ -159,17 +159,17 @@ module Ronin
159
159
  #
160
160
  # @api public
161
161
  #
162
- def file(remote_path,local_path,conditions={})
163
- get(remote_path,conditions) { send_file(local_path) }
162
+ def file(path,local_file,conditions={})
163
+ get(path,conditions) { send_file(local_file) }
164
164
  end
165
165
 
166
166
  #
167
167
  # Hosts the contents of the directory.
168
168
  #
169
- # @param [String] remote_path
169
+ # @param [String] path
170
170
  # The path the web server will host the directory at.
171
171
  #
172
- # @param [String] local_path
172
+ # @param [String] local_dir
173
173
  # The path to the local directory.
174
174
  #
175
175
  # @param [Hash{Symbol => Object}] conditions
@@ -180,10 +180,11 @@ module Ronin
180
180
  #
181
181
  # @api public
182
182
  #
183
- def directory(remote_path,local_path,conditions={})
184
- dir = Rack::File.new(local_path)
183
+ def directory(path,local_dir,conditions={})
184
+ path = path.chomp('/')
185
+ dir = Rack::File.new(local_dir)
185
186
 
186
- get("#{remote_path}/*",conditions) do |sub_path|
187
+ get("#{path}/*",conditions) do |sub_path|
187
188
  response = dir.call(env.merge('PATH_INFO' => "/#{sub_path}"))
188
189
 
189
190
  if response[0] == 200 then response
@@ -207,7 +208,7 @@ module Ronin
207
208
  # @api public
208
209
  #
209
210
  def public_dir(path,conditions={})
210
- directory('',path,conditions)
211
+ directory('/',path,conditions)
211
212
  end
212
213
 
213
214
  #
@@ -250,6 +251,8 @@ module Ronin
250
251
  # @api public
251
252
  #
252
253
  def mount(dir,app,conditions={})
254
+ dir = dir.chomp('/')
255
+
253
256
  any("#{dir}/?*",conditions) do |sub_path|
254
257
  app.call(env.merge('PATH_INFO' => "/#{sub_path}"))
255
258
  end
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # ronin-web-server - A custom Ruby web server based on Sinatra.
4
4
  #
5
- # Copyright (c) 2006-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ # Copyright (c) 2006-2025 Hal Brodigan (postmodern.mod3 at gmail.com)
6
6
  #
7
7
  # ronin-web-server is free software: you can redistribute it and/or modify
8
8
  # it under the terms of the GNU Lesser General Public License as published
@@ -22,7 +22,7 @@ module Ronin
22
22
  module Web
23
23
  module Server
24
24
  # ronin-web-server version
25
- VERSION = '0.1.0'
25
+ VERSION = '0.1.2'
26
26
  end
27
27
  end
28
28
  end
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # ronin-web-server - A custom Ruby web server based on Sinatra.
4
4
  #
5
- # Copyright (c) 2006-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ # Copyright (c) 2006-2025 Hal Brodigan (postmodern.mod3 at gmail.com)
6
6
  #
7
7
  # ronin-web-server is free software: you can redistribute it and/or modify
8
8
  # it under the terms of the GNU Lesser General Public License as published
@@ -18,10 +18,15 @@
18
18
  # along with ronin-web-server. If not, see <https://www.gnu.org/licenses/>.
19
19
  #
20
20
 
21
- require 'ronin/web/server/base'
22
- require 'ronin/web/server/app'
21
+ require_relative 'server/base'
22
+ require_relative 'server/app'
23
23
 
24
24
  module Ronin
25
+ #
26
+ # Namespace for [ronin-web].
27
+ #
28
+ # [ronin-web]: https://github.com/ronin-rb/ronin-web#readme
29
+ #
25
30
  module Web
26
31
  #
27
32
  # Returns the Ronin Web Server.
@@ -29,6 +34,15 @@ module Ronin
29
34
  # @param [Hash] options
30
35
  # Additional options.
31
36
  #
37
+ # @option options [String] :host
38
+ # The host the server will listen on.
39
+ #
40
+ # @option options [Integer] :port
41
+ # The port the server will bind to.
42
+ #
43
+ # @option options [String] :server
44
+ # The Web Server to run on.
45
+ #
32
46
  # @yield [server]
33
47
  # If a block is given, it will be passed the current web server.
34
48
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'yaml'
2
4
 
3
5
  Gem::Specification.new do |gem|
@@ -20,7 +22,7 @@ Gem::Specification.new do |gem|
20
22
  gem.homepage = gemspec['homepage']
21
23
  gem.metadata = gemspec['metadata'] if gemspec['metadata']
22
24
 
23
- glob = lambda { |patterns| gem.files & Dir[*patterns] }
25
+ glob = ->(patterns) { gem.files & Dir[*patterns] }
24
26
 
25
27
  gem.files = `git ls-files`.split($/)
26
28
  gem.files = glob[gemspec['files']] if gemspec['files']
@@ -44,7 +46,7 @@ Gem::Specification.new do |gem|
44
46
  gem.required_rubygems_version = gemspec['required_rubygems_version']
45
47
  gem.post_install_message = gemspec['post_install_message']
46
48
 
47
- split = lambda { |string| string.split(/,\s*/) }
49
+ split = ->(string) { string.split(/,\s*/) }
48
50
 
49
51
  if gemspec['dependencies']
50
52
  gemspec['dependencies'].each do |name,versions|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ronin-web-server
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Postmodern
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-01 00:00:00.000000000 Z
11
+ date: 2025-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: webrick
@@ -133,7 +133,7 @@ files:
133
133
  - ronin-web-server.gemspec
134
134
  homepage: https://ronin-rb.dev/
135
135
  licenses:
136
- - LGPL-3.0
136
+ - LGPL-3.0-or-later
137
137
  metadata:
138
138
  documentation_uri: https://ronin-rb.dev/docs/ronin-web-server
139
139
  source_code_uri: https://github.com/postmodern/ronin-web-server
@@ -155,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
155
155
  - !ruby/object:Gem::Version
156
156
  version: '0'
157
157
  requirements: []
158
- rubygems_version: 3.3.26
158
+ rubygems_version: 3.5.22
159
159
  signing_key:
160
160
  specification_version: 4
161
161
  summary: A custom Ruby web server based on Sinatra.