ticket.py

Go to the documentation of this file.
00001 # This file is part of Fail2Ban.
00002 #
00003 # Fail2Ban is free software; you can redistribute it and/or modify
00004 # it under the terms of the GNU General Public License as published by
00005 # the Free Software Foundation; either version 2 of the License, or
00006 # (at your option) any later version.
00007 #
00008 # Fail2Ban is distributed in the hope that it will be useful,
00009 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 # GNU General Public License for more details.
00012 #
00013 # You should have received a copy of the GNU General Public License
00014 # along with Fail2Ban; if not, write to the Free Software
00015 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00016 
00017 # Author: Cyril Jaquier
00018 # 
00019 # $Revision: 686 $
00020 
00021 __author__ = "Cyril Jaquier"
00022 __version__ = "$Revision: 686 $"
00023 __date__ = "$Date: 2008-04-13 19:48:52 +0200 (Sun, 13 Apr 2008) $"
00024 __copyright__ = "Copyright (c) 2004 Cyril Jaquier"
00025 __license__ = "GPL"
00026 
00027 import logging
00028 
00029 # Gets the instance of the logger.
00030 logSys = logging.getLogger("fail2ban")
00031 
00032 class Ticket:
00033     
00034     def __init__(self, ip, time):
00035         self.__ip = ip
00036         self.__time = time
00037         self.__attempt = 0
00038     
00039     def setIP(self, value):
00040         self.__ip = value
00041     
00042     def getIP(self):
00043         return self.__ip
00044     
00045     def setTime(self, value):
00046         self.__time = value
00047     
00048     def getTime(self):
00049         return self.__time
00050     
00051     def setAttempt(self, value):
00052         self.__attempt = value
00053     
00054     def getAttempt(self):
00055         return self.__attempt
00056 
00057 
00058 class FailTicket(Ticket):
00059     
00060     def __init__(self, ip, time):
00061         Ticket.__init__(self, ip, time)
00062 
00063 
00064 ##
00065 # Ban Ticket.
00066 #
00067 # This class extends the Ticket class. It is mainly used by the BanManager.
00068 
00069 class BanTicket(Ticket):
00070     
00071     ##
00072     # Constructor.
00073     #
00074     # Call the Ticket (parent) constructor and initialize default
00075     # values.
00076     # @param ip the IP address
00077     # @param time the ban time
00078     
00079     def __init__(self, ip, time):
00080         Ticket.__init__(self, ip, time)
Generated on Thu May 23 03:01:40 2013 for Fail2Ban by  doxygen 1.6.3