Pixelnuke Server auf Banana Pi / Raspberry Pi

Raspberri Pi, Banana Pi, Cubieboard etc. mit ARM CPU
Post Reply
User avatar
h3rb3rn
Administrator
Posts: 191
Joined: Mon 9. Feb 2015, 23:29

Pixelnuke Server auf Banana Pi / Raspberry Pi

Post by h3rb3rn »

Hier eine kurze Anleitung den Pixelnuke-Server auf dem Pi zu installieren von https://bitbucket.org/defnull/pixelnuke

Voraussetzung zum kompilieren schaffen

Code: Select all

apt-get install libevent-dev libssl-dev libglew-dev xorg-dev libglu1-mesa-dev


Quelldateien via Git holen

Code: Select all

git clone https://bitbucket.org/defnull/pixelnuke.git


In das Verzeichnis pixelnuke wechseln

Code: Select all

cd pixelnuke


Code: Select all

git submodule init
git submodule update


zum kompilieren make ausführen

Code: Select all

make



Für den Client

Voraussetzung

Code: Select all

apt-get install libjpeg-dev libfreetype6 libfreetype6-dev zlib1g-dev python3 python3-pip python3-dev python3-imaging python3-pil


Client Beispiel Quellcode für Python3

Code: Select all

__author__ = 'progamler'

from PIL import Image, ImageFilter
import subprocess
import socket
from time import sleep
from random import shuffle,randrange
TCP_IP = '192.168.123.234'
TCP_PORT = 1234
BUFFER_SIZE = 1024
MESSAGE = "Hello, World!"
conns = 1
start_ip = 50
loc_w = 300
loc_h = 300
max_w = 800
max_h =  576


im = Image.open("/home/BENUTZER/pixelflut/bild.jpg")

x, y = im.size
max_w = max_w - x
max_h = max_h - y



print(im.size)
rgb = im.convert('RGB')

list = []
print(x)
print(y)
for i in range(0,3,1):
    for x_i in range(1, x):
        for y_i in range(1, y):
            r, g, b = rgb.getpixel((x_i,y_i))
            r = str(hex(r))
            g = str(hex(g))
            b = str(hex(b))
            r = r[2:]
            g = g[2:]
            b = b[2:]
            if len(r) == 1:
                r = "0" + r
            if len(g) == 1:
                g = "0" + g
            if len(b) == 1:
                b = "0" + b


            list.append([x_i,y_i,r,g,b])




shuffle(list)


# generate ip addresses
#for ip in range(start_ip,start_ip+conns+1,1):
#    subprocess.Popen(["/usr/bin/ip addr add 10.20.30." + str(ip) +"/22 dev enp0s25"], shell=True)
sleep(1)
s = []
ip = start_ip
for i in range(0,conns,1):
    print("a")
    s.append(socket.socket(socket.AF_INET, socket.SOCK_STREAM))
    print("b")
#    s[i].bind(('10.20.30.' + str(ip) ,0))
    print("c")
    s[i].connect((TCP_IP, TCP_PORT))
    print("d")


    ip = ip+1
    print("con " + str(i))
while True:
    loc_h = randrange(0,max_h,1)
    loc_w = randrange(0,max_w,1)
    print("y=" + str(loc_h) + "  x=" + str(loc_w))
    i = 0
    for bla in range(0, len(list), conns):
        bar = 0
        for bar in range(0,conns,1):
            try:
                msg = "PX " + str(int(list[bla+bar][0]+loc_w)) + " " + str(list[bla+bar][1]+loc_h) + " " + list[bla+bar][2] + list[bla+bar][3] + list[bla+bar][4] + "\n"
                s[bar].send(bytes(msg, 'UTF-8'))
            except:
                pass

            bar = bar + 1

        i = i+1
        if i == 99:
            sleep(0.0001)
            i = 0
            print("wait")

for i in range(0,conns,1):
    s[i].close()

for ip in range(start_ip,start_ip+conns,1):
    subprocess.call(["ip addr del 10.20.30." + str(ip) +"/22 dev enp0s25"], shell=True)
Post Reply