ronin-listener-http 0.1.0.rc2 → 0.1.0

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: 5a7b158cba029bddb265109da882afaad58f783eb84970ca34645bce11ace7d2
4
- data.tar.gz: a10a9400d9770333391173cf362f791beb985cc2827790382db1ace979be8464
3
+ metadata.gz: c30560b1a128571b6624cc2d466dc1508395df6f2630cdc09b6012cee5e79fa4
4
+ data.tar.gz: fec1870e02c243c885c72a7eea34207ee9478a96931838a01d22811533993de1
5
5
  SHA512:
6
- metadata.gz: 593a95c60b3c449a445702a7583cd79777504cbf0238ab0190a73f66b8920b45ca6926c0fbd5adeeccfc0c5a09ae1edd968a2dfa1752bc158a75cf608491ac50
7
- data.tar.gz: 77fe8072868e85dc4de55b2418704b6f2dbbb42744e111a522f7385ba539166868cb5f7a09cecf72ad92ecea199e8dc79cc23538e0d87cbf3c10b03fb966ed38
6
+ metadata.gz: '09095fbcd472e192d14b1828db9b7c5e66a4a2a9f13ea0d55303eda62219dba71105094fcc16dba99c7cee7930b3584ecb558f354376a40333dd1bd4b6bb0bbc'
7
+ data.tar.gz: 3713e12f0a6b5ed8e2a50b927f7ae2e01b89275e5c1439e0e5c1cff83c9441fb8cb8ccc3e4d34040181f74dfc7d738c10897e89b749385a32a1f57e5ca6c1774
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-3.1
1
+ ruby-3.3
data/ChangeLog.md CHANGED
@@ -1,4 +1,4 @@
1
- ### 0.1.0 / 2024-XX-XX
1
+ ### 0.1.0 / 2024-07-22
2
2
 
3
3
  * Initial release:
4
4
  * Supports receiving HTTP requests.
@@ -44,6 +44,11 @@ module Ronin
44
44
  # @return [String]
45
45
  attr_reader :path
46
46
 
47
+ # The request query string.
48
+ #
49
+ # @return [String, nil]
50
+ attr_reader :query
51
+
47
52
  # The HTTP version.
48
53
  #
49
54
  # @return [String]
@@ -71,6 +76,9 @@ module Ronin
71
76
  # @param [String] path
72
77
  # The request path.
73
78
  #
79
+ # @param [String, nil] query
80
+ # The request query string.
81
+ #
74
82
  # @param [String] version
75
83
  # The HTTP version.
76
84
  #
@@ -83,12 +91,14 @@ module Ronin
83
91
  def initialize(remote_addr: ,
84
92
  method: ,
85
93
  path: ,
94
+ query: nil,
86
95
  version: ,
87
96
  headers:,
88
97
  body: nil)
89
98
  @remote_addr = remote_addr
90
99
  @method = method
91
100
  @path = path
101
+ @query = query
92
102
  @version = version
93
103
  @headers = headers
94
104
  @body = body
@@ -127,6 +137,7 @@ module Ronin
127
137
  remote_port == other.remote_port &&
128
138
  @method == other.method &&
129
139
  @path == other.path &&
140
+ @query == other.query &&
130
141
  @version == other.version &&
131
142
  @headers == other.headers &&
132
143
  @body == other.body
@@ -139,7 +150,11 @@ module Ronin
139
150
  # The raw HTTP request.
140
151
  #
141
152
  def to_s
142
- string = "#{@method} #{@path} HTTP/#{@version}\r\n"
153
+ request_uri = if @query then "#{@path}?#{@query}"
154
+ else @path
155
+ end
156
+
157
+ string = "#{@method} #{request_uri} HTTP/#{@version}\r\n"
143
158
 
144
159
  @headers.each do |name,value|
145
160
  string << "#{name}: #{value}\r\n"
@@ -160,6 +175,7 @@ module Ronin
160
175
  remote_port: remote_port,
161
176
  method: @method,
162
177
  path: @path,
178
+ query: @query,
163
179
  version: @version,
164
180
  headers: @headers,
165
181
  body: @body
@@ -179,6 +195,7 @@ module Ronin
179
195
  remote_port,
180
196
  @method,
181
197
  @path,
198
+ @query,
182
199
  @version,
183
200
  CSV.generate { |csv|
184
201
  @headers.each_pair do |name_value|
@@ -24,6 +24,7 @@ require 'async'
24
24
  require 'async/http/server'
25
25
  require 'async/http/endpoint'
26
26
  require 'async/http/protocol/response'
27
+ require 'protocol/http/reference'
27
28
 
28
29
  module Ronin
29
30
  module Listener
@@ -128,12 +129,16 @@ module Ronin
128
129
  #
129
130
  def process(request)
130
131
  if (@vhost.nil? || @vhost === request.authority)
131
- if request.path == @root || request.path.start_with?(@root)
132
+ reference = Protocol::HTTP::Reference.parse(request.path)
133
+ path = reference.path
134
+
135
+ if path == @root || path.start_with?(@root)
132
136
  @callback.call(
133
137
  Request.new(
134
138
  remote_addr: request.remote_address,
135
139
  method: request.method,
136
- path: request.path,
140
+ path: path,
141
+ query: reference.query,
137
142
  version: request.version,
138
143
  headers: request.headers,
139
144
  body: request.body
@@ -22,7 +22,7 @@ module Ronin
22
22
  module Listener
23
23
  module HTTP
24
24
  # ronin-listener-http version
25
- VERSION = '0.1.0.rc2'
25
+ VERSION = '0.1.0'
26
26
  end
27
27
  end
28
28
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ronin-listener-http
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.rc2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Postmodern
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-06 00:00:00.000000000 Z
11
+ date: 2024-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async-http
@@ -93,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
93
  - !ruby/object:Gem::Version
94
94
  version: '0'
95
95
  requirements: []
96
- rubygems_version: 3.3.27
96
+ rubygems_version: 3.5.11
97
97
  signing_key:
98
98
  specification_version: 4
99
99
  summary: A HTTP server for receiving exfiled data.