🎨 优化项目模块.

This commit is contained in:
lijiahang
2025-01-08 10:52:36 +08:00
parent 4119dbad6a
commit 35733e80eb
45 changed files with 377 additions and 99 deletions

View File

@@ -40,7 +40,7 @@ import com.alibaba.fastjson.JSON;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.dromara.visor.common.constant.ErrorMessage;
import org.dromara.visor.common.file.FileClient;
import org.dromara.visor.common.interfaces.FileClient;
import org.dromara.visor.common.utils.PathUtils;
import org.dromara.visor.module.asset.dao.ExecHostLogDAO;
import org.dromara.visor.module.asset.entity.domain.ExecHostLogDO;

View File

@@ -25,7 +25,7 @@ package org.dromara.visor.module.asset.handler.host.exec.log;
import cn.orionsec.kit.lang.annotation.Keep;
import lombok.extern.slf4j.Slf4j;
import org.dromara.visor.common.constant.ExtraFieldConst;
import org.dromara.visor.common.file.FileClient;
import org.dromara.visor.common.interfaces.FileClient;
import org.dromara.visor.framework.websocket.core.utils.WebSockets;
import org.dromara.visor.module.asset.define.AssetThreadPools;
import org.dromara.visor.module.asset.entity.dto.ExecHostLogTailDTO;

View File

@@ -32,7 +32,7 @@ import cn.orionsec.kit.net.host.SessionStore;
import lombok.extern.slf4j.Slf4j;
import org.dromara.visor.common.constant.AppConst;
import org.dromara.visor.common.constant.Const;
import org.dromara.visor.common.utils.CryptoUtils;
import org.dromara.visor.common.utils.AesEncryptUtils;
import org.dromara.visor.module.asset.entity.dto.TerminalConnectDTO;
import java.util.Optional;
@@ -94,13 +94,13 @@ public class SessionStores {
if (useKey) {
// 加载密钥
String publicKey = Optional.ofNullable(conn.getPublicKey())
.map(CryptoUtils::decryptAsString)
.map(AesEncryptUtils::decryptAsString)
.orElse(null);
String privateKey = Optional.ofNullable(conn.getPrivateKey())
.map(CryptoUtils::decryptAsString)
.map(AesEncryptUtils::decryptAsString)
.orElse(null);
String password = Optional.ofNullable(conn.getPrivateKeyPassword())
.map(CryptoUtils::decryptAsString)
.map(AesEncryptUtils::decryptAsString)
.orElse(null);
sessionHolder.addIdentityValue(String.valueOf(conn.getKeyId()),
privateKey,
@@ -113,7 +113,7 @@ public class SessionStores {
if (!useKey) {
String password = conn.getPassword();
if (!Strings.isEmpty(password)) {
session.password(CryptoUtils.decryptAsString(password));
session.password(AesEncryptUtils.decryptAsString(password));
}
}
// 超时时间

View File

@@ -35,7 +35,7 @@ import org.dromara.visor.common.constant.Const;
import org.dromara.visor.common.constant.ErrorMessage;
import org.dromara.visor.common.constant.ExtraFieldConst;
import org.dromara.visor.common.enums.EndpointDefine;
import org.dromara.visor.common.file.FileClient;
import org.dromara.visor.common.interfaces.FileClient;
import org.dromara.visor.common.utils.PathUtils;
import org.dromara.visor.module.asset.dao.UploadTaskFileDAO;
import org.dromara.visor.module.asset.define.config.AppSftpConfig;

View File

@@ -25,7 +25,7 @@ package org.dromara.visor.module.asset.interceptor;
import cn.orionsec.kit.lang.utils.Urls;
import lombok.extern.slf4j.Slf4j;
import org.dromara.visor.common.constant.ExtraFieldConst;
import org.dromara.visor.common.meta.TraceIdHolder;
import org.dromara.visor.common.trace.TraceIdHolder;
import org.dromara.visor.common.utils.Requests;
import org.dromara.visor.module.asset.entity.dto.TerminalAccessDTO;
import org.dromara.visor.module.asset.service.TerminalService;

View File

@@ -25,7 +25,7 @@ package org.dromara.visor.module.asset.interceptor;
import cn.orionsec.kit.lang.utils.Urls;
import lombok.extern.slf4j.Slf4j;
import org.dromara.visor.common.constant.ExtraFieldConst;
import org.dromara.visor.common.meta.TraceIdHolder;
import org.dromara.visor.common.trace.TraceIdHolder;
import org.dromara.visor.common.utils.Requests;
import org.dromara.visor.module.asset.entity.dto.TerminalTransferDTO;
import org.dromara.visor.module.asset.service.TerminalService;

View File

@@ -39,7 +39,7 @@ import org.dromara.visor.common.constant.Const;
import org.dromara.visor.common.constant.ErrorMessage;
import org.dromara.visor.common.constant.FileConst;
import org.dromara.visor.common.enums.EndpointDefine;
import org.dromara.visor.common.file.FileClient;
import org.dromara.visor.common.interfaces.FileClient;
import org.dromara.visor.common.security.LoginUser;
import org.dromara.visor.common.utils.PathUtils;
import org.dromara.visor.common.utils.Valid;

View File

@@ -41,7 +41,7 @@ import org.dromara.visor.common.constant.Const;
import org.dromara.visor.common.constant.ErrorMessage;
import org.dromara.visor.common.constant.FileConst;
import org.dromara.visor.common.enums.EndpointDefine;
import org.dromara.visor.common.file.FileClient;
import org.dromara.visor.common.interfaces.FileClient;
import org.dromara.visor.common.utils.SqlUtils;
import org.dromara.visor.common.utils.Valid;
import org.dromara.visor.framework.redis.core.utils.RedisStrings;

View File

@@ -34,7 +34,7 @@ import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogs;
import org.dromara.visor.common.constant.Const;
import org.dromara.visor.common.constant.ErrorMessage;
import org.dromara.visor.common.security.PasswordModifier;
import org.dromara.visor.common.utils.CryptoUtils;
import org.dromara.visor.common.utils.AesEncryptUtils;
import org.dromara.visor.common.utils.Valid;
import org.dromara.visor.framework.redis.core.utils.RedisMaps;
import org.dromara.visor.framework.redis.core.utils.RedisUtils;
@@ -104,7 +104,7 @@ public class HostIdentityServiceImpl implements HostIdentityService {
// 加密密码
String password = record.getPassword();
if (!Strings.isBlank(password)) {
record.setPassword(CryptoUtils.encryptAsString(password));
record.setPassword(AesEncryptUtils.encryptAsString(password));
}
// 插入
int effect = hostIdentityDAO.insert(record);

View File

@@ -32,7 +32,7 @@ import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogs;
import org.dromara.visor.common.constant.Const;
import org.dromara.visor.common.constant.ErrorMessage;
import org.dromara.visor.common.security.PasswordModifier;
import org.dromara.visor.common.utils.CryptoUtils;
import org.dromara.visor.common.utils.AesEncryptUtils;
import org.dromara.visor.common.utils.Valid;
import org.dromara.visor.framework.redis.core.utils.RedisMaps;
import org.dromara.visor.framework.redis.core.utils.RedisUtils;
@@ -97,7 +97,7 @@ public class HostKeyServiceImpl implements HostKeyService {
this.encryptKey(record);
String password = record.getPassword();
if (!Strings.isBlank(password)) {
record.setPassword(CryptoUtils.encryptAsString(password));
record.setPassword(AesEncryptUtils.encryptAsString(password));
}
// 插入
int effect = hostKeyDAO.insert(record);
@@ -154,7 +154,7 @@ public class HostKeyServiceImpl implements HostKeyService {
// 解密密码
String password = record.getPassword();
if (!Strings.isBlank(password)) {
record.setPassword(CryptoUtils.decryptAsString(password));
record.setPassword(AesEncryptUtils.decryptAsString(password));
}
return record;
}
@@ -278,11 +278,11 @@ public class HostKeyServiceImpl implements HostKeyService {
private void encryptKey(HostKeyDO record) {
String publicKey = record.getPublicKey();
if (!Strings.isBlank(publicKey)) {
record.setPublicKey(CryptoUtils.encryptAsString(publicKey));
record.setPublicKey(AesEncryptUtils.encryptAsString(publicKey));
}
String privateKey = record.getPrivateKey();
if (!Strings.isBlank(privateKey)) {
record.setPrivateKey(CryptoUtils.encryptAsString(privateKey));
record.setPrivateKey(AesEncryptUtils.encryptAsString(privateKey));
}
}
@@ -294,11 +294,11 @@ public class HostKeyServiceImpl implements HostKeyService {
private void decryptKey(HostKeyDO record) {
String publicKey = record.getPublicKey();
if (!Strings.isBlank(publicKey)) {
record.setPublicKey(CryptoUtils.decryptAsString(publicKey));
record.setPublicKey(AesEncryptUtils.decryptAsString(publicKey));
}
String privateKey = record.getPrivateKey();
if (!Strings.isBlank(privateKey)) {
record.setPrivateKey(CryptoUtils.decryptAsString(privateKey));
record.setPrivateKey(AesEncryptUtils.decryptAsString(privateKey));
}
}

View File

@@ -39,7 +39,7 @@ import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogs;
import org.dromara.visor.common.constant.Const;
import org.dromara.visor.common.constant.ErrorMessage;
import org.dromara.visor.common.enums.EndpointDefine;
import org.dromara.visor.common.file.FileClient;
import org.dromara.visor.common.interfaces.FileClient;
import org.dromara.visor.common.security.LoginUser;
import org.dromara.visor.common.utils.SqlUtils;
import org.dromara.visor.common.utils.Valid;