Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
eterban
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
eterban
Commits
ff37b349
Commit
ff37b349
authored
Jul 19, 2026
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
internal: escape user-controlled ban page output
parent
98913454
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
int2.py
ban-internal-server/data/www/int2.py
+8
-7
No files found.
ban-internal-server/data/www/int2.py
View file @
ff37b349
import
socket
import
struct
from
http.server
import
BaseHTTPRequestHandler
,
ThreadingHTTPServer
from
html
import
escape
from
urllib.parse
import
quote
,
parse_qs
,
urlparse
import
redis
import
configparser
...
...
@@ -44,9 +46,8 @@ class OriginalDstHandler(BaseHTTPRequestHandler):
# Обработка запроса на разблокировку
if
self
.
path
.
startswith
(
"/unban"
):
# Извлекаем IP из параметра запроса
import
urllib.parse
query
=
urllib
.
parse
.
urlparse
(
self
.
path
)
.
query
params
=
urllib
.
parse
.
parse_qs
(
query
)
query
=
urlparse
(
self
.
path
)
.
query
params
=
parse_qs
(
query
)
target_ip
=
params
.
get
(
"ip"
,
[
None
])[
0
]
...
...
@@ -90,7 +91,7 @@ class OriginalDstHandler(BaseHTTPRequestHandler):
<html>
<head><title>Unban IP</title></head>
<body>
<p>IP {
ip
} has been unblocked. Wait 5 seconds, please.</p>
<p>IP {
escape(ip)
} has been unblocked. Wait 5 seconds, please.</p>
<script>
function update() {{
window.location.href = "/";
...
...
@@ -116,10 +117,10 @@ class OriginalDstHandler(BaseHTTPRequestHandler):
<body>
<h2>Eterban note.</h2>
<h3>Access to this IP address is restricted due to it suspicious activity.</h3>
<p>You accessed: <strong>{
ip}</strong> from your IP {client_ip
}</p>
<p>You accessed: <strong>{
escape(ip)}</strong> from your IP {escape(client_ip)
}</p>
<p>
<a href="/unban.php?ip={
ip
}">
<button>Unban IP: {
ip
}</button>
<a href="/unban.php?ip={
quote(ip, safe='')
}">
<button>Unban IP: {
escape(ip)
}</button>
</a>
</p>
</body>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment