All Projects → closeio → flask-ipblock

closeio / flask-ipblock

Licence: MIT license
Block certain IP addresses from accessing your Flask app

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to flask-ipblock

ip2location-nginx
Nginx module that allows user to lookup for geolocation information using IP2Location database.
Stars: ✭ 33 (+135.71%)
Mutual labels:  ipv4, ip-address
PHP-IPAddress
IP Address utility classes for PHP
Stars: ✭ 63 (+350%)
Mutual labels:  ipv4, ip-address
ip
Immutable value object for IPv4 and IPv6 addresses, including helper methods and Doctrine support.
Stars: ✭ 212 (+1414.29%)
Mutual labels:  ipv4, ip-address
ipaddress
Data analysis of IP addresses and networks
Stars: ✭ 20 (+42.86%)
Mutual labels:  ipv4, ip-address
php-ip-anonymizer
IP address anonymizer library for PHP
Stars: ✭ 55 (+292.86%)
Mutual labels:  ipv4, ip-address
Geolocate-IP-Browser-Extension
A browser extension, which shows you the origin of your IP address.
Stars: ✭ 21 (+50%)
Mutual labels:  ipv4, ip-address
Ipwhois
Retrieve and parse whois data for IPv4 and IPv6 addresses
Stars: ✭ 432 (+2985.71%)
Mutual labels:  ipv4, ip-address
IP2Location-PHP-Module
This module is a PHP module that enables the user to find the country, region, city, coordinates, zip code, ISP, domain name, timezone, connection speed, IDD code, area code, weather station code, weather station name, mobile, usage types, address type, IAB category, etc that any IP address or host name originates from.
Stars: ✭ 154 (+1000%)
Mutual labels:  ipv4, ip-address
IP2Location-C-Library
IP2Location C library enables the user to find the country, region, city, coordinates, zip code, time zone, ISP, domain name, connection type, area code, weather station code, weather station name, mobile, usage types, etc that any IP address or hostname originates from.
Stars: ✭ 37 (+164.29%)
Mutual labels:  ipv4, ip-address
Ip Num
A TypeScript/JavaScript library for working with ASN, IPv4, and IPv6 numbers. It provides representations of these internet protocol numbers with the ability to perform various IP related operations like parsing, validating etc. on them
Stars: ✭ 113 (+707.14%)
Mutual labels:  ipv4, ip-address
ipapi-python
Python bindings for https://ipapi.co (IP Address Location) - Use with python / django / flask for IP address location lookup
Stars: ✭ 42 (+200%)
Mutual labels:  ipv4, ip-address
IPpy
🚀 Ping IP addresses and domains in parallel to find the accessible and inaccessible ones.
Stars: ✭ 54 (+285.71%)
Mutual labels:  ipv4, ip-address
ipcalc.el
IP calculator in Emacs Lisp
Stars: ✭ 23 (+64.29%)
Mutual labels:  ipv4, ip-address
Ipnetwork
A library to work with CIDRs in rust
Stars: ✭ 64 (+357.14%)
Mutual labels:  ipv4, ip-address
Ipaddress
Java library for handling IP addresses and subnets, both IPv4 and IPv6
Stars: ✭ 197 (+1307.14%)
Mutual labels:  ipv4, ip-address
private-ip
Check if IP address is private.
Stars: ✭ 26 (+85.71%)
Mutual labels:  ipv4, ip-address
masscanned
Let's be scanned. A low-interaction honeypot focused on network scanners and bots. It integrates very well with IVRE to build a self-hosted alternative to GreyNoise.
Stars: ✭ 50 (+257.14%)
Mutual labels:  ipv4
flask-jwt-login
Flask extension that helps authentication using JWT (for a personal purpose, not maintained now)
Stars: ✭ 12 (-14.29%)
Mutual labels:  flask-extension
draft-ip-address-privacy
Internet-Draft on IP address privacy
Stars: ✭ 15 (+7.14%)
Mutual labels:  ip-address
hphr
Halophile Router (a VyOS-based, SaltStack-automated, NetBox-configured router for small provider networks)
Stars: ✭ 39 (+178.57%)
Mutual labels:  ipv4

Flask-IPBlock Build Status

Block certain IP addresses from accessing your Flask application.

Flask-IPBlock is backed by MongoDB and supports application-level caching to boost performance.

Options

You can override the default MongoDB read preference via the optional read_preference kwarg.

You can limit the impact of the IP checks on your MongoDB by maintaining a local in-memory LRU cache. To do so, specify its cache_size (i.e. max number of IP addresses it can store) and cache_ttl (i.e. how many seconds each result should be cached for).

To run in dry-run mode without blocking requests, set blocking_enabled to False. Set logging_enabled to True to log IPs that match blocking rules -- if enabled, will log even if blocking_enabled is False.

Setup

from flask import Flask
from flask_ipblock import IPBlock
from flask_ipblock.documents import IPNetwork

# Initialize the Flask app
app = Flask(__name__)

# Configuration (e.g. setting up MongoEngine)

# Set up IPBlock
ipblock = IPBlock(app)

# Create a MongoEngine document corresponding to a range of IP addresses
# owned by Facebook
IPNetwork.objects.create_from_string('204.15.20.0/22', label='Facebook')

# From now on, any request coming from the above range will be blocked.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].