ronin-listener-http 0.1.0.rc1 → 0.1.0.rc2

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: 5adf81fa9ced6ab4fd65074de117b81415c1404928f92454232c2062ff758548
4
- data.tar.gz: 07e253fe463c655429521a42e2e79aeafe8a69389d58c606ea01d11a230271d7
3
+ metadata.gz: 5a7b158cba029bddb265109da882afaad58f783eb84970ca34645bce11ace7d2
4
+ data.tar.gz: a10a9400d9770333391173cf362f791beb985cc2827790382db1ace979be8464
5
5
  SHA512:
6
- metadata.gz: e1fdba946028f0696559f874f2264b3116c073398bd3dbc704b19d67a26cc73e02524177f2280c9fcb9ad42d51082b99ca809fd9da73258c794cafc26a9ab592
7
- data.tar.gz: 950be8ff0f2f62488e39d32d4d4d70d775ba72f926e0470ba4907e60168646e148b357f98472ccb120a66eaa1e37d3106e6259377d1af8519bf9478bc4857aac
6
+ metadata.gz: 593a95c60b3c449a445702a7583cd79777504cbf0238ab0190a73f66b8920b45ca6926c0fbd5adeeccfc0c5a09ae1edd968a2dfa1752bc158a75cf608491ac50
7
+ data.tar.gz: 77fe8072868e85dc4de55b2418704b6f2dbbb42744e111a522f7385ba539166868cb5f7a09cecf72ad92ecea199e8dc79cc23538e0d87cbf3c10b03fb966ed38
@@ -29,6 +29,11 @@ module Ronin
29
29
  #
30
30
  class Request
31
31
 
32
+ # The remote address that sent the request.
33
+ #
34
+ # @return [Addrinfo]
35
+ attr_reader :remote_addr
36
+
32
37
  # The HTTP request method.
33
38
  #
34
39
  # @return [String]
@@ -57,6 +62,9 @@ module Ronin
57
62
  #
58
63
  # Initializes the request.
59
64
  #
65
+ # @param [Addrinfo] remote_addr
66
+ # The remote address that sent the request.
67
+ #
60
68
  # @param [String] method
61
69
  # The HTTP request method.
62
70
  #
@@ -72,12 +80,36 @@ module Ronin
72
80
  # @param [String, nil] body
73
81
  # The optional body sent with the request.
74
82
  #
75
- def initialize(method: , path: , version: , headers:, body: nil)
76
- @method = method
77
- @path = path
78
- @version = version
79
- @headers = headers
80
- @body = body
83
+ def initialize(remote_addr: ,
84
+ method: ,
85
+ path: ,
86
+ version: ,
87
+ headers:,
88
+ body: nil)
89
+ @remote_addr = remote_addr
90
+ @method = method
91
+ @path = path
92
+ @version = version
93
+ @headers = headers
94
+ @body = body
95
+ end
96
+
97
+ #
98
+ # The remote IP address that sent the request.
99
+ #
100
+ # @return [String]
101
+ #
102
+ def remote_ip
103
+ @remote_addr.ip_address
104
+ end
105
+
106
+ #
107
+ # The remote port that sent the request.
108
+ #
109
+ # @return [String]
110
+ #
111
+ def remote_port
112
+ @remote_addr.ip_port
81
113
  end
82
114
 
83
115
  #
@@ -91,11 +123,13 @@ module Ronin
91
123
  #
92
124
  def ==(other)
93
125
  self.class == other.class &&
94
- @method == other.method &&
95
- @path == other.path &&
96
- @version == other.version &&
97
- @headers == other.headers &&
98
- @body == other.body
126
+ remote_ip == other.remote_ip &&
127
+ remote_port == other.remote_port &&
128
+ @method == other.method &&
129
+ @path == other.path &&
130
+ @version == other.version &&
131
+ @headers == other.headers &&
132
+ @body == other.body
99
133
  end
100
134
 
101
135
  #
@@ -122,11 +156,13 @@ module Ronin
122
156
  #
123
157
  def to_h
124
158
  {
125
- method: @method,
126
- path: @path,
127
- version: @version,
128
- headers: @headers,
129
- body: @body
159
+ remote_ip: remote_ip,
160
+ remote_port: remote_port,
161
+ method: @method,
162
+ path: @path,
163
+ version: @version,
164
+ headers: @headers,
165
+ body: @body
130
166
  }
131
167
  end
132
168
 
@@ -139,6 +175,8 @@ module Ronin
139
175
  def to_csv
140
176
  CSV.generate_line(
141
177
  [
178
+ remote_ip,
179
+ remote_port,
142
180
  @method,
143
181
  @path,
144
182
  @version,
@@ -131,11 +131,12 @@ module Ronin
131
131
  if request.path == @root || request.path.start_with?(@root)
132
132
  @callback.call(
133
133
  Request.new(
134
- method: request.method,
135
- path: request.path,
136
- version: request.version,
137
- headers: request.headers,
138
- body: request.body
134
+ remote_addr: request.remote_address,
135
+ method: request.method,
136
+ path: request.path,
137
+ version: request.version,
138
+ headers: request.headers,
139
+ body: request.body
139
140
  )
140
141
  )
141
142
  end
@@ -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.rc1'
25
+ VERSION = '0.1.0.rc2'
26
26
  end
27
27
  end
28
28
  end
@@ -47,8 +47,7 @@ module Ronin
47
47
  # @yield [request]
48
48
  # The given block will be passed each received HTTP request.
49
49
  #
50
- # @yieldparam [Async::HTTP::Protocol::HTTP1::Request,
51
- # Async::HTTP::Protocol::HTTP2::Request] request
50
+ # @yieldparam [Request] request
52
51
  # The received HTTP request object.
53
52
  #
54
53
  # @raise [ArgumentError]
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.rc1
4
+ version: 0.1.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Postmodern
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-23 00:00:00.000000000 Z
11
+ date: 2024-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async-http