-
-
Save mjf/e04ed9962ce3d8aad9b0128ea2eb8334 to your computer and use it in GitHub Desktop.
anna - Annonymize IPv4 and IPv6 addresses
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sed -f | |
# anna - Annonymize IPv4 and IPv6 addresses | |
# Copyright (2020) Matous Jan Fialka, <https://mjf.cz/> | |
# Released under the terms of the "MIT License" | |
# See RFC 5737 for the replacements explanation. | |
s/\(\(\([0-9]\|[1-9][0-9]\|1[0-9]\{2\}\|2[0-4][0-9]\|25[0-5]\)\.\)\{3\}\([0-9]\|[1-9][0-9]\|1[0-9]\{2\}\|2[0-4][0-9]\|25[0-5]\)\)/192.0.2.1/g | |
s/\(\([0-9a-f]\{1,4\}:\)\{6\}\(\([0-9a-f]\{1,4\}:[0-9a-f]\{1,4\}\)\|\(\([0-9]\|[1-9][0-9]\|1[0-9]\{2\}\|2[0-4][0-9]\|25[0-5]\)[.]\)\{3\}\([0-9]\|[1-9][0-9]\|1[0-9]\{2\}\|2[0-4][0-9]\|25[0-5]\)\)\|::\([0-9a-f]\{1,4\}:\)\{5\}\(\([0-9a-f]\{1,4\}:[0-9a-f]\{1,4\}\)\|\(\([0-9]\|[1-9][0-9]\|1[0-9]\{2\}\|2[0-4][0-9]\|25[0-5]\)[.]\)\{3\}\([0-9]\|[1-9][0-9]\|1[0-9]\{2\}\|2[0-4][0-9]\|25[0-5]\)\)\|\([0-9a-f]\{1,4\}\)\?::\([0-9a-f]\{1,4\}:\)\{4\}\(\([0-9a-f]\{1,4\}:[0-9a-f]\{1,4\}\)\|\(\([0-9]\|[1-9][0-9]\|1[0-9]\{2\}\|2[0-4][0-9]\|25[0-5]\)[.]\)\{3\}\([0-9]\|[1-9][0-9]\|1[0-9]\{2\}\|2[0-4][0-9]\|25[0-5]\)\)\|\(\([0-9a-f]\{1,4\}:\)\?[0-9a-f]\{1,4\}\)\?::\([0-9a-f]\{1,4\}:\)\{3\}\(\([0-9a-f]\{1,4\}:[0-9a-f]\{1,4\}\)\|\(\([0-9]\|[1-9][0-9]\|1[0-9]\{2\}\|2[0-4][0-9]\|25[0-5]\)[.]\)\{3\}\([0-9]\|[1-9][0-9]\|1[0-9]\{2\}\|2[0-4][0-9]\|25[0-5]\)\)\|\(\([0-9a-f]\{1,4\}:\)\{,2\}[0-9a-f]\{1,4\}\)\?::\([0-9a-f]\{1,4\}:\)\{2\}\(\([0-9a-f]\{1,4\}:[0-9a-f]\{1,4\}\)\|\(\([0-9]\|[1-9][0-9]\|1[0-9]\{2\}\|2[0-4][0-9]\|25[0-5]\)[.]\)\{3\}\([0-9]\|[1-9][0-9]\|1[0-9]\{2\}\|2[0-4][0-9]\|25[0-5]\)\)\|\(\([0-9a-f]\{1,4\}:\)\{,3\}[0-9a-f]\{1,4\}\)\?::[0-9a-f]\{1,4\}:\(\([0-9a-f]\{1,4\}:[0-9a-f]\{1,4\}\)\|\(\([0-9]\|[1-9][0-9]\|1[0-9]\{2\}\|2[0-4][0-9]\|25[0-5]\)[.]\)\{3\}\([0-9]\|[1-9][0-9]\|1[0-9]\{2\}\|2[0-4][0-9]\|25[0-5]\)\)\|\(\([0-9a-f]\{1,4\}:\)\{,4\}[0-9a-f]\{1,4\}\)\?::\(\([0-9a-f]\{1,4\}:[0-9a-f]\{1,4\}\)\|\(\([0-9]\|[1-9][0-9]\|1[0-9]\{2\}\|2[0-4][0-9]\|25[0-5]\)[.]\)\{3\}\([0-9]\|[1-9][0-9]\|1[0-9]\{2\}\|2[0-4][0-9]\|25[0-5]\)\)\|\(\([0-9a-f]\{1,4\}:\)\{,5\}[0-9a-f]\{1,4\}\)\?::[0-9a-f]\{1,4\}\|\(\([0-9a-f]\{1,4\}:\)\{,6\}[0-9a-f]\{1,4\}\)\?::\)/2001:db8::1/g | |
# vi:ft=sed:nowrap |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment