diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-09-17 20:42:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-17 20:42:35 +0200 |
commit | 4f8ebdd1d644dbc5094c1495932df3234d176b12 (patch) | |
tree | c2c95d836ca0a995773a7c836223a7c1261c5f1d /src/helpers/strip-private.py | |
parent | 3e85333ae7c53fc8b2ceae1d1788e795fd92c939 (diff) | |
parent | c1e0a1148c867c1202a0f69ac83f77e14272effd (diff) | |
download | vyos-1x-4f8ebdd1d644dbc5094c1495932df3234d176b12.tar.gz vyos-1x-4f8ebdd1d644dbc5094c1495932df3234d176b12.zip |
Merge pull request #1007 from erkin/current
T3823: Stop strip-private regexp from swallowing quotes
Diffstat (limited to 'src/helpers/strip-private.py')
-rwxr-xr-x | src/helpers/strip-private.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/helpers/strip-private.py b/src/helpers/strip-private.py index c165d2cba..c74a379aa 100755 --- a/src/helpers/strip-private.py +++ b/src/helpers/strip-private.py @@ -47,7 +47,7 @@ ipv4_re = re.compile(r'(\d{1,3}\.){2}(\d{1,3}\.\d{1,3})') ipv4_subst = r'xxx.xxx.\2' # Censor all but the first two fields. -ipv6_re = re.compile(r'([0-9a-fA-F]{1,4}\:){2}(\S+)') +ipv6_re = re.compile(r'([0-9a-fA-F]{1,4}\:){2}([0-9a-fA-F:]+)') ipv6_subst = r'xxxx:xxxx:\2' def ip_match(match: re.Match, subst: str) -> str: @@ -96,12 +96,12 @@ if __name__ == "__main__": args = parser.parse_args() # Strict mode is the default and the absence of loose mode implies presence of strict mode. if not args.loose: - for arg in [args.mac, args.domain, args.hostname, args.username, args.dhcp, args.asn, args.snmp, args.lldp]: - arg = True + args.mac = args.domain = args.hostname = args.username = args.dhcp = args.asn = args.snmp = args.lldp = True if not args.public_address and not args.keep_address: args.address = True elif not args.address and not args.public_address: args.keep_address = True + # (condition, precompiled regexp, substitution string) stripping_rules = [ # Strip passwords @@ -120,7 +120,7 @@ if __name__ == "__main__": (True, re.compile(r'private-key \S+'), 'private-key xxxxxx'), # Strip MAC addresses - (args.mac, re.compile(r'([0-9a-fA-F]{2}\:){5}([0-9a-fA-F]{2}((\:{0,1})){3})'), r'XX:XX:XX:XX:XX:\2'), + (args.mac, re.compile(r'([0-9a-fA-F]{2}\:){5}([0-9a-fA-F]{2}((\:{0,1})){3})'), r'xx:xx:xx:xx:xx:\2'), # Strip host-name, domain-name, and domain-search (args.hostname, re.compile(r'(host-name|domain-name|domain-search) \S+'), r'\1 xxxxxx'), |