diff --git a/image.jpg b/image.jpg new file mode 100644 index 0000000..b14af91 Binary files /dev/null and b/image.jpg differ diff --git a/pingplace.py b/pingplace.py index a353130..ac1d7b4 100644 --- a/pingplace.py +++ b/pingplace.py @@ -1,5 +1,5 @@ from icmplib import * -from time import sleep +from PIL import Image def one_ping(socket, address): request = ICMPRequest( @@ -28,38 +28,31 @@ x=0 y=0 width=512 hight=512 -r=0 -g=0 -b=0 prefix="2a01:4f8:c012:f8e6:1" # open socket sock = ICMPv6Socket() +# open image +with Image.open("image.jpg") as imgraw: + img = imgraw.resize((width, hight)) + # generate IP list ips=[] for w in range(width): - if (r>=255): - if (g>=255): - if(b>=255): - r=0 - g=0 - b=0 - else: - b=b+1 - else: - g=g+1 - else: - r=r+1 for h in range(hight): xcoord=x+w xcoord=f"{xcoord:#05x}".split('x')[-1] ycoord=hex(y+h).split('x')[-1] + r=img.getpixel((x+w, y+h))[0] + g=img.getpixel((x+w, y+h))[1] + b=img.getpixel((x+w, y+h))[2] colorr=f"{r:#04x}".split('x')[-1] colorg=f"{g:#04x}".split('x')[-1] colorb=f"{b:#04x}".split('x')[-1] ip=prefix+xcoord+":"+ycoord+":"+colorr+":"+colorg+colorb ips.append(ip) for ip in ips: - one_ping(sock, ip) + print(ip) +# #one_ping(sock, ip) print("done with %s ips" % len(ips)) \ No newline at end of file