Magic Banana translated my wordy english:
> Summing up (could you try to be brief and clear?), you want to replace, in
an IPv6 address,
> the n-th group of four hexadecimal digits (with n a random integer from 4
to 7) with a random one. Right?
Restated:
... replacing the [randomly selected] n-th field [of eight, skipping the
first three which likely define
the CIDR block of the IPv6 address] to be replaced with another [randomly
generated] group of four
hexadecimal digits ...
Example:
Original IPv6 address: 2a02:2788:1000:0:6037:fc9a:27ac:10c7
Select field number with shuf -i 4-7 -n 1 ==> 5
Generate a new field with [suitably simplified] echo "$(openssl rand -hex 2)"
==> 83bb
Place the new field: 2a02:2788:1000:0:83bb:fc9a:27ac:10c7 (83bb is the new
5th field)
Demonstrating Magic Banana's elegant & correctly interpreted solution:
[code] echo 2a02:2788:1000:0:6037:fc9a:27ac:10c7 | sed
s/'[0-9a-f]\{4\}'/$(openssl rand -hex 2)/$(shuf -i 4-7 -n 1) [/code]
with the result: 2a02:2788:1000:0:6037:fc9a:2b1e:10c7 (2ble is the new 7th
field)
Imagine the task of writing the PTR's of the
79,228,162,514,264,337,593,543,950,336 addresses in 2a02:2788::/32
Ref:
https://www.ultratools.com/tools/netMaskResult?ipAddress=2a02%3A2788%3A%3A%2F32
Now imagine the task of looking up all those
79,228,162,514,264,337,593,543,950,336 addresses ...
For those of you at home: 2a02:2788:5d3a:f8e2:83bb:198c:4a68:b1be gives the
same nslookup
result as all the original and modified IPv6 addresses here.
Could it be that nslookup is being hijacked ?
George Langford