mirror of
https://github.com/kurisufriend/openbased.git
synced 2025-04-11 22:52:58 -04:00
init~
This commit is contained in:
commit
cb2001cd44
63
c.py
Normal file
63
c.py
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
import requests, os, time
|
||||||
|
|
||||||
|
# go get hokierux@@@!!!!
|
||||||
|
if not os.path.exists("hkt.png"):
|
||||||
|
r = requests.get("https://vtluug.org/hokietux.png")
|
||||||
|
with open("hkt.png", "wb") as f:
|
||||||
|
f.write(r.content)
|
||||||
|
#uisbt he so cute...
|
||||||
|
|
||||||
|
def run(thread, node, threads, nodes):
|
||||||
|
im = Image.open("./hkt.png")
|
||||||
|
im.thumbnail((500, int((500 * im.width)/im.height)))
|
||||||
|
|
||||||
|
tgt = "2602:f75c:c0::XXXX:YYYY:RRGG:BBAA"
|
||||||
|
|
||||||
|
xo = 0
|
||||||
|
yo = 0
|
||||||
|
|
||||||
|
xchunk = im.width // nodes
|
||||||
|
xrange = (xchunk * node, xchunk * node + xchunk)
|
||||||
|
|
||||||
|
ychunk = im.height // threads
|
||||||
|
yrange = (ychunk * thread, ychunk * thread + ychunk)
|
||||||
|
|
||||||
|
d = im.load()
|
||||||
|
for x in range(xrange[0], xrange[1]):
|
||||||
|
for y in range(yrange[0], yrange[1]):
|
||||||
|
c = d[x, y]
|
||||||
|
if c[-1] == 0: continue
|
||||||
|
c = [hex(i).replace("0x", "") for i in c]
|
||||||
|
cmap = ["RR", "GG", "BB", "AA", "XXXX", "YYYY"]
|
||||||
|
sx = hex(x + xo).replace("0x", "")
|
||||||
|
sy = hex(y + yo).replace("0x", "")
|
||||||
|
while len(sx) < 4: sx = "0"+sx
|
||||||
|
while len(sy) < 4: sy = "0"+sy
|
||||||
|
for i in range(len(c)):
|
||||||
|
cc = c[i]
|
||||||
|
while len(cc) < 2: cc = "0"+cc
|
||||||
|
c[i] = cc
|
||||||
|
c.extend([sx, sy])
|
||||||
|
sighted = tgt
|
||||||
|
for i in range(len(cmap)):
|
||||||
|
sighted = sighted.replace(cmap[i], c[i])
|
||||||
|
os.system("ping -c 1 -W .001 "+sighted+" > /dev/null")
|
||||||
|
time.sleep(0.001)
|
||||||
|
#print(x, y, sx, sy, sighted)
|
||||||
|
|
||||||
|
import subprocess, json, sys
|
||||||
|
with open("./nodez.json", "r") as f:
|
||||||
|
nodes = json.loads(f.read())
|
||||||
|
|
||||||
|
whoami = subprocess.check_output(["hostname"]).decode("ascii").split(".")[0].strip()
|
||||||
|
|
||||||
|
if not whoami in nodes.keys():
|
||||||
|
print("dyign", whoami, nodes.keys())
|
||||||
|
sys.exit(1)
|
||||||
|
print("running openbased on "+whoami+"... ^///.///^")
|
||||||
|
|
||||||
|
from PIL import Image
|
||||||
|
threads = nodes[whoami]["threads"]
|
||||||
|
import threading
|
||||||
|
for i in range(threads):
|
||||||
|
threading.Thread(target=run, args=(i, list(nodes.keys()).index(whoami), threads, len(nodes.keys()))).start()
|
BIN
hkt.png
Normal file
BIN
hkt.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 154 KiB |
32
nodez.json
Normal file
32
nodez.json
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
"acidburn":
|
||||||
|
{
|
||||||
|
"u" : "rsk",
|
||||||
|
"fqdn" : "acidburn.vtluug.org",
|
||||||
|
"threads" : 1
|
||||||
|
},
|
||||||
|
"meltdown":
|
||||||
|
{
|
||||||
|
"u" : "rsk",
|
||||||
|
"fqdn" : "meltdown.vtluug.org",
|
||||||
|
"threads" : 8
|
||||||
|
},
|
||||||
|
"gibson":
|
||||||
|
{
|
||||||
|
"u" : "rsk",
|
||||||
|
"fqdn" : "gibson.vtluug.org",
|
||||||
|
"threads" : 8
|
||||||
|
},
|
||||||
|
"tacomanarrows":
|
||||||
|
{
|
||||||
|
"u" : "rsk",
|
||||||
|
"fqdn" : "tacomanarrows.wuvt.vt.edu",
|
||||||
|
"threads" : 2
|
||||||
|
},
|
||||||
|
"dirtycow":
|
||||||
|
{
|
||||||
|
"u" : "rsk",
|
||||||
|
"fqdn" : "dirtycow.vtluug.org",
|
||||||
|
"threads" : 2
|
||||||
|
}
|
||||||
|
}
|
10
run.py
Normal file
10
run.py
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import subprocess, json, sys, os, threading
|
||||||
|
with open("./nodez.json", "r") as f:
|
||||||
|
nodes = json.loads(f.read())
|
||||||
|
|
||||||
|
def run(tgt):
|
||||||
|
#os.system(f"ssh {tgt['u']}@{tgt['fqdn']} sudo apt install -y python3-pillow")
|
||||||
|
os.system(f"ssh {tgt['u']}@{tgt['fqdn']} \"cd ~/repos/openbased/ && python3 c.py\"")
|
||||||
|
|
||||||
|
for node in nodes.values():
|
||||||
|
threading.Thread(target=run, args=(node,)).start()
|
Loading…
Reference in New Issue
Block a user