Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ private int executeUdpClient(Meterpreter meterpreter, TLVPacket request, TLVPack
}
Channel channel = new DatagramSocketChannel(meterpreter, ds);
response.add(TLVType.TLV_TYPE_CHANNEL_ID, channel.getID());
response.add(TLVType.TLV_TYPE_LOCAL_HOST, ds.getLocalAddress().getHostAddress());
response.add(TLVType.TLV_TYPE_LOCAL_PORT, ds.getLocalPort());
return ERROR_SUCCESS;
}

Expand All @@ -89,14 +91,15 @@ private int executeTcpServer(Meterpreter meterpreter, TLVPacket request, TLVPack
ServerSocket ss = getSocket(localHost, localPort);
Channel channel = new ServerSocketChannel(meterpreter, ss);
response.add(TLVType.TLV_TYPE_CHANNEL_ID, channel.getID());
response.add(TLVType.TLV_TYPE_LOCAL_HOST, ss.getInetAddress().getHostAddress());
response.add(TLVType.TLV_TYPE_LOCAL_PORT, ss.getLocalPort());
return ERROR_SUCCESS;
}

protected ServerSocket getSocket(String localHost, int localPort) throws UnknownHostException, IOException {
return new ServerSocket(localPort, 50, InetAddress.getByName(localHost));
}


private int executeTcpClient(Meterpreter meterpreter, TLVPacket request, TLVPacket response) throws Exception {
String peerHost = request.getStringValue(TLVType.TLV_TYPE_PEER_HOST);
int peerPort = request.getIntValue(TLVType.TLV_TYPE_PEER_PORT);
Expand Down Expand Up @@ -124,6 +127,8 @@ private int executeTcpClient(Meterpreter meterpreter, TLVPacket request, TLVPack
Channel channel = new SocketChannel(meterpreter, socket);
channel.startInteract();
response.add(TLVType.TLV_TYPE_CHANNEL_ID, channel.getID());
response.add(TLVType.TLV_TYPE_LOCAL_HOST, socket.getLocalAddress().getHostAddress());
response.add(TLVType.TLV_TYPE_LOCAL_PORT, socket.getLocalPort());
return ERROR_SUCCESS;
}
}
Loading