-
Notifications
You must be signed in to change notification settings - Fork 0
/
Phone.py
27 lines (24 loc) · 990 Bytes
/
Phone.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import time
from socket import *
gPort = 31337
NumberOfPixels = 390
################################################################################
def MakePixel(Red, Green, Blue):
return chr(Red) + chr(Green) + chr(Blue)
################################################################################
def SendPacket(Socket, Packet):
Socket.sendto(Packet, ('workroom-partylights.internal.sbhackerspace.com', gPort))
Socket.sendto(Packet, ('classroom-partylights.internal.sbhackerspace.com', gPort))
Socket.sendto(Packet, ('10.18.0.68', gPort))
################################################################################
def triggerPhone():
Socket = socket(AF_INET, SOCK_DGRAM)
Socket.bind(('', 0))
Socket.setsockopt(SOL_SOCKET, SO_BROADCAST, 1)
for i in range(8):
Packet = MakePixel(0, 255, 0) * NumberOfPixels
SendPacket(Socket, Packet)
time.sleep(.8)
Packet = MakePixel(0, 0, 0) * NumberOfPixels
SendPacket(Socket, Packet)
time.sleep(.4)