initial commit
This commit is contained in:
commit
ac6fe6b66d
3 changed files with 55 additions and 0 deletions
1
README.md
Normal file
1
README.md
Normal file
|
@ -0,0 +1 @@
|
||||||
|
smol test project for https://ssi.place/timr/
|
53
pingplace.py
Normal file
53
pingplace.py
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
from icmplib import *
|
||||||
|
from time import sleep
|
||||||
|
|
||||||
|
def one_ping(socket, address):
|
||||||
|
request = ICMPRequest(
|
||||||
|
destination=address,
|
||||||
|
id=1,
|
||||||
|
sequence=1)
|
||||||
|
try:
|
||||||
|
print("sending packet to %s" % address)
|
||||||
|
socket.send(request)
|
||||||
|
return
|
||||||
|
except TimeoutExceeded as err:
|
||||||
|
# The timeout has been reached
|
||||||
|
print(err)
|
||||||
|
except DestinationUnreachable as err:
|
||||||
|
# The reply indicates that the destination host is unreachable
|
||||||
|
print(err)
|
||||||
|
except TimeExceeded as err:
|
||||||
|
# The reply indicates that the time to live exceeded in transit
|
||||||
|
print(err)
|
||||||
|
except ICMPLibError as err:
|
||||||
|
# All other errors
|
||||||
|
print(err)
|
||||||
|
|
||||||
|
# settings
|
||||||
|
x=1
|
||||||
|
y=1
|
||||||
|
width=512
|
||||||
|
hight=512
|
||||||
|
r=0xff
|
||||||
|
g=0xff
|
||||||
|
b=0xff
|
||||||
|
prefix="2a01:4f8:c012:f8e6:1"
|
||||||
|
|
||||||
|
# open socket
|
||||||
|
sock = ICMPv6Socket()
|
||||||
|
|
||||||
|
# generate IP list
|
||||||
|
ips=[]
|
||||||
|
for w in range(width):
|
||||||
|
for h in range(hight):
|
||||||
|
xcoord=x+w
|
||||||
|
xcoord=f"{xcoord:#05x}".split('x')[-1]
|
||||||
|
ycoord=hex(y+h).split('x')[-1]
|
||||||
|
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("done with %s ips" % len(ips))
|
1
requirements.txt
Normal file
1
requirements.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
icmplib
|
Loading…
Reference in a new issue