PyFilter | Denies user access via blocking IP addresses | Firewall library
kandi X-RAY | PyFilter Summary
kandi X-RAY | PyFilter Summary
PyFilter aims to filter out all of the requests that are not legitimate to your server, and blocks them if too many are sent. It works by reading log files and checking if a failed request has came from the same IP address within a user configurable amount of time and adding rules to the firewall if too many attempts have been captured. By default PyFilter is configured to read from /var/log/auth.log for incoming SSH requests, however there are options for Apache, Nginx and MySQL too. PyFilter uses a database to store all the banned ip addresses to ensure ips arent added more than once. PyFilter currently supports sqlite and redis, by default it is setup to use sqlite so no installation of a redis server is needed. However redis has support for cross server ban syncing (more info below).
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Runs firewall rules
- Get all ban messages
- Scans the server
- Ban an IP address from redis
- blacklist an IP address
- Checks IP address
- Log a message to a log file
- Checks if the given IP address is valid
- Monitor the redis connection
- Bulk ban redis
- Read files from a log file
- Filter based on pattern_type
- Check if the IP address matches the given pattern
PyFilter Key Features
PyFilter Examples and Code Snippets
{
"settings": {
"database": "sqlite",
"failed_attempts": 5,
"deny_type": "DROP",
"ignored_ips": ["127.0.0.1"],
"request_time": 5,
"reload_iptables": true,
"rules": {
"ssh": {
"log_files": "/var/log/auth.log
sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install tcl8.5
wget http://download.redis.io/releases/redis-stable.tar.gz
tar xzf redis-stable.tar.gz
cd redis-stable
make
make test
sudo make install
cd utils
sudo ./install_serve
%Y -> Year
%m -> Month (Month as number form e.g 10 = October)
%b -> Month (Month as abbreviated name e.g Oct)
%B -> Month (Month as full name e.g October)
%d -> Day
%H -> Hour
%S -> Second
%d -> Day within a month (e.g 1 for
Community Discussions
Trending Discussions on PyFilter
QUESTION
I made a script that takes a few arguments to run. Originally it could be run automatically with the argument 'auto', but I'm trying to daemonize it so it will run the run the script with the specified arguments as a daemon. The problem is that python-daemon and argparse don't seem to get along when it comes to deciding who parses what.
...ANSWER
Answered 2017-Nov-30 at 15:50Argparse takes arguments from sys.argv per default (see here). It is not surprising that the behaviour you see here is happening, as you just call the parse_args function with the default arguments. You can just pass whatever you want to parse to it, instead of sys.argv.
See this question for an example.
So consume whatever you need for python-deamon and then parse the remaining args with argparse.
QUESTION
In the code below, I cannot add the -v and -p arguments after the action (update, blacklist, auto), presumably due to the subparser. How can I make it so that I can add these optional arguments in any order?
...ANSWER
Answered 2017-Nov-21 at 01:24This is how your tree of parser looks like
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install PyFilter
You can use PyFilter like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page