sys-botbase
sys-botbase copied to clipboard
Can't get pixelPeek working
I can't seem te get pixelPeek working. Am i doing something wrong?
import socket
import sys
import time
import binascii
def sendCommand(s, content):
print(content)
content += '\r\n' #important for the parser on the switch side
s.sendall(content.encode())
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("192.168.178.75", 6000))
sendCommand(s, 'pixelPeek')
res = s.recv(512000)
print(sys.getsizeof(res))
f = open('test.jpeg', 'wb')
f.write(res)
f.close()
Have you solved it? I have the same problem.
//File corruption public byte[] pixelPeek() throws IOException, InterruptedException, DecoderException { String command = "pixelPeek"; getSocketChannel().write(ByteBuffer.wrap(encode(command))); // ByteBuffer byteBuffer = borrowResource(); ByteBuffer byteBuffer = ByteBuffer.allocate(0x7D000); int len = getSocketChannel().read(byteBuffer); if (null == byteBuffer) { return null; } byte[] result = new byte[len]; byteBuffer.get(0, result); System.out.println(new String(result)); return Hex.decodeHex(new String(result)); // return result; } FileOutputStream out = new FileOutputStream(new File("/Users/cheukbinli/Downloads/11111.gif")); out.write(imageByte1); out.close();
the java code