【fix】修复客户端渗透客户端问题 通道关闭错误

This commit is contained in:
wujiawei 2024-09-22 22:01:28 +08:00
parent 69e761e46f
commit bc1c2b008b
3 changed files with 12 additions and 11 deletions

View File

@ -78,14 +78,6 @@ public class NettyClientPermeateServerVisitorHandler extends SimpleChannelInboun
nettyProxyMsg.setData(bytes); nettyProxyMsg.setData(bytes);
nextChannel.writeAndFlush(nettyProxyMsg); nextChannel.writeAndFlush(nettyProxyMsg);
// 处理访客流量 // 处理访客流量
// ServerChannelFlow serverChannelFlow = ServerChannelFlow
// .builder()
// .channelFlowEnum(ChannelFlowEnum.IN_FLOW)
// .port(visitorPort)
// .clientId(clientId)
// .flow(bytes.length)
// .build();
// channelFlowAdapter.asyncHandler(visitorChannel, serverChannelFlow);
log.debug("【客户端渗透服务端】访客端口成功发送数据了"); log.debug("【客户端渗透服务端】访客端口成功发送数据了");
} }

View File

@ -48,10 +48,10 @@ public class ServerHandleReportClientPermeateServerTransferTypeAdvanced extends
ChannelFuture channelFuture = nextChannel.writeAndFlush(buf); ChannelFuture channelFuture = nextChannel.writeAndFlush(buf);
boolean success = channelFuture.isSuccess(); boolean success = channelFuture.isSuccess();
log.debug("visitor writerAndFlush status: {}", success); log.debug("visitor writerAndFlush status: {}", success);
// 记录口数据 // 记录口数据
ServerChannelFlow serverChannelFlow = ServerChannelFlow ServerChannelFlow serverChannelFlow = ServerChannelFlow
.builder() .builder()
.channelFlowEnum(ChannelFlowEnum.OUT_FLOW) .channelFlowEnum(ChannelFlowEnum.IN_FLOW)
.port(visitorPort) .port(visitorPort)
.clientId(clientId) .clientId(clientId)
.flow(msg.getData().length) .flow(msg.getData().length)

View File

@ -35,7 +35,7 @@ public class NettyClientPermeateServerRealHandler extends SimpleChannelInboundHa
Channel channel = ctx.channel(); Channel channel = ctx.channel();
byte[] bytes = nettyByteBuf.getData(); byte[] bytes = nettyByteBuf.getData();
log.debug("bytes.length:{}",bytes.length); log.debug("bytes.length:{}",bytes.length);
log.debug("接收客户端真实服务数据:{}", new String(bytes)); log.debug("【客户端渗透服务端】服务端真实服务数据:{}", new String(bytes));
Channel nextChannel = ChannelAttributeKeyUtils.getNextChannel(channel); Channel nextChannel = ChannelAttributeKeyUtils.getNextChannel(channel);
// 消息下发到客户端 // 消息下发到客户端
@ -44,6 +44,15 @@ public class NettyClientPermeateServerRealHandler extends SimpleChannelInboundHa
nettyMsg.setData(bytes); nettyMsg.setData(bytes);
nextChannel.writeAndFlush(nettyMsg); nextChannel.writeAndFlush(nettyMsg);
// 记录出口数据
// ServerChannelFlow serverChannelFlow = ServerChannelFlow
// .builder()
// .channelFlowEnum(ChannelFlowEnum.OUT_FLOW)
// .port(visitorPort)
// .clientId(clientId)
// .flow(msg.getData().length)
// .build();
// channelFlowAdapter.asyncHandler(channel, serverChannelFlow);
} }