Update server.py

This commit is contained in:
Namhyeon Go 2024-02-20 18:08:50 +09:00 committed by GitHub
parent 22e7dd1344
commit d8a514e7a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -190,6 +190,10 @@ def proxy_check_filtered(data, webserver, port, scheme, method, url):
return ratio > 0.2 and ratio < 0.7
filtered = not all(map(vowel_ratio_test, matches))
# check ID with Palindrome5 strategy
if filtered and len(matches) > 0:
filtered = not all(map(has_palindrome, matches))
# check an attached images (check images with Not-CAPTCHA strategy)
if not filtered and len(matches) > 0 and truecaptcha_userid != '':
def webp_to_png_base64(url):
@ -469,5 +473,18 @@ def calculate_vowel_ratio(s):
return vowel_ratio
# Strategy: Palindrome5
def has_palindrome(input_string):
def is_palindrome(s):
return s == s[::-1]
n = len(input_string)
for i in range(n):
for j in range(i + 5, n + 1): # Find substrings of at least 5 characters
substring = input_string[i:j]
if is_palindrome(substring):
return True
return False
if __name__== "__main__":
start()