From b141b56e6779644826129cf0899a87f28058c7ea Mon Sep 17 00:00:00 2001 From: sever-sever Date: Fri, 23 Apr 2021 13:11:45 +0000 Subject: container: T2216: Add binding for ports and volumes --- src/validators/port-range | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 src/validators/port-range (limited to 'src/validators/port-range') diff --git a/src/validators/port-range b/src/validators/port-range new file mode 100755 index 000000000..abf0b09d5 --- /dev/null +++ b/src/validators/port-range @@ -0,0 +1,19 @@ +#!/usr/bin/python3 + +import sys +import re + +if __name__ == '__main__': + if len(sys.argv)>1: + port_range = sys.argv[1] + if re.search('[0-9]{1,5}-[0-9]{1,5}', port_range): + for tmp in port_range.split('-'): + if int(tmp) not in range(1, 65535): + sys.exit(1) + else: + if int(port_range) not in range(1, 65535): + sys.exit(1) + else: + sys.exit(2) + + sys.exit(0) -- cgit v1.2.3