itertools.product
0.0.0.0
255.255.255.255
import itertools
li = range(0,256)
#Generate all possible combinations of numbers from 0 to 255, in a pair of 4
for t in itertools.product(li,repeat=4):
print(f'{t[0]}.{t[1]}.{t[2]}.{t[3]}')
.....
0.1.121.217
0.1.121.218
0.1.121.219
0.1.121.220
0.1.121.221
0.1.121.222
0.1.121.223
0.1.121.224
......