-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
147 additions
and
23 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import select | ||
import socket | ||
import time | ||
from threading import Thread | ||
|
||
from src.server.data import constants | ||
|
||
sock_cmd = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | ||
sock_cmd.bind(("192.168.1.10", constants.PORT_WII_CMD)) | ||
sock_msg = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | ||
sock_msg.bind(("192.168.1.10", constants.PORT_WII_MSG)) | ||
sock_hid = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | ||
sock_hid.bind(("192.168.1.10", constants.PORT_WII_HID)) | ||
sock_vid = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | ||
sock_vid.bind(("192.168.1.10", constants.PORT_WII_VID)) | ||
sock_aud = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | ||
sock_aud.bind(("192.168.1.10", constants.PORT_WII_AUD)) | ||
|
||
|
||
def print_packet(s, name, do_print=True): | ||
data = s.recv(2048) | ||
if do_print: | ||
print "%s: %s" % (name, data.encode('hex')) | ||
|
||
|
||
def send_cmd(data): | ||
sock_cmd.sendto(data, ("192.168.1.11", constants.PORT_WII_CMD + 100)) | ||
|
||
|
||
def cmd_request(): | ||
sid = 0 | ||
while True: | ||
data = { | ||
0: {0: {0: "000000000c00%s087e0115880040000000000000", | ||
10: "000000000d00%s007e0101780040000a0000000100"}, | ||
4: {4: "000000000c00%s007e0109780040040400000000"}, | ||
5: {6: "000000000c00%s007e0101a80040050600000000", | ||
12: "000000001100%s007e0102f80040050c000000050e0300870f", | ||
24: "000000001600%s007e0101c8004005180000000a54313936333030303030"} | ||
}, | ||
1: {0: {0: "000001003000%s1a010000000000000000000000803e000000010002000000000000000070000000404003002d00000" | ||
"10000000000000000" # Just CMD 1 - keys 0 0 are there so it fits nicely with the for loop | ||
} | ||
} | ||
} | ||
for command in data.keys(): | ||
for primary_id in data[command].keys(): | ||
for secondary_id in data[command][primary_id].keys(): | ||
h = hex(sid).replace("0x", "") | ||
if len(h) == 1: | ||
h = "0" + h | ||
send_data = bytes((data[command][primary_id][secondary_id] % h).decode("hex")) | ||
print "Sending command %d %d %d" % (command, primary_id, secondary_id) | ||
send_cmd(send_data) | ||
sid += 1 | ||
time.sleep(1) | ||
|
||
|
||
if __name__ == '__main__': | ||
Thread(target=cmd_request).start() | ||
|
||
while True: | ||
rlist, wlist, xlist = select.select((sock_cmd, sock_msg, sock_hid, sock_vid, sock_aud), (), (), 1) | ||
if rlist: | ||
for s in rlist: | ||
if s == sock_hid: | ||
print_packet(s, "hid", False) | ||
pass | ||
elif s == sock_aud: | ||
print_packet(s, "aud") | ||
elif s == sock_vid: | ||
print_packet(s, "vid") | ||
elif s == sock_cmd: | ||
print_packet(s, "cmd") | ||
elif s == sock_msg: | ||
print_packet(s, "msg") |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"0": { | ||
"0": { | ||
"0": "0200000014000c087e0115880009000000000008190c0117190c0117", | ||
"10": "02000000100007007e0101780009000a0000000400170200" | ||
}, | ||
"4": { | ||
"4": "02000000280008007e010978000904040000001c0000000b00000040190c011728000058000800000c0221fe00001c58" | ||
}, | ||
"5": { | ||
"6": "0200000010030a007e0101a80009050600000304280000580057696955333461663263613034626336000000000000000000000000000000001000800365636130366162363637646637326130646563393237626462656134366130356266353262633366623436643863653861353561303966643761303466343838405132000206d336213160525064cbe7470cca8a7e79f3b470ea34af2ca04bc67049010e1e24a16800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000031c3d8b5c35010e1e15ab48000000000000000000000000000000b8f006ff10abbcff200011ff6f1f611f551e6052c50000f0ffff0900003a5c02325702d05b02c8d26600000000000000000000000000000000000035001e002203c30153015d0ea90e9b0166aee41703a0b5430000000000000000000000000000000000000000008b5c35010e1e15ab48000000000000000000000000000000b8f006ff10abbcff200011ff6f1f611f551e6052c50000f0ffff0900003a5c02325702d05b02c8d26600000000000000000000000000000000000035001e002203c30153015d0ea90e9b0166aee41703a0b543000000000000000000000000000000000000052a5800870f00870f010e1e00000000001900161d6fbcff200011ff6f1f611f551e605200000000000000000000000000000000000000000000000000000000000000000000005d007800f8028201fc01920bf10d6c03481a01000217144800000003ba31e41703a0b54300000000000000000000000000870f15012d014d017a01b701ff0103268c04a34954313936335331333737780100870f00870f010e1effff0000870f00870f020008c30000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004a349", | ||
"12": "020000000c0009007e0102f80009050c00000000", | ||
"24": "020000000c0003007e0101c80009051800000000" | ||
} | ||
}, | ||
"1": "0200010010000b1a000000009e0000008000400000000158" | ||
} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
import os | ||
|
||
# Info | ||
VERSION = "1.4" | ||
|
||
# Port | ||
PORT_WII_MSG = 50010 | ||
PORT_WII_VID = 50020 | ||
|
This file contains 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
This file contains 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