🎉 优化 terminal 模块逻辑.

This commit is contained in:
lijiahangmax
2025-06-26 00:59:15 +08:00
parent 712b175179
commit 9d4c2aaeb4
206 changed files with 6612 additions and 1273 deletions

View File

@@ -1,44 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.api;
import java.util.List;
/**
* 命令片段 对外服务类
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/6/3 11:07
*/
public interface CommandSnippetApi {
/**
* 通过 userId 删除
*
* @param userIdList userIdList
* @return effect
*/
Integer deleteByUserIdList(List<Long> userIdList);
}

View File

@@ -1,44 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.api;
import java.util.List;
/**
* 路径标签 对外服务类
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/6/3 11:07
*/
public interface PathBookmarkApi {
/**
* 通过 userId 删除
*
* @param userIdList userIdList
* @return effect
*/
Integer deleteByUserIdList(List<Long> userIdList);
}

View File

@@ -1,52 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.api.impl;
import lombok.extern.slf4j.Slf4j;
import org.dromara.visor.module.asset.api.CommandSnippetApi;
import org.dromara.visor.module.asset.service.CommandSnippetService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 命令片段 对外服务实现类
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/6/3 11:11
*/
@Slf4j
@Service
public class CommandSnippetApiImpl implements CommandSnippetApi {
@Resource
private CommandSnippetService commandSnippetService;
@Override
public Integer deleteByUserIdList(List<Long> userIdList) {
return commandSnippetService.deleteByUserIdList(userIdList);
}
}

View File

@@ -1,52 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.api.impl;
import lombok.extern.slf4j.Slf4j;
import org.dromara.visor.module.asset.api.PathBookmarkApi;
import org.dromara.visor.module.asset.service.PathBookmarkService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 路径标签 对外服务实现类
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/6/3 11:11
*/
@Slf4j
@Service
public class PathBookmarkApiImpl implements PathBookmarkApi {
@Resource
private PathBookmarkService pathBookmarkService;
@Override
public Integer deleteByUserIdList(List<Long> userIdList) {
return pathBookmarkService.deleteByUserIdList(userIdList);
}
}

View File

@@ -1,85 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.configuration;
import org.dromara.visor.module.asset.handler.host.exec.log.ExecLogTailHandler;
import org.dromara.visor.module.asset.handler.host.terminal.TerminalMessageDispatcher;
import org.dromara.visor.module.asset.handler.host.transfer.TransferMessageDispatcher;
import org.dromara.visor.module.asset.interceptor.ExecLogTailInterceptor;
import org.dromara.visor.module.asset.interceptor.TerminalAccessInterceptor;
import org.dromara.visor.module.asset.interceptor.TerminalTransferInterceptor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
import javax.annotation.Resource;
/**
* 资产模块 websocket 配置
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/12/28 11:39
*/
@Configuration
public class AssetWebSocketConfiguration implements WebSocketConfigurer {
@Value("${orion.websocket.prefix}")
private String prefix;
@Resource
private TerminalAccessInterceptor terminalAccessInterceptor;
@Resource
private TerminalTransferInterceptor terminalTransferInterceptor;
@Resource
private ExecLogTailInterceptor execLogTailInterceptor;
@Resource
private TerminalMessageDispatcher terminalMessageDispatcher;
@Resource
private TransferMessageDispatcher transferMessageDispatcher;
@Resource
private ExecLogTailHandler execLogTailHandler;
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
// 终端会话
registry.addHandler(terminalMessageDispatcher, prefix + "/terminal/access/{accessToken}")
.addInterceptors(terminalAccessInterceptor)
.setAllowedOrigins("*");
// 文件传输
registry.addHandler(transferMessageDispatcher, prefix + "/terminal/transfer/{transferToken}")
.addInterceptors(terminalTransferInterceptor)
.setAllowedOrigins("*");
// 执行日志
registry.addHandler(execLogTailHandler, prefix + "/exec/log/{token}")
.addInterceptors(execLogTailInterceptor)
.setAllowedOrigins("*");
}
}

View File

@@ -1,67 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.controller;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.dromara.visor.common.entity.chart.PieChartData;
import org.dromara.visor.framework.log.core.annotation.IgnoreLog;
import org.dromara.visor.framework.log.core.enums.IgnoreLogMode;
import org.dromara.visor.framework.web.core.annotation.RestWrapper;
import org.dromara.visor.module.asset.service.AssetStatisticsService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* asset - 统计服务
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/12/23 15:56
*/
@Tag(name = "asset - 统计服务")
@Slf4j
@Validated
@RestWrapper
@RestController
@RequestMapping("/asset/statistics")
public class AssetStatisticsController {
@Resource
private AssetStatisticsService assetStatisticsService;
@IgnoreLog(IgnoreLogMode.RET)
@GetMapping("/host-type-chart")
@Operation(summary = "查询主机类型图表")
@PreAuthorize("@ss.hasPermission('asset:statistics:query')")
public PieChartData getHostTypeChart() {
return assetStatisticsService.getHostTypeChart();
}
}

View File

@@ -1,86 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.controller;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.dromara.visor.framework.log.core.annotation.IgnoreLog;
import org.dromara.visor.framework.log.core.enums.IgnoreLogMode;
import org.dromara.visor.framework.web.core.annotation.RestWrapper;
import org.dromara.visor.module.asset.entity.request.command.CommandSnippetCreateRequest;
import org.dromara.visor.module.asset.entity.request.command.CommandSnippetUpdateRequest;
import org.dromara.visor.module.asset.entity.vo.CommandSnippetWrapperVO;
import org.dromara.visor.module.asset.service.CommandSnippetService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* 命令片段 api
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024-1-22 15:28
*/
@Tag(name = "asset - 命令片段服务")
@Slf4j
@Validated
@RestWrapper
@RestController
@RequestMapping("/asset/command-snippet")
public class CommandSnippetController {
@Resource
private CommandSnippetService commandSnippetService;
@PostMapping("/create")
@Operation(summary = "创建命令片段")
public Long createCommandSnippet(@Validated @RequestBody CommandSnippetCreateRequest request) {
return commandSnippetService.createCommandSnippet(request);
}
@PutMapping("/update")
@Operation(summary = "更新命令片段")
public Integer updateCommandSnippet(@Validated @RequestBody CommandSnippetUpdateRequest request) {
return commandSnippetService.updateCommandSnippetById(request);
}
@IgnoreLog(IgnoreLogMode.RET)
@GetMapping("/list")
@Operation(summary = "查询全部命令片段")
public CommandSnippetWrapperVO getCommandSnippetList() {
return commandSnippetService.getCommandSnippet();
}
@DeleteMapping("/delete")
@Operation(summary = "删除命令片段")
@Parameter(name = "id", description = "id", required = true)
public Integer deleteCommandSnippet(@RequestParam("id") Long id) {
return commandSnippetService.deleteCommandSnippetById(id);
}
}

View File

@@ -1,87 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.controller;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.dromara.visor.common.validator.group.Id;
import org.dromara.visor.framework.log.core.annotation.IgnoreLog;
import org.dromara.visor.framework.log.core.enums.IgnoreLogMode;
import org.dromara.visor.framework.web.core.annotation.RestWrapper;
import org.dromara.visor.module.asset.entity.request.command.CommandSnippetGroupCreateRequest;
import org.dromara.visor.module.asset.entity.request.command.CommandSnippetGroupDeleteRequest;
import org.dromara.visor.module.asset.entity.request.command.CommandSnippetGroupUpdateRequest;
import org.dromara.visor.module.asset.entity.vo.CommandSnippetGroupVO;
import org.dromara.visor.module.asset.service.CommandSnippetGroupService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* 命令片段分组 api
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024-1-24 12:28
*/
@Tag(name = "asset - 命令片段分组服务")
@Slf4j
@Validated
@RestWrapper
@RestController
@RequestMapping("/asset/command-snippet-group")
public class CommandSnippetGroupController {
@Resource
private CommandSnippetGroupService commandSnippetGroupService;
@PostMapping("/create")
@Operation(summary = "创建命令片段分组")
public Long createCommandSnippetGroup(@Validated @RequestBody CommandSnippetGroupCreateRequest request) {
return commandSnippetGroupService.createCommandSnippetGroup(request);
}
@PutMapping("/update")
@Operation(summary = "更新命令片段分组")
public Integer updateCommandSnippetGroup(@Validated @RequestBody CommandSnippetGroupUpdateRequest request) {
return commandSnippetGroupService.updateCommandSnippetGroupById(request);
}
@IgnoreLog(IgnoreLogMode.RET)
@GetMapping("/list")
@Operation(summary = "查询全部命令片段分组")
public List<CommandSnippetGroupVO> getCommandSnippetGroupList() {
return commandSnippetGroupService.getCommandSnippetGroupList();
}
@DeleteMapping("/delete")
@Operation(summary = "删除命令片段分组")
public Integer deleteCommandSnippetGroup(@Validated(Id.class) @RequestBody CommandSnippetGroupDeleteRequest request) {
return commandSnippetGroupService.deleteCommandSnippetGroup(request);
}
}

View File

@@ -1,83 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.controller;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.dromara.visor.framework.web.core.annotation.RestWrapper;
import org.dromara.visor.module.asset.entity.request.path.PathBookmarkCreateRequest;
import org.dromara.visor.module.asset.entity.request.path.PathBookmarkUpdateRequest;
import org.dromara.visor.module.asset.entity.vo.PathBookmarkWrapperVO;
import org.dromara.visor.module.asset.service.PathBookmarkService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* 路径标签 api
*
* @author Jiahang Li
* @version 1.0.6
* @since 2024-4-23 23:15
*/
@Tag(name = "asset - 路径标签服务")
@Slf4j
@Validated
@RestWrapper
@RestController
@RequestMapping("/asset/path-bookmark")
public class PathBookmarkController {
@Resource
private PathBookmarkService pathBookmarkService;
@PostMapping("/create")
@Operation(summary = "创建路径标签")
public Long createPathBookmark(@Validated @RequestBody PathBookmarkCreateRequest request) {
return pathBookmarkService.createPathBookmark(request);
}
@PutMapping("/update")
@Operation(summary = "更新路径标签")
public Integer updatePathBookmark(@Validated @RequestBody PathBookmarkUpdateRequest request) {
return pathBookmarkService.updatePathBookmarkById(request);
}
@GetMapping("/list")
@Operation(summary = "查询全部路径标签")
public PathBookmarkWrapperVO getPathBookmarkList() {
return pathBookmarkService.getPathBookmark();
}
@DeleteMapping("/delete")
@Operation(summary = "删除路径标签")
@Parameter(name = "id", description = "id", required = true)
public Integer deletePathBookmark(@RequestParam("id") Long id) {
return pathBookmarkService.deletePathBookmarkById(id);
}
}

View File

@@ -1,87 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.controller;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.dromara.visor.common.validator.group.Id;
import org.dromara.visor.framework.log.core.annotation.IgnoreLog;
import org.dromara.visor.framework.log.core.enums.IgnoreLogMode;
import org.dromara.visor.framework.web.core.annotation.RestWrapper;
import org.dromara.visor.module.asset.entity.request.path.PathBookmarkGroupCreateRequest;
import org.dromara.visor.module.asset.entity.request.path.PathBookmarkGroupDeleteRequest;
import org.dromara.visor.module.asset.entity.request.path.PathBookmarkGroupUpdateRequest;
import org.dromara.visor.module.asset.entity.vo.PathBookmarkGroupVO;
import org.dromara.visor.module.asset.service.PathBookmarkGroupService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* 路径标签分组 api
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024-1-24 12:28
*/
@Tag(name = "asset - 路径标签分组服务")
@Slf4j
@Validated
@RestWrapper
@RestController
@RequestMapping("/asset/path-bookmark-group")
public class PathBookmarkGroupController {
@Resource
private PathBookmarkGroupService pathBookmarkGroupService;
@PostMapping("/create")
@Operation(summary = "创建路径标签分组")
public Long createPathBookmarkGroup(@Validated @RequestBody PathBookmarkGroupCreateRequest request) {
return pathBookmarkGroupService.createPathBookmarkGroup(request);
}
@PutMapping("/update")
@Operation(summary = "更新路径标签分组")
public Integer updatePathBookmarkGroup(@Validated @RequestBody PathBookmarkGroupUpdateRequest request) {
return pathBookmarkGroupService.updatePathBookmarkGroupById(request);
}
@IgnoreLog(IgnoreLogMode.RET)
@GetMapping("/list")
@Operation(summary = "查询全部路径标签分组")
public List<PathBookmarkGroupVO> getPathBookmarkGroupList() {
return pathBookmarkGroupService.getPathBookmarkGroupList();
}
@DeleteMapping("/delete")
@Operation(summary = "删除路径标签分组")
public Integer deletePathBookmarkGroup(@Validated(Id.class) @RequestBody PathBookmarkGroupDeleteRequest request) {
return pathBookmarkGroupService.deletePathBookmarkGroup(request);
}
}

View File

@@ -1,126 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.controller;
import cn.orionsec.kit.lang.define.wrapper.DataGrid;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.dromara.visor.common.validator.group.Id;
import org.dromara.visor.common.validator.group.Page;
import org.dromara.visor.framework.biz.operator.log.core.annotation.OperatorLog;
import org.dromara.visor.framework.log.core.annotation.IgnoreLog;
import org.dromara.visor.framework.log.core.enums.IgnoreLogMode;
import org.dromara.visor.framework.web.core.annotation.DemoDisableApi;
import org.dromara.visor.framework.web.core.annotation.RestWrapper;
import org.dromara.visor.module.asset.define.operator.TerminalConnectLogOperatorType;
import org.dromara.visor.module.asset.entity.request.host.TerminalConnectLogClearRequest;
import org.dromara.visor.module.asset.entity.request.host.TerminalConnectLogQueryRequest;
import org.dromara.visor.module.asset.entity.vo.TerminalConnectLogVO;
import org.dromara.visor.module.asset.service.TerminalConnectLogService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import java.util.Set;
/**
* 终端连接日志 api
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023-12-26 22:09
*/
@Tag(name = "asset - 终端连接日志服务")
@Slf4j
@Validated
@RestWrapper
@RestController
@RequestMapping("/asset/terminal-connect-log")
public class TerminalConnectLogController {
@Resource
private TerminalConnectLogService terminalConnectLogService;
@IgnoreLog(IgnoreLogMode.RET)
@PostMapping("/query")
@Operation(summary = "分页查询终端连接日志")
@PreAuthorize("@ss.hasPermission('asset:terminal-connect-log:management:query')")
public DataGrid<TerminalConnectLogVO> getTerminalConnectLogPage(@Validated(Page.class) @RequestBody TerminalConnectLogQueryRequest request) {
return terminalConnectLogService.getTerminalConnectLogPage(request);
}
@PostMapping("/count")
@Operation(summary = "查询终端连接日志数量")
@PreAuthorize("@ss.hasPermission('asset:terminal-connect-log:management:query')")
public Long getTerminalConnectLogCount(@Validated @RequestBody TerminalConnectLogQueryRequest request) {
return terminalConnectLogService.getTerminalConnectLogCount(request);
}
@IgnoreLog(IgnoreLogMode.RET)
@PostMapping("/sessions")
@Operation(summary = "查询全部终端连接会话")
@PreAuthorize("@ss.hasPermission('asset:terminal-connect-session:management:query')")
public List<TerminalConnectLogVO> getTerminalConnectSessions(@Validated @RequestBody TerminalConnectLogQueryRequest request) {
return terminalConnectLogService.getTerminalConnectSessions(request);
}
@IgnoreLog(IgnoreLogMode.RET)
@PostMapping("/latest-connect")
@Operation(summary = "查询用户最近连接的主机")
public Set<Long> getLatestConnectHostId(@RequestBody TerminalConnectLogQueryRequest request) {
return terminalConnectLogService.getLatestConnectHostId(request);
}
@OperatorLog(TerminalConnectLogOperatorType.DELETE)
@DeleteMapping("/delete")
@Operation(summary = "删除终端连接日志")
@Parameter(name = "idList", description = "idList", required = true)
@PreAuthorize("@ss.hasPermission('asset:terminal-connect-log:management:delete')")
public Integer deleteTerminalConnectLog(@RequestParam("idList") List<Long> idList) {
return terminalConnectLogService.deleteTerminalConnectLog(idList);
}
@OperatorLog(TerminalConnectLogOperatorType.CLEAR)
@PostMapping("/clear")
@Operation(summary = "清空终端连接日志")
@PreAuthorize("@ss.hasPermission('asset:terminal-connect-log:management:clear')")
public Integer clearTerminalConnectLog(@Validated @RequestBody TerminalConnectLogClearRequest request) {
return terminalConnectLogService.clearTerminalConnectLog(request);
}
@DemoDisableApi
@OperatorLog(TerminalConnectLogOperatorType.FORCE_OFFLINE)
@PutMapping("/force-offline")
@Operation(summary = "强制断开终端连接")
@PreAuthorize("@ss.hasAnyPermission('asset:terminal-connect-log:management:force-offline', 'asset:terminal-connect-session:management:force-offline')")
public Boolean forceOffline(@Validated(Id.class) @RequestBody TerminalConnectLogQueryRequest request) {
terminalConnectLogService.forceOffline(request);
return true;
}
}

View File

@@ -1,82 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.controller;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.dromara.visor.framework.log.core.annotation.IgnoreLog;
import org.dromara.visor.framework.log.core.enums.IgnoreLogMode;
import org.dromara.visor.framework.web.core.annotation.RestWrapper;
import org.dromara.visor.module.asset.entity.vo.TerminalThemeVO;
import org.dromara.visor.module.asset.service.TerminalService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
* 终端 api
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023-9-20 11:55
*/
@Tag(name = "asset - 终端服务")
@Slf4j
@Validated
@RestWrapper
@RestController
@RequestMapping("/asset/terminal")
public class TerminalController {
@Resource
private TerminalService terminalService;
@IgnoreLog(IgnoreLogMode.ALL)
@GetMapping("/themes")
@Operation(summary = "获取终端主题")
public List<TerminalThemeVO> getTerminalThemes() {
return terminalService.getTerminalThemes();
}
@GetMapping("/access")
@Operation(summary = "获取终端 accessToken")
@PreAuthorize("@ss.hasPermission('asset:terminal:access')")
public String getTerminalAccessToken() {
return terminalService.getTerminalAccessToken();
}
@GetMapping("/transfer")
@Operation(summary = "获取终端 transferToken")
@PreAuthorize("@ss.hasPermission('asset:terminal:access')")
public String getTerminalTransferToken() {
return terminalService.getTerminalTransferToken();
}
}

View File

@@ -1,118 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.controller;
import cn.orionsec.kit.lang.define.wrapper.DataGrid;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.dromara.visor.common.validator.group.Page;
import org.dromara.visor.framework.biz.operator.log.core.annotation.OperatorLog;
import org.dromara.visor.framework.log.core.annotation.IgnoreLog;
import org.dromara.visor.framework.log.core.enums.IgnoreLogMode;
import org.dromara.visor.framework.web.core.annotation.IgnoreWrapper;
import org.dromara.visor.framework.web.core.annotation.RestWrapper;
import org.dromara.visor.module.asset.define.operator.TerminalOperatorType;
import org.dromara.visor.module.asset.entity.request.host.TerminalSftpLogQueryRequest;
import org.dromara.visor.module.asset.entity.vo.TerminalSftpLogVO;
import org.dromara.visor.module.asset.service.TerminalSftpService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody;
import javax.annotation.Resource;
import javax.annotation.security.PermitAll;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* SFTP 操作服务 api
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023-12-26 22:09
*/
@Tag(name = "asset - SFTP 操作服务")
@Slf4j
@Validated
@RestWrapper
@RestController
@RequestMapping("/asset/terminal-sftp")
public class TerminalSftpController {
@Resource
private TerminalSftpService terminalSftpService;
@IgnoreLog(IgnoreLogMode.RET)
@PostMapping("/query-log")
@Operation(summary = "分页查询 SFTP 操作日志")
@PreAuthorize("@ss.hasAnyPermission('infra:operator-log:query', 'asset:terminal-sftp-log:management:query')")
public DataGrid<TerminalSftpLogVO> getTerminalSftpLogPage(@Validated(Page.class) @RequestBody TerminalSftpLogQueryRequest request) {
return terminalSftpService.getTerminalSftpLogPage(request);
}
@OperatorLog(TerminalOperatorType.DELETE_SFTP_LOG)
@DeleteMapping("/delete-log")
@Operation(summary = "删除 SFTP 操作日志")
@Parameter(name = "idList", description = "idList", required = true)
@PreAuthorize("@ss.hasAnyPermission('infra:operator-log:delete', 'asset:terminal-sftp-log:management:delete')")
public Integer deleteTerminalSftpLog(@RequestParam("idList") List<Long> idList) {
return terminalSftpService.deleteTerminalSftpLog(idList);
}
@IgnoreLog(IgnoreLogMode.RET)
@GetMapping("/get-content")
@Operation(summary = "获取文件内容")
@Parameter(name = "token", description = "token", required = true)
public void getFileContentByToken(@RequestParam("token") String token, HttpServletResponse response) throws Exception {
terminalSftpService.getFileContentByToken(token, response);
}
@PostMapping("/set-content")
@Operation(summary = "设置文件内容")
@Parameter(name = "token", description = "token", required = true)
@Parameter(name = "file", description = "file", required = true)
public Boolean setFileContentByToken(@RequestParam("token") String token,
@RequestParam("file") MultipartFile file) throws Exception {
terminalSftpService.setFileContentByToken(token, file);
return true;
}
@PermitAll
@IgnoreWrapper
@IgnoreLog(IgnoreLogMode.RET)
@GetMapping("/download")
@Operation(summary = "下载文件")
@Parameter(name = "channelId", description = "channelId", required = true)
@Parameter(name = "transferToken", description = "transferToken", required = true)
public StreamingResponseBody downloadWithTransferToken(@RequestParam("channelId") String channelId,
@RequestParam("transferToken") String transferToken,
HttpServletResponse response) {
return terminalSftpService.downloadWithTransferToken(channelId, transferToken, response);
}
}

View File

@@ -1,59 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.convert;
import org.dromara.visor.module.asset.entity.domain.CommandSnippetDO;
import org.dromara.visor.module.asset.entity.dto.CommandSnippetCacheDTO;
import org.dromara.visor.module.asset.entity.request.command.CommandSnippetCreateRequest;
import org.dromara.visor.module.asset.entity.request.command.CommandSnippetUpdateRequest;
import org.dromara.visor.module.asset.entity.vo.CommandSnippetVO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
* 命令片段 内部对象转换器
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024-1-22 15:28
*/
@Mapper
public interface CommandSnippetConvert {
CommandSnippetConvert MAPPER = Mappers.getMapper(CommandSnippetConvert.class);
CommandSnippetDO to(CommandSnippetCreateRequest request);
CommandSnippetDO to(CommandSnippetUpdateRequest request);
CommandSnippetVO to(CommandSnippetDO domain);
List<CommandSnippetVO> to(List<CommandSnippetDO> list);
CommandSnippetVO to(CommandSnippetCacheDTO cache);
CommandSnippetCacheDTO toCache(CommandSnippetDO domain);
}

View File

@@ -1,52 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.convert;
import org.dromara.visor.module.asset.entity.request.command.CommandSnippetGroupCreateRequest;
import org.dromara.visor.module.asset.entity.request.command.CommandSnippetGroupUpdateRequest;
import org.dromara.visor.module.asset.entity.vo.CommandSnippetGroupVO;
import org.dromara.visor.module.infra.entity.dto.data.DataGroupCreateDTO;
import org.dromara.visor.module.infra.entity.dto.data.DataGroupDTO;
import org.dromara.visor.module.infra.entity.dto.data.DataGroupRenameDTO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
/**
* 命令片段分组 内部对象转换器
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024-1-24 12:28
*/
@Mapper
public interface CommandSnippetGroupConvert {
CommandSnippetGroupConvert MAPPER = Mappers.getMapper(CommandSnippetGroupConvert.class);
DataGroupCreateDTO to(CommandSnippetGroupCreateRequest request);
DataGroupRenameDTO to(CommandSnippetGroupUpdateRequest request);
CommandSnippetGroupVO to(DataGroupDTO domain);
}

View File

@@ -1,59 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.convert;
import org.dromara.visor.module.asset.entity.domain.PathBookmarkDO;
import org.dromara.visor.module.asset.entity.dto.PathBookmarkCacheDTO;
import org.dromara.visor.module.asset.entity.request.path.PathBookmarkCreateRequest;
import org.dromara.visor.module.asset.entity.request.path.PathBookmarkUpdateRequest;
import org.dromara.visor.module.asset.entity.vo.PathBookmarkVO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
* 路径标签 内部对象转换器
*
* @author Jiahang Li
* @version 1.0.6
* @since 2024-4-23 23:15
*/
@Mapper
public interface PathBookmarkConvert {
PathBookmarkConvert MAPPER = Mappers.getMapper(PathBookmarkConvert.class);
PathBookmarkDO to(PathBookmarkCreateRequest request);
PathBookmarkDO to(PathBookmarkUpdateRequest request);
PathBookmarkVO to(PathBookmarkDO domain);
List<PathBookmarkVO> to(List<PathBookmarkDO> list);
PathBookmarkVO to(PathBookmarkCacheDTO cache);
PathBookmarkCacheDTO toCache(PathBookmarkDO domain);
}

View File

@@ -1,52 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.convert;
import org.dromara.visor.module.asset.entity.request.path.PathBookmarkGroupCreateRequest;
import org.dromara.visor.module.asset.entity.request.path.PathBookmarkGroupUpdateRequest;
import org.dromara.visor.module.asset.entity.vo.PathBookmarkGroupVO;
import org.dromara.visor.module.infra.entity.dto.data.DataGroupCreateDTO;
import org.dromara.visor.module.infra.entity.dto.data.DataGroupDTO;
import org.dromara.visor.module.infra.entity.dto.data.DataGroupRenameDTO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
/**
* 路径标签分组 内部对象转换器
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024-1-24 12:28
*/
@Mapper
public interface PathBookmarkGroupConvert {
PathBookmarkGroupConvert MAPPER = Mappers.getMapper(PathBookmarkGroupConvert.class);
DataGroupCreateDTO to(PathBookmarkGroupCreateRequest request);
DataGroupRenameDTO to(PathBookmarkGroupUpdateRequest request);
PathBookmarkGroupVO to(DataGroupDTO domain);
}

View File

@@ -1,57 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.convert;
import org.dromara.visor.module.asset.entity.domain.TerminalConnectLogDO;
import org.dromara.visor.module.asset.entity.dto.TerminalConnectDTO;
import org.dromara.visor.module.asset.entity.request.host.TerminalConnectLogCreateRequest;
import org.dromara.visor.module.asset.entity.request.host.TerminalConnectLogQueryRequest;
import org.dromara.visor.module.asset.entity.vo.TerminalConnectLogVO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
* 终端连接日志 内部对象转换器
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023-12-26 22:09
*/
@Mapper
public interface TerminalConnectLogConvert {
TerminalConnectLogConvert MAPPER = Mappers.getMapper(TerminalConnectLogConvert.class);
TerminalConnectLogDO to(TerminalConnectLogCreateRequest request);
TerminalConnectLogDO to(TerminalConnectLogQueryRequest request);
TerminalConnectLogVO to(TerminalConnectLogDO domain);
TerminalConnectLogCreateRequest to(TerminalConnectDTO dto);
List<TerminalConnectLogVO> to(List<TerminalConnectLogDO> list);
}

View File

@@ -1,46 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.convert;
import org.dromara.visor.module.asset.entity.vo.TerminalSftpLogVO;
import org.dromara.visor.module.infra.entity.dto.operator.OperatorLogDTO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;
/**
* SFTP 操作日志 内部对象转换器
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023-12-26 22:09
*/
@Mapper
public interface TerminalSftpLogConvert {
TerminalSftpLogConvert MAPPER = Mappers.getMapper(TerminalSftpLogConvert.class);
@Mapping(target = "extra", ignore = true)
TerminalSftpLogVO to(OperatorLogDTO request);
}

View File

@@ -1,81 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.dao;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.apache.ibatis.annotations.Mapper;
import org.dromara.visor.framework.mybatis.core.mapper.IMapper;
import org.dromara.visor.module.asset.entity.domain.CommandSnippetDO;
import java.util.List;
/**
* 命令片段 Mapper 接口
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024-1-22 15:28
*/
@Mapper
public interface CommandSnippetDAO extends IMapper<CommandSnippetDO> {
/**
* 设置 groupId 为 null
*
* @param groupId groupId
* @return effect
*/
default int setGroupIdWithNull(Long groupId) {
LambdaUpdateWrapper<CommandSnippetDO> wrapper = Wrappers.<CommandSnippetDO>lambdaUpdate()
.set(CommandSnippetDO::getGroupId, null)
.eq(CommandSnippetDO::getGroupId, groupId);
return this.update(null, wrapper);
}
/**
* 通过 groupId 删除
*
* @param groupId groupId
* @return effect
*/
default int deleteByGroupId(Long groupId) {
LambdaQueryWrapper<CommandSnippetDO> wrapper = this.lambda()
.eq(CommandSnippetDO::getGroupId, groupId);
return this.delete(wrapper);
}
/**
* 通过 userId 删除
*
* @param userIdList userIdList
* @return effect
*/
default int deleteByUserIdList(List<Long> userIdList) {
LambdaQueryWrapper<CommandSnippetDO> wrapper = this.lambda()
.in(CommandSnippetDO::getUserId, userIdList);
return this.delete(wrapper);
}
}

View File

@@ -1,81 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.dao;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.apache.ibatis.annotations.Mapper;
import org.dromara.visor.framework.mybatis.core.mapper.IMapper;
import org.dromara.visor.module.asset.entity.domain.PathBookmarkDO;
import java.util.List;
/**
* 路径标签 Mapper 接口
*
* @author Jiahang Li
* @version 1.0.6
* @since 2024-4-23 23:15
*/
@Mapper
public interface PathBookmarkDAO extends IMapper<PathBookmarkDO> {
/**
* 设置 groupId 为 null
*
* @param groupId groupId
* @return effect
*/
default int setGroupIdWithNull(Long groupId) {
LambdaUpdateWrapper<PathBookmarkDO> wrapper = Wrappers.<PathBookmarkDO>lambdaUpdate()
.set(PathBookmarkDO::getGroupId, null)
.eq(PathBookmarkDO::getGroupId, groupId);
return this.update(null, wrapper);
}
/**
* 通过 groupId 删除
*
* @param groupId groupId
* @return effect
*/
default int deleteByGroupId(Long groupId) {
LambdaQueryWrapper<PathBookmarkDO> wrapper = this.lambda()
.eq(PathBookmarkDO::getGroupId, groupId);
return this.delete(wrapper);
}
/**
* 通过 userId 删除
*
* @param userIdList userIdList
* @return effect
*/
default int deleteByUserIdList(List<Long> userIdList) {
LambdaQueryWrapper<PathBookmarkDO> wrapper = this.lambda()
.in(PathBookmarkDO::getUserId, userIdList);
return this.delete(wrapper);
}
}

View File

@@ -1,76 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.dao;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.dromara.visor.framework.mybatis.core.mapper.IMapper;
import org.dromara.visor.module.asset.entity.domain.TerminalConnectLogDO;
import org.dromara.visor.module.asset.entity.po.TerminalConnectLogCountPO;
import java.util.Date;
import java.util.List;
/**
* 终端连接日志 Mapper 接口
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023-12-26 22:09
*/
@Mapper
public interface TerminalConnectLogDAO extends IMapper<TerminalConnectLogDO> {
/**
* 查询最近连接的 hostId
*
* @param userId userId
* @param type type
* @param limit limit
* @return hostId
*/
default List<Long> selectLatestConnectHostId(Long userId, String type, Integer limit) {
return this.of()
.createWrapper(true)
.select(TerminalConnectLogDO::getHostId)
.eq(TerminalConnectLogDO::getUserId, userId)
.eq(TerminalConnectLogDO::getType, type)
.orderByDesc(TerminalConnectLogDO::getId)
.then()
.limit(limit)
.list(TerminalConnectLogDO::getHostId);
}
/**
* 查询终端连接日志用户数量
*
* @param userId userId
* @param startTime startTime
* @param endTime endTime
* @return rows
*/
List<TerminalConnectLogCountPO> selectConnectLogUserCount(@Param("userId") Long userId,
@Param("startTime") Date startTime,
@Param("endTime") Date endTime);
}

View File

@@ -1,49 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.define.cache;
import cn.orionsec.kit.lang.define.cache.key.CacheKeyBuilder;
import cn.orionsec.kit.lang.define.cache.key.CacheKeyDefine;
import cn.orionsec.kit.lang.define.cache.key.struct.RedisCacheStruct;
import org.dromara.visor.module.asset.entity.dto.CommandSnippetCacheDTO;
import java.util.concurrent.TimeUnit;
/**
* 命令片段缓存 key
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024-1-22 15:28
*/
public interface CommandSnippetCacheKeyDefine {
CacheKeyDefine SNIPPET = new CacheKeyBuilder()
.key("command:snippet:list:{}")
.desc("命令片段列表 ${userId}")
.type(CommandSnippetCacheDTO.class)
.struct(RedisCacheStruct.HASH)
.timeout(8, TimeUnit.HOURS)
.build();
}

View File

@@ -1,49 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.define.cache;
import cn.orionsec.kit.lang.define.cache.key.CacheKeyBuilder;
import cn.orionsec.kit.lang.define.cache.key.CacheKeyDefine;
import cn.orionsec.kit.lang.define.cache.key.struct.RedisCacheStruct;
import org.dromara.visor.module.asset.entity.dto.PathBookmarkCacheDTO;
import java.util.concurrent.TimeUnit;
/**
* 路径标签缓存 key
*
* @author Jiahang Li
* @version 1.0.6
* @since 2024-4-23 23:15
*/
public interface PathBookmarkCacheKeyDefine {
CacheKeyDefine PATH_BOOKMARK = new CacheKeyBuilder()
.key("path:bookmark:list:{}")
.desc("路径标签列表 ${userId}")
.type(PathBookmarkCacheDTO.class)
.struct(RedisCacheStruct.HASH)
.timeout(8, TimeUnit.HOURS)
.build();
}

View File

@@ -1,76 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.define.cache;
import cn.orionsec.kit.lang.define.cache.key.CacheKeyBuilder;
import cn.orionsec.kit.lang.define.cache.key.CacheKeyDefine;
import cn.orionsec.kit.lang.define.cache.key.struct.RedisCacheStruct;
import org.dromara.visor.module.asset.entity.dto.SftpGetContentCacheDTO;
import org.dromara.visor.module.asset.entity.dto.SftpSetContentCacheDTO;
import org.dromara.visor.module.asset.entity.dto.TerminalAccessDTO;
import org.dromara.visor.module.asset.entity.dto.TerminalTransferDTO;
import java.util.concurrent.TimeUnit;
/**
* 终端服务缓存 key
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/12/27 18:13
*/
public interface TerminalCacheKeyDefine {
CacheKeyDefine TERMINAL_ACCESS = new CacheKeyBuilder()
.key("terminal:access:{}")
.desc("终端访问token ${token}")
.type(TerminalAccessDTO.class)
.struct(RedisCacheStruct.STRING)
.timeout(3, TimeUnit.MINUTES)
.build();
CacheKeyDefine TERMINAL_TRANSFER = new CacheKeyBuilder()
.key("terminal:transfer:{}")
.desc("终端传输token ${token}")
.type(TerminalTransferDTO.class)
.struct(RedisCacheStruct.STRING)
.timeout(3, TimeUnit.MINUTES)
.build();
CacheKeyDefine TERMINAL_SFTP_GET_CONTENT = new CacheKeyBuilder()
.key("terminal:sftp:gc:{}")
.desc("sftp 获取文件内容 ${token}")
.type(SftpGetContentCacheDTO.class)
.struct(RedisCacheStruct.STRING)
.timeout(5, TimeUnit.MINUTES)
.build();
CacheKeyDefine TERMINAL_SFTP_SET_CONTENT = new CacheKeyBuilder()
.key("terminal:sftp:sc:{}")
.desc("sftp 设置文件内容 ${token}")
.type(SftpSetContentCacheDTO.class)
.struct(RedisCacheStruct.STRING)
.timeout(5, TimeUnit.MINUTES)
.build();
}

View File

@@ -1,57 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.define.operator;
import org.dromara.visor.framework.biz.operator.log.core.annotation.Module;
import org.dromara.visor.framework.biz.operator.log.core.factory.InitializingOperatorTypes;
import org.dromara.visor.framework.biz.operator.log.core.model.OperatorType;
import static org.dromara.visor.framework.biz.operator.log.core.enums.OperatorRiskLevel.H;
import static org.dromara.visor.framework.biz.operator.log.core.enums.OperatorRiskLevel.M;
/**
* 终端连接日志 操作日志类型
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/3/2 14:37
*/
@Module("asset:terminal-connect-log")
public class TerminalConnectLogOperatorType extends InitializingOperatorTypes {
public static final String DELETE = "terminal-connect-log:delete";
public static final String CLEAR = "terminal-connect-log:clear";
public static final String FORCE_OFFLINE = "terminal-connect-log:force-offline";
@Override
public OperatorType[] types() {
return new OperatorType[]{
new OperatorType(H, DELETE, "删除终端连接记录 <sb>${count}</sb> 条"),
new OperatorType(H, CLEAR, "清空终端连接记录 <sb>${count}</sb> 条"),
new OperatorType(M, FORCE_OFFLINE, "强制下线终端连接 <sb>${hostName}</sb>"),
};
}
}

View File

@@ -1,95 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.define.operator;
import cn.orionsec.kit.lang.utils.collect.Lists;
import org.dromara.visor.framework.biz.operator.log.core.annotation.Module;
import org.dromara.visor.framework.biz.operator.log.core.factory.InitializingOperatorTypes;
import org.dromara.visor.framework.biz.operator.log.core.model.OperatorType;
import java.util.List;
import static org.dromara.visor.framework.biz.operator.log.core.enums.OperatorRiskLevel.*;
/**
* 终端 操作日志类型
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/10/10 17:30
*/
@Module("asset:terminal")
public class TerminalOperatorType extends InitializingOperatorTypes {
public static final String CONNECT = "terminal:connect";
public static final String DELETE_SFTP_LOG = "terminal:delete-sftp-log";
public static final String SFTP_MKDIR = "terminal:sftp-mkdir";
public static final String SFTP_TOUCH = "terminal:sftp-touch";
public static final String SFTP_MOVE = "terminal:sftp-move";
public static final String SFTP_REMOVE = "terminal:sftp-remove";
public static final String SFTP_TRUNCATE = "terminal:sftp-truncate";
public static final String SFTP_CHMOD = "terminal:sftp-chmod";
public static final String SFTP_SET_CONTENT = "terminal:sftp-set-content";
public static final String SFTP_UPLOAD = "terminal:sftp-upload";
public static final String SFTP_DOWNLOAD = "terminal:sftp-download";
public static final List<String> SFTP_TYPES = Lists.of(
SFTP_MKDIR,
SFTP_TOUCH,
SFTP_MOVE,
SFTP_REMOVE,
SFTP_TRUNCATE,
SFTP_CHMOD,
SFTP_SET_CONTENT,
SFTP_UPLOAD,
SFTP_DOWNLOAD
);
@Override
public OperatorType[] types() {
return new OperatorType[]{
new OperatorType(L, CONNECT, "连接主机 ${connectType} <sb>${hostName}</sb>"),
new OperatorType(H, DELETE_SFTP_LOG, "删除 SFTP 操作日志 <sb>${count}</sb> 条"),
new OperatorType(L, SFTP_MKDIR, "创建文件夹 ${hostName} <sb>${path}</sb>"),
new OperatorType(L, SFTP_TOUCH, "创建文件 ${hostName} <sb>${path}</sb>"),
new OperatorType(M, SFTP_MOVE, "移动文件 ${hostName} <sb>${path}</sb> 至 <sb>${target}</sb>"),
new OperatorType(H, SFTP_REMOVE, "删除文件 ${hostName} <sb>${path}</sb>"),
new OperatorType(H, SFTP_TRUNCATE, "截断文件 ${hostName} <sb>${path}</sb>"),
new OperatorType(M, SFTP_CHMOD, "文件提权 ${hostName} <sb>${path}</sb> <sb>${mod}</sb>"),
new OperatorType(M, SFTP_SET_CONTENT, "修改文件内容 ${hostName} <sb>${path}</sb>"),
new OperatorType(M, SFTP_UPLOAD, "上传文件 ${hostName} <sb>${path}</sb>"),
new OperatorType(M, SFTP_DOWNLOAD, "下载文件 ${hostName} <sb>${path}</sb>"),
};
}
}

View File

@@ -1,69 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.entity.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
/**
* 命令片段 实体对象
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024-1-22 15:28
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName(value = "command_snippet", autoResultMap = true)
@Schema(name = "CommandSnippetDO", description = "命令片段 实体对象")
public class CommandSnippetDO extends BaseDO {
private static final long serialVersionUID = 1L;
@Schema(description = "用户id")
@TableField("user_id")
private Long userId;
@Schema(description = "分组id")
@TableField("group_id")
private Long groupId;
@Schema(description = "名称")
@TableField("name")
private String name;
@Schema(description = "代码片段")
@TableField("command")
private String command;
}

View File

@@ -1,73 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.entity.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
/**
* 路径标签 实体对象
*
* @author Jiahang Li
* @version 1.0.6
* @since 2024-4-23 23:15
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName(value = "path_bookmark", autoResultMap = true)
@Schema(name = "PathBookmarkDO", description = "路径标签 实体对象")
public class PathBookmarkDO extends BaseDO {
private static final long serialVersionUID = 1L;
@Schema(description = "用户id")
@TableField("user_id")
private Long userId;
@Schema(description = "分组id")
@TableField("group_id")
private Long groupId;
@Schema(description = "名称")
@TableField("name")
private String name;
@Schema(description = "类型")
@TableField("type")
private String type;
@Schema(description = "路径")
@TableField("path")
private String path;
}

View File

@@ -1,107 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.entity.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
import java.util.Date;
/**
* 终端连接日志 实体对象
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023-12-26 22:09
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName(value = "terminal_connect_log", autoResultMap = true)
@Schema(name = "TerminalConnectLogDO", description = "终端连接日志 实体对象")
public class TerminalConnectLogDO extends BaseDO {
private static final long serialVersionUID = 1L;
@Schema(description = "用户id")
@TableField("user_id")
private Long userId;
@Schema(description = "用户名")
@TableField("username")
private String username;
@Schema(description = "主机id")
@TableField("host_id")
private Long hostId;
@Schema(description = "主机名称")
@TableField("host_name")
private String hostName;
@Schema(description = "主机地址")
@TableField("host_address")
private String hostAddress;
@Schema(description = "类型")
@TableField("type")
private String type;
@Schema(description = "sessionId")
@TableField("session_id")
private String sessionId;
@Schema(description = "状态")
@TableField("status")
private String status;
@Schema(description = "开始时间")
@TableField("start_time")
private Date startTime;
@Schema(description = "结束时间")
@TableField("end_time")
private Date endTime;
@Schema(description = "额外信息")
@TableField("extra_info")
private String extraInfo;
@Schema(description = "创建人")
@TableField(exist = false)
private String creator;
@Schema(description = "修改人")
@TableField(exist = false)
private String updater;
}

View File

@@ -1,62 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.entity.dto;
import cn.orionsec.kit.lang.define.cache.key.model.LongCacheIdModel;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* 命令片段 缓存对象
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024-1-22 15:28
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "CommandSnippetCacheDTO", description = "命令片段 缓存对象")
public class CommandSnippetCacheDTO implements LongCacheIdModel, Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "id")
private Long id;
@Schema(description = "分组id")
private Long groupId;
@Schema(description = "名称")
private String name;
@Schema(description = "代码片段")
private String command;
}

View File

@@ -1,65 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.entity.dto;
import cn.orionsec.kit.lang.define.cache.key.model.LongCacheIdModel;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* 路径标签 缓存对象
*
* @author Jiahang Li
* @version 1.0.6
* @since 2024-4-23 23:15
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "PathBookmarkCacheDTO", description = "路径标签 缓存对象")
public class PathBookmarkCacheDTO implements LongCacheIdModel, Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "id")
private Long id;
@Schema(description = "分组id")
private Long groupId;
@Schema(description = "名称")
private String name;
@Schema(description = "类型")
private String type;
@Schema(description = "路径")
private String path;
}

View File

@@ -1,55 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.entity.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* sftp 获取文件内容缓存对象
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/10/10 20:49
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "SftpGetContentCacheDTO", description = "sftp 获取文件内容缓存对象")
public class SftpGetContentCacheDTO implements Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "主机id")
private Long hostId;
@Schema(description = "文件路径")
private String path;
}

View File

@@ -1,55 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.entity.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* sftp 获取文件内容缓存对象
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/10/10 20:49
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "SftpSetContentCacheDTO", description = "sftp 设置文件内容缓存对象")
public class SftpSetContentCacheDTO implements Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "主机id")
private Long hostId;
@Schema(description = "文件路径")
private String path;
}

View File

@@ -1,53 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.entity.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.dromara.visor.framework.desensitize.core.annotation.DesensitizeObject;
/**
* 终端访问参数
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/12/26 15:47
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@DesensitizeObject
@Schema(name = "TerminalAccessDTO", description = "终端访问参数")
public class TerminalAccessDTO {
@Schema(description = "userId")
private Long userId;
@Schema(description = "username")
private String username;
}

View File

@@ -1,75 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.entity.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 终端连接日志拓展信息对象
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024-3-12 23:31
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "TerminalConnectLogExtraDTO", description = "终端连接日志拓展信息对象")
public class TerminalConnectLogExtraDTO {
@Schema(description = "hostId")
private Long hostId;
@Schema(description = "主机名称")
private String hostName;
@Schema(description = "连接类型")
private String connectType;
@Schema(description = "traceId")
private String traceId;
@Schema(description = "channelId")
private String channelId;
@Schema(description = "sessionId")
private String sessionId;
@Schema(description = "请求地址")
private String address;
@Schema(description = "请求位置")
private String location;
@Schema(description = "ua")
private String userAgent;
@Schema(description = "错误信息")
private String errorMessage;
}

View File

@@ -1,53 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.entity.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.dromara.visor.framework.desensitize.core.annotation.DesensitizeObject;
/**
* 终端传输参数
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/12/26 15:47
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@DesensitizeObject
@Schema(name = "TerminalTransferDTO", description = "终端传输参数")
public class TerminalTransferDTO {
@Schema(description = "userId")
private Long userId;
@Schema(description = "username")
private String username;
}

View File

@@ -1,58 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.entity.po;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* 终端连接日志数量
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/12/23 22:31
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "TerminalConnectLogCountPO", description = "终端连接日志数量")
public class TerminalConnectLogCountPO implements Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "连接日期")
private String connectDate;
@Schema(description = "类型")
private String type;
@Schema(description = "数量")
private Integer count;
}

View File

@@ -1,63 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.entity.request.command;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.io.Serializable;
/**
* 命令片段 创建请求对象
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024-1-22 15:28
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "CommandSnippetCreateRequest", description = "命令片段 创建请求对象")
public class CommandSnippetCreateRequest implements Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "分组id")
private Long groupId;
@NotBlank
@Size(max = 64)
@Schema(description = "名称")
private String name;
@NotBlank
@Schema(description = "代码片段")
private String command;
}

View File

@@ -1,56 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.entity.request.command;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.io.Serializable;
/**
* 命令片段分组 创建请求对象
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024-1-24 12:28
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "CommandSnippetGroupCreateRequest", description = "命令片段分组 创建请求对象")
public class CommandSnippetGroupCreateRequest implements Serializable {
private static final long serialVersionUID = 1L;
@NotBlank
@Size(max = 64)
@Schema(description = "分组名称")
private String name;
}

View File

@@ -1,59 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.entity.request.command;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.dromara.visor.common.validator.group.Id;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* 命令片段分组 删除请求对象
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024-1-24 12:28
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "CommandSnippetGroupDeleteRequest", description = "命令片段分组 删除请求对象")
public class CommandSnippetGroupDeleteRequest implements Serializable {
private static final long serialVersionUID = 1L;
@NotNull(groups = Id.class)
@Schema(description = "id")
private Long id;
@NotNull
@Schema(description = "是否删除组内数据")
private Boolean deleteItem;
}

View File

@@ -1,61 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.entity.request.command;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
/**
* 命令片段分组 更新请求对象
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024-1-24 12:28
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "CommandSnippetGroupUpdateRequest", description = "命令片段分组 更新请求对象")
public class CommandSnippetGroupUpdateRequest implements Serializable {
private static final long serialVersionUID = 1L;
@NotNull
@Schema(description = "id")
private Long id;
@NotBlank
@Size(max = 64)
@Schema(description = "分组名称")
private String name;
}

View File

@@ -1,68 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.entity.request.command;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
/**
* 命令片段 更新请求对象
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024-1-22 15:28
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "CommandSnippetUpdateRequest", description = "命令片段 更新请求对象")
public class CommandSnippetUpdateRequest implements Serializable {
private static final long serialVersionUID = 1L;
@NotNull
@Schema(description = "id")
private Long id;
@Schema(description = "分组id")
private Long groupId;
@NotBlank
@Size(max = 64)
@Schema(description = "名称")
private String name;
@NotBlank
@Schema(description = "代码片段")
private String command;
}

View File

@@ -1,57 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.entity.request.host;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* 主机 更新配置请求对象
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023-9-13 14:31
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "HostUpdateConfigRequest", description = "主机 更新配置请求对象")
public class HostUpdateConfigRequest implements Serializable {
@NotNull
@Schema(description = "id")
private Long id;
@NotBlank
@Schema(description = "配置详情")
private String config;
}

View File

@@ -1,52 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.entity.request.host;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.dromara.visor.common.entity.DataClearRequest;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
/**
* 终端连接日志 清理请求对象
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023-12-26 22:09
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Schema(name = "TerminalConnectLogClearRequest", description = "终端连接日志 清理请求对象")
public class TerminalConnectLogClearRequest extends TerminalConnectLogQueryRequest implements DataClearRequest {
@NotNull
@Min(value = 1)
@Max(value = 2000)
@Schema(description = "清理数量限制")
private Integer limit;
}

View File

@@ -1,73 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.entity.request.host;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.Size;
import java.util.Map;
/**
* 终端连接日志 创建请求对象
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023-12-26 22:09
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "TerminalConnectLogCreateRequest", description = "终端连接日志 创建请求对象")
public class TerminalConnectLogCreateRequest {
@Schema(description = "用户id")
private Long userId;
@Schema(description = "用户名")
private String username;
@Schema(description = "主机id")
private Long hostId;
@Schema(description = "主机名称")
private String hostName;
@Schema(description = "主机地址")
private String hostAddress;
@Schema(description = "状态")
private String status;
@Size(max = 64)
@Schema(description = "sessionId")
private String sessionId;
@Schema(description = "拓展信息")
private Map<String, Object> extra;
}

View File

@@ -1,91 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.entity.request.host;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import org.dromara.visor.common.entity.BaseQueryRequest;
import org.dromara.visor.common.validator.group.Id;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Date;
import java.util.List;
/**
* 终端连接日志 查询请求对象
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023-12-26 22:09
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@Schema(name = "TerminalConnectLogQueryRequest", description = "终端连接日志 查询请求对象")
public class TerminalConnectLogQueryRequest extends BaseQueryRequest {
@NotNull(groups = Id.class)
@Schema(description = "id")
private Long id;
@Schema(description = "id")
private List<Long> idList;
@Schema(description = "用户id")
private Long userId;
@Schema(description = "主机id")
private Long hostId;
@Size(max = 128)
@Schema(description = "主机地址")
private String hostAddress;
@Size(max = 16)
@Schema(description = "类型")
private String type;
@Size(max = 64)
@Schema(description = "sessionId")
private String sessionId;
@Size(max = 16)
@Schema(description = "状态")
private String status;
@Schema(description = "开始时间-区间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date[] startTimeRange;
@Schema(description = "创建时间 <=")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTimeLe;
@Schema(description = "状态")
private List<String> statusList;
}

View File

@@ -1,65 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.entity.request.host;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import org.dromara.visor.common.entity.BaseQueryRequest;
import javax.validation.constraints.Size;
import java.util.Date;
/**
* SFTP 操作日志 查询请求对象
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024-3-4 22:59
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@Schema(name = "TerminalSftpLogQueryRequest", description = "SFTP 操作日志 查询请求对象")
public class TerminalSftpLogQueryRequest extends BaseQueryRequest {
@Schema(description = "用户id")
private Long userId;
@Schema(description = "hostId")
private Long hostId;
@Size(max = 64)
@Schema(description = "操作类型")
private String type;
@Schema(description = "操作结果 0失败 1成功")
private Integer result;
@Schema(description = "开始时间-区间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date[] startTimeRange;
}

View File

@@ -1,69 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.entity.request.path;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.io.Serializable;
/**
* 路径标签 创建请求对象
*
* @author Jiahang Li
* @version 1.0.6
* @since 2024-4-23 23:15
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "PathBookmarkCreateRequest", description = "路径标签 创建请求对象")
public class PathBookmarkCreateRequest implements Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "分组id")
private Long groupId;
@NotBlank
@Size(max = 64)
@Schema(description = "名称")
private String name;
@NotBlank
@Size(max = 4)
@Schema(description = "类型")
private String type;
@NotBlank
@Size(max = 1024)
@Schema(description = "路径")
private String path;
}

View File

@@ -1,56 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.entity.request.path;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.io.Serializable;
/**
* 路径标签分组 创建请求对象
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024-1-24 12:28
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "PathBookmarkGroupCreateRequest", description = "路径标签分组 创建请求对象")
public class PathBookmarkGroupCreateRequest implements Serializable {
private static final long serialVersionUID = 1L;
@NotBlank
@Size(max = 64)
@Schema(description = "分组名称")
private String name;
}

View File

@@ -1,59 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.entity.request.path;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.dromara.visor.common.validator.group.Id;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* 路径标签分组 删除请求对象
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024-1-24 12:28
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "PathBookmarkGroupDeleteRequest", description = "路径标签分组 删除请求对象")
public class PathBookmarkGroupDeleteRequest implements Serializable {
private static final long serialVersionUID = 1L;
@NotNull(groups = Id.class)
@Schema(description = "id")
private Long id;
@NotNull
@Schema(description = "是否删除组内数据")
private Boolean deleteItem;
}

View File

@@ -1,61 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.entity.request.path;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
/**
* 路径标签分组 更新请求对象
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024-1-24 12:28
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "PathBookmarkGroupUpdateRequest", description = "路径标签分组 更新请求对象")
public class PathBookmarkGroupUpdateRequest implements Serializable {
private static final long serialVersionUID = 1L;
@NotNull
@Schema(description = "id")
private Long id;
@NotBlank
@Size(max = 64)
@Schema(description = "分组名称")
private String name;
}

View File

@@ -1,74 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.entity.request.path;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
/**
* 路径标签 更新请求对象
*
* @author Jiahang Li
* @version 1.0.6
* @since 2024-4-23 23:15
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "PathBookmarkUpdateRequest", description = "路径标签 更新请求对象")
public class PathBookmarkUpdateRequest implements Serializable {
private static final long serialVersionUID = 1L;
@NotNull
@Schema(description = "id")
private Long id;
@Schema(description = "分组id")
private Long groupId;
@NotBlank
@Size(max = 64)
@Schema(description = "名称")
private String name;
@NotBlank
@Size(max = 4)
@Schema(description = "类型")
private String type;
@NotBlank
@Size(max = 1024)
@Schema(description = "路径")
private String path;
}

View File

@@ -1,59 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.entity.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* 命令片段分组 视图响应对象
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024-1-24 12:28
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "CommandSnippetGroupVO", description = "命令片段分组 视图响应对象")
public class CommandSnippetGroupVO implements Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "id")
private Long id;
@Schema(description = "分组名称")
private String name;
@Schema(description = "命令片段列表")
private List<CommandSnippetVO> items;
}

View File

@@ -1,61 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.entity.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* 命令片段 视图响应对象
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024-1-22 15:28
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "CommandSnippetVO", description = "命令片段 视图响应对象")
public class CommandSnippetVO implements Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "id")
private Long id;
@Schema(description = "分组id")
private Long groupId;
@Schema(description = "名称")
private String name;
@Schema(description = "代码片段")
private String command;
}

View File

@@ -1,56 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.entity.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* 命令片段组合 视图响应对象
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/1/24 17:30
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "CommandSnippetWrapperVO", description = "命令片段组合 视图响应对象")
public class CommandSnippetWrapperVO implements Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "分组")
private List<CommandSnippetGroupVO> groups;
@Schema(description = "未分组的命令片段")
private List<CommandSnippetVO> ungroupedItems;
}

View File

@@ -1,59 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.entity.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* 路径标签分组 视图响应对象
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024-1-24 12:28
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "PathBookmarkGroupVO", description = "路径标签分组 视图响应对象")
public class PathBookmarkGroupVO implements Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "id")
private Long id;
@Schema(description = "分组名称")
private String name;
@Schema(description = "路径标签列表")
private List<PathBookmarkVO> items;
}

View File

@@ -1,67 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.entity.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* 路径标签 视图响应对象
*
* @author Jiahang Li
* @version 1.0.6
* @since 2024-4-23 23:15
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "PathBookmarkVO", description = "路径标签 视图响应对象")
public class PathBookmarkVO implements Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "id")
private Long id;
@Schema(description = "用户id")
private Long userId;
@Schema(description = "分组id")
private Long groupId;
@Schema(description = "名称")
private String name;
@Schema(description = "类型")
private String type;
@Schema(description = "路径")
private String path;
}

View File

@@ -1,56 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.entity.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* 路径标签组合 视图响应对象
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/1/24 17:30
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "PathBookmarkWrapperVO", description = "路径标签组合 视图响应对象")
public class PathBookmarkWrapperVO implements Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "分组")
private List<PathBookmarkGroupVO> groups;
@Schema(description = "未分组的路径标签")
private List<PathBookmarkVO> ungroupedItems;
}

View File

@@ -1,87 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.entity.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.dromara.visor.module.asset.entity.dto.TerminalConnectLogExtraDTO;
import java.io.Serializable;
import java.util.Date;
/**
* 终端连接日志 视图响应对象
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023-12-26 22:09
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "TerminalConnectLogVO", description = "终端连接日志 视图响应对象")
public class TerminalConnectLogVO implements Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "id")
private Long id;
@Schema(description = "用户id")
private Long userId;
@Schema(description = "用户名")
private String username;
@Schema(description = "主机id")
private Long hostId;
@Schema(description = "主机名称")
private String hostName;
@Schema(description = "主机地址")
private String hostAddress;
@Schema(description = "类型")
private String type;
@Schema(description = "状态")
private String status;
@Schema(description = "sessionId")
private String sessionId;
@Schema(description = "开始时间")
private Date startTime;
@Schema(description = "结束时间")
private Date endTime;
@Schema(description = "额外信息")
private TerminalConnectLogExtraDTO extra;
}

View File

@@ -1,93 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.entity.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
import java.util.Map;
/**
* SFTP 操作日志 实体对象
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023-10-10 17:08
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "TerminalSftpLogVO", description = "SFTP 操作日志 实体对象")
public class TerminalSftpLogVO implements Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "id")
private Long id;
@Schema(description = "用户id")
private Long userId;
@Schema(description = "用户名")
private String username;
@Schema(description = "主机id")
private Long hostId;
@Schema(description = "主机名称")
private String hostName;
@Schema(description = "主机地址")
private String hostAddress;
@Schema(description = "操作文件")
private String[] paths;
@Schema(description = "请求ip")
private String address;
@Schema(description = "请求地址")
private String location;
@Schema(description = "userAgent")
private String userAgent;
@Schema(description = "操作类型")
private String type;
@Schema(description = "参数")
private Map<String, Object> extra;
@Schema(description = "操作结果 0失败 1成功")
private Integer result;
@Schema(description = "开始时间")
private Date startTime;
}

View File

@@ -1,55 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.entity.vo;
import com.alibaba.fastjson.JSONObject;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 终端主题 视图响应对象
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/7/4 19:27
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "TerminalThemeVO", description = "终端主题 视图响应对象")
public class TerminalThemeVO {
@Schema(description = "主题名称")
private String name;
@Schema(description = "是否为暗色")
private Boolean dark;
@Schema(description = "主题 schema")
private JSONObject schema;
}

View File

@@ -1,74 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.enums;
import cn.orionsec.kit.lang.utils.collect.Lists;
import java.util.List;
/**
* 终端连接状态
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/12/26 22:27
*/
public enum TerminalConnectStatusEnum {
/**
* 连接中
*/
CONNECTING,
/**
* 完成
*/
COMPLETE,
/**
* 失败
*/
FAILED,
/**
* 强制下线
*/
FORCE_OFFLINE,
;
public static final List<String> FINISH_STATUS_LIST = Lists.of(COMPLETE.name(), FAILED.name(), FORCE_OFFLINE.name());
public static TerminalConnectStatusEnum of(String type) {
if (type == null) {
return null;
}
for (TerminalConnectStatusEnum value : values()) {
if (value.name().equals(type)) {
return value;
}
}
return null;
}
}

View File

@@ -1,58 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.enums;
/**
* 终端连接类型
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/12/26 22:27
*/
public enum TerminalConnectTypeEnum {
/**
* ssh
*/
SSH,
/**
* sftp
*/
SFTP,
;
public static TerminalConnectTypeEnum of(String type) {
if (type == null) {
return null;
}
for (TerminalConnectTypeEnum value : values()) {
if (value.name().equalsIgnoreCase(type)) {
return value;
}
}
return null;
}
}

View File

@@ -1,48 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.handler.host.terminal.constant;
/**
* 终端信息常量
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/1/3 16:57
*/
public interface TerminalMessage {
String CONFIG_DISABLED = "SSH configuration has been disabled.";
String AUTHENTICATION_FAILURE = "authentication failed. please check the configuration.";
String SERVER_UNREACHABLE = "remote server unreachable. please check the configuration.";
String CONNECTION_FAILED = "connection failed.";
String CONNECTION_TIMEOUT = "connection timeout.";
String CONNECTION_CLOSED = "connection closed.";
String FORCED_OFFLINE = "forced offline.";
}

View File

@@ -1,280 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.handler.host.terminal.enums;
import cn.orionsec.kit.spring.SpringHolder;
import com.alibaba.fastjson.JSONObject;
import lombok.Getter;
import org.dromara.visor.module.asset.handler.host.terminal.handler.*;
import org.dromara.visor.module.asset.handler.host.terminal.model.TerminalBasePayload;
import org.dromara.visor.module.asset.handler.host.terminal.model.request.*;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
/**
* 输入操作类型枚举
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/12/29 15:33
*/
public enum InputTypeEnum {
/**
* 终端连接检查
*/
CHECK("ck",
TerminalCheckHandler.class,
new String[]{"type", "sessionId", "hostId", "connectType"},
TerminalCheckRequest.class,
true),
/**
* 连接主机
*/
CONNECT("co",
TerminalConnectHandler.class,
new String[]{"type", "sessionId", "terminalType", "cols", "rows"},
TerminalConnectRequest.class,
true),
/**
* 关闭连接
*/
CLOSE("cl",
TerminalCloseHandler.class,
new String[]{"type", "sessionId"},
TerminalBasePayload.class,
true),
/**
* ping
*/
PING("p",
TerminalPingHandler.class,
new String[]{"type"},
TerminalBasePayload.class,
true),
/**
* SSH 修改大小
*/
SSH_RESIZE("rs",
SshResizeHandler.class,
new String[]{"type", "sessionId", "cols", "rows"},
SshResizeRequest.class,
true),
/**
* SSH 输入
*/
SSH_INPUT("i",
SshInputHandler.class,
new String[]{"type", "sessionId", "command"},
SshInputRequest.class,
false),
/**
* SFTP 文件列表
*/
SFTP_LIST("ls",
SftpListHandler.class,
new String[]{"type", "sessionId", "showHiddenFile", "path"},
SftpListRequest.class,
true),
/**
* SFTP 创建文件夹
*/
SFTP_MKDIR("mk",
SftpMakeDirectoryHandler.class,
new String[]{"type", "sessionId", "path"},
SftpBaseRequest.class,
true),
/**
* SFTP 创建文件
*/
SFTP_TOUCH("to",
SftpTouchHandler.class,
new String[]{"type", "sessionId", "path"},
SftpBaseRequest.class,
true),
/**
* SFTP 移动文件
*/
SFTP_MOVE("mv",
SftpMoveHandler.class,
new String[]{"type", "sessionId", "path", "target"},
SftpMoveRequest.class,
true),
/**
* SFTP 删除文件
*/
SFTP_REMOVE("rm",
SftpRemoveHandler.class,
new String[]{"type", "sessionId", "path"},
SftpBaseRequest.class,
true),
/**
* SFTP 截断文件
*/
SFTP_TRUNCATE("tc",
SftpTruncateHandler.class,
new String[]{"type", "sessionId", "path"},
SftpBaseRequest.class,
true),
/**
* SFTP 修改文件权限
*/
SFTP_CHMOD("cm",
SftpChangeModeHandler.class,
new String[]{"type", "sessionId", "path", "mod"},
SftpChangeModeRequest.class,
true),
/**
* SFTP 下载文件夹展开文件
*/
SFTP_DOWNLOAD_FLAT_DIRECTORY("df",
SftpDownloadFlatDirectoryHandler.class,
new String[]{"type", "sessionId", "currentPath", "path"},
SftpDownloadFlatDirectoryRequest.class,
true),
/**
* SFTP 获取内容
*/
SFTP_GET_CONTENT("gc",
SftpGetContentHandler.class,
new String[]{"type", "sessionId", "path"},
SftpBaseRequest.class,
true),
/**
* SFTP 修改内容
*/
SFTP_SET_CONTENT("sc",
SftpSetContentHandler.class,
new String[]{"type", "sessionId", "path"},
SftpBaseRequest.class,
true),
;
private static final char SEPARATOR = '|';
@Getter
private final String type;
private final Class<? extends ITerminalHandler<? extends TerminalBasePayload>> handlerBean;
private final String[] payloadDefine;
private final Class<? extends TerminalBasePayload> payloadClass;
@Getter
private final boolean asyncExec;
@Getter
private ITerminalHandler<? extends TerminalBasePayload> handler;
<T extends TerminalBasePayload> InputTypeEnum(String type,
Class<? extends ITerminalHandler<T>> handlerBean,
String[] payloadDefine,
Class<T> payloadClass,
boolean asyncExec) {
this.type = type;
this.handlerBean = handlerBean;
this.payloadDefine = payloadDefine;
this.payloadClass = payloadClass;
this.asyncExec = asyncExec;
}
public static InputTypeEnum of(String payload) {
if (payload == null) {
return null;
}
for (InputTypeEnum value : values()) {
if (payload.startsWith(value.type + SEPARATOR) || payload.equals(value.type)) {
return value;
}
}
return null;
}
/**
* 解析请求
*
* @param payload payload
* @param <T> T
* @return payload
*/
@SuppressWarnings("unchecked")
public <T extends TerminalBasePayload> T parse(String payload) {
JSONObject object = new JSONObject();
int curr = 0;
int len = payload.length();
for (int i = 0, pl = payloadDefine.length; i < pl; i++) {
if (i == pl - 1) {
// 最后一次
object.put(payloadDefine[i], payload.substring(curr, len));
} else {
// 非最后一次
StringBuilder tmp = new StringBuilder();
for (; curr < len; curr++) {
char c = payload.charAt(curr);
if (c == SEPARATOR) {
object.put(payloadDefine[i], tmp.toString());
curr++;
break;
} else {
tmp.append(c);
}
}
}
}
return (T) object.toJavaObject(payloadClass);
}
/**
* 类型字段定义
*/
@Component
static class TypeFieldDefinition {
@PostConstruct
public void init() {
for (InputTypeEnum value : InputTypeEnum.values()) {
value.handler = SpringHolder.getBean(value.handlerBean);
}
}
}
}

View File

@@ -1,143 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.handler.host.terminal.enums;
import cn.orionsec.kit.lang.utils.json.matcher.ReplacementFormatters;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 输出操作类型枚举
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/12/29 15:33
*/
@Getter
@AllArgsConstructor
public enum OutputTypeEnum {
/**
* 终端连接检查
*/
CHECK("ck", "${type}|${sessionId}|${result}|${msg}"),
/**
* 终端连接
*/
CONNECT("co", "${type}|${sessionId}|${result}|${msg}"),
/**
* 关闭连接
*/
CLOSE("cl", "${type}|${sessionId}|${forceClose}|${msg}"),
/**
* pong
*/
PONG("p", "${type}"),
/**
* SSH 输出
*/
SSH_OUTPUT("o", "${type}|${sessionId}|${body}"),
/**
* SFTP 文件列表
*/
SFTP_LIST("ls", "${type}|${sessionId}|${path}|${result}|${msg}|${body}"),
/**
* SFTP 创建文件夹
*/
SFTP_MKDIR("mk", "${type}|${sessionId}|${result}|${msg}"),
/**
* SFTP 创建文件
*/
SFTP_TOUCH("to", "${type}|${sessionId}|${result}|${msg}"),
/**
* SFTP 移动文件
*/
SFTP_MOVE("mv", "${type}|${sessionId}|${result}|${msg}"),
/**
* SFTP 删除文件
*/
SFTP_REMOVE("rm", "${type}|${sessionId}|${result}|${msg}"),
/**
* SFTP 截断文件
*/
SFTP_TRUNCATE("tc", "${type}|${sessionId}|${result}|${msg}"),
/**
* SFTP 修改文件权限
*/
SFTP_CHMOD("cm", "${type}|${sessionId}|${result}|${msg}"),
/**
* SFTP 下载文件夹展开文件
*/
SFTP_DOWNLOAD_FLAT_DIRECTORY("df", "${type}|${sessionId}|${currentPath}|${result}|${msg}|${body}"),
/**
* SFTP 获取文件内容
*/
SFTP_GET_CONTENT("gc", "${type}|${sessionId}|${result}|${msg}|${token}"),
/**
* SFTP 修改文件内容
*/
SFTP_SET_CONTENT("sc", "${type}|${sessionId}|${result}|${msg}|${token}"),
;
private final String type;
private final String template;
/**
* 格式化
*
* @param o o
* @return 格式化
*/
public String format(Object o) {
return ReplacementFormatters.format(this.template, o);
}
public static OutputTypeEnum of(String type) {
if (type == null) {
return null;
}
for (OutputTypeEnum value : values()) {
if (value.type.equals(type)) {
return value;
}
}
return null;
}
}

View File

@@ -1,85 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.handler.host.terminal.handler;
import cn.orionsec.kit.lang.utils.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import org.dromara.visor.common.enums.BooleanBit;
import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogs;
import org.dromara.visor.module.asset.define.operator.TerminalOperatorType;
import org.dromara.visor.module.asset.handler.host.terminal.enums.OutputTypeEnum;
import org.dromara.visor.module.asset.handler.host.terminal.model.request.SftpChangeModeRequest;
import org.dromara.visor.module.asset.handler.host.terminal.model.response.SftpBaseResponse;
import org.dromara.visor.module.asset.handler.host.terminal.session.ISftpSession;
import org.springframework.stereotype.Component;
import org.springframework.web.socket.WebSocketSession;
import java.util.Map;
/**
* sftp 修改文件权限
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/2/19 11:13
*/
@Slf4j
@Component
public class SftpChangeModeHandler extends AbstractTerminalHandler<SftpChangeModeRequest> {
@Override
public void handle(WebSocketSession channel, SftpChangeModeRequest payload) {
long startTime = System.currentTimeMillis();
// 获取会话
String sessionId = payload.getSessionId();
ISftpSession session = terminalManager.getSession(channel.getId(), sessionId);
String path = payload.getPath();
Integer mod = payload.getMod();
log.info("SftpChangeModeHandler-handle start sessionId: {}, path: {}, mod: {}", sessionId, path, mod);
Exception ex = null;
// 修改权限
try {
session.chmod(path, mod);
log.info("SftpChangeModeHandler-handle success sessionId: {}, path: {}, mod: {}", sessionId, path, mod);
} catch (Exception e) {
log.error("SftpChangeModeHandler-handle error sessionId: {}", sessionId, e);
ex = e;
}
// 返回
this.send(channel,
OutputTypeEnum.SFTP_CHMOD,
SftpBaseResponse.builder()
.sessionId(sessionId)
.result(BooleanBit.of(ex == null).getValue())
.msg(this.getErrorMessage(ex))
.build());
// 保存操作日志
Map<String, Object> extra = Maps.newMap();
extra.put(OperatorLogs.PATH, path);
extra.put(OperatorLogs.MOD, mod);
this.saveOperatorLog(payload, channel,
extra, TerminalOperatorType.SFTP_CHMOD,
startTime, ex);
}
}

View File

@@ -1,80 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.handler.host.terminal.handler;
import cn.orionsec.kit.lang.utils.collect.Lists;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.dromara.visor.common.enums.BooleanBit;
import org.dromara.visor.module.asset.handler.host.terminal.enums.OutputTypeEnum;
import org.dromara.visor.module.asset.handler.host.terminal.model.request.SftpDownloadFlatDirectoryRequest;
import org.dromara.visor.module.asset.handler.host.terminal.model.response.SftpDownloadFlatDirectoryResponse;
import org.dromara.visor.module.asset.handler.host.terminal.model.response.SftpFileVO;
import org.dromara.visor.module.asset.handler.host.terminal.session.ISftpSession;
import org.springframework.stereotype.Component;
import org.springframework.web.socket.WebSocketSession;
import java.util.Arrays;
import java.util.List;
/**
* sftp 下载文件夹展开文件
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/2/19 11:13
*/
@Slf4j
@Component
public class SftpDownloadFlatDirectoryHandler extends AbstractTerminalHandler<SftpDownloadFlatDirectoryRequest> {
@Override
public void handle(WebSocketSession channel, SftpDownloadFlatDirectoryRequest payload) {
// 获取会话
String sessionId = payload.getSessionId();
ISftpSession session = terminalManager.getSession(channel.getId(), sessionId);
String[] paths = payload.getPath().split("\\|");
log.info("SftpDownloadFlatDirectoryHandler-handle start sessionId: {}, paths: {}", sessionId, Arrays.toString(paths));
Exception ex = null;
List<SftpFileVO> files = Lists.empty();
// 展开文件夹内的全部文件
try {
files = session.flatDirectory(paths);
log.info("SftpDownloadFlatDirectoryHandler-handle success sessionId: {}, paths: {}", sessionId, Arrays.toString(paths));
} catch (Exception e) {
log.error("SftpDownloadFlatDirectoryHandler-handle error sessionId: {}", sessionId, e);
ex = e;
}
// 返回
this.send(channel,
OutputTypeEnum.SFTP_DOWNLOAD_FLAT_DIRECTORY,
SftpDownloadFlatDirectoryResponse.builder()
.sessionId(sessionId)
.currentPath(payload.getCurrentPath())
.body(JSON.toJSONString(files))
.result(BooleanBit.of(ex == null).getValue())
.msg(this.getErrorMessage(ex))
.build());
}
}

View File

@@ -1,84 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.handler.host.terminal.handler;
import cn.orionsec.kit.lang.id.UUIds;
import lombok.extern.slf4j.Slf4j;
import org.dromara.visor.common.enums.BooleanBit;
import org.dromara.visor.framework.redis.core.utils.RedisStrings;
import org.dromara.visor.module.asset.define.cache.TerminalCacheKeyDefine;
import org.dromara.visor.module.asset.entity.dto.SftpGetContentCacheDTO;
import org.dromara.visor.module.asset.handler.host.terminal.enums.OutputTypeEnum;
import org.dromara.visor.module.asset.handler.host.terminal.model.request.SftpBaseRequest;
import org.dromara.visor.module.asset.handler.host.terminal.model.response.SftpGetContentResponse;
import org.dromara.visor.module.asset.handler.host.terminal.session.ISftpSession;
import org.springframework.stereotype.Component;
import org.springframework.web.socket.WebSocketSession;
/**
* sftp 获取文件内容
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/2/19 11:13
*/
@Slf4j
@Component
public class SftpGetContentHandler extends AbstractTerminalHandler<SftpBaseRequest> {
@Override
public void handle(WebSocketSession channel, SftpBaseRequest payload) {
// 获取会话
String sessionId = payload.getSessionId();
ISftpSession session = terminalManager.getSession(channel.getId(), sessionId);
String path = payload.getPath();
log.info("SftpGetContentHandler-handle start sessionId: {}, path: {}", sessionId, path);
String token = UUIds.random32();
Exception ex = null;
try {
// 检查文件是否可编辑
session.checkCanEdit(path);
// 设置缓存
String key = TerminalCacheKeyDefine.TERMINAL_SFTP_GET_CONTENT.format(token);
SftpGetContentCacheDTO cache = SftpGetContentCacheDTO.builder()
.hostId(session.getConfig().getHostId())
.path(path)
.build();
RedisStrings.setJson(key, TerminalCacheKeyDefine.TERMINAL_SFTP_GET_CONTENT, cache);
log.info("SftpGetContentHandler-handle success sessionId: {}, path: {}", sessionId, path);
} catch (Exception e) {
log.error("SftpGetContentHandler-handle error sessionId: {}", sessionId, e);
ex = e;
}
// 返回
this.send(channel,
OutputTypeEnum.SFTP_GET_CONTENT,
SftpGetContentResponse.builder()
.sessionId(sessionId)
.result(BooleanBit.of(ex == null).getValue())
.token(token)
.msg(this.getErrorMessage(ex))
.build());
}
}

View File

@@ -1,84 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.handler.host.terminal.handler;
import cn.orionsec.kit.lang.utils.collect.Lists;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.dromara.visor.common.enums.BooleanBit;
import org.dromara.visor.module.asset.handler.host.terminal.enums.OutputTypeEnum;
import org.dromara.visor.module.asset.handler.host.terminal.model.request.SftpListRequest;
import org.dromara.visor.module.asset.handler.host.terminal.model.response.SftpFileVO;
import org.dromara.visor.module.asset.handler.host.terminal.model.response.SftpListResponse;
import org.dromara.visor.module.asset.handler.host.terminal.session.ISftpSession;
import org.springframework.stereotype.Component;
import org.springframework.web.socket.WebSocketSession;
import java.util.List;
/**
* sftp 文件列表
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/12/29 15:32
*/
@Slf4j
@Component
public class SftpListHandler extends AbstractTerminalHandler<SftpListRequest> {
private static final String HOME_PATH = "~";
@Override
public void handle(WebSocketSession channel, SftpListRequest payload) {
// 获取会话
String sessionId = payload.getSessionId();
ISftpSession session = terminalManager.getSession(channel.getId(), sessionId);
String path = payload.getPath();
log.info("SftpListHandler-handle start sessionId: {}, path: {}", sessionId, path);
Exception ex = null;
List<SftpFileVO> list = Lists.empty();
try {
// 空目录则直接获取 home 目录
if (HOME_PATH.equals(path)) {
path = session.getHome();
}
// 文件列表
list = session.list(path, BooleanBit.toBoolean(payload.getShowHiddenFile()));
log.info("SftpListHandler-handle success sessionId: {}, path: {}", sessionId, path);
} catch (Exception e) {
log.error("SftpListHandler-handle error sessionId: {}", sessionId, e);
ex = e;
}
// 返回
this.send(channel,
OutputTypeEnum.SFTP_LIST,
SftpListResponse.builder()
.sessionId(sessionId)
.result(BooleanBit.of(ex == null).getValue())
.path(path)
.body(JSON.toJSONString(list))
.build());
}
}

View File

@@ -1,83 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.handler.host.terminal.handler;
import cn.orionsec.kit.lang.utils.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import org.dromara.visor.common.enums.BooleanBit;
import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogs;
import org.dromara.visor.module.asset.define.operator.TerminalOperatorType;
import org.dromara.visor.module.asset.handler.host.terminal.enums.OutputTypeEnum;
import org.dromara.visor.module.asset.handler.host.terminal.model.request.SftpBaseRequest;
import org.dromara.visor.module.asset.handler.host.terminal.model.response.SftpBaseResponse;
import org.dromara.visor.module.asset.handler.host.terminal.session.ISftpSession;
import org.springframework.stereotype.Component;
import org.springframework.web.socket.WebSocketSession;
import java.util.Map;
/**
* sftp 创建文件夹
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/2/19 11:13
*/
@Slf4j
@Component
public class SftpMakeDirectoryHandler extends AbstractTerminalHandler<SftpBaseRequest> {
@Override
public void handle(WebSocketSession channel, SftpBaseRequest payload) {
long startTime = System.currentTimeMillis();
// 获取会话
String sessionId = payload.getSessionId();
ISftpSession session = terminalManager.getSession(channel.getId(), sessionId);
String path = payload.getPath();
log.info("SftpMakeDirectoryHandler-handle start sessionId: {}, path: {}", sessionId, path);
Exception ex = null;
// 创建文件夹
try {
session.mkdir(path);
log.info("SftpMakeDirectoryHandler-handle success sessionId: {}, path: {}", sessionId, path);
} catch (Exception e) {
log.error("SftpMakeDirectoryHandler-handle error sessionId: {}", sessionId, e);
ex = e;
}
// 返回
this.send(channel,
OutputTypeEnum.SFTP_MKDIR,
SftpBaseResponse.builder()
.sessionId(sessionId)
.result(BooleanBit.of(ex == null).getValue())
.msg(this.getErrorMessage(ex))
.build());
// 保存操作日志
Map<String, Object> extra = Maps.newMap();
extra.put(OperatorLogs.PATH, path);
this.saveOperatorLog(payload, channel,
extra, TerminalOperatorType.SFTP_MKDIR,
startTime, ex);
}
}

View File

@@ -1,85 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.handler.host.terminal.handler;
import cn.orionsec.kit.lang.utils.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import org.dromara.visor.common.enums.BooleanBit;
import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogs;
import org.dromara.visor.module.asset.define.operator.TerminalOperatorType;
import org.dromara.visor.module.asset.handler.host.terminal.enums.OutputTypeEnum;
import org.dromara.visor.module.asset.handler.host.terminal.model.request.SftpMoveRequest;
import org.dromara.visor.module.asset.handler.host.terminal.model.response.SftpBaseResponse;
import org.dromara.visor.module.asset.handler.host.terminal.session.ISftpSession;
import org.springframework.stereotype.Component;
import org.springframework.web.socket.WebSocketSession;
import java.util.Map;
/**
* sftp 移动文件
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/2/19 11:13
*/
@Slf4j
@Component
public class SftpMoveHandler extends AbstractTerminalHandler<SftpMoveRequest> {
@Override
public void handle(WebSocketSession channel, SftpMoveRequest payload) {
long startTime = System.currentTimeMillis();
// 获取会话
String sessionId = payload.getSessionId();
ISftpSession session = terminalManager.getSession(channel.getId(), sessionId);
String path = payload.getPath();
String target = payload.getTarget();
log.info("SftpMoveHandler-handle start sessionId: {}, path: {}, target: {}", sessionId, path, target);
Exception ex = null;
// 移动
try {
session.move(path, target);
log.info("SftpMoveHandler-handle success sessionId: {}, path: {}, target: {}", sessionId, path, target);
} catch (Exception e) {
log.error("SftpMoveHandler-handle error sessionId: {}", sessionId, e);
ex = e;
}
// 返回
this.send(channel,
OutputTypeEnum.SFTP_MOVE,
SftpBaseResponse.builder()
.sessionId(sessionId)
.result(BooleanBit.of(ex == null).getValue())
.msg(this.getErrorMessage(ex))
.build());
// 保存操作日志
Map<String, Object> extra = Maps.newMap();
extra.put(OperatorLogs.PATH, path);
extra.put(OperatorLogs.TARGET, target);
this.saveOperatorLog(payload, channel,
extra, TerminalOperatorType.SFTP_MOVE,
startTime, ex);
}
}

View File

@@ -1,85 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.handler.host.terminal.handler;
import cn.orionsec.kit.lang.utils.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import org.dromara.visor.common.enums.BooleanBit;
import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogs;
import org.dromara.visor.module.asset.define.operator.TerminalOperatorType;
import org.dromara.visor.module.asset.handler.host.terminal.enums.OutputTypeEnum;
import org.dromara.visor.module.asset.handler.host.terminal.model.request.SftpBaseRequest;
import org.dromara.visor.module.asset.handler.host.terminal.model.response.SftpBaseResponse;
import org.dromara.visor.module.asset.handler.host.terminal.session.ISftpSession;
import org.springframework.stereotype.Component;
import org.springframework.web.socket.WebSocketSession;
import java.util.Arrays;
import java.util.Map;
/**
* sftp 删除文件
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/2/19 11:13
*/
@Slf4j
@Component
public class SftpRemoveHandler extends AbstractTerminalHandler<SftpBaseRequest> {
@Override
public void handle(WebSocketSession channel, SftpBaseRequest payload) {
long startTime = System.currentTimeMillis();
String path = payload.getPath();
String sessionId = payload.getSessionId();
// 获取会话
ISftpSession session = terminalManager.getSession(channel.getId(), sessionId);
String[] paths = path.split("\\|");
log.info("SftpRemoveHandler-handle start sessionId: {}, path: {}", sessionId, Arrays.toString(paths));
Exception ex = null;
// 删除
try {
session.remove(paths);
log.info("SftpRemoveHandler-handle success sessionId: {}, path: {}", sessionId, Arrays.toString(paths));
} catch (Exception e) {
log.error("SftpRemoveHandler-handle error sessionId: {}", sessionId, e);
ex = e;
}
// 返回
this.send(channel,
OutputTypeEnum.SFTP_REMOVE,
SftpBaseResponse.builder()
.sessionId(sessionId)
.result(BooleanBit.of(ex == null).getValue())
.msg(this.getErrorMessage(ex))
.build());
// 保存操作日志
Map<String, Object> extra = Maps.newMap();
extra.put(OperatorLogs.PATH, path);
this.saveOperatorLog(payload, channel,
extra, TerminalOperatorType.SFTP_REMOVE,
startTime, ex);
}
}

View File

@@ -1,96 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.handler.host.terminal.handler;
import cn.orionsec.kit.lang.id.UUIds;
import cn.orionsec.kit.lang.utils.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import org.dromara.visor.common.enums.BooleanBit;
import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogs;
import org.dromara.visor.framework.redis.core.utils.RedisStrings;
import org.dromara.visor.module.asset.define.cache.TerminalCacheKeyDefine;
import org.dromara.visor.module.asset.define.operator.TerminalOperatorType;
import org.dromara.visor.module.asset.entity.dto.SftpSetContentCacheDTO;
import org.dromara.visor.module.asset.handler.host.terminal.enums.OutputTypeEnum;
import org.dromara.visor.module.asset.handler.host.terminal.model.request.SftpBaseRequest;
import org.dromara.visor.module.asset.handler.host.terminal.model.response.SftpSetContentResponse;
import org.dromara.visor.module.asset.handler.host.terminal.session.ISftpSession;
import org.springframework.stereotype.Component;
import org.springframework.web.socket.WebSocketSession;
import java.util.Map;
/**
* sftp 设置文件内容
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/2/19 11:13
*/
@Slf4j
@Component
public class SftpSetContentHandler extends AbstractTerminalHandler<SftpBaseRequest> {
@Override
public void handle(WebSocketSession channel, SftpBaseRequest payload) {
long startTime = System.currentTimeMillis();
// 获取会话
String sessionId = payload.getSessionId();
ISftpSession session = terminalManager.getSession(channel.getId(), sessionId);
String path = payload.getPath();
log.info("SftpSetContentHandler-handle start sessionId: {}, path: {}", sessionId, path);
String token = UUIds.random32();
Exception ex = null;
try {
// 检查文件是否可编辑
session.checkCanEdit(path);
// 设置缓存
String key = TerminalCacheKeyDefine.TERMINAL_SFTP_SET_CONTENT.format(token);
SftpSetContentCacheDTO cache = SftpSetContentCacheDTO.builder()
.hostId(session.getConfig().getHostId())
.path(path)
.build();
RedisStrings.setJson(key, TerminalCacheKeyDefine.TERMINAL_SFTP_SET_CONTENT, cache);
log.info("SftpSetContentHandler-handle success sessionId: {}, path: {}", sessionId, path);
} catch (Exception e) {
log.error("SftpSetContentHandler-handle error sessionId: {}", sessionId, e);
ex = e;
}
// 返回
this.send(channel,
OutputTypeEnum.SFTP_SET_CONTENT,
SftpSetContentResponse.builder()
.sessionId(sessionId)
.result(BooleanBit.of(ex == null).getValue())
.token(token)
.msg(this.getErrorMessage(ex))
.build());
// 保存操作日志
Map<String, Object> extra = Maps.newMap();
extra.put(OperatorLogs.PATH, path);
this.saveOperatorLog(payload, channel,
extra, TerminalOperatorType.SFTP_SET_CONTENT,
startTime, ex);
}
}

View File

@@ -1,83 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.handler.host.terminal.handler;
import cn.orionsec.kit.lang.utils.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import org.dromara.visor.common.enums.BooleanBit;
import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogs;
import org.dromara.visor.module.asset.define.operator.TerminalOperatorType;
import org.dromara.visor.module.asset.handler.host.terminal.enums.OutputTypeEnum;
import org.dromara.visor.module.asset.handler.host.terminal.model.request.SftpBaseRequest;
import org.dromara.visor.module.asset.handler.host.terminal.model.response.SftpBaseResponse;
import org.dromara.visor.module.asset.handler.host.terminal.session.ISftpSession;
import org.springframework.stereotype.Component;
import org.springframework.web.socket.WebSocketSession;
import java.util.Map;
/**
* sftp 创建文件
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/2/19 11:13
*/
@Slf4j
@Component
public class SftpTouchHandler extends AbstractTerminalHandler<SftpBaseRequest> {
@Override
public void handle(WebSocketSession channel, SftpBaseRequest payload) {
long startTime = System.currentTimeMillis();
// 获取会话
String sessionId = payload.getSessionId();
ISftpSession session = terminalManager.getSession(channel.getId(), sessionId);
String path = payload.getPath();
log.info("SftpTouchHandler-handle start sessionId: {}, path: {}", sessionId, path);
Exception ex = null;
// 创建文件
try {
session.touch(path);
log.info("SftpTouchHandler-handle success sessionId: {}, path: {}", sessionId, path);
} catch (Exception e) {
log.error("SftpTouchHandler-handle error sessionId: {}", sessionId, e);
ex = e;
}
// 返回
this.send(channel,
OutputTypeEnum.SFTP_TOUCH,
SftpBaseResponse.builder()
.sessionId(sessionId)
.result(BooleanBit.of(ex == null).getValue())
.msg(this.getErrorMessage(ex))
.build());
// 保存操作日志
Map<String, Object> extra = Maps.newMap();
extra.put(OperatorLogs.PATH, path);
this.saveOperatorLog(payload, channel,
extra, TerminalOperatorType.SFTP_TOUCH,
startTime, ex);
}
}

View File

@@ -1,83 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.handler.host.terminal.handler;
import cn.orionsec.kit.lang.utils.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import org.dromara.visor.common.enums.BooleanBit;
import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogs;
import org.dromara.visor.module.asset.define.operator.TerminalOperatorType;
import org.dromara.visor.module.asset.handler.host.terminal.enums.OutputTypeEnum;
import org.dromara.visor.module.asset.handler.host.terminal.model.request.SftpBaseRequest;
import org.dromara.visor.module.asset.handler.host.terminal.model.response.SftpBaseResponse;
import org.dromara.visor.module.asset.handler.host.terminal.session.ISftpSession;
import org.springframework.stereotype.Component;
import org.springframework.web.socket.WebSocketSession;
import java.util.Map;
/**
* sftp 截断文件
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/2/19 11:13
*/
@Slf4j
@Component
public class SftpTruncateHandler extends AbstractTerminalHandler<SftpBaseRequest> {
@Override
public void handle(WebSocketSession channel, SftpBaseRequest payload) {
long startTime = System.currentTimeMillis();
// 获取会话
String sessionId = payload.getSessionId();
ISftpSession session = terminalManager.getSession(channel.getId(), sessionId);
String path = payload.getPath();
log.info("SftpTruncateHandler-handle start sessionId: {}, path: {}", sessionId, path);
Exception ex = null;
// 截断文件
try {
session.truncate(path);
log.info("SftpTruncateHandler-handle success sessionId: {}, path: {}", sessionId, path);
} catch (Exception e) {
log.error("SftpTruncateHandler-handle error sessionId: {}", sessionId, e);
ex = e;
}
// 返回
this.send(channel,
OutputTypeEnum.SFTP_TRUNCATE,
SftpBaseResponse.builder()
.sessionId(sessionId)
.result(BooleanBit.of(ex == null).getValue())
.msg(this.getErrorMessage(ex))
.build());
// 保存操作日志
Map<String, Object> extra = Maps.newMap();
extra.put(OperatorLogs.PATH, path);
this.saveOperatorLog(payload, channel,
extra, TerminalOperatorType.SFTP_TRUNCATE,
startTime, ex);
}
}

View File

@@ -1,50 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.handler.host.terminal.handler;
import lombok.extern.slf4j.Slf4j;
import org.dromara.visor.module.asset.handler.host.terminal.model.request.SshInputRequest;
import org.dromara.visor.module.asset.handler.host.terminal.session.ISshSession;
import org.springframework.stereotype.Component;
import org.springframework.web.socket.WebSocketSession;
/**
* ssh 处理输入处理器
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/12/29 15:32
*/
@Slf4j
@Component
public class SshInputHandler extends AbstractTerminalHandler<SshInputRequest> {
@Override
public void handle(WebSocketSession channel, SshInputRequest payload) {
// 获取会话
ISshSession session = terminalManager.getSession(channel.getId(), payload.getSessionId());
// 处理输入
session.write(payload.getCommand());
}
}

View File

@@ -1,50 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.handler.host.terminal.handler;
import lombok.extern.slf4j.Slf4j;
import org.dromara.visor.module.asset.handler.host.terminal.model.request.SshResizeRequest;
import org.dromara.visor.module.asset.handler.host.terminal.session.ISshSession;
import org.springframework.stereotype.Component;
import org.springframework.web.socket.WebSocketSession;
/**
* ssh 修改大小处理器
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/12/29 15:32
*/
@Slf4j
@Component
public class SshResizeHandler extends AbstractTerminalHandler<SshResizeRequest> {
@Override
public void handle(WebSocketSession channel, SshResizeRequest payload) {
// 获取会话
ISshSession session = terminalManager.getSession(channel.getId(), payload.getSessionId());
// 修改大小
session.resize(payload.getCols(), payload.getRows());
}
}

View File

@@ -1,48 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.handler.host.terminal.handler;
import lombok.extern.slf4j.Slf4j;
import org.dromara.visor.module.asset.handler.host.terminal.model.TerminalBasePayload;
import org.springframework.stereotype.Component;
import org.springframework.web.socket.WebSocketSession;
/**
* 关闭处理器
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/12/29 15:32
*/
@Slf4j
@Component
public class TerminalCloseHandler extends AbstractTerminalHandler<TerminalBasePayload> {
@Override
public void handle(WebSocketSession channel, TerminalBasePayload payload) {
log.info("TerminalCloseHandler-handle start sessionId: {}", payload.getSessionId());
// 关闭会话
terminalManager.closeSession(channel.getId(), payload.getSessionId());
}
}

View File

@@ -1,59 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.handler.host.terminal.handler;
import cn.orionsec.kit.lang.utils.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import org.dromara.visor.module.asset.handler.host.terminal.enums.OutputTypeEnum;
import org.dromara.visor.module.asset.handler.host.terminal.model.TerminalBasePayload;
import org.dromara.visor.module.asset.handler.host.terminal.session.ITerminalSession;
import org.springframework.stereotype.Component;
import org.springframework.web.socket.WebSocketSession;
import java.util.Map;
/**
* ping 处理器
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/12/29 15:32
*/
@Slf4j
@Component
public class TerminalPingHandler extends AbstractTerminalHandler<TerminalBasePayload> {
@Override
public void handle(WebSocketSession channel, TerminalBasePayload payload) {
// 发送 pong
this.send(channel, OutputTypeEnum.PONG.getType());
// 活跃 terminal
Map<String, ITerminalSession> sessions = terminalManager.getSession(channel.getId());
if (!Maps.isEmpty(sessions)) {
for (ITerminalSession session : sessions.values()) {
session.keepAlive();
}
}
}
}

View File

@@ -1,53 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.handler.host.terminal.model;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* 终端基础 payload
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/1/3 21:51
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
public class TerminalBasePayload {
/**
* 会话id
*/
private String sessionId;
/**
* 消息类型
*/
private String type;
}

View File

@@ -1,93 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.handler.host.terminal.model;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 终端连接参数
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/1/3 23:30
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class TerminalConfig {
/**
* logId
*/
private Long logId;
/**
* 主机id
*/
private Long hostId;
/**
* 主机名称
*/
private String hostName;
/**
* 主机地址
*/
private String address;
/**
* cols
*/
private Integer cols;
/**
* rows
*/
private Integer rows;
/**
* SSH输出编码
*/
private String charset;
/**
* 文件名称编码
*/
private String fileNameCharset;
/**
* 文件内容编码
*/
private String fileContentCharset;
/**
* 文件预览大小
*/
private Integer filePreviewSize;
}

View File

@@ -1,51 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.handler.host.terminal.model.request;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.dromara.visor.module.asset.handler.host.terminal.model.TerminalBasePayload;
/**
* sftp 基础请求 实体对象
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/2/19 17:46
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class SftpBaseRequest extends TerminalBasePayload {
/**
* path
*/
private String path;
}

View File

@@ -1,52 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.handler.host.terminal.model.request;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* sftp 修改文件权限 实体对象
* <p>
* i|eff00a1|path|mod
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/2/6 13:31
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class SftpChangeModeRequest extends SftpBaseRequest {
/**
* 10进制的8进制 权限
*/
private Integer mod;
}

View File

@@ -1,52 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.handler.host.terminal.model.request;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* sftp 下载文件夹展开文件 实体对象
* <p>
* i|eff00a1|currentPath|path
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/2/6 13:31
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class SftpDownloadFlatDirectoryRequest extends SftpBaseRequest {
/**
* 当前路径
*/
private String currentPath;
}

View File

@@ -1,52 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.handler.host.terminal.model.request;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* sftp 列表请求 实体对象
* <p>
* i|eff00a1|path
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/2/6 13:31
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class SftpListRequest extends SftpBaseRequest {
/**
* 是否显示隐藏文件
*/
private Integer showHiddenFile;
}

View File

@@ -1,52 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.handler.host.terminal.model.request;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* sftp 移动文件 实体对象
* <p>
* i|eff00a1|path|target
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/2/6 13:31
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class SftpMoveRequest extends SftpBaseRequest {
/**
* target
*/
private String target;
}

View File

@@ -1,53 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.handler.host.terminal.model.request;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.dromara.visor.module.asset.handler.host.terminal.model.TerminalBasePayload;
/**
* ssh 输入请求 实体对象
* <p>
* i|eff00a1|command
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/12/29 16:20
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class SshInputRequest extends TerminalBasePayload {
/**
* command
*/
private String command;
}

View File

@@ -1,58 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.handler.host.terminal.model.request;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.dromara.visor.module.asset.handler.host.terminal.model.TerminalBasePayload;
/**
* ssh 修改大小请求 实体对象
* <p>
* rs|eff00a1|100|20
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/12/29 16:20
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class SshResizeRequest extends TerminalBasePayload {
/**
* 列数
*/
private Integer cols;
/**
* 行数
*/
private Integer rows;
}

View File

@@ -1,58 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.handler.host.terminal.model.request;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.dromara.visor.module.asset.handler.host.terminal.model.TerminalBasePayload;
/**
* 终端连接检查请求 实体对象
* <p>
* ck|eff00a1|1
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/12/29 16:20
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class TerminalCheckRequest extends TerminalBasePayload {
/**
* 主机id
*/
private Long hostId;
/**
* 连接类型
*/
private String connectType;
}

View File

@@ -1,63 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.handler.host.terminal.model.request;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.dromara.visor.module.asset.handler.host.terminal.model.TerminalBasePayload;
/**
* 终端连接请求 实体对象
* <p>
* co|eff00a1|100|20
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/12/29 16:20
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class TerminalConnectRequest extends TerminalBasePayload {
/**
* 伪终端类型
*/
private String terminalType;
/**
* 列数
*/
private Integer cols;
/**
* 行数
*/
private Integer rows;
}

View File

@@ -1,56 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.handler.host.terminal.model.response;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.dromara.visor.module.asset.handler.host.terminal.model.TerminalBasePayload;
/**
* sftp 基础响应 实体对象
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/2/19 17:46
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class SftpBaseResponse extends TerminalBasePayload {
/**
* 结果
*/
private Integer result;
/**
* 消息
*/
private String msg;
}

View File

@@ -1,55 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.handler.host.terminal.model.response;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* sftp 下载文件夹展开文件 实体对象
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/2/6 16:20
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class SftpDownloadFlatDirectoryResponse extends SftpBaseResponse {
/**
* currentPath
*/
private String currentPath;
/**
* body
*/
private String body;
}

View File

@@ -1,100 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.handler.host.terminal.model.response;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.util.Date;
/**
* sftp 文件响应 实体对象
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/2/6 13:57
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
public class SftpFileVO {
/**
* 名称
*/
private String name;
/**
* 绝对路径
*/
private String path;
/**
* 文件后缀
*/
private String suffix;
/**
* 文件大小(byte)
*/
private Long size;
/**
* 属性
*/
private String attr;
/**
* 是否为目录
*/
private Boolean isDir;
/**
* 10进制表现的8进制权限
*/
private Integer permission;
/**
* 用户id
*/
private Integer uid;
/**
* 组id
*/
private Integer gid;
/**
* 更新时间
*/
private Date modifyTime;
/**
* 是否可预览
*/
private Boolean canPreview;
}

View File

@@ -1,50 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.handler.host.terminal.model.response;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* sftp 获取内容响应 实体对象
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/2/6 16:20
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class SftpGetContentResponse extends SftpBaseResponse {
/**
* content
*/
private String token;
}

View File

@@ -1,55 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.handler.host.terminal.model.response;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* sftp 列表响应 实体对象
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/2/6 16:20
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class SftpListResponse extends SftpBaseResponse {
/**
* path
*/
private String path;
/**
* body
*/
private String body;
}

View File

@@ -1,50 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.handler.host.terminal.model.response;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* sftp 设置内容响应
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/2/6 16:20
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class SftpSetContentResponse extends SftpBaseResponse {
/**
* content
*/
private String token;
}

View File

@@ -1,51 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.handler.host.terminal.model.response;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.dromara.visor.module.asset.handler.host.terminal.model.TerminalBasePayload;
/**
* ssh 输出响应 实体对象
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/12/29 16:20
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class SshOutputResponse extends TerminalBasePayload {
/**
* body
*/
private String body;
}

View File

@@ -1,56 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.asset.handler.host.terminal.model.response;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.dromara.visor.module.asset.handler.host.terminal.model.TerminalBasePayload;
/**
* 终端连接检查响应 实体对象
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/12/29 16:20
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class TerminalCheckResponse extends TerminalBasePayload {
/**
* 检查结果
*/
private Integer result;
/**
* 错误信息
*/
private String msg;
}

Some files were not shown because too many files have changed in this diff Show More