Created
December 28, 2014 16:10
-
-
Save jokey2k/ff203540a91fdd82c75b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
import random | |
import time | |
from PIL import Image | |
UDP_IP = "151.217.40.31" | |
UDP_PORT = 12345 | |
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
img = Image.open("test.png") | |
MESSAGE = "" | |
for (red, green, blue) in list(img.getdata()): | |
MESSAGE += chr(red) + chr(green) + chr(blue) | |
if len(MESSAGE) < 2048: | |
MESSAGE += "".join([chr(0) for i in range(2048+1-len(MESSAGE))]) | |
sock.sendto("".join(MESSAGE), (UDP_IP, UDP_PORT)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment