Browse Source

- Improved verbose mode

git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/trunk@95 a942ae1a-1317-0410-a47c-b1dcaea8d605
0.6
Cyril Jaquier 20 years ago
parent
commit
62feec3227
  1. 1
      CHANGELOG
  2. 2
      README
  3. 14
      fail2ban.py

1
CHANGELOG

@ -12,6 +12,7 @@ ver. 0.3.1 (??/??/2005) - beta
- Corrected level of messages - Corrected level of messages
- Added DNS lookup support - Added DNS lookup support
- Improved parsing speed. Only parse the new log messages - Improved parsing speed. Only parse the new log messages
- Added a second verbose level (-vv)
ver. 0.3.0 (02/24/2005) - beta ver. 0.3.0 (02/24/2005) - beta
---------- ----------

2
README

@ -94,7 +94,7 @@ options:
-l <FILE> log message in FILE -l <FILE> log message in FILE
-r <VALUE> allow a max of VALUE password failure -r <VALUE> allow a max of VALUE password failure
-t <TIME> ban IP for TIME seconds -t <TIME> ban IP for TIME seconds
-v verbose -v verbose. Use twice for greater effect
-w <FIWA> select the firewall to use. Can be iptables, -w <FIWA> select the firewall to use. Can be iptables,
ipfwadm or ipfw ipfwadm or ipfw

14
fail2ban.py

@ -63,7 +63,7 @@ def usage():
print " -l <FILE> log message in FILE" print " -l <FILE> log message in FILE"
print " -r <VALUE> allow a max of VALUE password failure" print " -r <VALUE> allow a max of VALUE password failure"
print " -t <TIME> ban IP for TIME seconds" print " -t <TIME> ban IP for TIME seconds"
print " -v verbose" print " -v verbose. Use twice for greater effect"
print " -w <FIWA> select the firewall to use. Can be iptables," print " -w <FIWA> select the firewall to use. Can be iptables,"
print " ipfwadm or ipfw" print " ipfwadm or ipfw"
print print
@ -212,7 +212,7 @@ if __name__ == "__main__":
logSys.set_formatstring("%T %L %M") logSys.set_formatstring("%T %L %M")
conf = dict() conf = dict()
conf["verbose"] = False conf["verbose"] = 0
conf["background"] = False conf["background"] = False
conf["debug"] = False conf["debug"] = False
conf["conffile"] = "/etc/fail2ban.conf" conf["conffile"] = "/etc/fail2ban.conf"
@ -357,7 +357,7 @@ if __name__ == "__main__":
if opt[0] == "-h": if opt[0] == "-h":
usage() usage()
if opt[0] == "-v": if opt[0] == "-v":
conf["verbose"] = True conf["verbose"] = conf["verbose"] + 1
if opt[0] == "-b": if opt[0] == "-b":
conf["background"] = True conf["background"] = True
if opt[0] == "-d": if opt[0] == "-d":
@ -393,8 +393,12 @@ if __name__ == "__main__":
# Process some options # Process some options
for c in conf: for c in conf:
if c == "verbose" and conf[c]: if c == "verbose":
logSys.set_loglevel(log4py.LOGLEVEL_VERBOSE) logSys.warn("Verbose level is "+`conf[c]`)
if conf[c] == 1:
logSys.set_loglevel(log4py.LOGLEVEL_VERBOSE)
elif conf[c] > 1:
logSys.set_loglevel(log4py.LOGLEVEL_DEBUG)
elif c == "debug" and conf[c]: elif c == "debug" and conf[c]:
logSys.set_loglevel(log4py.LOGLEVEL_DEBUG) logSys.set_loglevel(log4py.LOGLEVEL_DEBUG)
logSys.set_formatstring(log4py.FMT_DEBUG) logSys.set_formatstring(log4py.FMT_DEBUG)

Loading…
Cancel
Save