Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fuzzBackEnd
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钱炳权
fuzzBackEnd
Commits
97a834df
Commit
97a834df
authored
Apr 26, 2024
by
钱炳权
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
RECREATE PROJECT
parent
abb34784
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
319 additions
and
310 deletions
+319
-310
SeedFileController.java
...m/example/fuzzControll/controller/SeedFileController.java
+38
-34
TestClassController.java
.../example/fuzzControll/controller/TestClassController.java
+1
-1
TestControler.java
...va/com/example/fuzzControll/controller/TestControler.java
+9
-6
FuzzException.java
...ava/com/example/fuzzControll/exception/FuzzException.java
+1
-1
LockException.java
...ava/com/example/fuzzControll/exception/LockException.java
+8
-0
SeedFileService.java
...ava/com/example/fuzzControll/service/SeedFileService.java
+4
-2
TestService.java
...in/java/com/example/fuzzControll/service/TestService.java
+2
-0
SeedFileServiceImpl.java
...xample/fuzzControll/service/impl/SeedFileServiceImpl.java
+9
-4
TestServiceImpl.java
...om/example/fuzzControll/service/impl/TestServiceImpl.java
+3
-1
CmdTools.java
...rc/main/java/com/example/fuzzControll/tools/CmdTools.java
+3
-1
application.yml
fuzzIntegration/src/main/resources/application.yml
+1
-1
banner.txt
fuzzIntegration/src/main/resources/banner.txt
+17
-7
SeedFileController.java
...mple/fuzzbackendmaster/controller/SeedFileController.java
+18
-38
TestClassController.java
...ple/fuzzbackendmaster/controller/TestClassController.java
+61
-92
TestControler.java
...m/example/fuzzbackendmaster/controller/TestControler.java
+41
-58
CmdStartParams.java
...com/example/fuzzbackendmaster/pojo/vo/CmdStartParams.java
+22
-0
TestEntity.java
...ava/com/example/fuzzbackendmaster/pojo/vo/TestEntity.java
+13
-0
FuzzIntegrationFileApi.java
...ple/fuzzbackendmaster/service/FuzzIntegrationFileApi.java
+53
-0
KittyServerMessageApi.java
...mple/fuzzbackendmaster/service/KittyServerMessageApi.java
+0
-23
SeedFileApi.java
...va/com/example/fuzzbackendmaster/service/SeedFileApi.java
+0
-26
TestApi.java
...n/java/com/example/fuzzbackendmaster/service/TestApi.java
+0
-4
TestClassApi.java
...a/com/example/fuzzbackendmaster/service/TestClassApi.java
+0
-4
banner.txt
fuzzbackendmaster/src/main/resources/banner.txt
+15
-7
No files found.
fuzzIntegration/src/main/java/com/example/fuzzControll/controller/SeedFileController.java
View file @
97a834df
...
@@ -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
(
"上传文件成功!"
);
}
}
}
fuzzIntegration/src/main/java/com/example/fuzzControll/controller/TestClassController.java
View file @
97a834df
...
@@ -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
);
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/controller/TestControler.java
View file @
97a834df
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
(
"测试
已启动
!"
);
}
}
/**
/**
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/exception/FuzzException.java
View file @
97a834df
...
@@ -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
"
);
}
}
}
}
fuzzIntegration/src/main/java/com/example/fuzzControll/exception/LockException.java
0 → 100644
View file @
97a834df
package
com
.
example
.
fuzzControll
.
exception
;
public
class
LockException
extends
BaseException
{
private
static
final
long
serialVersionUID
=
1L
;
public
LockException
(
String
defaultMessage
)
{
super
(
defaultMessage
,
"fuzz"
);
}
}
fuzzIntegration/src/main/java/com/example/fuzzControll/service/SeedFileService.java
View file @
97a834df
...
@@ -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
);
}
}
fuzzIntegration/src/main/java/com/example/fuzzControll/service/TestService.java
View file @
97a834df
...
@@ -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
);
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/service/impl/SeedFileServiceImpl.java
View file @
97a834df
...
@@ -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.
"
);
}
}
}
}
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/service/impl/TestServiceImpl.java
View file @
97a834df
...
@@ -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"
;
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/tools/CmdTools.java
View file @
97a834df
...
@@ -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 不同协议种子路径也不同
/**
/**
...
...
fuzzIntegration/src/main/resources/application.yml
View file @
97a834df
spring
:
spring
:
application
:
application
:
name
:
fuzz-backend
name
:
fuzz-backend
-integration
profiles
:
profiles
:
active
:
dev
#默认为开发环境
active
:
dev
#默认为开发环境
...
...
fuzzIntegration/src/main/resources/banner.txt
View file @
97a834df
__ ___ _ __ _
/ _|_ _ ________ / __\ __ _ ___| | __ /__\ __ __| |
| |_| | | |_ /_ //__\/// _` |/ __| |/ //_\| '_ \ / _` |
,---, ___ ___
| _| |_| |/ / / // \/ \ (_| | (__| <//__| | | | (_| |
.--., ,`--.' | ,--.'|_ ,--.'|_ ,--,
|_| \__,_/___/___\_____/\__,_|\___|_|\_\__/|_| |_|\__,_|
,--.' \ ,--, ,----, ,----,| : : ,---, | | :,' __ ,-. | | :,' ,--.'| ,---. ,---,
| | /\/ ,'_ /| .' .`| .' .`|: | ' ,-+-. / | : : ' : ,----._,.,' ,'/ /| : : ' : | |, ' ,'\ ,-+-. / |
\ No newline at end of file
: : : .--. | | : .' .' .' .' .' .'| : | ,--.'|' |.;__,' / ,---. / / ' /' | |' | ,--.--. .;__,' / `--'_ / / | ,--.'|' |
: | |-,,'_ /| : . | ,---, ' ./ ,---, ' ./ ' ' ;| | ,"' || | | / \ | : || | ,'/ \ | | | ,' ,'| . ; ,. :| | ,"' |
| : :/|| ' | | . . ; | .' / ; | .' / | | || | / | |:__,'| : / / || | .\ .' : / .--. .-. |:__,'| : ' | | ' | |: :| | / | |
| | .'| | ' | | | `---' / ;--,`---' / ;--,' : ;| | | | | ' : |__ . ' / |. ; '; || | ' \__\/: . . ' : |__ | | : ' | .; :| | | | |
' : ' : | : ; ; | / / / .`| / / / .`|| | '| | | |/ | | '.'|' ; /|' . . |; : | ," .--.; | | | '.'|' : |_| : || | | |/
| | | ' : `--' \./__; .' ./__; .' ' : || | |--' ; : ;' | / | `---`-'| || , ; / / ,. | ; : ;| | '.'\ \ / | | |--'
| : \ : , .-./; | .' ; | .' ; |.' | |/ | , / | : | .'__/\_: | ---' ; : .' \ | , / ; : ;`----' | |/
| |,' `--`----' `---' `---' '---' '---' ---`-' \ \ / | : : | , .-./ ---`-' | , / '---'
`--' `----' \ \ / `--`---' ---`-'
`--`-'
\ No newline at end of file
fuzzbackendmaster/src/main/java/com/example/fuzzbackendmaster/controller/SeedFileController.java
View file @
97a834df
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.
Seed
FileApi
;
import
com.example.fuzzbackendmaster.service.
FuzzIntegration
FileApi
;
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
seed
FileApi
;
FuzzIntegrationFileApi
fuzzIntegration
FileApi
;
/**
/**
* 种子文件查询接口
* 种子文件查询接口
*/
*/
@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成功!");
// }
}
}
fuzzbackendmaster/src/main/java/com/example/fuzzbackendmaster/controller/TestClassController.java
View file @
97a834df
//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("漏洞类型测试失败!系统存在问题。");
// }
// }
//}
fuzzbackendmaster/src/main/java/com/example/fuzzbackendmaster/controller/TestControler.java
View file @
97a834df
//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("测试停止成功!");
// }
//}
//
fuzzbackendmaster/src/main/java/com/example/fuzzbackendmaster/pojo/vo/CmdStartParams.java
0 → 100644
View file @
97a834df
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
;
}
fuzzbackendmaster/src/main/java/com/example/fuzzbackendmaster/pojo/vo/TestEntity.java
0 → 100644
View file @
97a834df
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
;
}
fuzzbackendmaster/src/main/java/com/example/fuzzbackendmaster/service/FuzzIntegrationFileApi.java
0 → 100644
View file @
97a834df
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
);
}
fuzzbackendmaster/src/main/java/com/example/fuzzbackendmaster/service/KittyServerMessageApi.java
deleted
100644 → 0
View file @
abb34784
//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();
//}
fuzzbackendmaster/src/main/java/com/example/fuzzbackendmaster/service/SeedFileApi.java
deleted
100644 → 0
View file @
abb34784
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();
}
fuzzbackendmaster/src/main/java/com/example/fuzzbackendmaster/service/TestApi.java
deleted
100644 → 0
View file @
abb34784
package
com
.
example
.
fuzzbackendmaster
.
service
;
public
interface
TestApi
{
}
fuzzbackendmaster/src/main/java/com/example/fuzzbackendmaster/service/TestClassApi.java
deleted
100644 → 0
View file @
abb34784
package
com
.
example
.
fuzzbackendmaster
.
service
;
public
interface
TestClassApi
{
}
fuzzbackendmaster/src/main/resources/banner.txt
View file @
97a834df
__ ___ _ __ _
/ _|_ _ ________ / __\ __ _ ___| | __ /__\ __ __| |
| |_| | | |_ /_ //__\/// _` |/ __| |/ //_\| '_ \ / _` |
,-. ____ ___
| _| |_| |/ / / // \/ \ (_| | (__| <//__| | | | (_| |
.--., ,---, ,--/ /| ,---, ,' , `. ,--.'|_
|_| \__,_/___/___\_____/\__,_|\___|_|\_\__/|_| |_|\__,_|
,--.' \ ,--, ,----, ,----,,---.'| ,--. :/ | ,---, ,---.'| ,-+-,.' _ | | | :,' __ ,-.
| | /\/ ,'_ /| .' .`| .' .`|| | : : : ' / ,-+-. / | | | : ,-+-. ; , || .--.--. : : ' : ,' ,'/ /|
\ No newline at end of file
: : : .--. | | : .' .' .' .' .' .': : : ,--.--. ,---. | ' / ,---. ,--.'|' | | | | ,--.'|' | || ,--.--. / / '.;__,' / ,---. ' | |' |
: | |-,,'_ /| : . | ,---, ' ./ ,---, ' ./ : |,-. / \ / \ ' | : / \| | ,"' | ,--.__| || | ,', | |,/ \ | : /`./| | | / \ | | ,'
| : :/|| ' | | . . ; | .' / ; | .' / | : ' | .--. .-. | / / ' | | \ / / | | / | | / ,' || | / | |--'.--. .-. | | : ;_ :__,'| : / / |' : /
| | .'| | ' | | | `---' / ;--,`---' / ;--,| | / : \__\/: . .. ' / ' : |. \ . ' / | | | | |. ' / || : | | , \__\/: . . \ \ `. ' : |__ . ' / || | '
' : ' : | : ; ; | / / / .`| / / / .`|' : |: | ," .--.; |' ; :__ | | ' \ \' ; /| | | |/ ' ; |: || : | |/ ," .--.; | `----. \| | '.'|' ; /|; : |
| | | ' : `--' \./__; .' ./__; .' | | '/ : / / ,. |' | '.'|' : |--' ' | / | | |--' | | '/ '| | |`-' / / ,. | / /`--' /; : ;' | / || , ;
| : \ : , .-./; | .' ; | .' | : |; : .' \ : :; |,' | : | |/ | : :|| ;/ ; : .' \'--'. / | , / | : | ---'
| |,' `--`----' `---' `---' / \ / | , .-./\ \ / '--' \ \ /'---' \ \ / '---' | , .-./ `--'---' ---`-' \ \ /
`--' `-'----' `--`---' `----' `----' `----' `--`---' `----'
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment