1
mirror of https://github.com/rapid7/metasploit-payloads synced 2025-03-12 12:14:29 +01:00

fix xor endianness?

This commit is contained in:
Tim 2016-01-18 17:49:18 +00:00
parent 246c78fccc
commit 98545dbd1a

View File

@ -49,9 +49,7 @@ public abstract class Transport {
protected TLVPacket readAndDecodePacket(DataInputStream in) throws IOException {
int xorKey = in.readInt();
System.out.format("XOR key is 0x%x\n", xorKey);
int len = in.readInt() ^ xorKey - 8;
System.out.format("Length is %u\n", len);
int len = (in.readInt() ^ Integer.reverseBytes(xorKey)) - 8;
int type = in.readInt();
byte[] body = new byte[len];
in.readFully(body);
@ -72,8 +70,8 @@ public abstract class Transport {
this.xorBytes(xorKey, data);
synchronized (out) {
out.writeInt(xorKey);
out.writeInt((data.length + 8) ^ xorKey);
out.writeInt(type ^ xorKey);
out.writeInt((data.length + 8) ^ Integer.reverseBytes(xorKey));
out.writeInt(type ^ Integer.reverseBytes(xorKey));
out.write(data);
out.flush();
}