paraxial 1.3.1 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/paraxial/checker.rb +18 -31
- data/lib/paraxial/helpers.rb +1 -1
- data/lib/paraxial/version.rb +1 -1
- data/lib/paraxial.rb +8 -16
- 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: a049e14f86235b3984d52cb9d0401e42ec85deb103ae479df22ee73f52020f76
|
4
|
+
data.tar.gz: a05102fc73df7dc030be7a009de6a77be503aab05722dc7ff23fc8db10246f05
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f3af29e03215f6315ada3200487edadbd4c8bce1dba0c2ef1ff7dc73af72a1fb870a6474b40276e8a43e89baf94aedd286118bbc052216605bb39226ba67df8
|
7
|
+
data.tar.gz: 10ab830e631b9fa6b550b74a9c88ce87ed4917014574ecd8cbd25acee4fc76401bcc73994e83f73c5b0018641e6ab43f40d700737dbcbe58a2833799eaa8edb3
|
data/lib/paraxial/checker.rb
CHANGED
@@ -7,7 +7,7 @@ module Paraxial
|
|
7
7
|
@mutex = Mutex.new
|
8
8
|
@headers = { 'Content-Type': 'application/json' }
|
9
9
|
|
10
|
-
if Paraxial::Helpers.get_api_key
|
10
|
+
if Paraxial::Helpers.get_api_key and !Paraxial.configuration&.disable_http_tick
|
11
11
|
@thread = Thread.new do
|
12
12
|
loop do
|
13
13
|
get_abr
|
@@ -130,7 +130,11 @@ module Paraxial
|
|
130
130
|
end
|
131
131
|
|
132
132
|
def self.ban_ip_msg(ip, length, msg)
|
133
|
-
if
|
133
|
+
if whitelist_ip?(ip)
|
134
|
+
:on_whitelist
|
135
|
+
elsif blacklist_ip?(ip)
|
136
|
+
:already_banned
|
137
|
+
else
|
134
138
|
local_ban(ip)
|
135
139
|
|
136
140
|
uri = URI.parse(Paraxial::Helpers.get_ruby_ban_url)
|
@@ -147,8 +151,6 @@ module Paraxial
|
|
147
151
|
else
|
148
152
|
:error
|
149
153
|
end
|
150
|
-
else
|
151
|
-
:already_banned
|
152
154
|
end
|
153
155
|
end
|
154
156
|
|
@@ -166,19 +168,6 @@ module Paraxial
|
|
166
168
|
end
|
167
169
|
end
|
168
170
|
|
169
|
-
def self.ban_ip(ip)
|
170
|
-
local_ban(ip)
|
171
|
-
uri = URI.parse(Paraxial::Helpers.get_ban_url)
|
172
|
-
|
173
|
-
body = { api_key: Paraxial::Helpers.get_api_key, ip_address: ip }
|
174
|
-
r = Net::HTTP.post(uri, body.to_json, @headers)
|
175
|
-
if r.code == '200'
|
176
|
-
:ok
|
177
|
-
else
|
178
|
-
:error
|
179
|
-
end
|
180
|
-
end
|
181
|
-
|
182
171
|
def self.local_ban(ip)
|
183
172
|
if ip.include?('.')
|
184
173
|
# IPv4
|
@@ -193,21 +182,19 @@ module Paraxial
|
|
193
182
|
end
|
194
183
|
end
|
195
184
|
|
196
|
-
def self.
|
185
|
+
def self.whitelist_ip?(ip)
|
197
186
|
if ip.include?('.')
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
else # v6 on no list
|
210
|
-
true
|
187
|
+
!@allows['v4'].search_best(ip).nil? # v4 on allow list
|
188
|
+
else
|
189
|
+
!@allows['v6'].search_best(ip).nil? # v6 on allow list
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
def self.blacklist_ip?(ip)
|
194
|
+
if ip.include?('.')
|
195
|
+
!@bans['v4'].search_best(ip).nil? # v4 on allow list
|
196
|
+
else
|
197
|
+
!@bans['v6'].search_best(ip).nil? # v6 on allow list
|
211
198
|
end
|
212
199
|
end
|
213
200
|
end
|
data/lib/paraxial/helpers.rb
CHANGED
data/lib/paraxial/version.rb
CHANGED
data/lib/paraxial.rb
CHANGED
@@ -98,14 +98,16 @@ module Paraxial
|
|
98
98
|
def self.req_allowed?(request)
|
99
99
|
return if Paraxial::Helpers.get_api_key.nil?
|
100
100
|
|
101
|
-
if request.
|
102
|
-
false
|
103
|
-
elsif Paraxial::Checker.allow_ip?(request.remote_ip) == true
|
101
|
+
if Paraxial::Checker.whitelist_ip?(request.remote_ip)
|
104
102
|
request.env['paraxial.deny'] = false
|
105
103
|
true
|
106
|
-
|
104
|
+
elsif Paraxial::Checker.blacklist_ip?(request.remote_ip)
|
107
105
|
request.env['paraxial.deny'] = true
|
108
106
|
false
|
107
|
+
elsif request.env['paraxial.deny']
|
108
|
+
false
|
109
|
+
else
|
110
|
+
true
|
109
111
|
end
|
110
112
|
end
|
111
113
|
|
@@ -129,12 +131,6 @@ module Paraxial
|
|
129
131
|
end
|
130
132
|
end
|
131
133
|
|
132
|
-
def self.ban_ip(ip)
|
133
|
-
return if Paraxial::Helpers.get_api_key.nil?
|
134
|
-
|
135
|
-
Paraxial::Checker.ban_ip(ip)
|
136
|
-
end
|
137
|
-
|
138
134
|
def self.ban_ip_msg(ip, length, msg)
|
139
135
|
return if Paraxial::Helpers.get_api_key.nil?
|
140
136
|
|
@@ -147,12 +143,6 @@ module Paraxial
|
|
147
143
|
Paraxial::Checker.honeypot_ban(ip, length)
|
148
144
|
end
|
149
145
|
|
150
|
-
def self.allow_ip?(ip)
|
151
|
-
return if Paraxial::Helpers.get_api_key.nil?
|
152
|
-
|
153
|
-
Paraxial::Checker.allow_ip?(ip)
|
154
|
-
end
|
155
|
-
|
156
146
|
def self.trim_dep(input)
|
157
147
|
if input.nil?
|
158
148
|
nil
|
@@ -194,9 +184,11 @@ module Paraxial
|
|
194
184
|
|
195
185
|
class Configuration
|
196
186
|
attr_accessor :exploit_guard
|
187
|
+
attr_accessor :disable_http_tick
|
197
188
|
|
198
189
|
def initialize
|
199
190
|
@exploit_guard = nil
|
191
|
+
@disable_http_tick = nil
|
200
192
|
end
|
201
193
|
end
|
202
194
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paraxial
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Lubas
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|