diff --git a/src/utils/yunopaste.py b/src/utils/yunopaste.py index 35e829991..83e52a12a 100644 --- a/src/utils/yunopaste.py +++ b/src/utils/yunopaste.py @@ -5,7 +5,7 @@ import json import logging from yunohost.domain import _get_maindomain, domain_list -from yunohost.utils.network import get_public_ip +from yunohost.utils.network import get_public_ips from yunohost.utils.error import YunohostError logger = logging.getLogger("yunohost.utils.yunopaste") @@ -82,13 +82,26 @@ def anonymize(data): count += 1 # We also want to anonymize the ips - ipv4 = get_public_ip() - ipv6 = get_public_ip(6) + ipsv4 = get_public_ips(4) + ipsv6 = get_public_ips(6) - if ipv4: - data = data.replace(str(ipv4), "xx.xx.xx.xx") + def gen_anonymized_ip(length,counter,sep='.'): + # Generate anonymized IPs like "xx.xx.xx.yy" + chars = "xy" + binary_str = format(counter, 'b') + indexes = [int(x) for x in binary_str] + if len(indexes)