mirror of https://github.com/fail2ban/fail2ban
- Fixed printFormatted
- Added more commands git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/trunk@463 a942ae1a-1317-0410-a47c-b1dcaea8d6050.x
parent
994fefcd4a
commit
f8c0c60c2c
33
protocol.py
33
protocol.py
|
@ -42,7 +42,17 @@ protocol = [
|
||||||
["get logtarget", "gets logging target"],
|
["get logtarget", "gets logging target"],
|
||||||
['', ''],
|
['', ''],
|
||||||
["add <JAIL> <BACKEND>", "creates <JAIL> using <BACKEND>"],
|
["add <JAIL> <BACKEND>", "creates <JAIL> using <BACKEND>"],
|
||||||
["set <JAIL> <CMD>", "sets the <CMD> value for <JAIL>"],
|
['', ''],
|
||||||
|
["set <JAIL> idle on|off", "sets the idle state of <JAIL>"],
|
||||||
|
["set <JAIL> addignoreip <IP>", "adds <IP> to the ignore list of <JAIL>"],
|
||||||
|
["set <JAIL> delignoreip <IP>", "removes <IP> from the ignore list of <JAIL>"],
|
||||||
|
["set <JAIL> addlogpath <FILE>", "adds <FILE> to the monitoring list of <JAIL>"],
|
||||||
|
["set <JAIL> dellogpath <FILE>", "removes <FILE> to the monitoring list of <JAIL>"],
|
||||||
|
["set <JAIL> timeregex <REGEX>", "sets the regular expression <REGEX> to match the date format for <JAIL>"],
|
||||||
|
["set <JAIL> timepattern <PATTERN>", "sets the pattern <PATTERN> to match the date format for <JAIL>"],
|
||||||
|
["set <JAIL> failregex <REGEX>", "sets the regular expression <REGEX> which must match failures for <JAIL>"],
|
||||||
|
["set <JAIL> ignoreregex <REGEX>", "sets the regular expression <REGEX> which should match pattern to exclude for <JAIL>"],
|
||||||
|
['', ''],
|
||||||
["get <JAIL> <CMD>", "gets the <CMD> value for <JAIL>"],
|
["get <JAIL> <CMD>", "gets the <CMD> value for <JAIL>"],
|
||||||
['', ''],
|
['', ''],
|
||||||
["start <JAIL>", "starts <JAIL>"],
|
["start <JAIL>", "starts <JAIL>"],
|
||||||
|
@ -56,11 +66,16 @@ protocol = [
|
||||||
|
|
||||||
def printFormatted():
|
def printFormatted():
|
||||||
INDENT=4
|
INDENT=4
|
||||||
FIRST=30
|
MARGIN=35
|
||||||
WIDTH=75
|
WIDTH=40
|
||||||
for command in [' ' * INDENT + m[0] +
|
for m in protocol:
|
||||||
"\n".join(textwrap.wrap(m[1], WIDTH - INDENT,
|
if m[0] == '':
|
||||||
initial_indent=' ' * (FIRST - len(m[0])),
|
print
|
||||||
subsequent_indent=' ' * (FIRST + INDENT)))
|
first = True
|
||||||
for m in protocol]:
|
for n in textwrap.wrap(m[1], WIDTH):
|
||||||
print command
|
if first:
|
||||||
|
n = ' ' * INDENT + m[0] + ' ' * (MARGIN - len(m[0])) + n
|
||||||
|
first = False
|
||||||
|
else:
|
||||||
|
n = ' ' * (INDENT + MARGIN) + n
|
||||||
|
print n
|
||||||
|
|
Loading…
Reference in New Issue