flask-Humanify 0.1.3.2__tar.gz → 0.2.0__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 (31) hide show
  1. {flask_humanify-0.1.3.2/flask_Humanify.egg-info → flask_humanify-0.2.0}/PKG-INFO +14 -4
  2. {flask_humanify-0.1.3.2 → flask_humanify-0.2.0}/README.md +9 -4
  3. {flask_humanify-0.1.3.2 → flask_humanify-0.2.0/flask_Humanify.egg-info}/PKG-INFO +14 -4
  4. {flask_humanify-0.1.3.2 → flask_humanify-0.2.0}/flask_Humanify.egg-info/SOURCES.txt +8 -2
  5. flask_humanify-0.2.0/flask_Humanify.egg-info/requires.txt +7 -0
  6. {flask_humanify-0.1.3.2 → flask_humanify-0.2.0}/flask_humanify/__init__.py +1 -1
  7. flask_humanify-0.2.0/flask_humanify/datasets/ai_dogs.pkl +0 -0
  8. flask_humanify-0.2.0/flask_humanify/datasets/animals.pkl +0 -0
  9. flask_humanify-0.2.0/flask_humanify/datasets/characters.pkl +0 -0
  10. {flask_humanify-0.1.3.2 → flask_humanify-0.2.0}/flask_humanify/features/rate_limiter.py +1 -1
  11. flask_humanify-0.2.0/flask_humanify/humanify.py +535 -0
  12. flask_humanify-0.2.0/flask_humanify/memory_server.py +836 -0
  13. flask_humanify-0.2.0/flask_humanify/secret_key.bin +0 -0
  14. {flask_humanify-0.1.3.2 → flask_humanify-0.2.0}/flask_humanify/templates/access_denied.html +32 -25
  15. flask_humanify-0.2.0/flask_humanify/templates/audio_challenge.html +208 -0
  16. flask_humanify-0.2.0/flask_humanify/templates/grid_challenge.html +232 -0
  17. flask_humanify-0.1.3.2/flask_humanify/templates/oneclick_captcha.html → flask_humanify-0.2.0/flask_humanify/templates/one_click_challenge.html +48 -45
  18. {flask_humanify-0.1.3.2 → flask_humanify-0.2.0}/flask_humanify/templates/rate_limited.html +32 -25
  19. flask_humanify-0.2.0/flask_humanify/utils.py +508 -0
  20. {flask_humanify-0.1.3.2 → flask_humanify-0.2.0}/pyproject.toml +2 -2
  21. flask_humanify-0.1.3.2/flask_Humanify.egg-info/requires.txt +0 -2
  22. flask_humanify-0.1.3.2/flask_humanify/humanify.py +0 -158
  23. flask_humanify-0.1.3.2/flask_humanify/ipset.py +0 -315
  24. flask_humanify-0.1.3.2/flask_humanify/utils.py +0 -88
  25. {flask_humanify-0.1.3.2 → flask_humanify-0.2.0}/LICENSE +0 -0
  26. {flask_humanify-0.1.3.2 → flask_humanify-0.2.0}/MANIFEST.in +0 -0
  27. {flask_humanify-0.1.3.2 → flask_humanify-0.2.0}/flask_Humanify.egg-info/dependency_links.txt +0 -0
  28. {flask_humanify-0.1.3.2 → flask_humanify-0.2.0}/flask_Humanify.egg-info/top_level.txt +0 -0
  29. {flask_humanify-0.1.3.2 → flask_humanify-0.2.0}/flask_humanify/datasets/ipset.json +0 -0
  30. {flask_humanify-0.1.3.2 → flask_humanify-0.2.0}/setup.cfg +0 -0
  31. {flask_humanify-0.1.3.2 → flask_humanify-0.2.0}/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.2.0
4
4
  Summary: Protect against bots and DDoS attacks
5
5
  Author-email: TN3W <tn3w@protonmail.com>
6
6
  License-Expression: Apache-2.0
@@ -27,6 +27,11 @@ Description-Content-Type: text/markdown
27
27
  License-File: LICENSE
28
28
  Requires-Dist: Flask
29
29
  Requires-Dist: netaddr
30
+ Requires-Dist: opencv-python-headless
31
+ Requires-Dist: numpy
32
+ Requires-Dist: cryptography
33
+ Requires-Dist: scipy
34
+ Requires-Dist: pydub
30
35
  Dynamic: license-file
31
36
 
32
37
  <h1 align="center">flask-Humanify</h1>
@@ -40,10 +45,10 @@ from flask import Flask
40
45
  from flask_Humanify import Humanify
41
46
 
42
47
  app = Flask(__name__)
43
- humanify = Humanify(app)
48
+ humanify = Humanify(app, challenge_type="one_click", captcha_dataset="ai_dogs")
44
49
 
45
50
  # Register the middleware to deny access to bots
46
- humanify.register_middleware(action="deny_access")
51
+ humanify.register_middleware(action="challenge")
47
52
 
48
53
  @app.route("/")
49
54
  def index():
@@ -57,6 +62,7 @@ if __name__ == "__main__":
57
62
  ```
58
63
 
59
64
  Not using the middleware:
65
+
60
66
  ```python
61
67
  @app.route("/")
62
68
  def index():
@@ -64,24 +70,28 @@ def index():
64
70
  A route that is protected against bots and DDoS attacks.
65
71
  """
66
72
  if humanify.is_bot:
67
- return humanify.deny_access()
73
+ return humanify.challenge()
68
74
  return "Hello, Human!"
69
75
  ```
70
76
 
71
77
  ## Usage
72
78
 
73
79
  ### Installation
80
+
74
81
  Install the package with pip:
82
+
75
83
  ```bash
76
84
  pip install flask-humanify --upgrade
77
85
  ```
78
86
 
79
87
  Import the extension:
88
+
80
89
  ```python
81
90
  from flask_humanify import Humanify
82
91
  ```
83
92
 
84
93
  Add the extension to your Flask app:
94
+
85
95
  ```python
86
96
  app = Flask(__name__)
87
97
  humanify = Humanify(app)
@@ -9,10 +9,10 @@ from flask import Flask
9
9
  from flask_Humanify import Humanify
10
10
 
11
11
  app = Flask(__name__)
12
- humanify = Humanify(app)
12
+ humanify = Humanify(app, challenge_type="one_click", captcha_dataset="ai_dogs")
13
13
 
14
14
  # Register the middleware to deny access to bots
15
- humanify.register_middleware(action="deny_access")
15
+ humanify.register_middleware(action="challenge")
16
16
 
17
17
  @app.route("/")
18
18
  def index():
@@ -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():
@@ -33,25 +34,29 @@ def index():
33
34
  A route that is protected against bots and DDoS attacks.
34
35
  """
35
36
  if humanify.is_bot:
36
- return humanify.deny_access()
37
+ return humanify.challenge()
37
38
  return "Hello, Human!"
38
39
  ```
39
40
 
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.2.0
4
4
  Summary: Protect against bots and DDoS attacks
5
5
  Author-email: TN3W <tn3w@protonmail.com>
6
6
  License-Expression: Apache-2.0
@@ -27,6 +27,11 @@ Description-Content-Type: text/markdown
27
27
  License-File: LICENSE
28
28
  Requires-Dist: Flask
29
29
  Requires-Dist: netaddr
30
+ Requires-Dist: opencv-python-headless
31
+ Requires-Dist: numpy
32
+ Requires-Dist: cryptography
33
+ Requires-Dist: scipy
34
+ Requires-Dist: pydub
30
35
  Dynamic: license-file
31
36
 
32
37
  <h1 align="center">flask-Humanify</h1>
@@ -40,10 +45,10 @@ from flask import Flask
40
45
  from flask_Humanify import Humanify
41
46
 
42
47
  app = Flask(__name__)
43
- humanify = Humanify(app)
48
+ humanify = Humanify(app, challenge_type="one_click", captcha_dataset="ai_dogs")
44
49
 
45
50
  # Register the middleware to deny access to bots
46
- humanify.register_middleware(action="deny_access")
51
+ humanify.register_middleware(action="challenge")
47
52
 
48
53
  @app.route("/")
49
54
  def index():
@@ -57,6 +62,7 @@ if __name__ == "__main__":
57
62
  ```
58
63
 
59
64
  Not using the middleware:
65
+
60
66
  ```python
61
67
  @app.route("/")
62
68
  def index():
@@ -64,24 +70,28 @@ def index():
64
70
  A route that is protected against bots and DDoS attacks.
65
71
  """
66
72
  if humanify.is_bot:
67
- return humanify.deny_access()
73
+ return humanify.challenge()
68
74
  return "Hello, Human!"
69
75
  ```
70
76
 
71
77
  ## Usage
72
78
 
73
79
  ### Installation
80
+
74
81
  Install the package with pip:
82
+
75
83
  ```bash
76
84
  pip install flask-humanify --upgrade
77
85
  ```
78
86
 
79
87
  Import the extension:
88
+
80
89
  ```python
81
90
  from flask_humanify import Humanify
82
91
  ```
83
92
 
84
93
  Add the extension to your Flask app:
94
+
85
95
  ```python
86
96
  app = Flask(__name__)
87
97
  humanify = Humanify(app)
@@ -10,10 +10,16 @@ flask_Humanify.egg-info/requires.txt
10
10
  flask_Humanify.egg-info/top_level.txt
11
11
  flask_humanify/__init__.py
12
12
  flask_humanify/humanify.py
13
- flask_humanify/ipset.py
13
+ flask_humanify/memory_server.py
14
+ flask_humanify/secret_key.bin
14
15
  flask_humanify/utils.py
16
+ flask_humanify/datasets/ai_dogs.pkl
17
+ flask_humanify/datasets/animals.pkl
18
+ flask_humanify/datasets/characters.pkl
15
19
  flask_humanify/datasets/ipset.json
16
20
  flask_humanify/features/rate_limiter.py
17
21
  flask_humanify/templates/access_denied.html
18
- flask_humanify/templates/oneclick_captcha.html
22
+ flask_humanify/templates/audio_challenge.html
23
+ flask_humanify/templates/grid_challenge.html
24
+ flask_humanify/templates/one_click_challenge.html
19
25
  flask_humanify/templates/rate_limited.html
@@ -0,0 +1,7 @@
1
+ Flask
2
+ netaddr
3
+ opencv-python-headless
4
+ numpy
5
+ cryptography
6
+ scipy
7
+ pydub
@@ -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.2.0"
8
8
 
9
9
  from . import utils
10
10
  from .humanify import Humanify
@@ -11,7 +11,7 @@ class RateLimiter:
11
11
  Rate limiter.
12
12
  """
13
13
 
14
- def __init__(self, app=None, max_requests: int = 2, time_window: int = 10):
14
+ def __init__(self, app=None, max_requests: int = 10, time_window: int = 10):
15
15
  """
16
16
  Initialize the rate limiter.
17
17
  """