mirror of
https://github.com/ReaJason/MemShellParty.git
synced 2026-09-21 22:50:42 +08:00
feat: support custom command implementation
This commit is contained in:
+1
-1
@@ -48,7 +48,7 @@ dependencies {
|
||||
implementation('org.springframework.boot:spring-boot-starter-web') {
|
||||
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat'
|
||||
}
|
||||
implementation 'org.apache.commons:commons-lang3:3.+'
|
||||
implementation 'org.apache.commons:commons-lang3:3.17.0'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-undertow'
|
||||
compileOnly 'org.projectlombok:lombok'
|
||||
developmentOnly 'org.springframework.boot:spring-boot-devtools'
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.reajason.javaweb.boot.controller;
|
||||
|
||||
import com.reajason.javaweb.boot.vo.CommandConfigVO;
|
||||
import com.reajason.javaweb.memshell.Packers;
|
||||
import com.reajason.javaweb.memshell.Server;
|
||||
import com.reajason.javaweb.memshell.ShellTool;
|
||||
@@ -61,8 +62,11 @@ public class ConfigController {
|
||||
return coreMap;
|
||||
}
|
||||
|
||||
@GetMapping("/command/encryptors")
|
||||
public List<CommandConfig.Encryptor> getCommandEncryptors() {
|
||||
return Arrays.stream(CommandConfig.Encryptor.values()).toList();
|
||||
@GetMapping("/command/configs")
|
||||
public CommandConfigVO getCommandConfigs() {
|
||||
CommandConfigVO commandConfigVO = new CommandConfigVO();
|
||||
commandConfigVO.setEncryptors(Arrays.stream(CommandConfig.Encryptor.values()).toList());
|
||||
commandConfigVO.setImplementationClasses(Arrays.stream(CommandConfig.ImplementationClass.values()).toList());
|
||||
return commandConfigVO;
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,7 @@ public class GenerateRequest {
|
||||
private String headerValue;
|
||||
private String shellClassBase64;
|
||||
private String encryptor;
|
||||
private String implementationClass;
|
||||
}
|
||||
|
||||
public ShellToolConfig parseShellToolConfig() {
|
||||
@@ -50,6 +51,7 @@ public class GenerateRequest {
|
||||
.shellClassName(shellToolConfig.getShellClassName())
|
||||
.paramName(StringUtils.defaultIfBlank(shellToolConfig.getCommandParamName(), CommonUtil.getRandomString(8)))
|
||||
.encryptor(CommandConfig.Encryptor.fromString(shellToolConfig.getEncryptor()))
|
||||
.implementationClass(CommandConfig.ImplementationClass.fromString(shellToolConfig.getImplementationClass()))
|
||||
.build();
|
||||
case Suo5 -> Suo5Config.builder()
|
||||
.shellClassName(shellToolConfig.getShellClassName())
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.reajason.javaweb.boot.vo;
|
||||
|
||||
import com.reajason.javaweb.memshell.config.CommandConfig;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author ReaJason
|
||||
* @since 2025/5/25
|
||||
*/
|
||||
@Data
|
||||
public class CommandConfigVO {
|
||||
private List<CommandConfig.Encryptor> encryptors;
|
||||
private List<CommandConfig.ImplementationClass> implementationClasses;
|
||||
}
|
||||
Reference in New Issue
Block a user