Commit 97a834df by 钱炳权

RECREATE PROJECT

parent abb34784
...@@ -6,10 +6,7 @@ import com.example.fuzzControll.pojo.vo.AjaxResult; ...@@ -6,10 +6,7 @@ import com.example.fuzzControll.pojo.vo.AjaxResult;
import com.example.fuzzControll.service.SeedFileService; import com.example.fuzzControll.service.SeedFileService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.util.Arrays; import java.util.Arrays;
...@@ -30,36 +27,43 @@ public class SeedFileController { ...@@ -30,36 +27,43 @@ public class SeedFileController {
* 种子文件查询接口 * 种子文件查询接口
*/ */
@RequestMapping(value = "/list", method = RequestMethod.GET) @RequestMapping(value = "/list", method = RequestMethod.GET)
public List<String> list() { public AjaxResult list() {
List<String> files = service.getSeedFiles(); List<String> files = null;
return files ; try {
files = service.getSeedFiles();
} catch (CmdException e) {
log.error(e.getDefaultMessage());
return AjaxResult.error();
}
return AjaxResult.success(files);
} }
// /** /**
// * 种子文件删除接口 * 种子文件删除接口
// */ */
// @RequestMapping(value = "/delete/{fileName}", method = RequestMethod.GET) @RequestMapping(value = "/delete", method = RequestMethod.POST)
// public AjaxResult delete(@PathVariable("fileName") String fileName) { public AjaxResult delete(@RequestParam("fileName") String fileName) {
// try { try {
// service.delFile(fileName); service.delFile(fileName);
// } catch (CmdException e) { } catch (CmdException e) {
// log.error(e.getDefaultMessage()); log.error(e.getDefaultMessage());
// return AjaxResult.error("种子文件删除失败!"); return AjaxResult.error("种子文件删除失败!");
// } }
// return AjaxResult.success("种子文件删除成功!"); return AjaxResult.success("种子文件删除成功!");
// } }
//
// /**
// * seeFileUpload /**
// */ * seeFileUpload
// @RequestMapping(value = "/upload", method = RequestMethod.POST) */
// public AjaxResult upload(MultipartFile file) { @RequestMapping(value = "/upload", method = RequestMethod.POST)
// try { public AjaxResult upload(@RequestParam("file") MultipartFile file) {
// service.upload(file); try {
// } catch (FileException | CmdException e) { service.upload(file);
// log.error(e.getDefaultMessage()); } catch (FileException | CmdException e) {
// return AjaxResult.error("种子文件upload失败!"); log.error(e.getDefaultMessage());
// } return AjaxResult.error("上传文件失败!");
// return AjaxResult.success("种子文件upload成功!"); }
// } return AjaxResult.success("上传文件成功!");
}
} }
...@@ -81,7 +81,7 @@ public class TestClassController { ...@@ -81,7 +81,7 @@ public class TestClassController {
* 漏洞类型 * 漏洞类型
*/ */
@RequestMapping(value = "/vulnerabilityType", method = RequestMethod.POST) @RequestMapping(value = "/vulnerabilityType", method = RequestMethod.POST)
public AjaxResult upload(@RequestBody TestEntity testEntity) { public AjaxResult vulnerability(@RequestBody TestEntity testEntity) {
try { try {
Map<String, List<String>> result = vulnerabilityTypeService.generation(testEntity); Map<String, List<String>> result = vulnerabilityTypeService.generation(testEntity);
return AjaxResult.success(result == null ? "漏洞类型未成功运行!第三方接口可能存在问题。" : result); return AjaxResult.success(result == null ? "漏洞类型未成功运行!第三方接口可能存在问题。" : result);
......
package com.example.fuzzControll.controller; package com.example.fuzzControll.controller;
import com.example.fuzzControll.exception.AflnetException; import com.example.fuzzControll.exception.AflnetException;
import com.example.fuzzControll.exception.CmdException;
import com.example.fuzzControll.pojo.vo.AjaxResult; import com.example.fuzzControll.pojo.vo.AjaxResult;
import com.example.fuzzControll.pojo.vo.CmdStartParams; import com.example.fuzzControll.pojo.vo.CmdStartParams;
import com.example.fuzzControll.service.TestService; import com.example.fuzzControll.service.TestService;
...@@ -12,6 +13,7 @@ import org.springframework.web.bind.annotation.RequestMethod; ...@@ -12,6 +13,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.Arrays; import java.util.Arrays;
import java.util.concurrent.CountDownLatch;
/** /**
* aflnet测试控制 * aflnet测试控制
...@@ -27,20 +29,21 @@ public class TestControler { ...@@ -27,20 +29,21 @@ public class TestControler {
* 测试启动 * 测试启动
*/ */
@RequestMapping(value = "/testStart", method = RequestMethod.POST) @RequestMapping(value = "/testStart", method = RequestMethod.POST)
public AjaxResult list(@RequestBody final CmdStartParams cmdStartParams) { public AjaxResult start(@RequestBody final CmdStartParams cmdStartParams) {
//todo 捕获子线程错误
try { try {
//todo 加个同步锁,执行到特征点就返回数据 Thread alfnet = new Thread(new Runnable() {
new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
service.testStart(cmdStartParams); service.testStart(cmdStartParams);
} }
}).start(); });
} catch (AflnetException e) { alfnet.start();
} catch (AflnetException | CmdException e) {
log.error(e.getDefaultMessage()); log.error(e.getDefaultMessage());
return AjaxResult.error("测试启动失败!"); return AjaxResult.error("测试启动失败!");
} }
return AjaxResult.success("测试启动成功!"); return AjaxResult.success("测试已启动!");
} }
/** /**
......
...@@ -3,6 +3,6 @@ package com.example.fuzzControll.exception; ...@@ -3,6 +3,6 @@ package com.example.fuzzControll.exception;
public class FuzzException extends BaseException{ public class FuzzException extends BaseException{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public FuzzException(String defaultMessage) { public FuzzException(String defaultMessage) {
super(defaultMessage, "fuzz"); super(defaultMessage, "lock");
} }
} }
package com.example.fuzzControll.exception;
public class LockException extends BaseException{
private static final long serialVersionUID = 1L;
public LockException(String defaultMessage) {
super(defaultMessage, "fuzz");
}
}
...@@ -3,12 +3,14 @@ package com.example.fuzzControll.service; ...@@ -3,12 +3,14 @@ package com.example.fuzzControll.service;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.locks.ReentrantLock;
public interface SeedFileService { public interface SeedFileService {
public List<String> getSeedFiles(); public List<String> getSeedFiles();
void delFile(String fileName); void delFile(String fileName);
void upload(MultipartFile file); void upload(MultipartFile file) ;
int getSeedFileCount(String msg); int getSeedFileCount(String msg );
} }
...@@ -2,6 +2,8 @@ package com.example.fuzzControll.service; ...@@ -2,6 +2,8 @@ package com.example.fuzzControll.service;
import com.example.fuzzControll.pojo.vo.CmdStartParams; import com.example.fuzzControll.pojo.vo.CmdStartParams;
import java.util.concurrent.CountDownLatch;
public interface TestService { public interface TestService {
void testStart(CmdStartParams cmdStartParams); void testStart(CmdStartParams cmdStartParams);
......
...@@ -4,16 +4,21 @@ import com.example.fuzzControll.conf.SeedProperties; ...@@ -4,16 +4,21 @@ import com.example.fuzzControll.conf.SeedProperties;
import com.example.fuzzControll.constents.CmdConstent; import com.example.fuzzControll.constents.CmdConstent;
import com.example.fuzzControll.exception.CmdException; import com.example.fuzzControll.exception.CmdException;
import com.example.fuzzControll.exception.FileException; import com.example.fuzzControll.exception.FileException;
import com.example.fuzzControll.exception.LockException;
import com.example.fuzzControll.service.SeedFileService; import com.example.fuzzControll.service.SeedFileService;
import com.example.fuzzControll.tools.CmdTools; import com.example.fuzzControll.tools.CmdTools;
import com.example.fuzzControll.tools.FileTools; import com.example.fuzzControll.tools.FileTools;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.locks.ReentrantLock;
@Slf4j
@Service @Service
public class SeedFileServiceImpl implements SeedFileService { public class SeedFileServiceImpl implements SeedFileService {
CmdTools cmdTools = new CmdTools(); CmdTools cmdTools = new CmdTools();
...@@ -31,9 +36,9 @@ public class SeedFileServiceImpl implements SeedFileService { ...@@ -31,9 +36,9 @@ public class SeedFileServiceImpl implements SeedFileService {
public void delFile(String fileName) throws CmdException { public void delFile(String fileName) throws CmdException {
int fileCountBefore = 0; int fileCountBefore = 0;
int fileCountAfter = 0; int fileCountAfter = 0;
fileCountBefore = getSeedFileCount("delFile before."); fileCountBefore = getSeedFileCount("delFile before.");
cmdTools.runCmd(CmdConstent.DELETE_FILE + properties.getSeedPath() + "/" + fileName, "delFile"); cmdTools.runCmd(CmdConstent.DELETE_FILE + properties.getSeedPath() + "/" + fileName, "delFile");
fileCountAfter = getSeedFileCount("delFile after."); fileCountAfter = getSeedFileCount("delFile after.");
if (fileCountAfter == fileCountBefore) { if (fileCountAfter == fileCountBefore) {
throw new CmdException("Delete unsuccess ! The file has not changed .Attempt to change permissions or there is no filr to be deleted."); throw new CmdException("Delete unsuccess ! The file has not changed .Attempt to change permissions or there is no filr to be deleted.");
} }
...@@ -48,7 +53,7 @@ public class SeedFileServiceImpl implements SeedFileService { ...@@ -48,7 +53,7 @@ public class SeedFileServiceImpl implements SeedFileService {
fileTools.load(file); fileTools.load(file);
fileCountAfter = getSeedFileCount("upload after."); fileCountAfter = getSeedFileCount("upload after.");
if (fileCountAfter == fileCountBefore) { if (fileCountAfter == fileCountBefore) {
throw new FileException("upload file error !The file failed to be submitted.Attempt to change permissions."); throw new FileException("upload file error !The file failed to be submitted.Attempt to change permissions.Or thr file has been committed.");
} }
} }
......
...@@ -12,6 +12,8 @@ import com.example.fuzzControll.tools.TestControlTools; ...@@ -12,6 +12,8 @@ import com.example.fuzzControll.tools.TestControlTools;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.concurrent.CountDownLatch;
@Service("testService") @Service("testService")
@Slf4j @Slf4j
public class TestServiceImpl implements TestService { public class TestServiceImpl implements TestService {
...@@ -21,7 +23,7 @@ public class TestServiceImpl implements TestService { ...@@ -21,7 +23,7 @@ public class TestServiceImpl implements TestService {
//todo 不同服务不同端口 //todo 不同服务不同端口
@Override @Override
public void testStart(CmdStartParams cmdStartParams) throws AflnetException { public void testStart(CmdStartParams cmdStartParams) throws AflnetException,CmdException {
TestControlTools.setIsRunning(true); TestControlTools.setIsRunning(true);
String cmd = cmdTools.parse(cmdStartParams); String cmd = cmdTools.parse(cmdStartParams);
String finalCmd = CmdConstent.RUN_AFLNET + cmd + kittyProperties.getAflnetPath()+"live555/testProgs/testOnDemandRTSPServer 8554"; String finalCmd = CmdConstent.RUN_AFLNET + cmd + kittyProperties.getAflnetPath()+"live555/testProgs/testOnDemandRTSPServer 8554";
......
...@@ -13,6 +13,8 @@ import lombok.extern.slf4j.Slf4j; ...@@ -13,6 +13,8 @@ import lombok.extern.slf4j.Slf4j;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.locks.ReentrantLock;
//todo need modify //todo need modify
...@@ -22,6 +24,7 @@ public class CmdTools { ...@@ -22,6 +24,7 @@ public class CmdTools {
WebSocket socket = (WebSocket) SpringContextUtil.getBean("WebSocket"); WebSocket socket = (WebSocket) SpringContextUtil.getBean("WebSocket");
Boolean show = true; Boolean show = true;
/** /**
* 运行不需要后台运行cmd * 运行不需要后台运行cmd
*/ */
...@@ -39,7 +42,6 @@ public class CmdTools { ...@@ -39,7 +42,6 @@ public class CmdTools {
return result; return result;
} }
//todo 不同协议种子路径也不同 //todo 不同协议种子路径也不同
/** /**
......
spring: spring:
application: application:
name: fuzz-backend name: fuzz-backend-integration
profiles: profiles:
active: dev #默认为开发环境 active: dev #默认为开发环境
......
__ ___ _ __ _
/ _|_ _ ________ / __\ __ _ ___| | __ /__\ __ __| |
| |_| | | |_ /_ //__\/// _` |/ __| |/ //_\| '_ \ / _` | ,---, ___ ___
| _| |_| |/ / / // \/ \ (_| | (__| <//__| | | | (_| | .--., ,`--.' | ,--.'|_ ,--.'|_ ,--,
|_| \__,_/___/___\_____/\__,_|\___|_|\_\__/|_| |_|\__,_| ,--.' \ ,--, ,----, ,----,| : : ,---, | | :,' __ ,-. | | :,' ,--.'| ,---. ,---,
| | /\/ ,'_ /| .' .`| .' .`|: | ' ,-+-. / | : : ' : ,----._,.,' ,'/ /| : : ' : | |, ' ,'\ ,-+-. / |
\ No newline at end of file : : : .--. | | : .' .' .' .' .' .'| : | ,--.'|' |.;__,' / ,---. / / ' /' | |' | ,--.--. .;__,' / `--'_ / / | ,--.'|' |
: | |-,,'_ /| : . | ,---, ' ./ ,---, ' ./ ' ' ;| | ,"' || | | / \ | : || | ,'/ \ | | | ,' ,'| . ; ,. :| | ,"' |
| : :/|| ' | | . . ; | .' / ; | .' / | | || | / | |:__,'| : / / || | .\ .' : / .--. .-. |:__,'| : ' | | ' | |: :| | / | |
| | .'| | ' | | | `---' / ;--,`---' / ;--,' : ;| | | | | ' : |__ . ' / |. ; '; || | ' \__\/: . . ' : |__ | | : ' | .; :| | | | |
' : ' : | : ; ; | / / / .`| / / / .`|| | '| | | |/ | | '.'|' ; /|' . . |; : | ," .--.; | | | '.'|' : |_| : || | | |/
| | | ' : `--' \./__; .' ./__; .' ' : || | |--' ; : ;' | / | `---`-'| || , ; / / ,. | ; : ;| | '.'\ \ / | | |--'
| : \ : , .-./; | .' ; | .' ; |.' | |/ | , / | : | .'__/\_: | ---' ; : .' \ | , / ; : ;`----' | |/
| |,' `--`----' `---' `---' '---' '---' ---`-' \ \ / | : : | , .-./ ---`-' | , / '---'
`--' `----' \ \ / `--`---' ---`-'
`--`-'
\ No newline at end of file
package com.example.fuzzbackendmaster.controller; package com.example.fuzzbackendmaster.controller;
import com.example.fuzzbackendmaster.exception.CmdException;
import com.example.fuzzbackendmaster.exception.FileException;
import com.example.fuzzbackendmaster.pojo.vo.AjaxResult; import com.example.fuzzbackendmaster.pojo.vo.AjaxResult;
import com.example.fuzzbackendmaster.service.SeedFileApi; import com.example.fuzzbackendmaster.service.FuzzIntegrationFileApi;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
...@@ -24,47 +22,29 @@ import java.util.List; ...@@ -24,47 +22,29 @@ import java.util.List;
public class SeedFileController { public class SeedFileController {
@Autowired @Autowired
SeedFileApi seedFileApi; FuzzIntegrationFileApi fuzzIntegrationFileApi;
/** /**
* 种子文件查询接口 * 种子文件查询接口
*/ */
@RequestMapping(value = "/list", method = RequestMethod.GET) @RequestMapping(value = "/list", method = RequestMethod.GET)
public AjaxResult list() { public AjaxResult list() {
List<String> files = null; return fuzzIntegrationFileApi.list();
try {
files = seedFileApi.list();
} catch (CmdException e) {
log.error(e.getDefaultMessage());
return AjaxResult.error("种子文件获取失败!");
}
return AjaxResult.success(files);
} }
// /** /**
// * 种子文件删除接口 * 种子文件删除接口
// */ */
// @RequestMapping(value = "/delete/{fileName}", method = RequestMethod.GET) @RequestMapping(value = "/delete/{fileName}", method = RequestMethod.GET)
// public AjaxResult delete(@PathVariable("fileName")String fileName) { public AjaxResult delete(@PathVariable("fileName") String fileName) {
// try { return fuzzIntegrationFileApi.delFile(fileName);
// seedFileApi.delFile(fileName); }
// } catch (CmdException e) {
// log.error(e.getDefaultMessage()); /**
// return AjaxResult.error("种子文件删除失败!"); * seeFileUpload
// } */
// return AjaxResult.success("种子文件删除成功!"); @RequestMapping(value = "/upload", method = RequestMethod.POST)
// } public AjaxResult upload(MultipartFile file) {
// /** return fuzzIntegrationFileApi.upload(file);
// * seeFileUpload }
// */
// @RequestMapping(value = "/upload", method = RequestMethod.POST)
// public AjaxResult upload(MultipartFile file) {
// try {
// seedFileApi.upload(file);
// } catch (FileException | CmdException e) {
// log.error(e.getDefaultMessage());
// return AjaxResult.error("种子文件upload失败!");
// }
// return AjaxResult.success("种子文件upload成功!");
// }
} }
//package com.example.fuzzbackendmaster.controller; package com.example.fuzzbackendmaster.controller;
//
//import com.example.fuzzControll.exception.CmdException;
//import com.example.fuzzControll.exception.FuzzException; import com.example.fuzzbackendmaster.exception.CmdException;
//import com.example.fuzzControll.pojo.vo.AjaxResult; import com.example.fuzzbackendmaster.exception.FuzzException;
//import com.example.fuzzControll.pojo.vo.TestEntity; import com.example.fuzzbackendmaster.pojo.vo.AjaxResult;
//import com.example.fuzzControll.service.GenerateMethodService; import com.example.fuzzbackendmaster.pojo.vo.TestEntity;
//import com.example.fuzzControll.service.MutationService; import com.example.fuzzbackendmaster.service.FuzzIntegrationFileApi;
//import com.example.fuzzControll.service.ProtocolTemplateService; import lombok.extern.slf4j.Slf4j;
//import com.example.fuzzControll.service.VulnerabilityTypeService; import org.springframework.beans.factory.annotation.Autowired;
//import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController;
//import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.RestController; import java.util.List;
// import java.util.Map;
//import java.util.List;
//import java.util.Map; /**
// * 不同类型的测试方法
///** */
// * 不同类型的测试方法 @Slf4j
// */ @RestController
//@Slf4j @RequestMapping("/testClass")
//@RestController public class TestClassController {
//@RequestMapping("/testClass")
//public class TestClassController { @Autowired
// @Autowired FuzzIntegrationFileApi fuzzIntegrationFileApi;
// GenerateMethodService generateMethodService;
// @Autowired /**
// MutationService mutationService; * 模板
// @Autowired */
// ProtocolTemplateService protocolTemplateService; @RequestMapping(value = "/protocolTemplate", method = RequestMethod.POST)
// @Autowired public AjaxResult protocolTemplate(@RequestBody TestEntity testEntity) {
// VulnerabilityTypeService vulnerabilityTypeService; return fuzzIntegrationFileApi.protocolTemplate(testEntity);
// }
// /**
// * 模板 /**
// */ * 生成方法
// @RequestMapping(value = "/protocolTemplate", method = RequestMethod.POST) */
// public AjaxResult protocolTemplate(@RequestBody TestEntity testEntity) { @RequestMapping(value = "/generate", method = RequestMethod.POST)
// try { public AjaxResult generate(@RequestBody TestEntity testEntity) {
// Map<String, List<String>> result = protocolTemplateService.generation(testEntity); return fuzzIntegrationFileApi.generate(testEntity);
// return AjaxResult.success(result == null ? "模板文件生成未成功运行!第三方接口可能存在问题。" : result); }
// } catch (CmdException | FuzzException e) {
// log.error(e.getDefaultMessage()); /**
// return AjaxResult.error("模板生成失败!系统存在问题。"); * 变异方法
// } */
// } @RequestMapping(value = "/mutation", method = RequestMethod.POST)
// public AjaxResult mutation(@RequestBody TestEntity testEntity) {
// /** return fuzzIntegrationFileApi.mutation(testEntity);
// * 生成方法 }
// */
// @RequestMapping(value = "/generate", method = RequestMethod.POST) /**
// public AjaxResult generate(@RequestBody TestEntity testEntity) { * 漏洞类型
// try { */
// Map<String, List<String>> result = generateMethodService.generation(testEntity); @RequestMapping(value = "/vulnerabilityType", method = RequestMethod.POST)
// return AjaxResult.success(result == null ? "生成方法未成功运行!第三方接口可能存在问题。" : result); public AjaxResult upload(@RequestBody TestEntity testEntity) {
// } catch (CmdException | FuzzException e) { return fuzzIntegrationFileApi.vulnerability(testEntity);
// log.error(e.getDefaultMessage()); }
// return AjaxResult.error("生成方法使用失败!系统存在问题。"); }
// }
// }
//
// /**
// * 变异方法
// */
// @RequestMapping(value = "/mutation", method = RequestMethod.POST)
// public AjaxResult mutation(@RequestBody TestEntity testEntity) {
// try {
// Map<String, List<String>> result = mutationService.generation(testEntity);
// return AjaxResult.success(result == null ? "mutationTest未成功运行!第三方接口可能存在问题。" : result);
// } catch (CmdException | FuzzException e) {
// log.error(e.getDefaultMessage());
// return AjaxResult.error("mutationTest失败!系统存在问题。");
// }
// }
//
// /**
// * 漏洞类型
// */
// @RequestMapping(value = "/vulnerabilityType", method = RequestMethod.POST)
// public AjaxResult upload(@RequestBody TestEntity testEntity) {
// try {
// Map<String, List<String>> result = vulnerabilityTypeService.generation(testEntity);
// return AjaxResult.success(result == null ? "漏洞类型未成功运行!第三方接口可能存在问题。" : result);
// } catch (CmdException | FuzzException e) {
// log.error(e.getDefaultMessage());
// return AjaxResult.error("漏洞类型测试失败!系统存在问题。");
// }
// }
//}
//package com.example.fuzzbackendmaster.controller; package com.example.fuzzbackendmaster.controller;
//
//import com.example.fuzzControll.exception.AflnetException; import com.example.fuzzbackendmaster.exception.AflnetException;
//import com.example.fuzzControll.pojo.vo.AjaxResult; import com.example.fuzzbackendmaster.pojo.vo.AjaxResult;
//import com.example.fuzzControll.pojo.vo.CmdStartParams; import com.example.fuzzbackendmaster.pojo.vo.CmdStartParams;
//import com.example.fuzzControll.service.TestService; import com.example.fuzzbackendmaster.service.FuzzIntegrationFileApi;
//import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
//
///** /**
// * aflnet测试控制 * aflnet测试控制
// */ */
//@Slf4j @Slf4j
//@RestController @RestController
//@RequestMapping("/test") @RequestMapping("/test")
//public class TestControler { public class TestControler {
// @Autowired @Autowired
// TestService service; FuzzIntegrationFileApi fuzzIntegrationFileApi;
//
// /** /**
// * 测试启动 * 测试启动
// */ */
// @RequestMapping(value = "/testStart", method = RequestMethod.POST) @RequestMapping(value = "/testStart", method = RequestMethod.POST)
// public AjaxResult list(@RequestBody final CmdStartParams cmdStartParams) { public AjaxResult list(@RequestBody final CmdStartParams cmdStartParams) {
// try { return fuzzIntegrationFileApi.testStart(cmdStartParams);
// //todo 加个同步锁,执行到特征点就返回数据 }
// new Thread(new Runnable() {
// @Override /**
// public void run() { * 测试停止
// service.testStart(cmdStartParams); */
// } @RequestMapping(value = "/testStop", method = RequestMethod.GET)
// }).start(); public AjaxResult testStop() {
// } catch (AflnetException e) { return fuzzIntegrationFileApi.testStop();
// log.error(e.getDefaultMessage()); }
// return AjaxResult.error("测试启动失败!");
// } }
// return AjaxResult.success("测试启动成功!"); \ No newline at end of file
// }
//
// /**
// * 测试停止
// */
// @RequestMapping(value = "/testStop", method = RequestMethod.GET)
// public AjaxResult testStop() {
// try {
// service.testStop();
// } catch (AflnetException e) {
// log.error(e.getDefaultMessage());
// return AjaxResult.error("测试停止失败!");
// }
// return AjaxResult.success("测试停止成功!");
// }
//}
//
package com.example.fuzzbackendmaster.pojo.vo;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
@Data
@Getter
@Setter
public class CmdStartParams {
String netinfo; //netInfo
String protopcol; //protocol
int waiting; //usec
String nsname;//netnsname
Boolean kill;
Boolean awareMode;
Boolean regionMutationOperators;
Boolean falseNegativeMode;
String script;//script
int stateSelectionAlgo;
int seedSelectionAlgo;
}
package com.example.fuzzbackendmaster.pojo.vo;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
@Data
@Getter
@Setter
public class TestEntity {
String testClassName;
String[] paramJson;
}
package com.example.fuzzbackendmaster.service;
import com.example.fuzzbackendmaster.pojo.vo.AjaxResult;
import com.example.fuzzbackendmaster.pojo.vo.CmdStartParams;
import com.example.fuzzbackendmaster.pojo.vo.TestEntity;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
@Component
@FeignClient(value = "fuzz-backend-integration")
public interface FuzzIntegrationFileApi {
/**
* seedFlole
*
*/
@RequestMapping(value = "/seedFile/list", method = RequestMethod.GET)
AjaxResult list();
@RequestMapping(value = "/seedFile/upload", method = RequestMethod.GET, consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
AjaxResult upload(@RequestPart("file") MultipartFile file);
@RequestMapping(value = "/seedFile/delete", method = RequestMethod.GET, consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
AjaxResult delFile(@RequestPart("fileName") String fileName);
/**
* testclass
*
*/
@RequestMapping(value = "/testClass/protocolTemplate", method = RequestMethod.POST)
AjaxResult protocolTemplate(@RequestBody TestEntity testEntity);
@RequestMapping(value = "/testClass/generate", method = RequestMethod.POST)
AjaxResult generate(@RequestBody TestEntity testEntity);
@RequestMapping(value = "/testClass/mutation", method = RequestMethod.POST)
AjaxResult mutation(@RequestBody TestEntity testEntity);
@RequestMapping(value = "/testClass/vulnerabilityType", method = RequestMethod.POST)
AjaxResult vulnerability(@RequestBody TestEntity testEntity);
/**
*
* Aflnet
*/
@RequestMapping(value = "/test/testStop", method = RequestMethod.GET)
AjaxResult testStop();
@RequestMapping(value = "/test/testStart", method = RequestMethod.POST)
AjaxResult testStart(@RequestBody final CmdStartParams cmdStartParams);
}
//package com.example.fuzzbackendmaster.service;
//
//import org.springframework.cloud.openfeign.FeignClient;
//import org.springframework.stereotype.Component;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.PathVariable;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestBody;
//
//@Component
//@FeignClient(value = "fuzz-backend")
//public interface KittyServerMessageApi {
// @PostMapping("/kittyServer/stats")
// public CommonResult addPayment(@RequestBody Payment payment);
//
// @GetMapping("/kittyServer/templateInfo")
// public CommonResult findPaymentById(@PathVariable("id")Long id);
//
// @GetMapping("/kittyServer/stages")
// public CommonResult findPaymentList();
// @GetMapping("/kittyServer/report")
// public CommonResult findPaymentList();
//}
package com.example.fuzzbackendmaster.service;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
@Component
@FeignClient(value = "fuzz-backend")
public interface SeedFileApi {
@PostMapping("/seedFile/list")
public List<String> list( );
// @GetMapping("/seedFile/delete/{fileName}")
// public CommonResult findPaymentById(@PathVariable("id") Long id);
//
// @GetMapping("/seedFile/upload")
// public CommonResult findPaymentList();
}
package com.example.fuzzbackendmaster.service;
public interface TestApi {
}
package com.example.fuzzbackendmaster.service;
public interface TestClassApi {
}
__ ___ _ __ _
/ _|_ _ ________ / __\ __ _ ___| | __ /__\ __ __| |
| |_| | | |_ /_ //__\/// _` |/ __| |/ //_\| '_ \ / _` | ,-. ____ ___
| _| |_| |/ / / // \/ \ (_| | (__| <//__| | | | (_| | .--., ,---, ,--/ /| ,---, ,' , `. ,--.'|_
|_| \__,_/___/___\_____/\__,_|\___|_|\_\__/|_| |_|\__,_| ,--.' \ ,--, ,----, ,----,,---.'| ,--. :/ | ,---, ,---.'| ,-+-,.' _ | | | :,' __ ,-.
| | /\/ ,'_ /| .' .`| .' .`|| | : : : ' / ,-+-. / | | | : ,-+-. ; , || .--.--. : : ' : ,' ,'/ /|
\ No newline at end of file : : : .--. | | : .' .' .' .' .' .': : : ,--.--. ,---. | ' / ,---. ,--.'|' | | | | ,--.'|' | || ,--.--. / / '.;__,' / ,---. ' | |' |
: | |-,,'_ /| : . | ,---, ' ./ ,---, ' ./ : |,-. / \ / \ ' | : / \| | ,"' | ,--.__| || | ,', | |,/ \ | : /`./| | | / \ | | ,'
| : :/|| ' | | . . ; | .' / ; | .' / | : ' | .--. .-. | / / ' | | \ / / | | / | | / ,' || | / | |--'.--. .-. | | : ;_ :__,'| : / / |' : /
| | .'| | ' | | | `---' / ;--,`---' / ;--,| | / : \__\/: . .. ' / ' : |. \ . ' / | | | | |. ' / || : | | , \__\/: . . \ \ `. ' : |__ . ' / || | '
' : ' : | : ; ; | / / / .`| / / / .`|' : |: | ," .--.; |' ; :__ | | ' \ \' ; /| | | |/ ' ; |: || : | |/ ," .--.; | `----. \| | '.'|' ; /|; : |
| | | ' : `--' \./__; .' ./__; .' | | '/ : / / ,. |' | '.'|' : |--' ' | / | | |--' | | '/ '| | |`-' / / ,. | / /`--' /; : ;' | / || , ;
| : \ : , .-./; | .' ; | .' | : |; : .' \ : :; |,' | : | |/ | : :|| ;/ ; : .' \'--'. / | , / | : | ---'
| |,' `--`----' `---' `---' / \ / | , .-./\ \ / '--' \ \ /'---' \ \ / '---' | , .-./ `--'---' ---`-' \ \ /
`--' `-'----' `--`---' `----' `----' `----' `--`---' `----'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment