-
Notifications
You must be signed in to change notification settings - Fork 1
/
afilter.py
46 lines (32 loc) · 1.12 KB
/
afilter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from pathlib import Path
from afilter_utils import IReportSmtpIn, IReportSmtpOut, IFilterSmtpIn, Parser, ResultForFilter
LOGFILE = './out.log'
# noinspection PyMethodMayBeStatic
class FilterSmtpIn(IFilterSmtpIn):
def _some_private_function(self):
pass
# for further methods see interface
def rcpt_to(self, ctx, address):
# _some_private_function()
return ResultForFilter(ctx).proceed()
def mail_from(self, ctx, address):
# _some_private_function()
return ResultForFilter(ctx).proceed()
# for further methods see interface
# noinspection PyMethodMayBeStatic
class ReportSmtpIn(IReportSmtpIn):
# for further methods see interface
def link_connect(self, ctx, rdns, fcrdns, src, dest):
pass
def link_disconnect(self, ctx):
pass
def main():
class_method_list = [FilterSmtpIn.rcpt_to, FilterSmtpIn.mail_from, ReportSmtpIn, IReportSmtpOut]
parser = Parser(
debugmode=True,
logfile=Path(LOGFILE) if LOGFILE else None
)
parser.prepare_observers(class_method_list)
parser.dispatch()
if __name__ == '__main__':
main()