flask-Humanify 0.1.3.2__py3-none-any.whl → 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- flask_humanify/__init__.py +1 -1
- flask_humanify/datasets/ai_dogs.pkl +0 -0
- flask_humanify/datasets/animals.pkl +0 -0
- flask_humanify/datasets/characters.pkl +0 -0
- flask_humanify/features/rate_limiter.py +1 -1
- flask_humanify/humanify.py +393 -16
- flask_humanify/memory_server.py +836 -0
- flask_humanify/secret_key.bin +0 -0
- flask_humanify/templates/access_denied.html +32 -25
- flask_humanify/templates/audio_challenge.html +208 -0
- flask_humanify/templates/grid_challenge.html +232 -0
- flask_humanify/templates/{oneclick_captcha.html → one_click_challenge.html} +48 -45
- flask_humanify/templates/rate_limited.html +32 -25
- flask_humanify/utils.py +422 -2
- {flask_humanify-0.1.3.2.dist-info → flask_humanify-0.2.0.dist-info}/METADATA +14 -4
- flask_humanify-0.2.0.dist-info/RECORD +20 -0
- flask_humanify/ipset.py +0 -315
- flask_humanify-0.1.3.2.dist-info/RECORD +0 -14
- {flask_humanify-0.1.3.2.dist-info → flask_humanify-0.2.0.dist-info}/WHEEL +0 -0
- {flask_humanify-0.1.3.2.dist-info → flask_humanify-0.2.0.dist-info}/licenses/LICENSE +0 -0
- {flask_humanify-0.1.3.2.dist-info → flask_humanify-0.2.0.dist-info}/top_level.txt +0 -0
Binary file
|
@@ -1,8 +1,8 @@
|
|
1
|
-
<!
|
1
|
+
<!doctype html>
|
2
2
|
<html lang="en">
|
3
3
|
<head>
|
4
|
-
<meta charset="UTF-8"
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0"
|
4
|
+
<meta charset="UTF-8" />
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
6
6
|
<title>Access Denied</title>
|
7
7
|
<style>
|
8
8
|
body {
|
@@ -17,23 +17,23 @@
|
|
17
17
|
height: 100vh;
|
18
18
|
padding: 0 20px;
|
19
19
|
}
|
20
|
-
|
20
|
+
|
21
21
|
@media (prefers-color-scheme: dark) {
|
22
22
|
body {
|
23
23
|
background: #121212;
|
24
24
|
color: #f2f2f2;
|
25
25
|
}
|
26
|
-
|
26
|
+
|
27
27
|
.btn {
|
28
28
|
background: #f2f2f2;
|
29
29
|
color: #121212;
|
30
30
|
}
|
31
|
-
|
31
|
+
|
32
32
|
.fill {
|
33
|
-
background: rgba(0,0,0,0.15);
|
33
|
+
background: rgba(0, 0, 0, 0.15);
|
34
34
|
}
|
35
35
|
}
|
36
|
-
|
36
|
+
|
37
37
|
.content {
|
38
38
|
max-width: 600px;
|
39
39
|
}
|
@@ -42,17 +42,17 @@
|
|
42
42
|
font-size: 48px;
|
43
43
|
margin-bottom: 10px;
|
44
44
|
}
|
45
|
-
|
45
|
+
|
46
46
|
h1 {
|
47
47
|
font-size: 22px;
|
48
48
|
margin: 15px 0;
|
49
49
|
}
|
50
|
-
|
50
|
+
|
51
51
|
p {
|
52
52
|
margin: 15px 0;
|
53
53
|
opacity: 0.8;
|
54
54
|
}
|
55
|
-
|
55
|
+
|
56
56
|
.btn {
|
57
57
|
display: inline-block;
|
58
58
|
padding: 12px 24px;
|
@@ -65,46 +65,53 @@
|
|
65
65
|
overflow: hidden;
|
66
66
|
pointer-events: none;
|
67
67
|
}
|
68
|
-
|
68
|
+
|
69
69
|
.fill {
|
70
70
|
position: absolute;
|
71
71
|
left: 0;
|
72
72
|
top: 0;
|
73
73
|
height: 100%;
|
74
74
|
width: 0;
|
75
|
-
background: rgba(255,255,255,0.15);
|
75
|
+
background: rgba(255, 255, 255, 0.15);
|
76
76
|
animation: fillBtn 10s linear forwards;
|
77
77
|
}
|
78
|
-
|
78
|
+
|
79
79
|
@keyframes fillBtn {
|
80
|
-
to {
|
80
|
+
to {
|
81
|
+
width: 100%;
|
82
|
+
}
|
81
83
|
}
|
82
84
|
</style>
|
83
85
|
</head>
|
84
86
|
<body>
|
85
87
|
<div class="content">
|
86
|
-
<div class="emoji">
|
87
|
-
🚨
|
88
|
-
</div>
|
88
|
+
<div class="emoji">🚨</div>
|
89
89
|
<h1>Sorry, but you can't see the requested page.</h1>
|
90
|
-
<p>
|
90
|
+
<p>
|
91
|
+
Automated scripts are likely attempting to request this page. If you use anonymizing
|
92
|
+
tools like VPNs or proxies, consider disabling them temporarily.
|
93
|
+
</p>
|
91
94
|
<a href="RETURN_URL" id="retry" class="btn">
|
92
95
|
<div class="fill"></div>
|
93
96
|
<span>Try again</span>
|
94
97
|
</a>
|
95
98
|
</div>
|
96
|
-
|
99
|
+
|
97
100
|
<noscript>
|
98
101
|
<style>
|
99
|
-
.btn {
|
100
|
-
|
102
|
+
.btn {
|
103
|
+
pointer-events: all !important;
|
104
|
+
}
|
105
|
+
.fill {
|
106
|
+
display: none;
|
107
|
+
}
|
101
108
|
</style>
|
102
109
|
</noscript>
|
103
|
-
|
110
|
+
|
104
111
|
<script>
|
105
|
-
setTimeout(function() {
|
112
|
+
setTimeout(function () {
|
106
113
|
document.getElementById('retry').style.pointerEvents = 'all';
|
107
114
|
}, 10000);
|
108
115
|
</script>
|
109
116
|
</body>
|
110
|
-
</html>
|
117
|
+
</html>
|
@@ -0,0 +1,208 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8" />
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
6
|
+
<title>Verify you're human</title>
|
7
|
+
<style>
|
8
|
+
body {
|
9
|
+
font-family: system-ui, sans-serif;
|
10
|
+
background: #f2f2f2;
|
11
|
+
color: #181818;
|
12
|
+
margin: 0;
|
13
|
+
line-height: 1.5;
|
14
|
+
text-align: center;
|
15
|
+
display: grid;
|
16
|
+
place-items: center;
|
17
|
+
height: 100vh;
|
18
|
+
padding: 0 20px;
|
19
|
+
}
|
20
|
+
|
21
|
+
@media (prefers-color-scheme: dark) {
|
22
|
+
body {
|
23
|
+
background: #121212;
|
24
|
+
color: #f2f2f2;
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
28
|
+
.content {
|
29
|
+
max-width: 600px;
|
30
|
+
display: flex;
|
31
|
+
flex-direction: column;
|
32
|
+
align-items: center;
|
33
|
+
}
|
34
|
+
|
35
|
+
h1 {
|
36
|
+
font-size: 22px;
|
37
|
+
margin: 15px 0;
|
38
|
+
}
|
39
|
+
|
40
|
+
p {
|
41
|
+
margin: 15px 0;
|
42
|
+
opacity: 0.8;
|
43
|
+
}
|
44
|
+
|
45
|
+
.text-container {
|
46
|
+
text-align: center;
|
47
|
+
margin-bottom: 25px;
|
48
|
+
}
|
49
|
+
|
50
|
+
.error {
|
51
|
+
color: #e53935;
|
52
|
+
margin: 10px 0;
|
53
|
+
font-size: 16px;
|
54
|
+
}
|
55
|
+
|
56
|
+
form {
|
57
|
+
display: flex;
|
58
|
+
flex-direction: column;
|
59
|
+
align-items: center;
|
60
|
+
width: 100%;
|
61
|
+
max-width: 450px;
|
62
|
+
}
|
63
|
+
|
64
|
+
.audio-container {
|
65
|
+
width: 100%;
|
66
|
+
margin-bottom: 25px;
|
67
|
+
display: flex;
|
68
|
+
flex-direction: column;
|
69
|
+
align-items: center;
|
70
|
+
padding: 20px;
|
71
|
+
}
|
72
|
+
|
73
|
+
.audio-player {
|
74
|
+
width: 100%;
|
75
|
+
margin-bottom: 20px;
|
76
|
+
height: 40px;
|
77
|
+
}
|
78
|
+
|
79
|
+
.input-field {
|
80
|
+
width: 100%;
|
81
|
+
padding: 12px;
|
82
|
+
margin-bottom: 10px;
|
83
|
+
border: 2px solid rgba(74, 110, 208, 0.3);
|
84
|
+
border-radius: 6px;
|
85
|
+
font-size: 16px;
|
86
|
+
background-color: #ffffff;
|
87
|
+
color: #181818;
|
88
|
+
transition: all 0.2s ease;
|
89
|
+
}
|
90
|
+
|
91
|
+
@media (prefers-color-scheme: dark) {
|
92
|
+
.input-field {
|
93
|
+
background-color: #242424;
|
94
|
+
color: #f2f2f2;
|
95
|
+
border-color: rgba(74, 110, 208, 0.5);
|
96
|
+
}
|
97
|
+
}
|
98
|
+
|
99
|
+
.input-field:focus {
|
100
|
+
border-color: #4a6ed0;
|
101
|
+
outline: none;
|
102
|
+
box-shadow: 0 0 0 3px rgba(74, 110, 208, 0.3);
|
103
|
+
}
|
104
|
+
|
105
|
+
.submit-button {
|
106
|
+
padding: 12px 24px;
|
107
|
+
background-color: #4a6ed0;
|
108
|
+
color: white;
|
109
|
+
border: none;
|
110
|
+
border-radius: 6px;
|
111
|
+
cursor: pointer;
|
112
|
+
font-weight: 500;
|
113
|
+
transition: all 0.2s ease;
|
114
|
+
width: 100%;
|
115
|
+
max-width: 250px;
|
116
|
+
font-size: 16px;
|
117
|
+
margin-bottom: 15px;
|
118
|
+
}
|
119
|
+
|
120
|
+
.submit-button:hover {
|
121
|
+
background-color: #3a5ec0;
|
122
|
+
transform: translateY(-2px);
|
123
|
+
}
|
124
|
+
|
125
|
+
.image-challenge-link {
|
126
|
+
display: flex;
|
127
|
+
align-items: center;
|
128
|
+
justify-content: center;
|
129
|
+
margin-top: 15px;
|
130
|
+
color: #4a6ed0;
|
131
|
+
text-decoration: none;
|
132
|
+
font-size: 14px;
|
133
|
+
transition: all 0.2s ease;
|
134
|
+
}
|
135
|
+
|
136
|
+
.image-challenge-link:hover {
|
137
|
+
transform: translateY(-2px);
|
138
|
+
}
|
139
|
+
|
140
|
+
.image-challenge-link svg {
|
141
|
+
margin-right: 6px;
|
142
|
+
width: 16px;
|
143
|
+
height: 16px;
|
144
|
+
fill: currentColor;
|
145
|
+
}
|
146
|
+
|
147
|
+
@media (max-width: 600px) {
|
148
|
+
.audio-container {
|
149
|
+
padding: 15px;
|
150
|
+
}
|
151
|
+
|
152
|
+
.input-field {
|
153
|
+
font-size: 15px;
|
154
|
+
}
|
155
|
+
}
|
156
|
+
|
157
|
+
@media (max-width: 400px) {
|
158
|
+
form {
|
159
|
+
max-width: 300px;
|
160
|
+
}
|
161
|
+
}
|
162
|
+
</style>
|
163
|
+
</head>
|
164
|
+
<body>
|
165
|
+
<div class="content">
|
166
|
+
<div class="text-container">
|
167
|
+
<h1>Verify you're human</h1>
|
168
|
+
<p>Listen to the audio and type what you hear.</p>
|
169
|
+
{% if error %}
|
170
|
+
<p class="error">{{ error }}</p>
|
171
|
+
{% endif %}
|
172
|
+
</div>
|
173
|
+
|
174
|
+
<form action="{{ url_for('humanify.verify_audio') }}" method="POST">
|
175
|
+
<div class="audio-container">
|
176
|
+
<audio class="audio-player" controls autoplay>
|
177
|
+
<source src="{{ audio_file }}" type="audio/mpeg" />
|
178
|
+
Your browser does not support the audio element.
|
179
|
+
</audio>
|
180
|
+
<input
|
181
|
+
type="text"
|
182
|
+
class="input-field"
|
183
|
+
name="audio_response"
|
184
|
+
placeholder="Enter what you hear"
|
185
|
+
required
|
186
|
+
autocomplete="off"
|
187
|
+
autofocus
|
188
|
+
/>
|
189
|
+
</div>
|
190
|
+
<input type="hidden" name="return_url" value="{{ return_url }}" />
|
191
|
+
<input type="hidden" name="captcha_data" value="{{ captcha_data }}" />
|
192
|
+
<button type="submit" class="submit-button">Verify</button>
|
193
|
+
</form>
|
194
|
+
|
195
|
+
{% if image_challenge_available %}
|
196
|
+
<a
|
197
|
+
class="image-challenge-link"
|
198
|
+
href="{{ url_for('humanify.challenge', return_url=return_url) }}"
|
199
|
+
>
|
200
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
201
|
+
<path d="M96 416q-14 0-23-9t-9-23V128q0-14 9-23t23-9h320q14 0 23 9t9 23v256q0 14-9 23t-23 9zm88-176q20 0 34-14t14-34-14-34-34-14-34 14-14 34 14 34 34 14m216 128v-64l-64-64-96 96-56-57-88 89z"/>
|
202
|
+
</svg>
|
203
|
+
Image challenge
|
204
|
+
</a>
|
205
|
+
{% endif %}
|
206
|
+
</div>
|
207
|
+
</body>
|
208
|
+
</html>
|
@@ -0,0 +1,232 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8" />
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
6
|
+
<title>Verify you're human</title>
|
7
|
+
<style>
|
8
|
+
body {
|
9
|
+
font-family: system-ui, sans-serif;
|
10
|
+
background: #f2f2f2;
|
11
|
+
color: #181818;
|
12
|
+
margin: 0;
|
13
|
+
line-height: 1.5;
|
14
|
+
text-align: center;
|
15
|
+
display: grid;
|
16
|
+
place-items: center;
|
17
|
+
height: 100vh;
|
18
|
+
padding: 0 20px;
|
19
|
+
}
|
20
|
+
|
21
|
+
@media (prefers-color-scheme: dark) {
|
22
|
+
body {
|
23
|
+
background: #121212;
|
24
|
+
color: #f2f2f2;
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
28
|
+
.content {
|
29
|
+
max-width: 600px;
|
30
|
+
display: flex;
|
31
|
+
flex-direction: column;
|
32
|
+
align-items: center;
|
33
|
+
}
|
34
|
+
|
35
|
+
h1 {
|
36
|
+
font-size: 22px;
|
37
|
+
margin: 15px 0;
|
38
|
+
}
|
39
|
+
|
40
|
+
p {
|
41
|
+
margin: 15px 0;
|
42
|
+
opacity: 0.8;
|
43
|
+
}
|
44
|
+
|
45
|
+
.text-container {
|
46
|
+
text-align: center;
|
47
|
+
margin-bottom: 25px;
|
48
|
+
}
|
49
|
+
|
50
|
+
.error {
|
51
|
+
color: #e53935;
|
52
|
+
margin: 10px 0;
|
53
|
+
font-size: 16px;
|
54
|
+
}
|
55
|
+
|
56
|
+
form {
|
57
|
+
display: flex;
|
58
|
+
flex-direction: column;
|
59
|
+
align-items: center;
|
60
|
+
width: 100%;
|
61
|
+
}
|
62
|
+
|
63
|
+
.grid {
|
64
|
+
display: grid;
|
65
|
+
grid-template-columns: repeat(3, 1fr);
|
66
|
+
grid-gap: 15px;
|
67
|
+
width: 100%;
|
68
|
+
margin-bottom: 25px;
|
69
|
+
max-width: 450px;
|
70
|
+
}
|
71
|
+
|
72
|
+
.image-container {
|
73
|
+
position: relative;
|
74
|
+
transition: transform 0.2s ease;
|
75
|
+
border-radius: 8px;
|
76
|
+
overflow: hidden;
|
77
|
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
78
|
+
aspect-ratio: 1;
|
79
|
+
}
|
80
|
+
|
81
|
+
.image-container:hover {
|
82
|
+
transform: translateY(-3px);
|
83
|
+
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
|
84
|
+
}
|
85
|
+
|
86
|
+
.image-container img {
|
87
|
+
width: 100%;
|
88
|
+
height: 100%;
|
89
|
+
object-fit: cover;
|
90
|
+
display: block;
|
91
|
+
}
|
92
|
+
|
93
|
+
.custom-checkbox {
|
94
|
+
position: absolute;
|
95
|
+
bottom: 8px;
|
96
|
+
right: 8px;
|
97
|
+
appearance: none;
|
98
|
+
width: 22px;
|
99
|
+
height: 22px;
|
100
|
+
border: 2px solid #ffffff;
|
101
|
+
border-radius: 4px;
|
102
|
+
background-color: rgba(255, 255, 255, 0.7);
|
103
|
+
cursor: pointer;
|
104
|
+
transition: all 0.2s ease;
|
105
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
106
|
+
}
|
107
|
+
|
108
|
+
.custom-checkbox:checked {
|
109
|
+
background-color: #4a6ed0;
|
110
|
+
border-color: #4a6ed0;
|
111
|
+
}
|
112
|
+
|
113
|
+
.custom-checkbox:checked::before {
|
114
|
+
content: '✓';
|
115
|
+
position: absolute;
|
116
|
+
color: white;
|
117
|
+
font-size: 14px;
|
118
|
+
top: 50%;
|
119
|
+
left: 50%;
|
120
|
+
transform: translate(-50%, -50%);
|
121
|
+
}
|
122
|
+
|
123
|
+
.submit-button {
|
124
|
+
padding: 12px 24px;
|
125
|
+
background-color: #4a6ed0;
|
126
|
+
color: white;
|
127
|
+
border: none;
|
128
|
+
border-radius: 6px;
|
129
|
+
cursor: pointer;
|
130
|
+
font-weight: 500;
|
131
|
+
transition: all 0.2s ease;
|
132
|
+
width: 100%;
|
133
|
+
max-width: 250px;
|
134
|
+
font-size: 16px;
|
135
|
+
margin-bottom: 15px;
|
136
|
+
}
|
137
|
+
|
138
|
+
.submit-button:hover {
|
139
|
+
background-color: #3a5ec0;
|
140
|
+
transform: translateY(-2px);
|
141
|
+
}
|
142
|
+
|
143
|
+
.audio-challenge-link {
|
144
|
+
display: flex;
|
145
|
+
align-items: center;
|
146
|
+
justify-content: center;
|
147
|
+
margin-top: 15px;
|
148
|
+
color: #4a6ed0;
|
149
|
+
text-decoration: none;
|
150
|
+
font-size: 14px;
|
151
|
+
transition: all 0.2s ease;
|
152
|
+
}
|
153
|
+
|
154
|
+
.audio-challenge-link:hover {
|
155
|
+
transform: translateY(-2px);
|
156
|
+
}
|
157
|
+
|
158
|
+
.audio-challenge-link svg {
|
159
|
+
margin-right: 6px;
|
160
|
+
width: 16px;
|
161
|
+
height: 16px;
|
162
|
+
fill: currentColor;
|
163
|
+
}
|
164
|
+
|
165
|
+
@media (max-width: 600px) {
|
166
|
+
.grid {
|
167
|
+
grid-gap: 10px;
|
168
|
+
max-width: 350px;
|
169
|
+
}
|
170
|
+
|
171
|
+
.custom-checkbox {
|
172
|
+
width: 20px;
|
173
|
+
height: 20px;
|
174
|
+
bottom: 6px;
|
175
|
+
right: 6px;
|
176
|
+
}
|
177
|
+
}
|
178
|
+
|
179
|
+
@media (max-width: 400px) {
|
180
|
+
.grid {
|
181
|
+
grid-gap: 8px;
|
182
|
+
max-width: 300px;
|
183
|
+
}
|
184
|
+
}
|
185
|
+
</style>
|
186
|
+
</head>
|
187
|
+
<body>
|
188
|
+
<div class="content">
|
189
|
+
<div class="text-container">
|
190
|
+
<h1>Verify you're human</h1>
|
191
|
+
<p>Select all images that contain a <strong>{{ subject }}</strong>.</p>
|
192
|
+
{% if error %}
|
193
|
+
<p class="error">{{ error }}</p>
|
194
|
+
{% endif %}
|
195
|
+
</div>
|
196
|
+
|
197
|
+
<form action="{{ url_for('humanify.verify') }}" method="POST">
|
198
|
+
<div class="grid">
|
199
|
+
{% for image in images %}
|
200
|
+
<div class="image-container">
|
201
|
+
<img src="{{ image }}" alt="Verification image {{ loop.index }}" />
|
202
|
+
<input
|
203
|
+
type="checkbox"
|
204
|
+
class="custom-checkbox"
|
205
|
+
id="check{{ loop.index }}"
|
206
|
+
name="{{ loop.index }}"
|
207
|
+
value="1"
|
208
|
+
/>
|
209
|
+
</div>
|
210
|
+
{% endfor %}
|
211
|
+
</div>
|
212
|
+
<input type="hidden" name="return_url" value="{{ return_url }}" />
|
213
|
+
<input type="hidden" name="captcha_data" value="{{ captcha_data }}" />
|
214
|
+
<button type="submit" class="submit-button">Verify</button>
|
215
|
+
</form>
|
216
|
+
|
217
|
+
{% if audio_challenge_available %}
|
218
|
+
<a
|
219
|
+
class="audio-challenge-link"
|
220
|
+
href="{{ url_for('humanify.audio_challenge', return_url=return_url) }}"
|
221
|
+
>
|
222
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
223
|
+
<path
|
224
|
+
d="M128 448q-26 0-45-19t-19-45V256q0-50 26-96 26-45 71-70 44-26 95-26 52 0 96 26 45 26 71 71 25 44 25 95v128q0 26-19 45t-45 19h-64V288h80v-32q0-38-19-72-20-33-53-52-33-20-72-20-40 0-72 19-33 20-52 53-20 33-20 72v32h80v160z"
|
225
|
+
/>
|
226
|
+
</svg>
|
227
|
+
Audio challenge
|
228
|
+
</a>
|
229
|
+
{% endif %}
|
230
|
+
</div>
|
231
|
+
</body>
|
232
|
+
</html>
|