diff --git a/results/telemetry.php b/results/telemetry.php index b021759..3163f54 100644 --- a/results/telemetry.php +++ b/results/telemetry.php @@ -15,8 +15,15 @@ $log=($_POST["log"]); if($redact_ip_addresses){ $ip="0.0.0.0"; - $ispinfo=preg_replace('/((2[0-4]|1\d|[1-9])?\d|25[0-5])(\.(?1)){3}/',"0.0.0.0",preg_replace('/(((?=(?>.*?(::))(?!.+\3)))\3?|([\dA-F]{1,4}(\3|:(?!$)|$)|\2))(?4){5}((?4){2}|((2[0-4]|1\d|[1-9])?\d|25[0-5])(\.(?7)){3})/i',"0.0.0.0",$ispinfo)); - $log=preg_replace('/((2[0-4]|1\d|[1-9])?\d|25[0-5])(\.(?1)){3}/',"0.0.0.0",preg_replace('/(((?=(?>.*?(::))(?!.+\3)))\3?|([\dA-F]{1,4}(\3|:(?!$)|$)|\2))(?4){5}((?4){2}|((2[0-4]|1\d|[1-9])?\d|25[0-5])(\.(?7)){3})/i',"0.0.0.0",$log)); + $ipv4_regex='/(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/'; + $ipv6_regex='/(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/'; + $hostname_regex='/"hostname":"([^\\\\"]|\\\\")*"/'; + $ispinfo=preg_replace($ipv4_regex,"0.0.0.0",$ispinfo); + $ispinfo=preg_replace($ipv6_regex,"0.0.0.0",$ispinfo); + $ispinfo=preg_replace($hostname_regex,"\"hostname\":\"REDACTED\"",$ispinfo); + $log=preg_replace($ipv4_regex,"0.0.0.0",$log); + $log=preg_replace($ipv6_regex,"0.0.0.0",$log); + $log=preg_replace($hostname_regex,"\"hostname\":\"REDACTED\"",$log); } header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0, s-maxage=0');