Commit 375b74cc by 钱炳权

recreate to springcloud

parent 356c9ddd
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.1</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>fuzzbackendmaster</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>fuzzbackendmaster</name>
<description>fuzzbackendmaster</description>
<properties>
<java.version>11</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<spring-cloud.version>2021.0.5</spring-cloud.version>
<spring-cloud-alibaba.version>2021.0.5.0</spring-cloud-alibaba.version>
</properties>
<dependencies>
<!-- 微服务依赖-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
<version>3.1.5</version>
</dependency>
<!-- springCloud相关-->
<!-- SpringCloud依赖开始-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bootstrap</artifactId>
<version>3.1.2</version>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
<version>2021.0.5.0</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
<version>3.1.5</version>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
<version>2021.0.5.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.9</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>5.2.9.RELEASE</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>2.0.31</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
<version>2.7.2</version>
</dependency>
<!-- log4j - slf4j 日志依赖 结束-->
<dependency>
<groupId>com.fasterxml.uuid</groupId>
<artifactId>java-uuid-generator</artifactId>
<version>3.1.5</version>
</dependency>
<!-- log4j - slf4j 日志依赖 开始-->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.24</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
<version>${spring-cloud-alibaba.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.6.13</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>7</source>
<target>7</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
package com.example.fuzzbackendmaster;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
@EnableFeignClients
@SpringBootApplication
public class FuzzbackendmasterApplication {
public static void main(String[] args) {
SpringApplication.run(FuzzbackendmasterApplication.class, args);
}
}
//package com.example.fuzzbackendmaster.controller;
//
//
//import com.example.fuzzbackendmaster.exception.ServerException;
//import com.example.fuzzbackendmaster.pojo.vo.AjaxResult;
//import com.example.fuzzbackendmaster.service.KittyServerMessageApi;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.RestController;
//
//
//
///**
// * kitty服务器信息
// */
//@RestController
//@RequestMapping("/kittyServer")
//@Slf4j
//public class KittyServerMessageController {
//
// @Autowired
// KittyServerMessageApi kittyServerMessageApi;
// /**
// * 获取服务器stats信息
// */
// @RequestMapping(value = "/stats", method = RequestMethod.GET)
// public AjaxResult getStats( ) {
// try {
// return AjaxResult.success(kittyServerMessageApi.getStats());
// } catch (ServerException e) {
// log.error(e.getDefaultMessage());
// return AjaxResult.error("stats信息获取失败!");
// }
// }
// /**
// * 获取服务器templateInfo信息
// */
// @RequestMapping(value = "/templateInfo", method = RequestMethod.GET)
// public AjaxResult getTemplateInfo( ) {
// try {
// return AjaxResult.success(getServerMessageService.getTemplateInfo());
// } catch (ServerException e) {
// log.error(e.getDefaultMessage());
// return AjaxResult.error("templateInfo信息获取失败!");
// }
// }
// /**
// * 获取服务器stages信息
// */
// @RequestMapping(value = "/stages", method = RequestMethod.GET)
// public AjaxResult getStages( ) {
// try {
// return AjaxResult.success(getServerMessageService.getStages());
// } catch (ServerException e) {
// log.error(e.getDefaultMessage());
// return AjaxResult.error("stages信息获取失败!");
// }
// }
// /**
// * 获取服务器report信息
// */
// @RequestMapping(value = "/report", method = RequestMethod.GET)
// public AjaxResult getReport( ) {
// try {
// return AjaxResult.success(getServerMessageService.getReport());
// } catch (ServerException e) {
// log.error(e.getDefaultMessage());
// return AjaxResult.error("report信息获取失败!");
// }
// }
//}
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.service.SeedFileApi;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
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 java.util.List;
/**
* aflnet种子文件
*/
@Slf4j
@RestController
@RequestMapping("/seedFile")
public class SeedFileController {
@Autowired
SeedFileApi seedFileApi;
/**
* 种子文件查询接口
*/
@RequestMapping(value = "/list", method = RequestMethod.GET)
public AjaxResult list() {
List<String> files = null;
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)
// public AjaxResult delete(@PathVariable("fileName")String fileName) {
// try {
// seedFileApi.delFile(fileName);
// } catch (CmdException e) {
// log.error(e.getDefaultMessage());
// return AjaxResult.error("种子文件删除失败!");
// }
// return AjaxResult.success("种子文件删除成功!");
// }
// /**
// * 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;
//
//import com.example.fuzzControll.exception.CmdException;
//import com.example.fuzzControll.exception.FuzzException;
//import com.example.fuzzControll.pojo.vo.AjaxResult;
//import com.example.fuzzControll.pojo.vo.TestEntity;
//import com.example.fuzzControll.service.GenerateMethodService;
//import com.example.fuzzControll.service.MutationService;
//import com.example.fuzzControll.service.ProtocolTemplateService;
//import com.example.fuzzControll.service.VulnerabilityTypeService;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.RestController;
//
//import java.util.List;
//import java.util.Map;
//
///**
// * 不同类型的测试方法
// */
//@Slf4j
//@RestController
//@RequestMapping("/testClass")
//public class TestClassController {
// @Autowired
// GenerateMethodService generateMethodService;
// @Autowired
// MutationService mutationService;
// @Autowired
// ProtocolTemplateService protocolTemplateService;
// @Autowired
// VulnerabilityTypeService vulnerabilityTypeService;
//
// /**
// * 模板
// */
// @RequestMapping(value = "/protocolTemplate", method = RequestMethod.POST)
// public AjaxResult protocolTemplate(@RequestBody TestEntity testEntity) {
// try {
// Map<String, List<String>> result = protocolTemplateService.generation(testEntity);
// return AjaxResult.success(result == null ? "模板文件生成未成功运行!第三方接口可能存在问题。" : result);
// } catch (CmdException | FuzzException e) {
// log.error(e.getDefaultMessage());
// return AjaxResult.error("模板生成失败!系统存在问题。");
// }
// }
//
// /**
// * 生成方法
// */
// @RequestMapping(value = "/generate", method = RequestMethod.POST)
// public AjaxResult generate(@RequestBody TestEntity testEntity) {
// try {
// Map<String, List<String>> result = generateMethodService.generation(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) {
// 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;
//
//import com.example.fuzzControll.exception.AflnetException;
//import com.example.fuzzControll.pojo.vo.AjaxResult;
//import com.example.fuzzControll.pojo.vo.CmdStartParams;
//import com.example.fuzzControll.service.TestService;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.RestController;
//
///**
// * aflnet测试控制
// */
//@Slf4j
//@RestController
//@RequestMapping("/test")
//public class TestControler {
// @Autowired
// TestService service;
//
// /**
// * 测试启动
// */
// @RequestMapping(value = "/testStart", method = RequestMethod.POST)
// public AjaxResult list(@RequestBody final CmdStartParams cmdStartParams) {
// try {
// //todo 加个同步锁,执行到特征点就返回数据
// new Thread(new Runnable() {
// @Override
// public void run() {
// service.testStart(cmdStartParams);
// }
// }).start();
// } catch (AflnetException e) {
// log.error(e.getDefaultMessage());
// return AjaxResult.error("测试启动失败!");
// }
// return AjaxResult.success("测试启动成功!");
// }
//
// /**
// * 测试停止
// */
// @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.controller;
//
//
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.stereotype.Component;
//
//import javax.websocket.*;
//import javax.websocket.server.PathParam;
//import javax.websocket.server.ServerEndpoint;
//import java.io.IOException;
//import java.util.concurrent.ConcurrentHashMap;
//
///**
// * @author
// */
//@Component("WebSocket")
//@ServerEndpoint("/websocket/testResult/{name}")
//@Slf4j
//public class WebSocket {
//
// private Session session; //与某个客户端连接对话,通过此对客户端发送消息
// private static final ConcurrentHashMap<String, WebSocket> WEBSOCKET_CONCURRENTHASHMAP = new ConcurrentHashMap<String, WebSocket>(); //存放所有连接的客户端
//
//
// @OnOpen
// public void onOpen(Session session, @PathParam(value = "name") String name) {
// this.session = session; //默认客户端,没有重名
// WEBSOCKET_CONCURRENTHASHMAP.put(name, this);
// log.info("Websocket is connected! The man is {}.There are {} people in the connection ",name,WEBSOCKET_CONCURRENTHASHMAP.size());
// }
//
//
// @OnClose
// public void onClose() {
//
// for (String name : WEBSOCKET_CONCURRENTHASHMAP.keySet()) {
//
// if (this == WEBSOCKET_CONCURRENTHASHMAP.get(name)) {
//
// WEBSOCKET_CONCURRENTHASHMAP.remove(name);
// break;
// }
// }
//
// log.info("Websocket is closed! There are {} people in the connection ",WEBSOCKET_CONCURRENTHASHMAP.size());
// }
//
// @OnError
// public void onError(Session session, Throwable throwable) {
//
// System.out.println("error:");
// throwable.printStackTrace();
// }
//
// @OnMessage
// public void onMessage(Session session, String message) {
//
// System.out.println("【webSocket接收成功】内容为:" + message); //此处可以指定发送,或者群发,或者xxxx的
//
// if (message.indexOf("name:") == 0) {
//
// String name = message.substring(message.indexOf("name") + 5, message.indexOf(";"));
//
//
// for (String senderStr : WEBSOCKET_CONCURRENTHASHMAP.keySet()) {//获取sender的Stirng
//
// if (WEBSOCKET_CONCURRENTHASHMAP.get(senderStr).getSession() == session) {
//
// appointSending(senderStr, name, message.substring(message.indexOf(";") + 1));
// }
// }
// } else {
//
// groupSending(message, session);
// }
// }
//
//
// public void groupSending(String message, Session exIncludeSession) {
//
// for (String name : WEBSOCKET_CONCURRENTHASHMAP.keySet()) {
//
// try {
// if (exIncludeSession == WEBSOCKET_CONCURRENTHASHMAP.get(name).session) {
// continue;
// }
//
// WEBSOCKET_CONCURRENTHASHMAP.get(name).session.getBasicRemote().sendText(name + ":" + message);
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// }
//
//
// public void appointSending(String sender, String name, String message) {
// try {
//// WEBSOCKET_CONCURRENTHASHMAP.get(name).session.getBasicRemote().sendText(sender + ":" + message);
// WEBSOCKET_CONCURRENTHASHMAP.get(name).session.getBasicRemote().sendText(message);
//
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
//
// public Session getSession() {
// return session;
// }
//}
\ No newline at end of file
package com.example.fuzzbackendmaster.exception;
public class AflnetException extends BaseException {
private static final long serialVersionUID = 1L;
public AflnetException(String defaultMessage) {
super(defaultMessage, "aflnet");
}
}
package com.example.fuzzbackendmaster.exception;
/**
* 基础异常
*/
public class BaseException extends RuntimeException{
private static final long serialVersionUID = 1L;
/**
* 错误消息
*/
private String defaultMessage;
/**
* 所属模块
*/
private String module;
public BaseException() {
}
public BaseException(String defaultMessage, String module) {
this.defaultMessage = defaultMessage;
this.module = module;
}
public String getDefaultMessage() {
return defaultMessage;
}
}
package com.example.fuzzbackendmaster.exception;
/**
* cmd运行异常
*/
public class CmdException extends BaseException {
private static final long serialVersionUID = 1L;
public CmdException() {
}
public CmdException(String defaultMessage) {
super(defaultMessage, "cmd");
}
}
package com.example.fuzzbackendmaster.exception;
/**
* 文件操作异常
*/
public class FileException extends BaseException {
private static final long serialVersionUID = 1L;
public FileException(String defaultMessage) {
super(defaultMessage, "file");
}
}
package com.example.fuzzbackendmaster.exception;
public class FuzzException extends BaseException {
private static final long serialVersionUID = 1L;
public FuzzException(String defaultMessage) {
super(defaultMessage, "fuzz");
}
}
package com.example.fuzzbackendmaster.exception;
public class ServerException extends BaseException {
private static final long serialVersionUID = 1L;
public ServerException(String defaultMessage) {
super(defaultMessage, "server");
}
}
package com.example.fuzzbackendmaster.pojo.vo;
import java.util.HashMap;
public class AjaxResult extends HashMap<String, Object> {
private static final long serialVersionUID = 1L;
/**
* 状态码
*/
public static final String CODE_TAG = "code";
/**
* 返回内容
*/
public static final String MSG_TAG = "data";
/**
* 数据对象
*/
public static final String DATA_TAG = "data";
/**
* 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。
*/
public AjaxResult() {
}
/**
* 初始化一个新创建的 AjaxResult 对象
*
* @param code 状态码
* @param data 返回内容
*/
public AjaxResult(int code, String data) {
super.put(CODE_TAG, code);
super.put(MSG_TAG, data);
}
/**
* 初始化一个新创建的 AjaxResult 对象
*
* @param code 状态码
* @param msg 返回内容
* @param data 数据对象
*/
public AjaxResult(int code, String msg, Object data) {
super.put(CODE_TAG, code);
super.put(MSG_TAG, msg);
if (data != null) {
super.put(DATA_TAG, data);
}
}
/**
* 返回成功消息
*
* @return 成功消息
*/
public static AjaxResult success() {
return AjaxResult.success("success");
}
/**
* 返回成功数据
*
* @return 成功消息
*/
public static AjaxResult success(Object data) {
return AjaxResult.success("success", data);
}
/**
* 返回成功消息
*
* @param msg 返回内容
* @return 成功消息
*/
public static AjaxResult success(String msg) {
return AjaxResult.success(msg, null);
}
/**
* 返回成功消息
*
* @param msg 返回内容
* @param data 数据对象
* @return 成功消息
*/
public static AjaxResult success(String msg, Object data) {
return new AjaxResult(200, msg, data);
}
/**
* 返回警告消息
*
* @param msg 返回内容
* @return 警告消息
*/
public static AjaxResult warn(String msg) {
return AjaxResult.warn(msg, null);
}
/**
* 返回警告消息
*
* @param msg 返回内容
* @param data 数据对象
* @return 警告消息
*/
public static AjaxResult warn(String msg, Object data) {
return new AjaxResult(403, msg, data);
}
/**
* 返回错误消息
*
* @return 错误消息
*/
public static AjaxResult error() {
return AjaxResult.error("操作失败");
}
/**
* 返回错误消息
*
* @param msg 返回内容
* @return 错误消息
*/
public static AjaxResult error(String msg) {
return AjaxResult.error(msg, null);
}
/**
* 返回错误消息
*
* @param msg 返回内容
* @param data 数据对象
* @return 错误消息
*/
public static AjaxResult error(String msg, Object data) {
return new AjaxResult(500, msg, data);
}
/**
* 返回错误消息
*
* @param code 状态码
* @param msg 返回内容
* @return 错误消息
*/
public static AjaxResult error(int code, String msg) {
return new AjaxResult(code, msg, null);
}
/**
* 方便链式调用
*
* @param key 键
* @param value 值
* @return 数据对象
*/
@Override
public AjaxResult put(String key, Object value) {
super.put(key, value);
return this;
}
}
\ No newline at end of file
//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 {
}
logging:
pattern:
file: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n"
console: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n"
file:
# 默认日志路径
path: ./fuzzbackendmaster/log
level:
root: info
org.springframework.data.mongodb.core: debug
com.ice.Application: info
logback:
rollingPolicy:
max-file-size: 10MB
spring:
cloud:
nacos:
discovery:
server-addr: http://127.0.0.1:8848
spring:
application:
name: fuzz-backend-master
profiles:
active: dev #默认为开发环境
server:
port: 8102
__ ___ _ __ _
/ _|_ _ ________ / __\ __ _ ___| | __ /__\ __ __| |
| |_| | | |_ /_ //__\/// _` |/ __| |/ //_\| '_ \ / _` |
| _| |_| |/ / / // \/ \ (_| | (__| <//__| | | | (_| |
|_| \__,_/___/___\_____/\__,_|\___|_|\_\__/|_| |_|\__,_|
\ No newline at end of file
# Global logging configuration
# 设置日志输出级别以及输出目的地,可以设置多个输出目的地,开发环境下,日志级别要设置成DEBUG或者ERROR
# 前面写日志级别,逗号后面写输出目的地:我自己下面设置的目的地相对应,以逗号分开
# log4j.rootLogger = [level],appenderName1,appenderName2,…
log4j.rootLogger=INFO,CONSOLE,LOGFILE
# log4j.rootLogger=DEBUG,CONSOLE,LOGFILE
#### 控制台输出 ####
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
# 输出到控制台
log4j.appender.CONSOLE.Target = System.out
# 指定控制台输出日志级别
# log4j.appender.CONSOLE.Threshold = DEBUG
# 默认值是 true, 表示是否立即输出
# log4j.appender.CONSOLE.ImmediateFlush = true
# 设置编码方式
log4j.appender.CONSOLE.Encoding = UTF-8
# 日志输出布局
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
# 如果日志输出布局为PatternLayout 自定义级别,需要使用ConversionPattern指定输出格式
log4j.appender.CONSOLE.layout.ConversionPattern=[%d{yyyy-MM-dd HH:mm:ss}] %5p (%c:%L) >>> %m%n
#### 输出错误信息到文件 ####
log4j.appender.LOGFILE=org.apache.log4j.FileAppender
# 指定输出文件路径
#log4j.appender.LOGFILE.File =F://Intellij idea/logs/error.log
log4j.appender.LOGFILE.File =./logs/error.log
#日志输出到文件,默认为true
log4j.appender.LOGFILE.Append = true
# 指定输出日志级别
# log4j.appender.LOGFILE.Threshold = ERROR
# 是否立即输出,默认值是 true,
# log4j.appender.LOGFILE.ImmediateFlush = true
# 设置编码方式
log4j.appender.LOGFILE.Encoding = UTF-8
# 日志输出布局
log4j.appender.LOGFILE.layout = org.apache.log4j.PatternLayout
# 如果日志输出布局为PatternLayout 自定义级别,需要使用ConversionPattern指定输出格式
log4j.appender.LOGFILE.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>websocket client</title>
<script type="text/javascript">
var ws1 = null;
var ws2 = null;
function myFunction() {
ws1 = new WebSocket("ws://localhost:8200/websocket/testResult/" + "web");
ws1.onmessage = function (evt) {
console.log(evt);
var received_msg =JSON.parse(evt.data) ;
const nameValue = Object.values(received_msg)
var context = '<div class="sendMsg">' +
'aflnet:<br/>'+
'aflnet<h3>'+nameValue+'</h3><br/>'+
' </div>';
document.getElementById("sendDiv").innerHTML = context;
};
ws1.onclose = function () {
// 关闭 websocket
alert("连接已关闭...");
};
}
</script>
<body onload="javascript:myFunction()">
<div id="sendDiv">
</div>
</body>
</html>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.1</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>fuzzbackend</artifactId>
......@@ -11,31 +17,50 @@
<java.version>11</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<spring-boot.version>2.6.13</spring-boot.version>
<spring-cloud.version>2021.0.5</spring-cloud.version>
<spring-cloud-alibaba.version>2021.0.5.0</spring-cloud-alibaba.version>
</properties>
<dependencies>
<!-- 微服务依赖-->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.13</version>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
<version>3.1.5</version>
</dependency>
<!-- springCloud相关-->
<!-- SpringCloud依赖开始-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>2.5.3</version>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bootstrap</artifactId>
<version>3.1.2</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
<version>2021.0.5.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
<version>3.1.5</version>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
<version>2021.0.5.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
......@@ -65,13 +90,19 @@
<artifactId>java-uuid-generator</artifactId>
<version>3.1.5</version>
</dependency>
<!-- log4j - slf4j 日志依赖 开始-->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.24</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
<version>${spring-cloud-alibaba.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
......@@ -109,8 +140,6 @@
<target>7</target>
</configuration>
</plugin>
</plugins>
</build>
......
......@@ -2,8 +2,10 @@ package com.example.fuzzControll;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableFeignClients
public class FuzzControlApplication {
public static void main(String[] args) {
......
......@@ -30,41 +30,36 @@ public class SeedFileController {
* 种子文件查询接口
*/
@RequestMapping(value = "/list", method = RequestMethod.GET)
public AjaxResult list() {
List<String> files = null;
try {
files = service.getSeedFiles();
} catch (CmdException e) {
log.error(e.getDefaultMessage());
return AjaxResult.error("种子文件获取失败!");
}
return AjaxResult.success(files);
public List<String> list() {
List<String> files = service.getSeedFiles();
return files ;
}
/**
* 种子文件删除接口
*/
@RequestMapping(value = "/delete/{fileName}", method = RequestMethod.GET)
public AjaxResult delete(@PathVariable("fileName")String fileName) {
try {
service.delFile(fileName);
} catch (CmdException e) {
log.error(e.getDefaultMessage());
return AjaxResult.error("种子文件删除失败!");
}
return AjaxResult.success("种子文件删除成功!");
}
/**
* seeFileUpload
*/
@RequestMapping(value = "/upload", method = RequestMethod.POST)
public AjaxResult upload(MultipartFile file) {
try {
service.upload(file);
} catch (FileException | CmdException e) {
log.error(e.getDefaultMessage());
return AjaxResult.error("种子文件upload失败!");
}
return AjaxResult.success("种子文件upload成功!");
}
// /**
// * 种子文件删除接口
// */
// @RequestMapping(value = "/delete/{fileName}", method = RequestMethod.GET)
// public AjaxResult delete(@PathVariable("fileName") String fileName) {
// try {
// service.delFile(fileName);
// } catch (CmdException e) {
// log.error(e.getDefaultMessage());
// return AjaxResult.error("种子文件删除失败!");
// }
// return AjaxResult.success("种子文件删除成功!");
// }
//
// /**
// * seeFileUpload
// */
// @RequestMapping(value = "/upload", method = RequestMethod.POST)
// public AjaxResult upload(MultipartFile file) {
// try {
// service.upload(file);
// } catch (FileException | CmdException e) {
// log.error(e.getDefaultMessage());
// return AjaxResult.error("种子文件upload失败!");
// }
// return AjaxResult.success("种子文件upload成功!");
// }
}
logging:
pattern:
file: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n"
......@@ -14,16 +16,22 @@ logging:
max-file-size: 10MB
filepath:
seedPath: "/home/aflnet/tutorials/live555/in-rtsp"
seedPath: "/usr/fuzzenv/fuzzenv/aflnet/tutorials/live555/in-rtsp"
kitty:
aflnetPath: "/home/"
path: "/home/fuzz50/kitty/renix/" #kitty项目下的各协议生成模板python文件路径
venvPath: "/home/fuzz50/kitty/venv/bin/python"
methodPath: "/home/fuzz50/kitty/2020test/"#kitty下变异方法路径
vulnerabilityTypePath: "/home/fuzz50/kitty/2020test/"#kitty下漏洞类型python路径
mutationPath: "/home/fuzz50/kitty/2020test/"
aflnetPath: "/usr/fuzzenv/fuzzenv/"
path: "/usr/fuzzenv/fuzzenv/fuzz50/kitty/renix/" #kitty项目下的各协议生成模板python文件路径
venvPath: "/usr/fuzzenv/fuzzenv/fuzz50/kitty/venv/bin/python"
methodPath: "/usr/fuzzenv/fuzzenv/fuzz50/kitty/2020test/"#kitty下变异方法路径
vulnerabilityTypePath: "/usr/fuzzenv/fuzzenv/fuzz50/kitty/2020test/"#kitty下漏洞类型python路径
mutationPath: "/usr/fuzzenv/fuzzenv/fuzz50/kitty/2020test/"
templateInfoHttp: "http://127.0.0.1:26001/api/template_info.json"#模板信息请求链接
statsHttp: "http://127.0.0.1:26001/api/stats.json"#运行时数据
stagesHttp: "http://127.0.0.1:26001/api/stages.json"#
reportHttp: "http://127.0.0.1:26001/api/report"#
spring:
cloud:
nacos:
discovery:
server-addr: http://127.0.0.1:8848
......@@ -3,7 +3,8 @@ spring:
name: fuzz-backend
profiles:
active: dev #默认为开发环境
server:
port: 8100
port: 8101
......@@ -8,7 +8,7 @@
var ws1 = null;
var ws2 = null;
function myFunction() {
ws1 = new WebSocket("ws://localhost:8100/websocket/testResult/" + "web");
ws1 = new WebSocket("ws://localhost:8200/websocket/testResult/" + "web");
ws1.onmessage = function (evt) {
console.log(evt);
var received_msg =JSON.parse(evt.data) ;
......
package com.example.fuzzControll;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class AflnetControlApplicationTests {
@Test
void contextLoads() {
}
}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>fuzzbackendmaster</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>fuzzbackendmaster</name>
<description>fuzzbackendmaster</description>
<properties>
<java.version>11</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<spring-boot.version>2.6.13</spring-boot.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>11</source>
<target>11</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
<configuration>
<mainClass>com.example.fuzzbackendmaster.FuzzbackendmasterApplication</mainClass>
<skip>true</skip>
</configuration>
<executions>
<execution>
<id>repackage</id>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
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