Linux vps-61133.fhnet.fr 4.9.0-19-amd64 #1 SMP Debian 4.9.320-2 (2022-06-30) x86_64
Apache/2.4.25 (Debian)
Server IP : 93.113.207.21 & Your IP : 216.73.216.112
Domains :
Cant Read [ /etc/named.conf ]
User : www-data
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
usr /
lib /
python3 /
dist-packages /
fail2ban /
server /
Delete
Unzip
Name
Size
Permission
Date
Action
__pycache__
[ DIR ]
drwxr-xr-x
2022-11-21 13:39
__init__.py
974
B
-rw-r--r--
2016-12-09 15:48
action.py
16.56
KB
-rw-r--r--
2017-04-17 16:27
actions.py
11.47
KB
-rw-r--r--
2017-04-17 16:27
asyncserver.py
5.34
KB
-rw-r--r--
2016-12-09 15:48
banmanager.py
8.66
KB
-rw-r--r--
2016-12-09 15:48
database.py
15.89
KB
-rw-r--r--
2017-04-17 16:27
datedetector.py
6.37
KB
-rw-r--r--
2016-12-09 15:48
datetemplate.py
7.55
KB
-rw-r--r--
2017-04-17 16:27
faildata.py
1.85
KB
-rw-r--r--
2016-12-09 15:48
failmanager.py
3.99
KB
-rw-r--r--
2017-04-17 16:27
failregex.py
6.39
KB
-rw-r--r--
2016-12-09 15:48
filter.py
26.91
KB
-rw-r--r--
2017-04-17 16:27
filtergamin.py
3.53
KB
-rw-r--r--
2016-12-09 15:48
filterpoll.py
4.39
KB
-rw-r--r--
2016-12-09 15:48
filterpyinotify.py
6.26
KB
-rw-r--r--
2016-12-09 15:48
filtersystemd.py
8.21
KB
-rw-r--r--
2016-12-09 15:48
jail.py
6.95
KB
-rw-r--r--
2017-04-17 16:27
jails.py
2.68
KB
-rw-r--r--
2016-12-09 15:48
jailthread.py
2.38
KB
-rw-r--r--
2016-12-09 15:48
mytime.py
2.57
KB
-rw-r--r--
2016-12-09 15:48
server.py
17.8
KB
-rw-r--r--
2017-04-17 16:27
strptime.py
5.91
KB
-rw-r--r--
2017-04-17 16:27
ticket.py
2.41
KB
-rw-r--r--
2017-04-17 16:27
transmitter.py
10.59
KB
-rw-r--r--
2017-04-17 16:27
Save
Rename
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: t -*- # vi: set ft=python sts=4 ts=4 sw=4 noet : # This file is part of Fail2Ban. # # Fail2Ban is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # Fail2Ban is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Fail2Ban; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Author: Cyril Jaquier # __author__ = "Cyril Jaquier" __copyright__ = "Copyright (c) 2004 Cyril Jaquier" __license__ = "GPL" from threading import Lock import logging from .faildata import FailData from .ticket import FailTicket from ..helpers import getLogger # Gets the instance of the logger. logSys = getLogger(__name__) class FailManager: def __init__(self): self.__lock = Lock() self.__failList = dict() self.__maxRetry = 3 self.__maxTime = 600 self.__failTotal = 0 def setFailTotal(self, value): try: self.__lock.acquire() self.__failTotal = value finally: self.__lock.release() def getFailTotal(self): try: self.__lock.acquire() return self.__failTotal finally: self.__lock.release() def setMaxRetry(self, value): try: self.__lock.acquire() self.__maxRetry = value finally: self.__lock.release() def getMaxRetry(self): try: self.__lock.acquire() return self.__maxRetry finally: self.__lock.release() def setMaxTime(self, value): try: self.__lock.acquire() self.__maxTime = value finally: self.__lock.release() def getMaxTime(self): try: self.__lock.acquire() return self.__maxTime finally: self.__lock.release() def addFailure(self, ticket): try: self.__lock.acquire() ip = ticket.getIP() unixTime = ticket.getTime() matches = ticket.getMatches() if ip in self.__failList: fData = self.__failList[ip] if fData.getLastReset() < unixTime - self.__maxTime: fData.setLastReset(unixTime) fData.setRetry(0) fData.inc(matches) fData.setLastTime(unixTime) else: fData = FailData() fData.inc(matches) fData.setLastReset(unixTime) fData.setLastTime(unixTime) self.__failList[ip] = fData self.__failTotal += 1 if logSys.getEffectiveLevel() <= logging.DEBUG: # yoh: Since composing this list might be somewhat time consuming # in case of having many active failures, it should be ran only # if debug level is "low" enough failures_summary = ', '.join(['%s:%d' % (k, v.getRetry()) for k,v in self.__failList.items()]) logSys.debug("Total # of detected failures: %d. Current failures from %d IPs (IP:count): %s" % (self.__failTotal, len(self.__failList), failures_summary)) finally: self.__lock.release() def size(self): try: self.__lock.acquire() return len(self.__failList) finally: self.__lock.release() def cleanup(self, time): try: self.__lock.acquire() tmp = self.__failList.copy() for item in tmp: if tmp[item].getLastTime() < time - self.__maxTime: self.__delFailure(item) finally: self.__lock.release() def __delFailure(self, ip): if ip in self.__failList: del self.__failList[ip] def toBan(self): try: self.__lock.acquire() for ip in self.__failList: data = self.__failList[ip] if data.getRetry() >= self.__maxRetry: self.__delFailure(ip) # Create a FailTicket from BanData failTicket = FailTicket(ip, data.getLastTime(), data.getMatches()) failTicket.setAttempt(data.getRetry()) return failTicket raise FailManagerEmpty finally: self.__lock.release() class FailManagerEmpty(Exception): pass