flask-Humanify 0.1.3.2__tar.gz → 0.1.4__tar.gz

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.
Files changed (21) hide show
  1. {flask_humanify-0.1.3.2/flask_Humanify.egg-info → flask_humanify-0.1.4}/PKG-INFO +6 -1
  2. {flask_humanify-0.1.3.2 → flask_humanify-0.1.4}/README.md +6 -1
  3. {flask_humanify-0.1.3.2 → flask_humanify-0.1.4/flask_Humanify.egg-info}/PKG-INFO +6 -1
  4. {flask_humanify-0.1.3.2 → flask_humanify-0.1.4}/flask_humanify/__init__.py +1 -1
  5. {flask_humanify-0.1.3.2 → flask_humanify-0.1.4}/flask_humanify/humanify.py +1 -1
  6. {flask_humanify-0.1.3.2 → flask_humanify-0.1.4}/flask_humanify/templates/access_denied.html +32 -25
  7. {flask_humanify-0.1.3.2 → flask_humanify-0.1.4}/flask_humanify/templates/oneclick_captcha.html +47 -39
  8. {flask_humanify-0.1.3.2 → flask_humanify-0.1.4}/flask_humanify/templates/rate_limited.html +32 -25
  9. {flask_humanify-0.1.3.2 → flask_humanify-0.1.4}/pyproject.toml +1 -1
  10. {flask_humanify-0.1.3.2 → flask_humanify-0.1.4}/LICENSE +0 -0
  11. {flask_humanify-0.1.3.2 → flask_humanify-0.1.4}/MANIFEST.in +0 -0
  12. {flask_humanify-0.1.3.2 → flask_humanify-0.1.4}/flask_Humanify.egg-info/SOURCES.txt +0 -0
  13. {flask_humanify-0.1.3.2 → flask_humanify-0.1.4}/flask_Humanify.egg-info/dependency_links.txt +0 -0
  14. {flask_humanify-0.1.3.2 → flask_humanify-0.1.4}/flask_Humanify.egg-info/requires.txt +0 -0
  15. {flask_humanify-0.1.3.2 → flask_humanify-0.1.4}/flask_Humanify.egg-info/top_level.txt +0 -0
  16. {flask_humanify-0.1.3.2 → flask_humanify-0.1.4}/flask_humanify/datasets/ipset.json +0 -0
  17. {flask_humanify-0.1.3.2 → flask_humanify-0.1.4}/flask_humanify/features/rate_limiter.py +0 -0
  18. {flask_humanify-0.1.3.2 → flask_humanify-0.1.4}/flask_humanify/ipset.py +0 -0
  19. {flask_humanify-0.1.3.2 → flask_humanify-0.1.4}/flask_humanify/utils.py +0 -0
  20. {flask_humanify-0.1.3.2 → flask_humanify-0.1.4}/setup.cfg +0 -0
  21. {flask_humanify-0.1.3.2 → flask_humanify-0.1.4}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flask-Humanify
3
- Version: 0.1.3.2
3
+ Version: 0.1.4
4
4
  Summary: Protect against bots and DDoS attacks
5
5
  Author-email: TN3W <tn3w@protonmail.com>
6
6
  License-Expression: Apache-2.0
@@ -57,6 +57,7 @@ if __name__ == "__main__":
57
57
  ```
58
58
 
59
59
  Not using the middleware:
60
+
60
61
  ```python
61
62
  @app.route("/")
62
63
  def index():
@@ -71,17 +72,21 @@ def index():
71
72
  ## Usage
72
73
 
73
74
  ### Installation
75
+
74
76
  Install the package with pip:
77
+
75
78
  ```bash
76
79
  pip install flask-humanify --upgrade
77
80
  ```
78
81
 
79
82
  Import the extension:
83
+
80
84
  ```python
81
85
  from flask_humanify import Humanify
82
86
  ```
83
87
 
84
88
  Add the extension to your Flask app:
89
+
85
90
  ```python
86
91
  app = Flask(__name__)
87
92
  humanify = Humanify(app)
@@ -26,6 +26,7 @@ if __name__ == "__main__":
26
26
  ```
27
27
 
28
28
  Not using the middleware:
29
+
29
30
  ```python
30
31
  @app.route("/")
31
32
  def index():
@@ -40,18 +41,22 @@ def index():
40
41
  ## Usage
41
42
 
42
43
  ### Installation
44
+
43
45
  Install the package with pip:
46
+
44
47
  ```bash
45
48
  pip install flask-humanify --upgrade
46
49
  ```
47
50
 
48
51
  Import the extension:
52
+
49
53
  ```python
50
54
  from flask_humanify import Humanify
51
55
  ```
52
56
 
53
57
  Add the extension to your Flask app:
58
+
54
59
  ```python
55
60
  app = Flask(__name__)
56
61
  humanify = Humanify(app)
57
- ```
62
+ ```
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flask-Humanify
3
- Version: 0.1.3.2
3
+ Version: 0.1.4
4
4
  Summary: Protect against bots and DDoS attacks
5
5
  Author-email: TN3W <tn3w@protonmail.com>
6
6
  License-Expression: Apache-2.0
@@ -57,6 +57,7 @@ if __name__ == "__main__":
57
57
  ```
58
58
 
59
59
  Not using the middleware:
60
+
60
61
  ```python
61
62
  @app.route("/")
62
63
  def index():
@@ -71,17 +72,21 @@ def index():
71
72
  ## Usage
72
73
 
73
74
  ### Installation
75
+
74
76
  Install the package with pip:
77
+
75
78
  ```bash
76
79
  pip install flask-humanify --upgrade
77
80
  ```
78
81
 
79
82
  Import the extension:
83
+
80
84
  ```python
81
85
  from flask_humanify import Humanify
82
86
  ```
83
87
 
84
88
  Add the extension to your Flask app:
89
+
85
90
  ```python
86
91
  app = Flask(__name__)
87
92
  humanify = Humanify(app)
@@ -4,7 +4,7 @@ Flask-Humanify
4
4
  A Flask extension that protects against bots and DDoS attacks.
5
5
  """
6
6
 
7
- __version__ = "0.1.3.2"
7
+ __version__ = "0.1.4"
8
8
 
9
9
  from . import utils
10
10
  from .humanify import Humanify
@@ -100,7 +100,7 @@ class Humanify:
100
100
  self.ipset_client.connect()
101
101
 
102
102
  self.blueprint = Blueprint(
103
- "humanify", __name__, template_folder="templates", static_folder="static"
103
+ "humanify", __name__, template_folder="templates", static_folder=None
104
104
  )
105
105
  self._register_routes()
106
106
  app.register_blueprint(self.blueprint)
@@ -1,8 +1,8 @@
1
- <!DOCTYPE html>
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 { width: 100%; }
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>Automated scripts are likely attempting to request this page. If you use anonymizing tools like VPNs or proxies, consider disabling them temporarily.</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 { pointer-events: all !important; }
100
- .fill { display: none; }
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>
@@ -1,8 +1,8 @@
1
- <!DOCTYPE html>
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>Verify Human</title>
7
7
  <style>
8
8
  body {
@@ -17,18 +17,18 @@
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
  .fill {
28
- background: rgba(0,0,0,0.15);
28
+ background: rgba(0, 0, 0, 0.15);
29
29
  }
30
30
  }
31
-
31
+
32
32
  .content {
33
33
  max-width: 600px;
34
34
  display: flex;
@@ -40,17 +40,17 @@
40
40
  font-size: 48px;
41
41
  margin-bottom: 10px;
42
42
  }
43
-
43
+
44
44
  h1 {
45
45
  font-size: 22px;
46
46
  margin: 15px 0;
47
47
  }
48
-
48
+
49
49
  p {
50
50
  margin: 15px 0;
51
51
  opacity: 0.8;
52
52
  }
53
-
53
+
54
54
  .preview-container {
55
55
  width: 200px;
56
56
  height: 200px;
@@ -64,18 +64,18 @@
64
64
  border-radius: 8px;
65
65
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
66
66
  }
67
-
67
+
68
68
  .text-container {
69
69
  text-align: center;
70
70
  margin-bottom: 25px;
71
71
  }
72
-
72
+
73
73
  .error {
74
74
  color: #e53935;
75
75
  margin: 10px 0;
76
76
  font-size: 16px;
77
77
  }
78
-
78
+
79
79
  .images-row {
80
80
  display: flex;
81
81
  flex-direction: row;
@@ -85,7 +85,7 @@
85
85
  margin-bottom: 25px;
86
86
  width: 100%;
87
87
  }
88
-
88
+
89
89
  .image-button {
90
90
  background: none;
91
91
  border: none;
@@ -93,23 +93,25 @@
93
93
  cursor: pointer;
94
94
  width: 100px;
95
95
  height: 100px;
96
- transition: transform 0.2s ease, box-shadow 0.2s ease;
96
+ transition:
97
+ transform 0.2s ease,
98
+ box-shadow 0.2s ease;
97
99
  border-radius: 8px;
98
100
  overflow: hidden;
99
101
  position: relative;
100
102
  }
101
-
103
+
102
104
  .image-button:hover {
103
105
  transform: translateY(-3px);
104
106
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
105
107
  }
106
-
108
+
107
109
  .image-button img {
108
110
  width: 100%;
109
111
  height: 100%;
110
112
  object-fit: cover;
111
113
  }
112
-
114
+
113
115
  .audio-challenge-link {
114
116
  display: flex;
115
117
  align-items: center;
@@ -120,29 +122,29 @@
120
122
  font-size: 14px;
121
123
  transition: all 0.2s ease;
122
124
  }
123
-
125
+
124
126
  .audio-challenge-link:hover {
125
127
  transform: translateY(-2px);
126
128
  }
127
-
129
+
128
130
  .audio-challenge-link svg {
129
131
  margin-right: 6px;
130
132
  width: 16px;
131
133
  height: 16px;
132
134
  fill: currentColor;
133
135
  }
134
-
136
+
135
137
  @media (max-width: 600px) {
136
138
  .preview-container {
137
139
  width: 180px;
138
140
  height: 180px;
139
141
  }
140
-
142
+
141
143
  .images-row {
142
144
  gap: 10px;
143
145
  justify-content: center;
144
146
  }
145
-
147
+
146
148
  .image-button {
147
149
  width: 80px;
148
150
  height: 80px;
@@ -153,39 +155,45 @@
153
155
  <body>
154
156
  <div class="content">
155
157
  <div class="preview-container">
156
- <img src="{{ preview_image }}" alt="Reference image">
158
+ <img src="{{ preview_image }}" alt="Reference image" />
157
159
  </div>
158
-
160
+
159
161
  <div class="text-container">
160
162
  {% if subject == "smiling dog" %}
161
163
  <p>To verify you're not a bot, select the dog that smiles like shown above.</p>
162
164
  {% else %}
163
- <p>To verify you're not a bot, select the image that matches the motif shown above.</p>
164
- {% endif %}
165
- {% if error %}
166
- <p class="error">{{ error }}</p>
165
+ <p>
166
+ To verify you're not a bot, select the image that matches the motif shown above.
167
+ </p>
168
+ {% endif %} {% if error %}
169
+ <p class="error">{{ error }}</p>
167
170
  {% endif %}
168
171
  </div>
169
172
 
170
173
  <div class="images-row">
171
174
  {% for image in images %}
172
175
  <form action="{{ url_for('humanify.verify') }}" method="POST">
173
- <input type="hidden" name="return_url" value="{{ return_url }}">
174
- <input type="hidden" name="captcha_data" value="{{ captcha_data }}">
176
+ <input type="hidden" name="return_url" value="{{ return_url }}" />
177
+ <input type="hidden" name="captcha_data" value="{{ captcha_data }}" />
175
178
  <button type="submit" class="image-button" name="{{ loop.index }}" value="1">
176
- <img src="{{ image }}" alt="Selection image {{ loop.index }}">
179
+ <img src="{{ image }}" alt="Selection image {{ loop.index }}" />
177
180
  </button>
178
181
  </form>
179
182
  {% endfor %}
180
183
  </div>
181
-
184
+
182
185
  {% if audio_challenge_available %}
183
- <a class="audio-challenge-link" href="{{ url_for('humanify.audio_challenge', return_url=return_url) }}">
184
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
185
- <path d="M10 1a1 1 0 0 1 1 1v13.59l1.29-1.29a1 1 0 1 1 1.42 1.42l-3 3a1 1 0 0 1-1.42 0l-3-3a1 1 0 0 1 1.42-1.42L9 15.59V2a1 1 0 0 1 1-1zm2-1a1 1 0 1 1 0 2 5 5 0 0 0-5 5 1 1 0 1 1-2 0 7 7 0 0 1 7-7zm2 3a1 1 0 1 1 0 2 3 3 0 0 0-3 3 1 1 0 1 1-2 0 5 5 0 0 1 5-5z" />
186
- </svg>
187
- Audio challenge
188
- </a>
186
+ <a
187
+ class="audio-challenge-link"
188
+ href="{{ url_for('humanify.audio_challenge', return_url=return_url) }}"
189
+ >
190
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
191
+ <path
192
+ d="M10 1a1 1 0 0 1 1 1v13.59l1.29-1.29a1 1 0 1 1 1.42 1.42l-3 3a1 1 0 0 1-1.42 0l-3-3a1 1 0 0 1 1.42-1.42L9 15.59V2a1 1 0 0 1 1-1zm2-1a1 1 0 1 1 0 2 5 5 0 0 0-5 5 1 1 0 1 1-2 0 7 7 0 0 1 7-7zm2 3a1 1 0 1 1 0 2 3 3 0 0 0-3 3 1 1 0 1 1-2 0 5 5 0 0 1 5-5z"
193
+ />
194
+ </svg>
195
+ Audio challenge
196
+ </a>
189
197
  {% endif %}
190
198
  </div>
191
199
  </body>
@@ -1,8 +1,8 @@
1
- <!DOCTYPE html>
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>Rate Limited</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 { width: 100%; }
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>Have some Tea</h1>
90
- <p>It appears that you are sending an excessive number of requests to this website. Please reduce the frequency of your requests.</p>
90
+ <p>
91
+ It appears that you are sending an excessive number of requests to this website.
92
+ Please reduce the frequency of your requests.
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 { pointer-events: all !important; }
100
- .fill { display: none; }
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>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "flask-Humanify"
3
- version = "0.1.3.2"
3
+ version = "0.1.4"
4
4
  description = "Protect against bots and DDoS attacks"
5
5
  readme = "README.md"
6
6
  authors = [
File without changes