summaryrefslogtreecommitdiff
path: root/src/validators/tcp-flag
blob: 86ebec1893eb882e16342334c3906928fb6a3515 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/python3

import sys
import re

if __name__ == '__main__':
    if len(sys.argv)>1:
        flags = sys.argv[1].split(",")

        for flag in flags:
            if flag and flag[0] == '!':
                flag = flag[1:]
            if flag.lower() not in ['syn', 'ack', 'rst', 'fin', 'urg', 'psh']:
                print(f'Error: {flag} is not a valid TCP flag')
                sys.exit(1)
    else:
        sys.exit(2)

    sys.exit(0)