1 """
2 Tools module for IOIDS
3
4 Inter-Organisational Intrusion Detection System (IOIDS)
5
6 Check README in the IOIDS folder for more information.
7
8 @author: Michael Pilgermann
9 @contact: mailto:mpilgerm@glam.ac.uk
10 @license: GPL (General Public License)
11 """
12
13 import output
14 from sys import stdout
15
16 oneindent = ' ' * 3
17 SUCESS_POS = output.green(' OK ')
18 SUCESS_NEG = output.red('FAILED')
19 SUCESS_SKIP = output.yellow(' SKIP ')
20 SUCESS_WARN = output.yellow(' !! ')
21
22 COLUMN_SUCESS = 80
23 COLUMN_INPUT = 70
24 LENGTH_LINE = 89
25
26
27 -def printAction(indent, text, linebreak = 0, out = stdout):
28 """
29 Prints a line for an action and puts the cursor on a predefined column.
30
31 Usually, no line break is written, the line should be finished after performing an
32 action using the function L{finishActionLine}.
33 """
34 print ((oneindent * indent) + text).ljust(COLUMN_SUCESS),
35 if linebreak:
36 print
37 else:
38 out.flush()
39
41 """
42 Finishes a line as prepared by L{printAction}.
43
44 Puts the given sucess string in brackets.
45 """
46 print '[%s]' %(sucess)
47
61