diff --git a/daemon.py b/daemon.py index 8e81b9140..1ef446529 100644 --- a/daemon.py +++ b/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 diff --git a/daemon_get.py b/daemon_get.py index 57eedda4b..58b163acc 100644 --- a/daemon_get.py +++ b/daemon_get.py @@ -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 diff --git a/daemon_head.py b/daemon_head.py index e9020de13..82c130867 100644 --- a/daemon_head.py +++ b/daemon_head.py @@ -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 diff --git a/daemon_post.py b/daemon_post.py index 66cb38ae7..b8f4ebb23 100644 --- a/daemon_post.py +++ b/daemon_post.py @@ -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 diff --git a/utils.py b/utils.py index 7dead817a..5ec5692cd 100644 --- a/utils.py +++ b/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