This commit is contained in:
wujiawei 2024-09-28 16:44:05 +08:00
parent dd6daa5421
commit 0493c1ce5e
33 changed files with 211 additions and 35 deletions

View File

@ -32,4 +32,8 @@ public class InternalNetworkPermeateRealServer {
* 访问端口 * 访问端口
*/ */
private Integer visitorPort; private Integer visitorPort;
/**
* 是否是ssl
*/
private Boolean isSsl;
} }

View File

@ -5,6 +5,7 @@ import lombok.Setter;
import java.util.Arrays; import java.util.Arrays;
@Deprecated
@Setter @Setter
@Getter @Getter
public class NettyMsg { public class NettyMsg {

View File

@ -14,7 +14,7 @@ import java.nio.charset.StandardCharsets;
@Getter @Getter
public class NettyProxyMsg { public class NettyProxyMsg {
// body 长度 type 1 clientId 4 clientTargetIp 4 clientTargetPort 4 visitorPort 4 visitorId 4 data 4 // body 长度 type 1 clientId 4 clientTargetIp 4 clientTargetPort 4 visitorPort 4 visitorId 4 data 4
public static final int bodyLength = 1 + 4 + 4 + 4 + 4 + 4 + 4; public static final int bodyLength = 1 + 1 + 4 + 4 + 4 + 4 + 4 + 4;
/** /**
@ -25,6 +25,13 @@ public class NettyProxyMsg {
*/ */
private byte type; private byte type;
/**
* 是否是ssl
* byte 长度 1
* 1 true
* 0 false
*/
private byte isSsl = 0;
/** /**
* 客户端ID * 客户端ID
* byte[] 长度 4 * byte[] 长度 4
@ -110,4 +117,23 @@ public class NettyProxyMsg {
} }
public Boolean isSsl() {
return isSsl == 1;
}
public void isSsl(Boolean isSsl) {
if (isSsl) {
this.isSsl = 1;
} else {
this.isSsl = 0;
}
}
public byte getIsSsl() {
return isSsl;
}
public void setIsSsl(byte isSsl) {
this.isSsl = isSsl;
}
} }

View File

@ -109,6 +109,8 @@ public class NettyProxyMsgDecoder extends LengthFieldBasedFrameDecoder {
int bodyLength = in.readInt(); int bodyLength = in.readInt();
byte type = in.readByte(); byte type = in.readByte();
nettyProxyMsg.setType(type); nettyProxyMsg.setType(type);
byte isSsl = in.readByte();
nettyProxyMsg.setIsSsl(isSsl);
int clientIdLength = in.readInt(); int clientIdLength = in.readInt();
byte[] clientIdBytes = new byte[clientIdLength]; byte[] clientIdBytes = new byte[clientIdLength];

View File

@ -23,6 +23,7 @@ public class NettyProxyMsgEncoder extends MessageToByteEncoder<NettyProxyMsg> {
// body 长度 type 1 clientId 4 clientTargetIp 4 clientTargetPort 4 visitorPort 4 visitorId 4 data 4 // body 长度 type 1 clientId 4 clientTargetIp 4 clientTargetPort 4 visitorPort 4 visitorId 4 data 4
int bodyLength = NettyProxyMsg.bodyLength; int bodyLength = NettyProxyMsg.bodyLength;
byte typeBytes = msg.getType(); byte typeBytes = msg.getType();
byte isSsl = msg.getIsSsl();
byte[] clientIdBytes = msg.getClientId(); byte[] clientIdBytes = msg.getClientId();
byte[] clientTargetIpBytes = msg.getClientTargetIp(); byte[] clientTargetIpBytes = msg.getClientTargetIp();
byte[] clientTargetPortBytes = msg.getClientTargetPort(); byte[] clientTargetPortBytes = msg.getClientTargetPort();
@ -30,7 +31,6 @@ public class NettyProxyMsgEncoder extends MessageToByteEncoder<NettyProxyMsg> {
byte[] visitorIdBytes = msg.getVisitorId(); byte[] visitorIdBytes = msg.getVisitorId();
byte[] msgDataBytes = msg.getData(); byte[] msgDataBytes = msg.getData();
if (clientIdBytes != null) { if (clientIdBytes != null) {
bodyLength += clientIdBytes.length; bodyLength += clientIdBytes.length;
} }
@ -54,6 +54,7 @@ public class NettyProxyMsgEncoder extends MessageToByteEncoder<NettyProxyMsg> {
out.writeInt(bodyLength); out.writeInt(bodyLength);
out.writeByte(typeBytes); out.writeByte(typeBytes);
out.writeByte(isSsl);
// 防止数据读错位置 clientId // 防止数据读错位置 clientId
if (clientIdBytes != null) { if (clientIdBytes != null) {

View File

@ -19,6 +19,10 @@ public class InitServerPermeateSocket implements CommandLineRunner {
@Override @Override
public void run(String... args) throws Exception { public void run(String... args) throws Exception {
try {
lazyInternalNetworkServerPermeateMappingApplication.initPermeateSocket(); lazyInternalNetworkServerPermeateMappingApplication.initPermeateSocket();
} catch (Exception e) {
e.printStackTrace();
}
} }
} }

View File

@ -1,13 +1,14 @@
package org.framework.lazy.cloud.network.heartbeat.server.netty.filter; package org.framework.lazy.cloud.network.heartbeat.server.netty.filter;
import io.netty.channel.Channel;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.SocketChannel;
import org.framework.lazy.cloud.network.heartbeat.common.decoder.TransferDecoder; import org.framework.lazy.cloud.network.heartbeat.common.decoder.TransferDecoder;
import org.framework.lazy.cloud.network.heartbeat.common.encoder.TransferEncoder; import org.framework.lazy.cloud.network.heartbeat.common.encoder.TransferEncoder;
import org.framework.lazy.cloud.network.heartbeat.common.filter.DebugChannelInitializer; import org.framework.lazy.cloud.network.heartbeat.common.filter.DebugChannelInitializer;
import org.framework.lazy.cloud.network.heartbeat.server.netty.handler.PermeateClientRealHandler; import org.framework.lazy.cloud.network.heartbeat.server.netty.handler.NettyServerPermeateServerRealHandler;
public class PermeateClientRealFilter extends DebugChannelInitializer<SocketChannel> { public class NettyServerPermeateServerRealFilter extends DebugChannelInitializer<SocketChannel> {
/** /**
* This method will be called once the {@link Channel} was registered. After the method returns this instance * This method will be called once the {@link Channel} was registered. After the method returns this instance
* will be removed from the {@link ChannelPipeline} of the {@link Channel}. * will be removed from the {@link ChannelPipeline} of the {@link Channel}.
@ -17,10 +18,18 @@ public class PermeateClientRealFilter extends DebugChannelInitializer<SocketChan
@Override @Override
protected void initChannel0(SocketChannel ch) { protected void initChannel0(SocketChannel ch) {
ChannelPipeline pipeline = ch.pipeline(); ChannelPipeline pipeline = ch.pipeline();
// // 适配https
// try {
// SslContext sslContext = SslContextBuilder.forClient()
// .trustManager(InsecureTrustManagerFactory.INSTANCE).build();
// ch.pipeline().addLast(sslContext.newHandler(ch.alloc(), "https://juno.shuhan-juno.com", 443));
// } catch (SSLException e) {
// throw new RuntimeException(e);
// }
// 解码编码 // 解码编码
pipeline.addLast(new TransferDecoder(Integer.MAX_VALUE, 1024 * 1024*10)); pipeline.addLast(new TransferDecoder(Integer.MAX_VALUE, 1024 * 1024*10));
pipeline.addLast(new TransferEncoder()); pipeline.addLast(new TransferEncoder());
pipeline.addLast(new PermeateClientRealHandler()); pipeline.addLast(new NettyServerPermeateServerRealHandler());
} }
} }

View File

@ -8,13 +8,13 @@ import io.netty.channel.socket.SocketChannel;
import org.framework.lazy.cloud.network.heartbeat.common.InternalNetworkPermeateRealServer; import org.framework.lazy.cloud.network.heartbeat.common.InternalNetworkPermeateRealServer;
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelFlowAdapter; import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelFlowAdapter;
import org.framework.lazy.cloud.network.heartbeat.common.filter.DebugChannelInitializer; import org.framework.lazy.cloud.network.heartbeat.common.filter.DebugChannelInitializer;
import org.framework.lazy.cloud.network.heartbeat.server.netty.handler.PermeateVisitorHandler; import org.framework.lazy.cloud.network.heartbeat.server.netty.handler.NettyServerPermeateServerVisitorHandler;
public class PermeateVisitorFilter extends DebugChannelInitializer<SocketChannel> { public class NettyServerPermeateServerVisitorFilter extends DebugChannelInitializer<SocketChannel> {
private final InternalNetworkPermeateRealServer internalNetworkPermeateRealServer; private final InternalNetworkPermeateRealServer internalNetworkPermeateRealServer;
private final ChannelFlowAdapter channelFlowAdapter; private final ChannelFlowAdapter channelFlowAdapter;
public PermeateVisitorFilter(InternalNetworkPermeateRealServer internalNetworkPermeateRealServer, ChannelFlowAdapter channelFlowAdapter) { public NettyServerPermeateServerVisitorFilter(InternalNetworkPermeateRealServer internalNetworkPermeateRealServer, ChannelFlowAdapter channelFlowAdapter) {
this.internalNetworkPermeateRealServer = internalNetworkPermeateRealServer; this.internalNetworkPermeateRealServer = internalNetworkPermeateRealServer;
this.channelFlowAdapter = channelFlowAdapter; this.channelFlowAdapter = channelFlowAdapter;
} }
@ -32,6 +32,6 @@ public class PermeateVisitorFilter extends DebugChannelInitializer<SocketChannel
protected void initChannel0(SocketChannel ch) throws Exception { protected void initChannel0(SocketChannel ch) throws Exception {
ChannelPipeline pipeline = ch.pipeline(); ChannelPipeline pipeline = ch.pipeline();
pipeline.addLast(new ChannelDuplexHandler()); pipeline.addLast(new ChannelDuplexHandler());
pipeline.addLast(new PermeateVisitorHandler(internalNetworkPermeateRealServer, channelFlowAdapter)); pipeline.addLast(new NettyServerPermeateServerVisitorHandler(internalNetworkPermeateRealServer, channelFlowAdapter));
} }
} }

View File

@ -14,7 +14,7 @@ import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeK
* 来自客户端 真实服务器返回的数据请求 * 来自客户端 真实服务器返回的数据请求
*/ */
@Slf4j @Slf4j
public class PermeateClientRealHandler extends SimpleChannelInboundHandler<NettyByteBuf> { public class NettyServerPermeateServerRealHandler extends SimpleChannelInboundHandler<NettyByteBuf> {
@Override @Override
public void channelActive(ChannelHandlerContext ctx) throws Exception { public void channelActive(ChannelHandlerContext ctx) throws Exception {

View File

@ -17,12 +17,12 @@ import org.framework.lazy.cloud.network.heartbeat.server.netty.socket.NettyServe
import java.util.UUID; import java.util.UUID;
@Slf4j @Slf4j
public class PermeateVisitorHandler extends SimpleChannelInboundHandler<ByteBuf> { public class NettyServerPermeateServerVisitorHandler extends SimpleChannelInboundHandler<ByteBuf> {
private final InternalNetworkPermeateRealServer internalNetworkPermeateRealServer; private final InternalNetworkPermeateRealServer internalNetworkPermeateRealServer;
private final ChannelFlowAdapter channelFlowAdapter;// 流量适配器 private final ChannelFlowAdapter channelFlowAdapter;// 流量适配器
// private final NettyChannelPool nettyChannelPool = new DefaultNettyChannelPool(10); // private final NettyChannelPool nettyChannelPool = new DefaultNettyChannelPool(10);
public PermeateVisitorHandler(InternalNetworkPermeateRealServer internalNetworkPermeateRealServer, ChannelFlowAdapter channelFlowAdapter) { public NettyServerPermeateServerVisitorHandler(InternalNetworkPermeateRealServer internalNetworkPermeateRealServer, ChannelFlowAdapter channelFlowAdapter) {
this.internalNetworkPermeateRealServer = internalNetworkPermeateRealServer; this.internalNetworkPermeateRealServer = internalNetworkPermeateRealServer;
this.channelFlowAdapter = channelFlowAdapter; this.channelFlowAdapter = channelFlowAdapter;
} }

View File

@ -8,7 +8,7 @@ import io.netty.channel.socket.nio.NioSocketChannel;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.common.InternalNetworkPermeateRealServer; import org.framework.lazy.cloud.network.heartbeat.common.InternalNetworkPermeateRealServer;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils; import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
import org.framework.lazy.cloud.network.heartbeat.server.netty.filter.PermeateClientRealFilter; import org.framework.lazy.cloud.network.heartbeat.server.netty.filter.NettyServerPermeateServerRealFilter;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -50,7 +50,7 @@ public class NettyServerPermeateServerConnectRealSocket {
// .option(ChannelOption.SO_BACKLOG, 128)//务端接受连接的队列长度 默认128 // .option(ChannelOption.SO_BACKLOG, 128)//务端接受连接的队列长度 默认128
// .option(ChannelOption.RCVBUF_ALLOCATOR, new NettyRecvByteBufAllocator(1024 * 1024))//用于Channel分配接受Buffer的分配器 默认AdaptiveRecvByteBufAllocator.DEFAULT // .option(ChannelOption.RCVBUF_ALLOCATOR, new NettyRecvByteBufAllocator(1024 * 1024))//用于Channel分配接受Buffer的分配器 默认AdaptiveRecvByteBufAllocator.DEFAULT
.option(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(1024 * 1024, 1024 * 1024 * 2)) .option(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(1024 * 1024, 1024 * 1024 * 2))
.handler(new PermeateClientRealFilter()) .handler(new NettyServerPermeateServerRealFilter())
; ;

View File

@ -11,7 +11,7 @@ import org.framework.lazy.cloud.network.heartbeat.common.InternalNetworkPermeate
import org.framework.lazy.cloud.network.heartbeat.common.NettyPermeateVisitorContext; import org.framework.lazy.cloud.network.heartbeat.common.NettyPermeateVisitorContext;
import org.framework.lazy.cloud.network.heartbeat.common.NettyVisitorPortContext; import org.framework.lazy.cloud.network.heartbeat.common.NettyVisitorPortContext;
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelFlowAdapter; import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelFlowAdapter;
import org.framework.lazy.cloud.network.heartbeat.server.netty.filter.PermeateVisitorFilter; import org.framework.lazy.cloud.network.heartbeat.server.netty.filter.NettyServerPermeateServerVisitorFilter;
import java.io.IOException; import java.io.IOException;
@ -22,19 +22,16 @@ import java.io.IOException;
public class NettyServerPermeateServerConnectVisitorSocket { public class NettyServerPermeateServerConnectVisitorSocket {
private final EventLoopGroup bossGroup = new NioEventLoopGroup(); private final EventLoopGroup bossGroup = new NioEventLoopGroup();
private final EventLoopGroup workerGroup = new NioEventLoopGroup(); private final EventLoopGroup workerGroup = new NioEventLoopGroup();
private final PermeateVisitorFilter permeateVisitorFilter; private final NettyServerPermeateServerVisitorFilter nettyServerPermeateServerVisitorFilter;
@Getter @Getter
private final int visitorPort; private final int visitorPort;
private final InternalNetworkPermeateRealServer internalNetworkPermeateRealServer;
public NettyServerPermeateServerConnectVisitorSocket(PermeateVisitorFilter permeateVisitorFilter, public NettyServerPermeateServerConnectVisitorSocket(NettyServerPermeateServerVisitorFilter nettyServerPermeateServerVisitorFilter,
InternalNetworkPermeateRealServer internalNetworkPermeateRealServer,
int visitorPort) { int visitorPort) {
this.permeateVisitorFilter = permeateVisitorFilter; this.nettyServerPermeateServerVisitorFilter = nettyServerPermeateServerVisitorFilter;
this.visitorPort = visitorPort; this.visitorPort = visitorPort;
this.internalNetworkPermeateRealServer = internalNetworkPermeateRealServer;
} }
@ -66,7 +63,7 @@ public class NettyServerPermeateServerConnectVisitorSocket {
.childOption(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(1024 * 1024, 1024 * 1024 * 2)) .childOption(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(1024 * 1024, 1024 * 1024 * 2))
.childHandler(permeateVisitorFilter); .childHandler(nettyServerPermeateServerVisitorFilter);
ChannelFuture sync = bootstrap.bind(visitorPort).sync(); ChannelFuture sync = bootstrap.bind(visitorPort).sync();
sync.addListener((ChannelFutureListener) future -> { sync.addListener((ChannelFutureListener) future -> {
if (future.isSuccess()) { if (future.isSuccess()) {
@ -122,10 +119,11 @@ public class NettyServerPermeateServerConnectVisitorSocket {
* 访问端口 * 访问端口
*/ */
private Integer permeateVisitorPort; private Integer permeateVisitorPort;
/** /**
* 访客ID * 是否是ssl
*/ */
private String visitorId; private Boolean isSsl;
/** /**
* 流量适配器 * 流量适配器
@ -179,6 +177,16 @@ public class NettyServerPermeateServerConnectVisitorSocket {
this.channelFlowAdapter = channelFlowAdapter; this.channelFlowAdapter = channelFlowAdapter;
return this; return this;
} }
/**
* 是否是ssl
*
* @param isSsl 是否是ssl
* @return 当前对象
*/
public NettyPermeateVisitorSocketBuilder builderIsSsl(Boolean isSsl) {
this.isSsl = isSsl;
return this;
}
public NettyServerPermeateServerConnectVisitorSocket build() { public NettyServerPermeateServerConnectVisitorSocket build() {
@ -197,10 +205,11 @@ public class NettyServerPermeateServerConnectVisitorSocket {
.clientTargetIp(clientTargetIp) .clientTargetIp(clientTargetIp)
.clientTargetPort(clientTargetPort) .clientTargetPort(clientTargetPort)
.visitorPort(permeateVisitorPort) .visitorPort(permeateVisitorPort)
.isSsl(isSsl)
.build(); .build();
PermeateVisitorFilter permeateVisitorFilter = new PermeateVisitorFilter(internalNetworkPermeateRealServer, channelFlowAdapter); NettyServerPermeateServerVisitorFilter nettyServerPermeateServerVisitorFilter = new NettyServerPermeateServerVisitorFilter(internalNetworkPermeateRealServer, channelFlowAdapter);
return new NettyServerPermeateServerConnectVisitorSocket(permeateVisitorFilter, internalNetworkPermeateRealServer, permeateVisitorPort); return new NettyServerPermeateServerConnectVisitorSocket(nettyServerPermeateServerVisitorFilter, permeateVisitorPort);
} }

View File

@ -56,4 +56,10 @@ public class LazyInternalNetworkPenetrationMappingStoryCommand {
*/ */
@Schema(description = "服务端ID", name = "serverId", example = "") @Schema(description = "服务端ID", name = "serverId", example = "")
private String serverId; private String serverId;
/**
* 是否是ssl
*/
@Schema(description ="是否是ssl",name ="is_ssl",example = "")
private Boolean isSsl;
} }

View File

@ -61,4 +61,10 @@ public class LazyInternalNetworkPenetrationMappingUpdateCommand {
*/ */
@Schema(description = "服务端ID", name = "serverId", example = "") @Schema(description = "服务端ID", name = "serverId", example = "")
private String serverId; private String serverId;
/**
* 是否是ssl
*/
@Schema(description ="是否是ssl",name ="is_ssl",example = "")
private Boolean isSsl;
} }

View File

@ -98,4 +98,11 @@ public class LazyInternalNetworkClientPermeateClientMappingStoryCommand {
@Schema(description ="渗透端口",name ="visitorPort",example = "") @Schema(description ="渗透端口",name ="visitorPort",example = "")
private Integer visitorPort; private Integer visitorPort;
/**
* 是否是ssl
*/
@Schema(description ="是否是ssl",name ="is_ssl",example = "")
private Boolean isSsl;
} }

View File

@ -98,4 +98,10 @@ public class LazyInternalNetworkClientPermeateClientMappingUpdateCommand {
@Schema(description ="渗透端口",name ="visitorPort",example = "") @Schema(description ="渗透端口",name ="visitorPort",example = "")
private Integer visitorPort; private Integer visitorPort;
/**
* 是否是ssl
*/
@Schema(description ="是否是ssl",name ="is_ssl",example = "")
private Boolean isSsl;
} }

View File

@ -91,4 +91,9 @@ public class LazyInternalNetworkClientPermeateServerMappingStoryCommand {
@Schema(description ="渗透端口",name ="visitorPort",example = "") @Schema(description ="渗透端口",name ="visitorPort",example = "")
private Integer visitorPort; private Integer visitorPort;
/**
* 是否是ssl
*/
@Schema(description ="是否是ssl",name ="is_ssl",example = "")
private Boolean isSsl;
} }

View File

@ -91,4 +91,9 @@ public class LazyInternalNetworkClientPermeateServerMappingUpdateCommand {
@Schema(description ="渗透端口",name ="visitorPort",example = "") @Schema(description ="渗透端口",name ="visitorPort",example = "")
private Integer visitorPort; private Integer visitorPort;
/**
* 是否是ssl
*/
@Schema(description ="是否是ssl",name ="is_ssl",example = "")
private Boolean isSsl;
} }

View File

@ -84,4 +84,9 @@ public class LazyInternalNetworkServerPermeateMappingStoryCommand {
@Schema(description ="渗透端口",name ="visitorPort",example = "") @Schema(description ="渗透端口",name ="visitorPort",example = "")
private Integer visitorPort; private Integer visitorPort;
/**
* 是否是ssl
*/
@Schema(description ="是否是ssl",name ="is_ssl",example = "")
private Boolean isSsl;
} }

View File

@ -84,4 +84,9 @@ public class LazyInternalNetworkServerPermeateMappingUpdateCommand {
@Schema(description ="渗透端口",name ="visitorPort",example = "") @Schema(description ="渗透端口",name ="visitorPort",example = "")
private Integer visitorPort; private Integer visitorPort;
/**
* 是否是ssl
*/
@Schema(description ="是否是ssl",name ="is_ssl",example = "")
private Boolean isSsl;
} }

View File

@ -98,4 +98,9 @@ public class LazyInternalNetworkClientPermeateClientMappingDTO {
@Schema(description ="渗透端口",name ="visitorPort",example = "") @Schema(description ="渗透端口",name ="visitorPort",example = "")
private Integer visitorPort; private Integer visitorPort;
/**
* 是否是ssl
*/
@Schema(description ="是否是ssl",name ="is_ssl",example = "")
private Boolean isSsl;
} }

View File

@ -91,4 +91,9 @@ public class LazyInternalNetworkClientPermeateServerMappingDTO {
@Schema(description ="渗透端口",name ="visitorPort",example = "") @Schema(description ="渗透端口",name ="visitorPort",example = "")
private Integer visitorPort; private Integer visitorPort;
/**
* 是否是ssl
*/
@Schema(description ="是否是ssl",name ="is_ssl",example = "")
private Boolean isSsl;
} }

View File

@ -79,4 +79,10 @@ public class LazyInternalNetworkPenetrationMappingDTO {
*/ */
@Schema(description = "服务端ID", name = "serverId", example = "") @Schema(description = "服务端ID", name = "serverId", example = "")
private String serverId; private String serverId;
/**
* 是否是ssl
*/
@Schema(description ="是否是ssl",name ="is_ssl",example = "")
private Boolean isSsl;
} }

View File

@ -84,4 +84,9 @@ public class LazyInternalNetworkServerPermeateMappingDTO {
@Schema(description ="渗透端口",name ="visitorPort",example = "") @Schema(description ="渗透端口",name ="visitorPort",example = "")
private Integer visitorPort; private Integer visitorPort;
/**
* 是否是ssl
*/
@Schema(description ="是否是ssl",name ="is_ssl",example = "")
private Boolean isSsl;
} }

View File

@ -59,7 +59,8 @@ public class LazyInternalNetworkServerPermeateMappingApplicationImpl implements
String permeateTargetIp = lazyInternalNetworkServerPermeateMapping.getPermeateTargetIp(); String permeateTargetIp = lazyInternalNetworkServerPermeateMapping.getPermeateTargetIp();
Integer permeateTargetPort = lazyInternalNetworkServerPermeateMapping.getPermeateTargetPort(); Integer permeateTargetPort = lazyInternalNetworkServerPermeateMapping.getPermeateTargetPort();
Integer visitorPort = lazyInternalNetworkServerPermeateMapping.getVisitorPort(); Integer visitorPort = lazyInternalNetworkServerPermeateMapping.getVisitorPort();
this.changePermeateSocket(permeateTargetIp, permeateTargetPort, visitorPort); Boolean isSsl = lazyInternalNetworkServerPermeateMapping.getIsSsl();
this.changePermeateSocket(permeateTargetIp, permeateTargetPort, visitorPort,isSsl);
return lazyInternalNetworkServerPermeateMappingRepository.story(lazyInternalNetworkServerPermeateMapping); return lazyInternalNetworkServerPermeateMappingRepository.story(lazyInternalNetworkServerPermeateMapping);
} }
@ -82,7 +83,8 @@ public class LazyInternalNetworkServerPermeateMappingApplicationImpl implements
String permeateTargetIp = lazyInternalNetworkServerPermeateMapping.getPermeateTargetIp(); String permeateTargetIp = lazyInternalNetworkServerPermeateMapping.getPermeateTargetIp();
Integer permeateTargetPort = lazyInternalNetworkServerPermeateMapping.getPermeateTargetPort(); Integer permeateTargetPort = lazyInternalNetworkServerPermeateMapping.getPermeateTargetPort();
Integer visitorPort = lazyInternalNetworkServerPermeateMapping.getVisitorPort(); Integer visitorPort = lazyInternalNetworkServerPermeateMapping.getVisitorPort();
this.changePermeateSocket(permeateTargetIp, permeateTargetPort, visitorPort); Boolean isSsl = lazyInternalNetworkServerPermeateMapping.getIsSsl();
this.changePermeateSocket(permeateTargetIp, permeateTargetPort, visitorPort,isSsl);
} }
return lazyInternalNetworkServerPermeateMappingRepository.batchStory(lazyInternalNetworkServerPermeateMappingList); return lazyInternalNetworkServerPermeateMappingRepository.batchStory(lazyInternalNetworkServerPermeateMappingList);
} }
@ -105,7 +107,8 @@ public class LazyInternalNetworkServerPermeateMappingApplicationImpl implements
String permeateTargetIp = lazyInternalNetworkServerPermeateMapping.getPermeateTargetIp(); String permeateTargetIp = lazyInternalNetworkServerPermeateMapping.getPermeateTargetIp();
Integer permeateTargetPort = lazyInternalNetworkServerPermeateMapping.getPermeateTargetPort(); Integer permeateTargetPort = lazyInternalNetworkServerPermeateMapping.getPermeateTargetPort();
Integer visitorPort = lazyInternalNetworkServerPermeateMapping.getVisitorPort(); Integer visitorPort = lazyInternalNetworkServerPermeateMapping.getVisitorPort();
this.changePermeateSocket(permeateTargetIp, permeateTargetPort, visitorPort); Boolean isSsl = lazyInternalNetworkServerPermeateMapping.getIsSsl();
this.changePermeateSocket(permeateTargetIp, permeateTargetPort, visitorPort,isSsl);
return lazyInternalNetworkServerPermeateMappingRepository.story(lazyInternalNetworkServerPermeateMapping); return lazyInternalNetworkServerPermeateMappingRepository.story(lazyInternalNetworkServerPermeateMapping);
} }
@ -189,8 +192,9 @@ public class LazyInternalNetworkServerPermeateMappingApplicationImpl implements
String permeateTargetIp = internalNetworkServerPermeateMapping.getPermeateTargetIp(); String permeateTargetIp = internalNetworkServerPermeateMapping.getPermeateTargetIp();
Integer permeateTargetPort = internalNetworkServerPermeateMapping.getPermeateTargetPort(); Integer permeateTargetPort = internalNetworkServerPermeateMapping.getPermeateTargetPort();
Integer visitorPort = internalNetworkServerPermeateMapping.getVisitorPort(); Integer visitorPort = internalNetworkServerPermeateMapping.getVisitorPort();
Boolean isSsl = internalNetworkServerPermeateMapping.getIsSsl();
log.info("init permeate socket ip:{}, port:{},visitorPort:{}", permeateTargetIp, permeateTargetPort, visitorPort); log.info("init permeate socket ip:{}, port:{},visitorPort:{}", permeateTargetIp, permeateTargetPort, visitorPort);
this.createPermeateVisitor(permeateTargetIp, permeateTargetPort, visitorPort); this.createPermeateVisitor(permeateTargetIp, permeateTargetPort, visitorPort,isSsl);
} }
}); });
@ -203,11 +207,11 @@ public class LazyInternalNetworkServerPermeateMappingApplicationImpl implements
* @param permeateTargetPort 客户端莫表端口 * @param permeateTargetPort 客户端莫表端口
* @param visitorPort 访客端口 * @param visitorPort 访客端口
*/ */
private void changePermeateSocket(String permeateTargetIp, Integer permeateTargetPort, Integer visitorPort) { private void changePermeateSocket(String permeateTargetIp, Integer permeateTargetPort, Integer visitorPort, Boolean isSsl) {
// 删除 客户端映射 // 删除 客户端映射
this.closePermeateSocket(visitorPort); this.closePermeateSocket(visitorPort);
// 更新 客户端映射 // 更新 客户端映射
createPermeateVisitor(permeateTargetIp, permeateTargetPort, visitorPort); createPermeateVisitor(permeateTargetIp, permeateTargetPort, visitorPort,isSsl);
} }
@ -236,13 +240,14 @@ public class LazyInternalNetworkServerPermeateMappingApplicationImpl implements
* @param permeateTargetPort 客户端目标端口 * @param permeateTargetPort 客户端目标端口
* @param visitorPort 访客端口 * @param visitorPort 访客端口
*/ */
private void createPermeateVisitor(String permeateTargetIp, Integer permeateTargetPort, Integer visitorPort) { private void createPermeateVisitor(String permeateTargetIp, Integer permeateTargetPort, Integer visitorPort, Boolean isSsl) {
// 更新 客户端映射 // 更新 客户端映射
NettyServerPermeateServerConnectVisitorSocket nettyServerPermeateServerConnectVisitorSocket = NettyServerPermeateServerConnectVisitorSocket.NettyPermeateVisitorSocketBuilder NettyServerPermeateServerConnectVisitorSocket nettyServerPermeateServerConnectVisitorSocket = NettyServerPermeateServerConnectVisitorSocket.NettyPermeateVisitorSocketBuilder
.builder() .builder()
.builderClientTargetIp(permeateTargetIp) .builderClientTargetIp(permeateTargetIp)
.builderClientTargetPort(permeateTargetPort) .builderClientTargetPort(permeateTargetPort)
.builderVisitorPort(visitorPort) .builderVisitorPort(visitorPort)
.builderIsSsl(isSsl)
.builderChannelFlowAdapter(channelFlowAdapter) .builderChannelFlowAdapter(channelFlowAdapter)
.build(); .build();
try { try {

View File

@ -79,4 +79,11 @@ public class LazyInternalNetworkPenetrationMapping {
@Schema(description = "服务端ID", name = "serverId", example = "") @Schema(description = "服务端ID", name = "serverId", example = "")
private String serverId; private String serverId;
/**
* 是否是ssl
*/
@Schema(description ="是否是ssl",name ="is_ssl",example = "")
private Boolean isSsl;
} }

View File

@ -3,6 +3,8 @@ package org.framework.lazy.cloud.network.heartbeat.server.standalone.domain.mode
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;
import org.wu.framework.lazy.orm.core.stereotype.LazyTableField;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.lang.String; import java.lang.String;
import java.lang.Long; import java.lang.Long;
@ -97,5 +99,10 @@ public class LazyInternalNetworkClientPermeateClientMapping {
*/ */
@Schema(description ="渗透端口",name ="visitorPort",example = "") @Schema(description ="渗透端口",name ="visitorPort",example = "")
private Integer visitorPort; private Integer visitorPort;
/**
* 是否是ssl
*/
@Schema(description ="是否是ssl",name ="is_ssl",example = "")
private Boolean isSsl;
} }

View File

@ -90,5 +90,10 @@ public class LazyInternalNetworkClientPermeateServerMapping {
*/ */
@Schema(description ="渗透端口",name ="visitorPort",example = "") @Schema(description ="渗透端口",name ="visitorPort",example = "")
private Integer visitorPort; private Integer visitorPort;
/**
* 是否是ssl
*/
@Schema(description ="是否是ssl",name ="is_ssl",example = "")
private Boolean isSsl;
} }

View File

@ -84,4 +84,10 @@ public class LazyInternalNetworkServerPermeateMapping {
@Schema(description ="渗透端口",name ="visitorPort",example = "") @Schema(description ="渗透端口",name ="visitorPort",example = "")
private Integer visitorPort; private Integer visitorPort;
/**
* 是否是ssl
*/
@Schema(description ="是否是ssl",name ="is_ssl",example = "")
private Boolean isSsl;
} }

View File

@ -110,5 +110,10 @@ public class LazyInternalNetworkClientPermeateClientMappingDO {
@LazyTableField(name="update_time",comment="",defaultValue="CURRENT_TIMESTAMP",upsertStrategy = LazyFieldStrategy.NEVER,columnType="datetime",extra=" on update CURRENT_TIMESTAMP") @LazyTableField(name="update_time",comment="",defaultValue="CURRENT_TIMESTAMP",upsertStrategy = LazyFieldStrategy.NEVER,columnType="datetime",extra=" on update CURRENT_TIMESTAMP")
private LocalDateTime updateTime; private LocalDateTime updateTime;
/**
* 是否是ssl
*/
@Schema(description ="是否是ssl",name ="is_ssl",example = "")
@LazyTableField(name="is_ssl",comment="是否是ssl",defaultValue = "'0'")
private Boolean isSsl;
} }

View File

@ -110,4 +110,10 @@ public class LazyInternalNetworkClientPermeateServerMappingDO {
@LazyTableFieldUnique(name="visitor_port",comment="渗透端口",notNull=true,columnType="int") @LazyTableFieldUnique(name="visitor_port",comment="渗透端口",notNull=true,columnType="int")
private Integer visitorPort; private Integer visitorPort;
/**
* 是否是ssl
*/
@Schema(description ="是否是ssl",name ="is_ssl",example = "")
@LazyTableField(name="is_ssl",comment="是否是ssl",defaultValue = "'0'")
private Boolean isSsl;
} }

View File

@ -91,4 +91,10 @@ public class LazyInternalNetworkPenetrationMappingDO {
@Schema(description = "服务端ID", name = "serverId", example = "") @Schema(description = "服务端ID", name = "serverId", example = "")
private String serverId; private String serverId;
/**
* 是否是ssl
*/
@Schema(description ="是否是ssl",name ="is_ssl",example = "")
@LazyTableField(name="is_ssl",comment="是否是ssl",defaultValue = "'0'")
private Boolean isSsl;
} }

View File

@ -102,4 +102,11 @@ public class LazyInternalNetworkServerPermeateMappingDO {
@LazyTableFieldUnique(name="visitor_port",comment="渗透端口",notNull=true,columnType="int") @LazyTableFieldUnique(name="visitor_port",comment="渗透端口",notNull=true,columnType="int")
private Integer visitorPort; private Integer visitorPort;
/**
* 是否是ssl
*/
@Schema(description ="是否是ssl",name ="is_ssl",example = "")
@LazyTableField(name="is_ssl",comment="是否是ssl",defaultValue = "'0'")
private Boolean isSsl;
} }