HTTP spam security for Flask.
Project description
IpBan is a Flask extension that can help protect against ip locations spamming url requests against unknown pages. Often this is to search for security issues.
The default configuration:
50 attempts before ban
1 hour blocking period
Installation & Basic Usage
Install via pip:
pip install flask-ipban
After installing, wrap your Flask app with a IpBan:
from flask import Flask
from flask_ipban import IpBan
app = Flask(__name__)
IpBan(app)
Enclosed is a small example application
Options
ban_count, default 50, Number of observations before banning
ban_seconds, default 60, Number of seconds ip address is banned
ip_ban.block(ip_address, permanent=True) - block the specific address forever
ip_ban.add(reason='spite') - increase the observation for the current request ip
Per-view options
Example code
from flask import Flask
from flask_ipban import IpBan
app = Flask(__name__)
ip_ban = IpBan(app)
@app.route('/normal')
def normal():
return 'Normal'
Licensing
Apache 2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for flask_ipban-0.1.4-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b91c07352af7a092fd0b0f76f991769bfb4d11f60c1963057c6f59555280fe8b |
|
MD5 | 204ea48af084da08e0fe1f23c2a45f97 |
|
BLAKE2b-256 | ada33c6ef58934505eb14123a757184aee0250bf3755577355145757d8f54f5f |