ronin-listener-http 0.1.0.rc1 → 0.1.0.rc2
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.
- checksums.yaml +4 -4
- data/lib/ronin/listener/http/request.rb +54 -16
- data/lib/ronin/listener/http/server.rb +6 -5
- data/lib/ronin/listener/http/version.rb +1 -1
- data/lib/ronin/listener/http.rb +1 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a7b158cba029bddb265109da882afaad58f783eb84970ca34645bce11ace7d2
|
4
|
+
data.tar.gz: a10a9400d9770333391173cf362f791beb985cc2827790382db1ace979be8464
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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(
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
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
|
-
|
95
|
-
|
96
|
-
@
|
97
|
-
@
|
98
|
-
@
|
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
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
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
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
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
|
data/lib/ronin/listener/http.rb
CHANGED
@@ -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 [
|
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.
|
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
|
11
|
+
date: 2024-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async-http
|