[fix] 流量访问、添加下步计划内网渗透

This commit is contained in:
wujiawei
2024-09-13 09:06:44 +08:00
parent c9798d7289
commit ee6cafa8f2
6 changed files with 69 additions and 13 deletions

View File

@ -31,8 +31,6 @@ public class VisitorFilter extends DebugChannelInitializer<SocketChannel> {
@Override
protected void initChannel0(SocketChannel ch) throws Exception {
ChannelPipeline pipeline = ch.pipeline();
ch.config().setReceiveBufferSize(1024 * 1024);
ch.config().setSendBufferSize(1024 * 1024);
pipeline.addLast(new ChannelDuplexHandler());
pipeline.addLast(new VisitorHandler(internalNetworkPenetrationRealClient, channelFlowAdapter));
}

View File

@ -114,9 +114,20 @@ public interface LazyVisitorPortPerDayFlowApplication {
*/
Result<LazyClientPortFlowPerDayEchartsDTO> findClient7DayFlow();
/**
* 获取客户流量数据
* @param dayLength 天数
* @param clientIds 客户端
* @return
*/
Result<LazyClientPortFlowPerDayEchartsDTO> findClientDayFlow(int dayLength, List<String> clientIds);
/**
* 获取客户流量数据
* @return
*/
Result<LazyClientFlowPerDayEchartsDTO> findClientPerDayFlow();
}

View File

@ -181,10 +181,27 @@ public class LazyVisitorPortPerDayFlowApplicationImpl implements LazyVisitorPort
@Override
public Result<LazyClientPortFlowPerDayEchartsDTO> findClient7DayFlow() {
int dayLength = 7;
LazyNettyClientState lazyNettyClientState = new LazyNettyClientState();
String serverId = serverNodeProperties.getNodeId();
lazyNettyClientState.setServerId(serverId);
return findClientDayFlow(dayLength, null);
}
/**
* 获取客户流量数据
*
* @param dayLength 天数
* @param clientIds 客户端
* @return
*/
@Override
public Result<LazyClientPortFlowPerDayEchartsDTO> findClientDayFlow(int dayLength, List<String> clientIds) {
LazyClientPortFlowPerDayEchartsDTO lazyClientPortFlowPerDayEchartsDTO = new LazyClientPortFlowPerDayEchartsDTO();
int dayLength = 7;
// 流量日期
List<String> dayList = Stream.iterate(1, n -> n + 1).limit(dayLength).map(index -> {
LocalDate minus = LocalDate.now().minusDays(dayLength - index);
@ -196,11 +213,14 @@ public class LazyVisitorPortPerDayFlowApplicationImpl implements LazyVisitorPort
lazyNettyClientState.setServerId(serverId);
// 客户端ID
List<String> clientIdList = lazyNettyClientStateRepository.findList(lazyNettyClientState)
.applyOther(nettyClientStates -> nettyClientStates
.stream().map(LazyNettyClientState::getClientId)
.toList());
lazyClientPortFlowPerDayEchartsDTO.setClientIdList(clientIdList);
if (ObjectUtils.isEmpty(clientIds)) {
// 客户端ID
clientIds = lazyNettyClientStateRepository.findList(lazyNettyClientState)
.applyOther(nettyClientStates -> nettyClientStates
.stream().map(LazyNettyClientState::getClientId)
.toList());
}
lazyClientPortFlowPerDayEchartsDTO.setClientIdList(clientIds);
LazyVisitorPortPerDayFlow lazyVisitorPortPerDayFlow1 = new LazyVisitorPortPerDayFlow();
lazyVisitorPortPerDayFlow1.setServerId(serverId);
List<LazyVisitorPortPerDayFlow> lazyVisitorPortPerDayFlowList = lazyVisitorPortPerDayFlowRepository.findList(lazyVisitorPortPerDayFlow1)

View File

@ -10,6 +10,8 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.wu.framework.web.response.Result;
import org.wu.framework.web.spring.EasyController;
import java.util.List;
/**
* describe 每日统计流量
*
@ -36,6 +38,18 @@ public class LazyVisitorPortPerDayFlowProvider {
return lazyVisitorPortPerDayFlowApplication.findClient7DayFlow();
}
/**
* describe 获取客户流量数据
*
* @author Jia wei Wu
**/
@Operation(summary = "获取客户流量数据")
@GetMapping("/findClientDayFlow")
public Result<LazyClientPortFlowPerDayEchartsDTO> findClientPortDayFlow(int dayLength, List<String> clientIds) {
return lazyVisitorPortPerDayFlowApplication.findClientDayFlow(dayLength,clientIds);
}
/**
* 获取客户流量数据
* @return