mirror of
https://gitee.com/wujiawei1207537021/wu-lazy-cloud-network.git
synced 2025-06-06 13:27:55 +08:00
【fix】数据通信失败原因需要使用 ByteBuf格式 发送数据 ByteBuf realBuf = nextChannel.config().getAllocator().buffer(bytes.length);
realBuf.writeBytes(bytes);
This commit is contained in:
parent
4a7bdb366f
commit
2683bb4dee
@ -22,6 +22,11 @@ public class NettyClientVisitorRealHandler extends SimpleChannelInboundHandler<N
|
|||||||
this.channelTypeAdapter = channelTypeAdapter;
|
this.channelTypeAdapter = channelTypeAdapter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
||||||
|
super.channelActive(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void channelRead0(ChannelHandlerContext ctx, NettyProxyMsg nettyProxyMsg) throws Exception {
|
public void channelRead0(ChannelHandlerContext ctx, NettyProxyMsg nettyProxyMsg) throws Exception {
|
||||||
Channel channel = ctx.channel();
|
Channel channel = ctx.channel();
|
||||||
@ -29,11 +34,6 @@ public class NettyClientVisitorRealHandler extends SimpleChannelInboundHandler<N
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
|
||||||
super.channelActive(ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.framework.lazy.cloud.network.heartbeat.server.netty.handler;
|
package org.framework.lazy.cloud.network.heartbeat.server.netty.handler;
|
||||||
|
|
||||||
|
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelOption;
|
import io.netty.channel.ChannelOption;
|
||||||
@ -35,7 +36,11 @@ public class PermeateClientRealHandler extends SimpleChannelInboundHandler<Netty
|
|||||||
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);
|
||||||
nextChannel.writeAndFlush(bytes);
|
// 将二进制数组转换成 ByteBuf 然后进行发送
|
||||||
|
ByteBuf realBuf = nextChannel.config().getAllocator().buffer(bytes.length);
|
||||||
|
realBuf.writeBytes(bytes);
|
||||||
|
|
||||||
|
nextChannel.writeAndFlush(realBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -66,10 +66,16 @@ public class PermeateVisitorHandler extends SimpleChannelInboundHandler<ByteBuf>
|
|||||||
|
|
||||||
Channel nextChannel = ChannelAttributeKeyUtils.getNextChannel(visitorChannel);
|
Channel nextChannel = ChannelAttributeKeyUtils.getNextChannel(visitorChannel);
|
||||||
// 下一个通道开启自动读写
|
// 下一个通道开启自动读写
|
||||||
|
log.info("write data to channelId:{}",nextChannel.id().asLongText());
|
||||||
nextChannel.config().setOption(ChannelOption.AUTO_READ, true);
|
nextChannel.config().setOption(ChannelOption.AUTO_READ, true);
|
||||||
// 绑定数据流量
|
// 绑定数据流量
|
||||||
ChannelAttributeKeyUtils.buildInFlow(nextChannel, bytes.length);
|
ChannelAttributeKeyUtils.buildInFlow(nextChannel, bytes.length);
|
||||||
nextChannel.writeAndFlush(bytes);
|
|
||||||
|
// 将二进制数组转换成 ByteBuf 然后进行发送
|
||||||
|
ByteBuf visitorBuf = visitorChannel.config().getAllocator().buffer(bytes.length);
|
||||||
|
visitorBuf.writeBytes(bytes);
|
||||||
|
|
||||||
|
nextChannel.writeAndFlush(visitorBuf);
|
||||||
|
|
||||||
// 处理访客流量
|
// 处理访客流量
|
||||||
ServerChannelFlow serverChannelFlow = ServerChannelFlow
|
ServerChannelFlow serverChannelFlow = ServerChannelFlow
|
||||||
|
@ -60,9 +60,9 @@ public class NettyPermeateClientRealSocket {
|
|||||||
if (channelFuture.isSuccess()) {
|
if (channelFuture.isSuccess()) {
|
||||||
// 客户端链接真实服务成功 设置自动读写false 等待访客连接成功后设置成true
|
// 客户端链接真实服务成功 设置自动读写false 等待访客连接成功后设置成true
|
||||||
Channel realChannel = channelFuture.channel();
|
Channel realChannel = channelFuture.channel();
|
||||||
realChannel.config().setOption(ChannelOption.AUTO_READ, true);
|
realChannel.config().setOption(ChannelOption.AUTO_READ, false);
|
||||||
|
|
||||||
log.info("服务端内网渗透通过,绑定本地服务,IP:{},端口:{} 新建通道成功", clientTargetIp, clientTargetPort);
|
log.info("服务端内网渗透通过,绑定本地服务,IP:{},端口:{} channelID:{} 新建通道成功", clientTargetIp, clientTargetPort,realChannel.id().asLongText());
|
||||||
ChannelAttributeKeyUtils.buildVisitorPort(realChannel, visitorPort);
|
ChannelAttributeKeyUtils.buildVisitorPort(realChannel, visitorPort);
|
||||||
// 缓存当前端口对应的通道、通道池
|
// 缓存当前端口对应的通道、通道池
|
||||||
ChannelAttributeKeyUtils.buildNextChannel(realChannel, visitorChannel);
|
ChannelAttributeKeyUtils.buildNextChannel(realChannel, visitorChannel);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package org.framework.lazy.cloud.network.heartbeat.server.standalone.application.command.lazy.internal.network.server.permeate.mapping;
|
package org.framework.lazy.cloud.network.heartbeat.server.standalone.application.command.lazy.internal.network.server.permeate.mapping;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
@ -25,6 +26,7 @@ public class LazyInternalNetworkServerPermeateMappingRemoveCommand {
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
@Schema(description ="",name ="createTime",example = "")
|
@Schema(description ="",name ="createTime",example = "")
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
@ -74,6 +76,7 @@ public class LazyInternalNetworkServerPermeateMappingRemoveCommand {
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
@Schema(description ="",name ="updateTime",example = "")
|
@Schema(description ="",name ="updateTime",example = "")
|
||||||
private LocalDateTime updateTime;
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
package org.framework.lazy.cloud.network.heartbeat.server.standalone.infrastructure.persistence;
|
package org.framework.lazy.cloud.network.heartbeat.server.standalone.infrastructure.persistence;
|
||||||
|
|
||||||
import org.framework.lazy.cloud.network.heartbeat.server.standalone.infrastructure.entity.LazyInternalNetworkServerPermeateMappingDO;
|
import jakarta.annotation.Resource;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.server.standalone.infrastructure.converter.LazyInternalNetworkServerPermeateMappingConverter;
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.domain.model.lazy.internal.network.server.permeate.mapping.LazyInternalNetworkServerPermeateMapping;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.server.standalone.infrastructure.mapper.LazyInternalNetworkServerPermeateMappingMapper;
|
|
||||||
import org.framework.lazy.cloud.network.heartbeat.server.standalone.domain.model.lazy.internal.network.server.permeate.mapping.LazyInternalNetworkServerPermeateMappingRepository;
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.domain.model.lazy.internal.network.server.permeate.mapping.LazyInternalNetworkServerPermeateMappingRepository;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.infrastructure.converter.LazyInternalNetworkServerPermeateMappingConverter;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.infrastructure.entity.LazyInternalNetworkServerPermeateMappingDO;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
import java.util.stream.Collectors;
|
import org.wu.framework.lazy.orm.database.lambda.domain.LazyPage;
|
||||||
|
import org.wu.framework.lazy.orm.database.lambda.stream.lambda.LazyLambdaStream;
|
||||||
import org.wu.framework.lazy.orm.database.lambda.stream.wrapper.LazyWrappers;
|
import org.wu.framework.lazy.orm.database.lambda.stream.wrapper.LazyWrappers;
|
||||||
import org.wu.framework.web.response.Result;
|
import org.wu.framework.web.response.Result;
|
||||||
import org.wu.framework.web.response.ResultFactory;
|
import org.wu.framework.web.response.ResultFactory;
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import org.framework.lazy.cloud.network.heartbeat.server.standalone.domain.model.lazy.internal.network.server.permeate.mapping.LazyInternalNetworkServerPermeateMapping;
|
|
||||||
import org.wu.framework.lazy.orm.database.lambda.stream.lambda.LazyLambdaStream;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.wu.framework.lazy.orm.database.lambda.domain.LazyPage;
|
import java.util.stream.Collectors;
|
||||||
/**
|
/**
|
||||||
* describe 服务端网络渗透映射
|
* describe 服务端网络渗透映射
|
||||||
*
|
*
|
||||||
@ -128,7 +128,7 @@ public class LazyInternalNetworkServerPermeateMappingRepositoryImpl implements
|
|||||||
@Override
|
@Override
|
||||||
public Result<LazyInternalNetworkServerPermeateMapping> remove(LazyInternalNetworkServerPermeateMapping lazyInternalNetworkServerPermeateMapping) {
|
public Result<LazyInternalNetworkServerPermeateMapping> remove(LazyInternalNetworkServerPermeateMapping lazyInternalNetworkServerPermeateMapping) {
|
||||||
LazyInternalNetworkServerPermeateMappingDO lazyInternalNetworkServerPermeateMappingDO = LazyInternalNetworkServerPermeateMappingConverter.INSTANCE.fromLazyInternalNetworkServerPermeateMapping(lazyInternalNetworkServerPermeateMapping);
|
LazyInternalNetworkServerPermeateMappingDO lazyInternalNetworkServerPermeateMappingDO = LazyInternalNetworkServerPermeateMappingConverter.INSTANCE.fromLazyInternalNetworkServerPermeateMapping(lazyInternalNetworkServerPermeateMapping);
|
||||||
// lazyLambdaStream.delete(LazyWrappers.lambdaWrapperBean(lazyInternalNetworkServerPermeateMappingDO));
|
lazyLambdaStream.delete(LazyWrappers.lambdaWrapperBean(lazyInternalNetworkServerPermeateMappingDO));
|
||||||
return ResultFactory.successOf();
|
return ResultFactory.successOf();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
package org.framework.lazy.cloud.network.heartbeat.server.standalone.infrastructure.persistence;
|
package org.framework.lazy.cloud.network.heartbeat.server.standalone.infrastructure.persistence;
|
||||||
|
|
||||||
import org.framework.lazy.cloud.network.heartbeat.server.standalone.infrastructure.entity.LazyNettyClientPermeatePortPoolDO;
|
import jakarta.annotation.Resource;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.server.standalone.infrastructure.converter.LazyNettyClientPermeatePortPoolConverter;
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.domain.model.lazy.netty.client.permeate.port.pool.LazyNettyClientPermeatePortPool;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.server.standalone.infrastructure.mapper.LazyNettyClientPermeatePortPoolMapper;
|
|
||||||
import org.framework.lazy.cloud.network.heartbeat.server.standalone.domain.model.lazy.netty.client.permeate.port.pool.LazyNettyClientPermeatePortPoolRepository;
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.domain.model.lazy.netty.client.permeate.port.pool.LazyNettyClientPermeatePortPoolRepository;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.infrastructure.converter.LazyNettyClientPermeatePortPoolConverter;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.infrastructure.entity.LazyNettyClientPermeatePortPoolDO;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
import java.util.stream.Collectors;
|
import org.wu.framework.lazy.orm.database.lambda.domain.LazyPage;
|
||||||
|
import org.wu.framework.lazy.orm.database.lambda.stream.lambda.LazyLambdaStream;
|
||||||
import org.wu.framework.lazy.orm.database.lambda.stream.wrapper.LazyWrappers;
|
import org.wu.framework.lazy.orm.database.lambda.stream.wrapper.LazyWrappers;
|
||||||
import org.wu.framework.web.response.Result;
|
import org.wu.framework.web.response.Result;
|
||||||
import org.wu.framework.web.response.ResultFactory;
|
import org.wu.framework.web.response.ResultFactory;
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import org.framework.lazy.cloud.network.heartbeat.server.standalone.domain.model.lazy.netty.client.permeate.port.pool.LazyNettyClientPermeatePortPool;
|
|
||||||
import org.wu.framework.lazy.orm.database.lambda.stream.lambda.LazyLambdaStream;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.wu.framework.lazy.orm.database.lambda.domain.LazyPage;
|
import java.util.stream.Collectors;
|
||||||
/**
|
/**
|
||||||
* describe 客户端内网渗透端口池
|
* describe 客户端内网渗透端口池
|
||||||
*
|
*
|
||||||
@ -128,7 +128,7 @@ public class LazyNettyClientPermeatePortPoolRepositoryImpl implements LazyNett
|
|||||||
@Override
|
@Override
|
||||||
public Result<LazyNettyClientPermeatePortPool> remove(LazyNettyClientPermeatePortPool lazyNettyClientPermeatePortPool) {
|
public Result<LazyNettyClientPermeatePortPool> remove(LazyNettyClientPermeatePortPool lazyNettyClientPermeatePortPool) {
|
||||||
LazyNettyClientPermeatePortPoolDO lazyNettyClientPermeatePortPoolDO = LazyNettyClientPermeatePortPoolConverter.INSTANCE.fromLazyNettyClientPermeatePortPool(lazyNettyClientPermeatePortPool);
|
LazyNettyClientPermeatePortPoolDO lazyNettyClientPermeatePortPoolDO = LazyNettyClientPermeatePortPoolConverter.INSTANCE.fromLazyNettyClientPermeatePortPool(lazyNettyClientPermeatePortPool);
|
||||||
// lazyLambdaStream.delete(LazyWrappers.lambdaWrapperBean(lazyNettyClientPermeatePortPoolDO));
|
lazyLambdaStream.delete(LazyWrappers.lambdaWrapperBean(lazyNettyClientPermeatePortPoolDO));
|
||||||
return ResultFactory.successOf();
|
return ResultFactory.successOf();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
package org.framework.lazy.cloud.network.heartbeat.server.standalone.infrastructure.persistence;
|
package org.framework.lazy.cloud.network.heartbeat.server.standalone.infrastructure.persistence;
|
||||||
|
|
||||||
import org.framework.lazy.cloud.network.heartbeat.server.standalone.infrastructure.entity.LazyNettyServerPermeatePortPoolDO;
|
import jakarta.annotation.Resource;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.server.standalone.infrastructure.converter.LazyNettyServerPermeatePortPoolConverter;
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.domain.model.lazy.netty.server.permeate.port.pool.LazyNettyServerPermeatePortPool;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.server.standalone.infrastructure.mapper.LazyNettyServerPermeatePortPoolMapper;
|
|
||||||
import org.framework.lazy.cloud.network.heartbeat.server.standalone.domain.model.lazy.netty.server.permeate.port.pool.LazyNettyServerPermeatePortPoolRepository;
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.domain.model.lazy.netty.server.permeate.port.pool.LazyNettyServerPermeatePortPoolRepository;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.infrastructure.converter.LazyNettyServerPermeatePortPoolConverter;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.infrastructure.entity.LazyNettyServerPermeatePortPoolDO;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
import java.util.stream.Collectors;
|
import org.wu.framework.lazy.orm.database.lambda.domain.LazyPage;
|
||||||
|
import org.wu.framework.lazy.orm.database.lambda.stream.lambda.LazyLambdaStream;
|
||||||
import org.wu.framework.lazy.orm.database.lambda.stream.wrapper.LazyWrappers;
|
import org.wu.framework.lazy.orm.database.lambda.stream.wrapper.LazyWrappers;
|
||||||
import org.wu.framework.web.response.Result;
|
import org.wu.framework.web.response.Result;
|
||||||
import org.wu.framework.web.response.ResultFactory;
|
import org.wu.framework.web.response.ResultFactory;
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import org.framework.lazy.cloud.network.heartbeat.server.standalone.domain.model.lazy.netty.server.permeate.port.pool.LazyNettyServerPermeatePortPool;
|
|
||||||
import org.wu.framework.lazy.orm.database.lambda.stream.lambda.LazyLambdaStream;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.wu.framework.lazy.orm.database.lambda.domain.LazyPage;
|
import java.util.stream.Collectors;
|
||||||
/**
|
/**
|
||||||
* describe 服务端内网渗透端口池
|
* describe 服务端内网渗透端口池
|
||||||
*
|
*
|
||||||
@ -128,7 +128,7 @@ public class LazyNettyServerPermeatePortPoolRepositoryImpl implements LazyNett
|
|||||||
@Override
|
@Override
|
||||||
public Result<LazyNettyServerPermeatePortPool> remove(LazyNettyServerPermeatePortPool lazyNettyServerPermeatePortPool) {
|
public Result<LazyNettyServerPermeatePortPool> remove(LazyNettyServerPermeatePortPool lazyNettyServerPermeatePortPool) {
|
||||||
LazyNettyServerPermeatePortPoolDO lazyNettyServerPermeatePortPoolDO = LazyNettyServerPermeatePortPoolConverter.INSTANCE.fromLazyNettyServerPermeatePortPool(lazyNettyServerPermeatePortPool);
|
LazyNettyServerPermeatePortPoolDO lazyNettyServerPermeatePortPoolDO = LazyNettyServerPermeatePortPoolConverter.INSTANCE.fromLazyNettyServerPermeatePortPool(lazyNettyServerPermeatePortPool);
|
||||||
// lazyLambdaStream.delete(LazyWrappers.lambdaWrapperBean(lazyNettyServerPermeatePortPoolDO));
|
lazyLambdaStream.delete(LazyWrappers.lambdaWrapperBean(lazyNettyServerPermeatePortPoolDO));
|
||||||
return ResultFactory.successOf();
|
return ResultFactory.successOf();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,6 +24,6 @@ spring:
|
|||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
|
||||||
---
|
---
|
||||||
logging:
|
#logging:
|
||||||
level:
|
# level:
|
||||||
root: DEBUG
|
# root: DEBUG
|
Loading…
x
Reference in New Issue
Block a user