mirror of https://gitlab.com/bashrc2/epicyon
Bad path ip address logging
parent
79e40ba194
commit
f3fcb3283f
16
daemon.py
16
daemon.py
|
|
@ -254,6 +254,10 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
if self.server.starting_daemon:
|
||||
return
|
||||
if check_bad_path(self.path):
|
||||
calling_ip_address = self.request.getpeername()
|
||||
if calling_ip_address:
|
||||
print('WARN: bad path PROPFIND ' +
|
||||
self.path + ' ' + str(calling_ip_address))
|
||||
http_400(self)
|
||||
return
|
||||
|
||||
|
|
@ -263,6 +267,10 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
if self.server.starting_daemon:
|
||||
return
|
||||
if check_bad_path(self.path):
|
||||
calling_ip_address = self.request.getpeername()
|
||||
if calling_ip_address:
|
||||
print('WARN: bad path PROPFIND ' +
|
||||
self.path + ' ' + str(calling_ip_address))
|
||||
http_400(self)
|
||||
return
|
||||
|
||||
|
|
@ -272,6 +280,10 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
if self.server.starting_daemon:
|
||||
return
|
||||
if check_bad_path(self.path):
|
||||
calling_ip_address = self.request.getpeername()
|
||||
if calling_ip_address:
|
||||
print('WARN: bad path REPORT ' +
|
||||
self.path + ' ' + str(calling_ip_address))
|
||||
http_400(self)
|
||||
return
|
||||
|
||||
|
|
@ -281,6 +293,10 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
if self.server.starting_daemon:
|
||||
return
|
||||
if check_bad_path(self.path):
|
||||
calling_ip_address = self.request.getpeername()
|
||||
if calling_ip_address:
|
||||
print('WARN: bad path DELETE ' +
|
||||
self.path + ' ' + str(calling_ip_address))
|
||||
http_400(self)
|
||||
return
|
||||
|
||||
|
|
|
|||
|
|
@ -250,7 +250,8 @@ def daemon_http_get(self) -> None:
|
|||
if check_bad_path(self.path):
|
||||
calling_ip_address = self.request.getpeername()
|
||||
if calling_ip_address:
|
||||
print('WARN: bad path ip address: ' + str(calling_ip_address))
|
||||
print('WARN: bad path GET ' +
|
||||
self.path + ' ' + str(calling_ip_address))
|
||||
http_400(self)
|
||||
return
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,10 @@ def daemon_http_head(self) -> None:
|
|||
if self.server.starting_daemon:
|
||||
return
|
||||
if check_bad_path(self.path):
|
||||
calling_ip_address = self.request.getpeername()
|
||||
if calling_ip_address:
|
||||
print('WARN: bad path HEAD ' +
|
||||
self.path + ' ' + str(calling_ip_address))
|
||||
http_400(self)
|
||||
return
|
||||
|
||||
|
|
|
|||
|
|
@ -161,6 +161,10 @@ def daemon_http_post(self) -> None:
|
|||
if self.server.starting_daemon:
|
||||
return
|
||||
if check_bad_path(self.path):
|
||||
calling_ip_address = self.request.getpeername()
|
||||
if calling_ip_address:
|
||||
print('WARN: bad path POST ' +
|
||||
self.path + ' ' + str(calling_ip_address))
|
||||
http_400(self)
|
||||
return
|
||||
|
||||
|
|
|
|||
3
utils.py
3
utils.py
|
|
@ -4002,7 +4002,6 @@ def check_bad_path(path: str):
|
|||
bad_strings = ('..', '%2e%2e', '%252e%252e')
|
||||
|
||||
if path_lower.startswith('/wp-'):
|
||||
print('WARN: this is not wordpress ' + path)
|
||||
return True
|
||||
|
||||
bad_endings = (
|
||||
|
|
@ -4010,11 +4009,9 @@ def check_bad_path(path: str):
|
|||
'.rs', '.ru'
|
||||
)
|
||||
if string_ends_with(path_lower, bad_endings):
|
||||
print('WARN: bad path ' + path)
|
||||
return True
|
||||
|
||||
if string_contains(path_lower, bad_strings):
|
||||
print('WARN: bad path ' + path)
|
||||
return True
|
||||
return False
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue