forked from Snawoot/postfix-mta-sts-resolver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mta-sts-query
executable file
·39 lines (30 loc) · 1.13 KB
/
mta-sts-query
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
#!/usr/bin/env python3
import sys
import argparse
import postfix_mta_sts_resolver.utils as utils
from postfix_mta_sts_resolver.resolver import STSResolver
import asyncio
def parse_args():
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument("-v", "--verbosity",
help="logging verbosity",
type=utils.LogLevel.__getitem__,
choices=list(utils.LogLevel),
default=utils.LogLevel.warn)
parser.add_argument("domain",
help="domain to fetch MTA-STS policy from")
parser.add_argument("known_version",
nargs="?",
default=None,
help="latest known version")
return parser.parse_args()
def main():
args = parse_args()
mainLogger = utils.setup_logger('MAIN', args.verbosity)
loop = asyncio.get_event_loop()
R = STSResolver(loop=loop)
result = loop.run_until_complete(R.resolve(args.domain, args.known_version))
print(result)
if __name__ == '__main__':
main()