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
267c45e2
Commit
267c45e2
authored
Jun 18, 2024
by
钱炳权
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
项目结构重规划+aflnet信息全流程正常
parent
deacd8b0
Show whitespace changes
Inline
Side-by-side
Showing
75 changed files
with
472 additions
and
308 deletions
+472
-308
NeedCutAfter.java
.../java/com/example/fuzzControll/annotion/NeedCutAfter.java
+2
-3
NeedCutAround.java
...java/com/example/fuzzControll/annotion/NeedCutAround.java
+14
-0
NeedCutBefore.java
...java/com/example/fuzzControll/annotion/NeedCutBefore.java
+14
-0
IntegrationAop.java
...ain/java/com/example/fuzzControll/aop/IntegrationAop.java
+95
-20
CmdConstent.java
.../java/com/example/fuzzControll/constents/CmdConstent.java
+7
-6
LogicDeleteEnum.java
...a/com/example/fuzzControll/constents/LogicDeleteEnum.java
+0
-29
MissionStateEnum.java
.../com/example/fuzzControll/constents/MissionStateEnum.java
+3
-0
MutationConstent.java
.../com/example/fuzzControll/constents/MutationConstent.java
+3
-0
ProtocolConstent.java
.../com/example/fuzzControll/constents/ProtocolConstent.java
+3
-0
ServerClassEnum.java
...a/com/example/fuzzControll/constents/ServerClassEnum.java
+3
-0
TableClassEnum.java
...va/com/example/fuzzControll/constents/TableClassEnum.java
+3
-0
AflnetDataController.java
...troll/controller/dataController/AflnetDataController.java
+2
-5
FuzzLogController.java
...Controll/controller/dataController/FuzzLogController.java
+1
-5
KittyDataController.java
...ntroll/controller/dataController/KittyDataController.java
+3
-3
KittyServerMessageController.java
...ntroller/dataController/KittyServerMessageController.java
+3
-5
MissionInfoController.java
...roll/controller/dataController/MissionInfoController.java
+1
-3
SeedFileController.java
...ontroll/controller/dataController/SeedFileController.java
+4
-5
WebsocketController.java
...ntroll/controller/dataController/WebsocketController.java
+4
-1
AlfnetController.java
...zControll/controller/testController/AlfnetController.java
+13
-9
KittyController.java
...zzControll/controller/testController/KittyController.java
+5
-5
AflnetDataParams.java
.../com/example/fuzzControll/domain/bo/AflnetDataParams.java
+1
-1
CmdStartParams.java
...va/com/example/fuzzControll/domain/bo/CmdStartParams.java
+1
-1
FuzzLogTransEntity.java
...om/example/fuzzControll/domain/bo/FuzzLogTransEntity.java
+1
-1
KittyDataParams.java
...a/com/example/fuzzControll/domain/bo/KittyDataParams.java
+1
-1
TestEntity.java
...n/java/com/example/fuzzControll/domain/bo/TestEntity.java
+1
-1
MissionInfo.java
.../java/com/example/fuzzControll/domain/po/MissionInfo.java
+1
-1
AflnetResult.java
...java/com/example/fuzzControll/domain/vo/AflnetResult.java
+1
-1
AjaxResult.java
...n/java/com/example/fuzzControll/domain/vo/AjaxResult.java
+1
-1
KittyPackageFile.java
.../com/example/fuzzControll/domain/vo/KittyPackageFile.java
+1
-1
KittyResult.java
.../java/com/example/fuzzControll/domain/vo/KittyResult.java
+1
-1
TestReturnEntity.java
.../com/example/fuzzControll/domain/vo/TestReturnEntity.java
+1
-1
FileException.java
...le/fuzzControll/exception/fileExcption/FileException.java
+4
-2
MysqlException.java
...fuzzControll/exception/mysqlException/MysqlException.java
+4
-2
ServerException.java
...zzControll/exception/serverException/ServerException.java
+4
-2
AflnetException.java
...fuzzControll/exception/testException/AflnetException.java
+4
-2
CmdException.java
...le/fuzzControll/exception/testException/CmdException.java
+3
-1
FuzzException.java
...e/fuzzControll/exception/testException/FuzzException.java
+4
-2
LockException.java
...fuzzControll/exception/threadException/LockException.java
+4
-2
MyExceptionHandler.java
...ontroll/exception/threadException/MyExceptionHandler.java
+4
-4
SystemInitial.java
...n/java/com/example/fuzzControll/inital/SystemInitial.java
+17
-0
AflnetMapper.java
...in/java/com/example/fuzzControll/mapper/AflnetMapper.java
+1
-4
KittyMapper.java
...ain/java/com/example/fuzzControll/mapper/KittyMapper.java
+2
-2
MissionInfoMapper.java
...va/com/example/fuzzControll/mapper/MissionInfoMapper.java
+3
-1
KittyLog.java
.../main/java/com/example/fuzzControll/pojo/vo/KittyLog.java
+0
-5
AflnetPersistenceService.java
...xample/fuzzControll/service/AflnetPersistenceService.java
+1
-1
FuzzLogService.java
...java/com/example/fuzzControll/service/FuzzLogService.java
+1
-3
GenerateMethodService.java
...m/example/fuzzControll/service/GenerateMethodService.java
+1
-1
KittyFuzzPersistenceService.java
...ple/fuzzControll/service/KittyFuzzPersistenceService.java
+2
-2
MutationService.java
...ava/com/example/fuzzControll/service/MutationService.java
+1
-1
ProtocolTemplateService.java
...example/fuzzControll/service/ProtocolTemplateService.java
+1
-1
TestService.java
...in/java/com/example/fuzzControll/service/TestService.java
+1
-3
VulnerabilityTypeService.java
...xample/fuzzControll/service/VulnerabilityTypeService.java
+1
-1
AflnetPersistenceServiceImpl.java
...zzControll/service/impl/AflnetPersistenceServiceImpl.java
+11
-11
FuzzLogServiceImpl.java
...example/fuzzControll/service/impl/FuzzLogServiceImpl.java
+6
-5
GenerateMethodServiceImpl.java
.../fuzzControll/service/impl/GenerateMethodServiceImpl.java
+5
-5
GetServerMessageImpl.java
...ample/fuzzControll/service/impl/GetServerMessageImpl.java
+1
-1
KittyFuzzPersistenceServiceImpl.java
...ontroll/service/impl/KittyFuzzPersistenceServiceImpl.java
+6
-6
MutationServiceImpl.java
...xample/fuzzControll/service/impl/MutationServiceImpl.java
+5
-5
ProtocolTemplateImpl.java
...ample/fuzzControll/service/impl/ProtocolTemplateImpl.java
+7
-7
SeedFileServiceImpl.java
...xample/fuzzControll/service/impl/SeedFileServiceImpl.java
+4
-8
TestServiceImpl.java
...om/example/fuzzControll/service/impl/TestServiceImpl.java
+16
-47
VulnerabilityTypeServiceImpl.java
...zzControll/service/impl/VulnerabilityTypeServiceImpl.java
+4
-4
RegularTools.java
...ain/java/com/example/fuzzControll/tools/RegularTools.java
+0
-4
FileTools.java
...n/java/com/example/fuzzControll/tools/file/FileTools.java
+2
-8
GlobalClass.java
...va/com/example/fuzzControll/tools/system/GlobalClass.java
+5
-11
SystemRunningParams.java
...xample/fuzzControll/tools/system/SystemRunningParams.java
+35
-0
CmdTools.java
...in/java/com/example/fuzzControll/tools/test/CmdTools.java
+43
-23
SingleCmdTools.java
...a/com/example/fuzzControll/tools/test/SingleCmdTools.java
+49
-0
TestControlTools.java
...com/example/fuzzControll/tools/test/TestControlTools.java
+1
-1
TestTools.java
...n/java/com/example/fuzzControll/tools/test/TestTools.java
+1
-1
application-dev.yml
fuzzIntegration/src/main/resources/application-dev.yml
+1
-1
AflnetMapper.xml
fuzzIntegration/src/main/resources/mapper/AflnetMapper.xml
+1
-1
KittyMapper.xml
fuzzIntegration/src/main/resources/mapper/KittyMapper.xml
+4
-4
MissionInfoMapper.xml
...tegration/src/main/resources/mapper/MissionInfoMapper.xml
+7
-2
MissionInfoController.java
...e/fuzzbackendmaster/controller/MissionInfoController.java
+1
-1
No files found.
fuzzIntegration/src/main/java/com/example/fuzzControll/annotion/NeedCut.java
→
fuzzIntegration/src/main/java/com/example/fuzzControll/annotion/NeedCut
After
.java
View file @
267c45e2
...
@@ -3,13 +3,12 @@ package com.example.fuzzControll.annotion;
...
@@ -3,13 +3,12 @@ package com.example.fuzzControll.annotion;
import
java.lang.annotation.*
;
import
java.lang.annotation.*
;
/**
/**
*
切片标识注解
*
方法后置处理
*/
*/
@Inherited
@Inherited
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Target
({
ElementType
.
METHOD
})
@Target
({
ElementType
.
METHOD
})
public
@interface
NeedCut
{
public
@interface
NeedCut
After
{
String
name
()
default
""
;
String
name
()
default
""
;
String
moment
()
default
""
;
String
function
()
default
""
;
String
function
()
default
""
;
}
}
fuzzIntegration/src/main/java/com/example/fuzzControll/annotion/NeedCutAround.java
0 → 100644
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
annotion
;
import
java.lang.annotation.*
;
/**
* 方法前置处理
*/
@Inherited
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Target
({
ElementType
.
METHOD
})
public
@interface
NeedCutAround
{
String
name
()
default
""
;
String
function
()
default
""
;
}
fuzzIntegration/src/main/java/com/example/fuzzControll/annotion/NeedCutBefore.java
0 → 100644
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
annotion
;
import
java.lang.annotation.*
;
/**
* 方法前置处理
*/
@Inherited
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Target
({
ElementType
.
METHOD
})
public
@interface
NeedCutBefore
{
String
name
()
default
""
;
String
function
()
default
""
;
}
fuzzIntegration/src/main/java/com/example/fuzzControll/aop/IntegrationAop.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
aop
;
package
com
.
example
.
fuzzControll
.
aop
;
import
com.example.fuzzControll.annotion.NeedCut
;
import
com.example.fuzzControll.annotion.NeedCut
Before
;
import
com.example.fuzzControll.constents.
LogicDeleteEnum
;
import
com.example.fuzzControll.constents.
CmdConstent
;
import
com.example.fuzzControll.constents.MissionStateEnum
;
import
com.example.fuzzControll.constents.MissionStateEnum
;
import
com.example.fuzzControll.constents.TableClassEnum
;
import
com.example.fuzzControll.constents.TableClassEnum
;
import
com.example.fuzzControll.mapper.MissionInfoMapper
;
import
com.example.fuzzControll.domain.po.MissionInfo
;
import
com.example.fuzzControll.pojo.vo.MissionInfo
;
import
com.example.fuzzControll.exception.mysqlException.MysqlException
;
import
com.example.fuzzControll.service.AflnetPersistenceService
;
import
com.example.fuzzControll.exception.testException.AflnetException
;
import
com.example.fuzzControll.tools.GlobalParameters
;
import
com.example.fuzzControll.exception.testException.CmdException
;
import
com.example.fuzzControll.tools.system.GlobalClass
;
import
com.example.fuzzControll.tools.system.SystemRunningParams
;
import
com.example.fuzzControll.tools.test.SingleCmdTools
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.aspectj.lang.JoinPoint
;
import
org.aspectj.lang.JoinPoint
;
import
org.aspectj.lang.ProceedingJoinPoint
;
import
org.aspectj.lang.ProceedingJoinPoint
;
...
@@ -17,7 +20,6 @@ import org.aspectj.lang.annotation.Aspect;
...
@@ -17,7 +20,6 @@ import org.aspectj.lang.annotation.Aspect;
import
org.aspectj.lang.annotation.Before
;
import
org.aspectj.lang.annotation.Before
;
import
org.aspectj.lang.annotation.Pointcut
;
import
org.aspectj.lang.annotation.Pointcut
;
import
org.aspectj.lang.reflect.MethodSignature
;
import
org.aspectj.lang.reflect.MethodSignature
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.core.Ordered
;
import
org.springframework.core.Ordered
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -26,20 +28,33 @@ import java.util.Arrays;
...
@@ -26,20 +28,33 @@ import java.util.Arrays;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
static
com
.
example
.
fuzzControll
.
tools
.
system
.
GlobalClass
.
aflnetPersistenceService
;
@Aspect
@Aspect
@Component
@Component
@Slf4j
@Slf4j
public
class
IntegrationAop
implements
Ordered
{
public
class
IntegrationAop
implements
Ordered
{
SingleCmdTools
singleCmdTools
=
new
SingleCmdTools
();
@Pointcut
(
value
=
"@annotation(com.example.fuzzControll.annotion.NeedCutBefore)"
)
private
void
beforCut
()
{
}
@Pointcut
(
value
=
"@annotation(com.example.fuzzControll.annotion.NeedCutBefore)"
)
private
void
afterCut
()
{
}
@Pointcut
(
value
=
"@annotation(com.example.fuzzControll.annotion.NeedCut)"
)
@Pointcut
(
value
=
"@annotation(com.example.fuzzControll.annotion.NeedCut
Before
)"
)
private
void
c
ut
()
{
private
void
aroundC
ut
()
{
}
}
@Before
(
"cut()"
)
/**
* 用于aflnet测试相关的数据库操作
*/
@Before
(
"beforCut()"
)
private
void
before
(
JoinPoint
point
)
{
private
void
before
(
JoinPoint
point
)
{
List
<
String
>
needProcess
=
Arrays
.
asList
(
"aflnet"
);
/*负责获取反射对象*/
Signature
signature
=
point
.
getSignature
();
Signature
signature
=
point
.
getSignature
();
MethodSignature
methodSignature
=
null
;
MethodSignature
methodSignature
=
null
;
if
(!(
signature
instanceof
MethodSignature
))
{
if
(!(
signature
instanceof
MethodSignature
))
{
...
@@ -55,17 +70,21 @@ public class IntegrationAop implements Ordered {
...
@@ -55,17 +70,21 @@ public class IntegrationAop implements Ordered {
e
.
printStackTrace
();
e
.
printStackTrace
();
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
}
}
NeedCut
logotype
=
currentMethod
.
getAnnotation
(
NeedCut
.
class
);
NeedCutBefore
logotype
=
currentMethod
.
getAnnotation
(
NeedCutBefore
.
class
);
if
(
"before"
.
equals
(
logotype
.
moment
()))
{
//需要进行处理
/*aflnet相关处理逻辑,负责数据存入*/
if
(
"aflnet"
.
equals
(
logotype
.
name
()))
{
//aflnet测试信息存储
switch
(
logotype
.
name
())
{
int
missionId
=
GlobalParameters
.
missionInfoMapper
.
selectTopMissionId
()
+
1
;
case
"aflnet"
:
GlobalParameters
.
missionInfoMapper
.
insertMission
(
new
MissionInfo
(
missionId
,
TableClassEnum
.
AFLNET
.
getTableId
(),
new
Date
(),
GlobalParameters
.
aflnetData
.
get
(
"missionName"
),
aflnet
(
logotype
.
function
());
MissionStateEnum
.
RUNNING
.
getStateCode
(),
0L
));
break
;
}
case
"kitty"
:
kitty
(
logotype
.
function
());
break
;
default
:
throw
new
AflnetException
(
"Cut error: There is no name of anotation!"
);
}
}
}
}
@Around
(
"
c
ut()"
)
@Around
(
"
aroundC
ut()"
)
public
Object
around
(
ProceedingJoinPoint
point
)
throws
Throwable
{
public
Object
around
(
ProceedingJoinPoint
point
)
throws
Throwable
{
Signature
signature
=
point
.
getSignature
();
Signature
signature
=
point
.
getSignature
();
...
@@ -78,7 +97,7 @@ public class IntegrationAop implements Ordered {
...
@@ -78,7 +97,7 @@ public class IntegrationAop implements Ordered {
Object
target
=
point
.
getTarget
();
Object
target
=
point
.
getTarget
();
Method
currentMethod
=
target
.
getClass
().
getMethod
(
methodSignature
.
getName
(),
methodSignature
.
getParameterTypes
());
Method
currentMethod
=
target
.
getClass
().
getMethod
(
methodSignature
.
getName
(),
methodSignature
.
getParameterTypes
());
NeedCut
logotype
=
currentMethod
.
getAnnotation
(
NeedCut
.
class
);
NeedCut
Before
logotype
=
currentMethod
.
getAnnotation
(
NeedCutBefore
.
class
);
// if (datasource != null) {
// if (datasource != null) {
// DataSourceContextHolder.setDataSourceType(logotype.name());
// DataSourceContextHolder.setDataSourceType(logotype.name());
// log.debug("设置数据源为:" + datasource.name());
// log.debug("设置数据源为:" + datasource.name());
...
@@ -94,6 +113,62 @@ public class IntegrationAop implements Ordered {
...
@@ -94,6 +113,62 @@ public class IntegrationAop implements Ordered {
// }
// }
}
}
private
void
aflnet
(
String
function
)
{
if
(
function
==
null
||
""
.
equals
(
function
))
{
throw
new
AflnetException
(
"There is no value in function!"
);
}
if
(
"startBackup"
.
equals
(
function
))
{
/*存入alfnet启动时的任务信息*/
try
{
int
missionId
=
GlobalClass
.
missionInfoMapper
.
selectTopMissionId
()
+
1
;
SystemRunningParams
.
aflnetMissionId
=
missionId
;
GlobalClass
.
missionInfoMapper
.
insertMission
(
new
MissionInfo
(
missionId
,
TableClassEnum
.
AFLNET
.
getTableId
(),
new
Date
(),
SystemRunningParams
.
aflnetData
.
get
(
"missionName"
),
MissionStateEnum
.
RUNNING
.
getStateCode
(),
0L
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
MysqlException
(
"Aflnet start backup failed!"
);
}
}
else
if
(
"stopBackup"
.
equals
(
function
))
{
/*存入alfnet停止时的任务信息*/
new
Thread
(
new
Runnable
()
{
@Override
public
void
run
()
{
try
{
int
flag
=
0
;
/*压缩aflnet产生的测试文件,为存入数据库做准备*/
String
fileName
=
SystemRunningParams
.
aflnetData
.
get
(
"aflnetName"
);
String
fileZipName
=
fileName
+
".zip"
;
singleCmdTools
.
runCmd
(
CmdConstent
.
RUN_ZIP_FILE
+
fileZipName
+
" "
+
fileName
,
"zip file in testStart"
);
List
<
String
>
files
=
singleCmdTools
.
runCmd
(
CmdConstent
.
GET_FILE_NAME
+
GlobalClass
.
aflnetProperties
.
getOutputPath
(),
"getSeedFiles"
);
if
(!
files
.
contains
(
fileZipName
))
{
log
.
error
(
"File zip error!"
);
}
/*存入压缩包*/
while
(
files
.
contains
(
fileZipName
)
&&
flag
==
0
)
{
//当前存在压缩包,且没有存过才存入,循环是等待压缩完成 todo 感觉这里后期会出现问题
flag
=
aflnetPersistenceService
.
aflnetResultBackup
(
fileZipName
,
1
,
SystemRunningParams
.
testTimeMessage
.
get
(
"aflnet"
).
get
(
"end"
)
-
SystemRunningParams
.
testTimeMessage
.
get
(
"aflnet"
).
get
(
"start"
));
}
/*清除生成的文件*/
try
{
singleCmdTools
.
runCmd
(
CmdConstent
.
DELETE_FILE
+
fileName
,
"delete file"
);
singleCmdTools
.
runCmd
(
CmdConstent
.
DELETE_FILE
+
fileZipName
,
"delete zipFile"
);
}
catch
(
CmdException
e
)
{
e
.
printStackTrace
();
log
.
error
(
"file delete failed!"
);
}
log
.
info
(
"Aflnet Logs has been backuped!"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
MysqlException
(
"Aflnet after backup failed!"
);
}
}
}).
start
();
}
}
private
void
kitty
(
String
function
)
{
}
@Override
@Override
public
int
getOrder
()
{
public
int
getOrder
()
{
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/constents/CmdConstent.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
constents
;
package
com
.
example
.
fuzzControll
.
constents
;
import
com.example.fuzzControll.conf.SpringContextUtil
;
import
com.example.fuzzControll.tools.system.GlobalClass
;
import
com.example.fuzzControll.conf.KittyProperties
;
import
com.example.fuzzControll.tools.GlobalParameters
;
/**
* 系统内置命令
*/
public
class
CmdConstent
{
public
class
CmdConstent
{
public
static
final
String
GET_FILE_NAME
=
"ls -h "
;
public
static
final
String
GET_FILE_NAME
=
"ls -h "
;
public
static
final
String
DELETE_FILE
=
"rm -r "
;
public
static
final
String
DELETE_FILE
=
"rm -r "
;
public
static
final
String
COUNT_FILE
=
"ls -l | grep \"^-\" | wc -l"
;
public
static
final
String
COUNT_FILE
=
"ls -l | grep \"^-\" | wc -l"
;
public
static
final
String
COUNT_DIR
=
"ls -l | grep \"^d\" | wc -l"
;
public
static
final
String
COUNT_DIR
=
"ls -l | grep \"^d\" | wc -l"
;
public
static
final
String
RUN_AFLNET_BEFORE
=
"afl-fuzz -d -i "
+
Global
Parameter
s
.
aflnetProperties
.
getAflnetPath
()
+
"aflnet/tutorials/live555/in-rtsp -o "
+
public
static
final
String
RUN_AFLNET_BEFORE
=
"afl-fuzz -d -i "
+
Global
Clas
s
.
aflnetProperties
.
getAflnetPath
()
+
"aflnet/tutorials/live555/in-rtsp -o "
+
Global
Parameter
s
.
aflnetProperties
.
getOutputPath
();
Global
Clas
s
.
aflnetProperties
.
getOutputPath
();
public
static
final
String
RUN_AFLNET_AFTER
=
" -x "
+
Global
Parameter
s
.
aflnetProperties
.
getAflnetPath
()
+
"aflnet/tutorials/live555/rtsp.dict "
;
public
static
final
String
RUN_AFLNET_AFTER
=
" -x "
+
Global
Clas
s
.
aflnetProperties
.
getAflnetPath
()
+
"aflnet/tutorials/live555/rtsp.dict "
;
public
static
final
String
RUN_PING
=
"ping www.baidu.com"
;
public
static
final
String
RUN_PING
=
"ping www.baidu.com"
;
public
static
final
String
RUN_ZIP_FILE
=
"zip -r "
;
public
static
final
String
RUN_ZIP_FILE
=
"zip -r "
;
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/constents/LogicDeleteEnum.java
deleted
100644 → 0
View file @
deacd8b0
package
com
.
example
.
fuzzControll
.
constents
;
public
enum
LogicDeleteEnum
{
ALIVE
(
"alive"
,
0
),
LOGIC_DELETE
(
"logic_delete"
,
1
);
private
String
name
;
private
int
code
;
LogicDeleteEnum
(
String
name
,
int
code
)
{
this
.
name
=
name
;
this
.
code
=
code
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
int
getCode
()
{
return
code
;
}
public
void
setCode
(
int
code
)
{
this
.
code
=
code
;
}
}
fuzzIntegration/src/main/java/com/example/fuzzControll/constents/MissionStateEnum.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
constents
;
package
com
.
example
.
fuzzControll
.
constents
;
/**
* 任务运行状态枚举类
*/
public
enum
MissionStateEnum
{
public
enum
MissionStateEnum
{
DONE
(
"done"
,
1
),
DONE
(
"done"
,
1
),
RUNNING
(
"running"
,
2
),
RUNNING
(
"running"
,
2
),
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/constents/MutationConstent.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
constents
;
package
com
.
example
.
fuzzControll
.
constents
;
/**
* 变异脚本路径
*/
public
class
MutationConstent
{
public
class
MutationConstent
{
public
static
final
String
TEST_GRANULARITY_BIT_BYTE
=
"test_granularity_bit_byte.py "
;
public
static
final
String
TEST_GRANULARITY_BIT_BYTE
=
"test_granularity_bit_byte.py "
;
public
static
final
String
TEST_MUTATED_LIBS
=
"test_mutated_libs.py "
;
public
static
final
String
TEST_MUTATED_LIBS
=
"test_mutated_libs.py "
;
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/constents/ProtocolConstent.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
constents
;
package
com
.
example
.
fuzzControll
.
constents
;
/**
* 协议模板路径
*/
public
class
ProtocolConstent
{
public
class
ProtocolConstent
{
public
static
final
String
ARP
=
"arp_raw.py "
;
public
static
final
String
ARP
=
"arp_raw.py "
;
public
static
final
String
BGP
=
"bgp_tcp.py "
;
public
static
final
String
BGP
=
"bgp_tcp.py "
;
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/constents/ServerClassEnum.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
constents
;
package
com
.
example
.
fuzzControll
.
constents
;
/**
* aflnet目标服务路径
*/
public
enum
ServerClassEnum
{
public
enum
ServerClassEnum
{
RTSP
(
"rtsp"
,
"testOnDemandRTSPServer 8554"
),
RTSP
(
"rtsp"
,
"testOnDemandRTSPServer 8554"
),
FTP
(
"ftp"
,
"testOnDemandFTP 8554"
),
//error
FTP
(
"ftp"
,
"testOnDemandFTP 8554"
),
//error
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/constents/TableClassEnum.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
constents
;
package
com
.
example
.
fuzzControll
.
constents
;
/**
* 数据库表分类枚举
*/
public
enum
TableClassEnum
{
public
enum
TableClassEnum
{
AFLNET
(
"alfnetResult"
,
1
),
AFLNET
(
"alfnetResult"
,
1
),
KITTY_PACKAGE
(
"kittyPackageFile"
,
2
),
KITTY_PACKAGE
(
"kittyPackageFile"
,
2
),
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/controller/dataController/AflnetDataController.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
controller
.
dataController
;
package
com
.
example
.
fuzzControll
.
controller
.
dataController
;
import
com.example.fuzzControll.pojo.vo.AflnetDataParams
;
import
com.example.fuzzControll.domain.bo.AflnetDataParams
;
import
com.example.fuzzControll.pojo.vo.AjaxResult
;
import
com.example.fuzzControll.domain.vo.AjaxResult
;
import
com.example.fuzzControll.pojo.vo.KittyResult
;
import
com.example.fuzzControll.service.AflnetPersistenceService
;
import
com.example.fuzzControll.service.AflnetPersistenceService
;
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.*
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
@RestController
@RestController
@RequestMapping
(
"/aflnet"
)
@RequestMapping
(
"/aflnet"
)
@Slf4j
@Slf4j
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/controller/dataController/FuzzLogController.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
controller
.
dataController
;
package
com
.
example
.
fuzzControll
.
controller
.
dataController
;
import
com.example.fuzzControll.pojo.vo.AflnetDataParams
;
import
com.example.fuzzControll.domain.bo.FuzzLogTransEntity
;
import
com.example.fuzzControll.pojo.vo.AjaxResult
;
import
com.example.fuzzControll.pojo.vo.FuzzLogTransEntity
;
import
com.example.fuzzControll.service.FuzzLogService
;
import
com.example.fuzzControll.service.FuzzLogService
;
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.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.List
;
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/controller/dataController/KittyDataController.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
controller
.
dataController
;
package
com
.
example
.
fuzzControll
.
controller
.
dataController
;
import
com.example.fuzzControll.
pojo
.vo.AjaxResult
;
import
com.example.fuzzControll.
domain
.vo.AjaxResult
;
import
com.example.fuzzControll.
pojo.v
o.KittyDataParams
;
import
com.example.fuzzControll.
domain.b
o.KittyDataParams
;
import
com.example.fuzzControll.
pojo
.vo.KittyResult
;
import
com.example.fuzzControll.
domain
.vo.KittyResult
;
import
com.example.fuzzControll.service.KittyFuzzPersistenceService
;
import
com.example.fuzzControll.service.KittyFuzzPersistenceService
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/controller/KittyServerMessageController.java
→
fuzzIntegration/src/main/java/com/example/fuzzControll/controller/
dataController/
KittyServerMessageController.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
controller
;
package
com
.
example
.
fuzzControll
.
controller
.
dataController
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.example.fuzzControll.exception.ServerException
;
import
com.example.fuzzControll.exception.
serverException.
ServerException
;
import
com.example.fuzzControll.
pojo
.vo.AjaxResult
;
import
com.example.fuzzControll.
domain
.vo.AjaxResult
;
import
com.example.fuzzControll.service.GetServerMessageService
;
import
com.example.fuzzControll.service.GetServerMessageService
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -10,8 +10,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
...
@@ -10,8 +10,6 @@ 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
;
import
java.util.Arrays
;
/**
/**
* kitty服务器信息
* kitty服务器信息
*/
*/
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/controller/dataController/MissionInfoController.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
controller
.
dataController
;
package
com
.
example
.
fuzzControll
.
controller
.
dataController
;
import
com.example.fuzzControll.mapper.MissionInfoMapper
;
import
com.example.fuzzControll.mapper.MissionInfoMapper
;
import
com.example.fuzzControll.pojo.vo.AjaxResult
;
import
com.example.fuzzControll.domain.vo.AjaxResult
;
import
com.example.fuzzControll.pojo.vo.FuzzLogTransEntity
;
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.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
;
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/controller/SeedFileController.java
→
fuzzIntegration/src/main/java/com/example/fuzzControll/controller/
dataController/
SeedFileController.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
controller
;
package
com
.
example
.
fuzzControll
.
controller
.
dataController
;
import
com.example.fuzzControll.exception.CmdException
;
import
com.example.fuzzControll.exception.
testException.
CmdException
;
import
com.example.fuzzControll.exception.FileException
;
import
com.example.fuzzControll.exception.
fileExcption.
FileException
;
import
com.example.fuzzControll.
pojo
.vo.AjaxResult
;
import
com.example.fuzzControll.
domain
.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.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/controller/WebsocketController.java
→
fuzzIntegration/src/main/java/com/example/fuzzControll/controller/
dataController/
WebsocketController.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
controller
;
package
com
.
example
.
fuzzControll
.
controller
.
dataController
;
import
com.example.fuzzControll.service.websocketClientService
;
import
com.example.fuzzControll.service.websocketClientService
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -7,6 +7,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
...
@@ -7,6 +7,9 @@ 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
;
/**
* websocket 客户端
*/
@Slf4j
@Slf4j
@RestController
@RestController
@RequestMapping
(
"/websocket"
)
@RequestMapping
(
"/websocket"
)
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/controller/AlfnetController.java
→
fuzzIntegration/src/main/java/com/example/fuzzControll/controller/
testController/
AlfnetController.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
controller
;
package
com
.
example
.
fuzzControll
.
controller
.
testController
;
import
com.example.fuzzControll.exception.*
;
import
com.example.fuzzControll.exception.mysqlException.MysqlException
;
import
com.example.fuzzControll.pojo.vo.AjaxResult
;
import
com.example.fuzzControll.exception.testException.AflnetException
;
import
com.example.fuzzControll.pojo.vo.CmdStartParams
;
import
com.example.fuzzControll.exception.threadException.MyExceptionHandler
;
import
com.example.fuzzControll.domain.vo.AjaxResult
;
import
com.example.fuzzControll.domain.bo.CmdStartParams
;
import
com.example.fuzzControll.service.TestService
;
import
com.example.fuzzControll.service.TestService
;
import
com.example.fuzzControll.tools.GlobalParameters
;
import
com.example.fuzzControll.tools.system.GlobalClass
;
import
com.example.fuzzControll.tools.system.SystemRunningParams
;
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
;
...
@@ -29,18 +32,19 @@ public class AlfnetController {
...
@@ -29,18 +32,19 @@ public class AlfnetController {
public
AjaxResult
start
(
@RequestBody
final
CmdStartParams
cmdStartParams
)
{
public
AjaxResult
start
(
@RequestBody
final
CmdStartParams
cmdStartParams
)
{
//todo 捕获子线程错误
//todo 捕获子线程错误
try
{
try
{
GlobalParameter
s
.
aflnetData
.
put
(
"missionName"
,
cmdStartParams
.
getProtopcol
());
SystemRunningParam
s
.
aflnetData
.
put
(
"missionName"
,
cmdStartParams
.
getProtopcol
());
Thread
subThread
=
new
Thread
(
new
Runnable
()
{
Thread
subThread
=
new
Thread
(
new
Runnable
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
service
.
testStart
(
cmdStartParams
);
service
.
testStart
(
cmdStartParams
);
}
}
});
});
GlobalParameter
s
.
ThreadState
.
put
(
subThread
,
"start"
);
SystemRunningParam
s
.
ThreadState
.
put
(
subThread
,
"start"
);
subThread
.
setUncaughtExceptionHandler
(
new
MyExceptionHandler
());
subThread
.
setUncaughtExceptionHandler
(
new
MyExceptionHandler
());
subThread
.
start
();
subThread
.
start
();
subThread
.
join
();
// subThread.join();
if
(
"error"
.
equals
(
GlobalParameters
.
ThreadState
.
get
(
subThread
)))
{
Thread
.
sleep
(
1000
*
10
);
//暂停3s,让系统运行至指令完全运行 todo跟据系统运行设定时间
if
(
"error"
.
equals
(
SystemRunningParams
.
ThreadState
.
get
(
subThread
)))
{
//使用join串行就无法停止
throw
new
Exception
();
throw
new
Exception
();
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/controller/KittyController.java
→
fuzzIntegration/src/main/java/com/example/fuzzControll/controller/
testController/
KittyController.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
controller
;
package
com
.
example
.
fuzzControll
.
controller
.
testController
;
import
com.example.fuzzControll.exception.CmdException
;
import
com.example.fuzzControll.exception.
testException.
CmdException
;
import
com.example.fuzzControll.exception.FuzzException
;
import
com.example.fuzzControll.exception.
testException.
FuzzException
;
import
com.example.fuzzControll.
pojo
.vo.AjaxResult
;
import
com.example.fuzzControll.
domain
.vo.AjaxResult
;
import
com.example.fuzzControll.
pojo.v
o.TestEntity
;
import
com.example.fuzzControll.
domain.b
o.TestEntity
;
import
com.example.fuzzControll.service.GenerateMethodService
;
import
com.example.fuzzControll.service.GenerateMethodService
;
import
com.example.fuzzControll.service.MutationService
;
import
com.example.fuzzControll.service.MutationService
;
import
com.example.fuzzControll.service.ProtocolTemplateService
;
import
com.example.fuzzControll.service.ProtocolTemplateService
;
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/
pojo/v
o/AflnetDataParams.java
→
fuzzIntegration/src/main/java/com/example/fuzzControll/
domain/b
o/AflnetDataParams.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
pojo
.
v
o
;
package
com
.
example
.
fuzzControll
.
domain
.
b
o
;
import
lombok.Data
;
import
lombok.Data
;
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/
pojo/v
o/CmdStartParams.java
→
fuzzIntegration/src/main/java/com/example/fuzzControll/
domain/b
o/CmdStartParams.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
pojo
.
v
o
;
package
com
.
example
.
fuzzControll
.
domain
.
b
o
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.Getter
;
import
lombok.Getter
;
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/
pojo/v
o/FuzzLogTransEntity.java
→
fuzzIntegration/src/main/java/com/example/fuzzControll/
domain/b
o/FuzzLogTransEntity.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
pojo
.
v
o
;
package
com
.
example
.
fuzzControll
.
domain
.
b
o
;
import
lombok.Data
;
import
lombok.Data
;
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/
pojo/v
o/KittyDataParams.java
→
fuzzIntegration/src/main/java/com/example/fuzzControll/
domain/b
o/KittyDataParams.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
pojo
.
v
o
;
package
com
.
example
.
fuzzControll
.
domain
.
b
o
;
import
lombok.Data
;
import
lombok.Data
;
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/
pojo/v
o/TestEntity.java
→
fuzzIntegration/src/main/java/com/example/fuzzControll/
domain/b
o/TestEntity.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
pojo
.
v
o
;
package
com
.
example
.
fuzzControll
.
domain
.
b
o
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.Getter
;
import
lombok.Getter
;
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/
pojo/v
o/MissionInfo.java
→
fuzzIntegration/src/main/java/com/example/fuzzControll/
domain/p
o/MissionInfo.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
pojo
.
v
o
;
package
com
.
example
.
fuzzControll
.
domain
.
p
o
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
lombok.Data
;
import
lombok.Data
;
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/
pojo
/vo/AflnetResult.java
→
fuzzIntegration/src/main/java/com/example/fuzzControll/
domain
/vo/AflnetResult.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
pojo
.
vo
;
package
com
.
example
.
fuzzControll
.
domain
.
vo
;
import
lombok.Data
;
import
lombok.Data
;
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/
pojo
/vo/AjaxResult.java
→
fuzzIntegration/src/main/java/com/example/fuzzControll/
domain
/vo/AjaxResult.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
pojo
.
vo
;
package
com
.
example
.
fuzzControll
.
domain
.
vo
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/
pojo
/vo/KittyPackageFile.java
→
fuzzIntegration/src/main/java/com/example/fuzzControll/
domain
/vo/KittyPackageFile.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
pojo
.
vo
;
package
com
.
example
.
fuzzControll
.
domain
.
vo
;
import
lombok.Data
;
import
lombok.Data
;
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/
pojo
/vo/KittyResult.java
→
fuzzIntegration/src/main/java/com/example/fuzzControll/
domain
/vo/KittyResult.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
pojo
.
vo
;
package
com
.
example
.
fuzzControll
.
domain
.
vo
;
import
lombok.Data
;
import
lombok.Data
;
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/
pojo
/vo/TestReturnEntity.java
→
fuzzIntegration/src/main/java/com/example/fuzzControll/
domain
/vo/TestReturnEntity.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
pojo
.
vo
;
package
com
.
example
.
fuzzControll
.
domain
.
vo
;
import
lombok.Data
;
import
lombok.Data
;
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/exception/FileException.java
→
fuzzIntegration/src/main/java/com/example/fuzzControll/exception/
fileExcption/
FileException.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
exception
;
package
com
.
example
.
fuzzControll
.
exception
.
fileExcption
;
import
com.example.fuzzControll.exception.BaseException
;
/**
/**
* 文件操作异常
* 文件操作异常
*/
*/
public
class
FileException
extends
BaseException
{
public
class
FileException
extends
BaseException
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
public
FileException
(
String
defaultMessage
)
{
public
FileException
(
String
defaultMessage
)
{
super
(
defaultMessage
,
"file"
);
super
(
defaultMessage
,
"file"
);
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/exception/MysqlException.java
→
fuzzIntegration/src/main/java/com/example/fuzzControll/exception/
mysqlException/
MysqlException.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
exception
;
package
com
.
example
.
fuzzControll
.
exception
.
mysqlException
;
public
class
MysqlException
extends
BaseException
{
import
com.example.fuzzControll.exception.BaseException
;
public
class
MysqlException
extends
BaseException
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
public
MysqlException
(
String
defaultMessage
)
{
public
MysqlException
(
String
defaultMessage
)
{
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/exception/ServerException.java
→
fuzzIntegration/src/main/java/com/example/fuzzControll/exception/
serverException/
ServerException.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
exception
;
package
com
.
example
.
fuzzControll
.
exception
.
serverException
;
public
class
ServerException
extends
BaseException
{
import
com.example.fuzzControll.exception.BaseException
;
public
class
ServerException
extends
BaseException
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
public
ServerException
(
String
defaultMessage
)
{
public
ServerException
(
String
defaultMessage
)
{
super
(
defaultMessage
,
"server"
);
super
(
defaultMessage
,
"server"
);
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/exception/AflnetException.java
→
fuzzIntegration/src/main/java/com/example/fuzzControll/exception/
testException/
AflnetException.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
exception
;
package
com
.
example
.
fuzzControll
.
exception
.
testException
;
public
class
AflnetException
extends
BaseException
{
import
com.example.fuzzControll.exception.BaseException
;
public
class
AflnetException
extends
BaseException
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
public
AflnetException
(
String
defaultMessage
)
{
public
AflnetException
(
String
defaultMessage
)
{
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/exception/CmdException.java
→
fuzzIntegration/src/main/java/com/example/fuzzControll/exception/
testException/
CmdException.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
exception
;
package
com
.
example
.
fuzzControll
.
exception
.
testException
;
import
com.example.fuzzControll.exception.BaseException
;
/**
/**
* cmd运行异常
* cmd运行异常
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/exception/FuzzException.java
→
fuzzIntegration/src/main/java/com/example/fuzzControll/exception/
testException/
FuzzException.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
exception
;
package
com
.
example
.
fuzzControll
.
exception
.
testException
;
public
class
FuzzException
extends
BaseException
{
import
com.example.fuzzControll.exception.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
,
"lock"
);
super
(
defaultMessage
,
"lock"
);
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/exception/LockException.java
→
fuzzIntegration/src/main/java/com/example/fuzzControll/exception/
threadException/
LockException.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
exception
;
package
com
.
example
.
fuzzControll
.
exception
.
threadException
;
public
class
LockException
extends
BaseException
{
import
com.example.fuzzControll.exception.BaseException
;
public
class
LockException
extends
BaseException
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
public
LockException
(
String
defaultMessage
)
{
public
LockException
(
String
defaultMessage
)
{
super
(
defaultMessage
,
"fuzz"
);
super
(
defaultMessage
,
"fuzz"
);
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/exception/MyExceptionHandler.java
→
fuzzIntegration/src/main/java/com/example/fuzzControll/exception/
threadException/
MyExceptionHandler.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
exception
;
package
com
.
example
.
fuzzControll
.
exception
.
threadException
;
import
com.example.fuzzControll.tools.
GlobalParameter
s
;
import
com.example.fuzzControll.tools.
system.GlobalClas
s
;
import
org.springframework.context.annotation.Bean
;
import
com.example.fuzzControll.tools.system.SystemRunningParams
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
@Configuration
@Configuration
...
@@ -10,7 +10,7 @@ public class MyExceptionHandler implements Thread.UncaughtExceptionHandler
...
@@ -10,7 +10,7 @@ public class MyExceptionHandler implements Thread.UncaughtExceptionHandler
@Override
@Override
public
void
uncaughtException
(
Thread
t
,
Throwable
e
)
public
void
uncaughtException
(
Thread
t
,
Throwable
e
)
{
{
GlobalParameter
s
.
ThreadState
.
put
(
t
,
"error"
);
SystemRunningParam
s
.
ThreadState
.
put
(
t
,
"error"
);
}
}
}
}
fuzzIntegration/src/main/java/com/example/fuzzControll/inital/SystemInitial.java
0 → 100644
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
inital
;
import
com.example.fuzzControll.tools.system.SystemRunningParams
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.PostConstruct
;
/**
* 系统全局初始化
*/
@Component
public
class
SystemInitial
{
@PostConstruct
public
void
doConstruct
()
throws
Exception
{
SystemRunningParams
.
init
();
}
}
fuzzIntegration/src/main/java/com/example/fuzzControll/mapper/AflnetMapper.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
mapper
;
package
com
.
example
.
fuzzControll
.
mapper
;
import
com.example.fuzzControll.pojo.vo.AflnetResult
;
import
com.example.fuzzControll.domain.vo.AflnetResult
;
import
com.example.fuzzControll.pojo.vo.KittyResult
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
@Mapper
@Mapper
@Component
(
"AflnetMapper"
)
@Component
(
"AflnetMapper"
)
public
interface
AflnetMapper
{
public
interface
AflnetMapper
{
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/mapper/KittyMapper.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
mapper
;
package
com
.
example
.
fuzzControll
.
mapper
;
import
com.example.fuzzControll.
pojo
.vo.KittyResult
;
import
com.example.fuzzControll.
domain
.vo.KittyResult
;
import
com.example.fuzzControll.
pojo
.vo.KittyPackageFile
;
import
com.example.fuzzControll.
domain
.vo.KittyPackageFile
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/mapper/MissionInfoMapper.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
mapper
;
package
com
.
example
.
fuzzControll
.
mapper
;
import
com.example.fuzzControll.
pojo.v
o.MissionInfo
;
import
com.example.fuzzControll.
domain.p
o.MissionInfo
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -21,4 +21,6 @@ public interface MissionInfoMapper {
...
@@ -21,4 +21,6 @@ public interface MissionInfoMapper {
int
selectTopMissionId
();
int
selectTopMissionId
();
void
insertMission
(
MissionInfo
missionInfo
);
void
insertMission
(
MissionInfo
missionInfo
);
void
updateMission
(
int
state
,
Long
runTime
,
int
missionId
);
}
}
fuzzIntegration/src/main/java/com/example/fuzzControll/pojo/vo/KittyLog.java
deleted
100644 → 0
View file @
deacd8b0
package
com
.
example
.
fuzzControll
.
pojo
.
vo
;
public
class
KittyLog
{
int
id
;
}
fuzzIntegration/src/main/java/com/example/fuzzControll/service/AflnetPersistenceService.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
service
;
package
com
.
example
.
fuzzControll
.
service
;
public
interface
AflnetPersistenceService
{
public
interface
AflnetPersistenceService
{
public
int
aflnetResultBackup
(
String
filename
,
String
missionName
,
int
state
,
int
logicDelete
,
Long
runTime
);
public
int
aflnetResultBackup
(
String
filename
,
int
state
,
Long
runTime
);
public
void
loadInFile
(
int
missionId
,
String
filePath
);
public
void
loadInFile
(
int
missionId
,
String
filePath
);
}
}
fuzzIntegration/src/main/java/com/example/fuzzControll/service/FuzzLogService.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
service
;
package
com
.
example
.
fuzzControll
.
service
;
import
com.example.fuzzControll.
pojo.v
o.FuzzLogTransEntity
;
import
com.example.fuzzControll.
domain.b
o.FuzzLogTransEntity
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
import
java.util.List
;
public
interface
FuzzLogService
{
public
interface
FuzzLogService
{
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/service/GenerateMethodService.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
service
;
package
com
.
example
.
fuzzControll
.
service
;
import
com.example.fuzzControll.
pojo.v
o.TestEntity
;
import
com.example.fuzzControll.
domain.b
o.TestEntity
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/service/KittyFuzzPersistenceService.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
service
;
package
com
.
example
.
fuzzControll
.
service
;
import
com.example.fuzzControll.
pojo.v
o.KittyDataParams
;
import
com.example.fuzzControll.
domain.b
o.KittyDataParams
;
import
com.example.fuzzControll.
pojo
.vo.KittyResult
;
import
com.example.fuzzControll.
domain
.vo.KittyResult
;
import
java.util.List
;
import
java.util.List
;
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/service/MutationService.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
service
;
package
com
.
example
.
fuzzControll
.
service
;
import
com.example.fuzzControll.
pojo.v
o.TestEntity
;
import
com.example.fuzzControll.
domain.b
o.TestEntity
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/service/ProtocolTemplateService.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
service
;
package
com
.
example
.
fuzzControll
.
service
;
import
com.example.fuzzControll.
pojo.v
o.TestEntity
;
import
com.example.fuzzControll.
domain.b
o.TestEntity
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/service/TestService.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
service
;
package
com
.
example
.
fuzzControll
.
service
;
import
com.example.fuzzControll.pojo.vo.CmdStartParams
;
import
com.example.fuzzControll.domain.bo.CmdStartParams
;
import
java.util.concurrent.CountDownLatch
;
public
interface
TestService
{
public
interface
TestService
{
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/service/VulnerabilityTypeService.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
service
;
package
com
.
example
.
fuzzControll
.
service
;
import
com.example.fuzzControll.
pojo.v
o.TestEntity
;
import
com.example.fuzzControll.
domain.b
o.TestEntity
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/service/impl/AflnetPersistenceServiceImpl.java
View file @
267c45e2
...
@@ -2,14 +2,14 @@ package com.example.fuzzControll.service.impl;
...
@@ -2,14 +2,14 @@ package com.example.fuzzControll.service.impl;
import
com.example.fuzzControll.conf.AflnetProperties
;
import
com.example.fuzzControll.conf.AflnetProperties
;
import
com.example.fuzzControll.constents.TableClassEnum
;
import
com.example.fuzzControll.constents.TableClassEnum
;
import
com.example.fuzzControll.exception.MysqlException
;
import
com.example.fuzzControll.exception.
mysqlException.
MysqlException
;
import
com.example.fuzzControll.mapper.AflnetMapper
;
import
com.example.fuzzControll.mapper.AflnetMapper
;
import
com.example.fuzzControll.mapper.MissionInfoMapper
;
import
com.example.fuzzControll.mapper.MissionInfoMapper
;
import
com.example.fuzzControll.pojo.vo.AflnetResult
;
import
com.example.fuzzControll.domain.vo.AflnetResult
;
import
com.example.fuzzControll.pojo.vo.KittyResult
;
import
com.example.fuzzControll.domain.po.MissionInfo
;
import
com.example.fuzzControll.pojo.vo.MissionInfo
;
import
com.example.fuzzControll.service.AflnetPersistenceService
;
import
com.example.fuzzControll.service.AflnetPersistenceService
;
import
com.example.fuzzControll.tools.FileTools
;
import
com.example.fuzzControll.tools.file.FileTools
;
import
com.example.fuzzControll.tools.system.SystemRunningParams
;
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.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -29,8 +29,8 @@ public class AflnetPersistenceServiceImpl implements AflnetPersistenceService {
...
@@ -29,8 +29,8 @@ public class AflnetPersistenceServiceImpl implements AflnetPersistenceService {
FileTools
fileTools
=
new
FileTools
();
FileTools
fileTools
=
new
FileTools
();
@Override
@Override
public
int
aflnetResultBackup
(
String
filename
,
String
missionName
,
int
state
,
int
logicDelete
,
Long
runTime
)
{
public
int
aflnetResultBackup
(
String
filename
,
int
state
,
Long
runTime
)
{
return
mysqlTransaction
(
filename
,
missionName
,
state
,
logicDelete
,
runTime
);
return
mysqlTransaction
(
filename
,
state
,
runTime
);
}
}
@Override
@Override
...
@@ -46,11 +46,11 @@ public class AflnetPersistenceServiceImpl implements AflnetPersistenceService {
...
@@ -46,11 +46,11 @@ public class AflnetPersistenceServiceImpl implements AflnetPersistenceService {
}
}
@Transactional
(
rollbackFor
=
MysqlException
.
class
)
@Transactional
(
rollbackFor
=
MysqlException
.
class
)
public
int
mysqlTransaction
(
String
filename
,
String
missionName
,
int
state
,
int
logicDelete
,
Long
runTime
)
{
public
int
mysqlTransaction
(
String
filename
,
int
state
,
Long
runTime
)
{
int
topMissionId
=
missionInfoMapper
.
selectTopMissionId
()
+
1
;
//获取最新
的missionId
int
aflnetMissionId
=
SystemRunningParams
.
aflnetMissionId
;
//获取系统正在操作的aflnet
的missionId
AflnetResult
result
=
new
AflnetResult
(
top
MissionId
,
fileTools
.
fileReadAndTranstoBytes
(
aflnetProperties
.
getOutputPath
(),
filename
),
filename
);
AflnetResult
result
=
new
AflnetResult
(
aflnet
MissionId
,
fileTools
.
fileReadAndTranstoBytes
(
aflnetProperties
.
getOutputPath
(),
filename
),
filename
);
aflnetMapper
.
aflnetOutputBackup
(
result
);
//存入日志文件
aflnetMapper
.
aflnetOutputBackup
(
result
);
//存入日志文件
missionInfoMapper
.
insertMission
(
new
MissionInfo
(
topMissionId
,
TableClassEnum
.
AFLNET
.
getTableId
(),
new
Date
(),
missionName
,
state
,
runTime
));
//插入任务信息
missionInfoMapper
.
updateMission
(
state
,
runTime
,
aflnetMissionId
);
//更新该次任务的执行时间
return
1
;
return
1
;
}
}
}
}
fuzzIntegration/src/main/java/com/example/fuzzControll/service/impl/FuzzLogServiceImpl.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
service
.
impl
;
package
com
.
example
.
fuzzControll
.
service
.
impl
;
import
com.example.fuzzControll.exception.MysqlException
;
import
com.example.fuzzControll.domain.vo.AflnetResult
;
import
com.example.fuzzControll.domain.bo.FuzzLogTransEntity
;
import
com.example.fuzzControll.domain.vo.KittyResult
;
import
com.example.fuzzControll.domain.po.MissionInfo
;
import
com.example.fuzzControll.exception.mysqlException.MysqlException
;
import
com.example.fuzzControll.mapper.AflnetMapper
;
import
com.example.fuzzControll.mapper.AflnetMapper
;
import
com.example.fuzzControll.mapper.KittyMapper
;
import
com.example.fuzzControll.mapper.KittyMapper
;
import
com.example.fuzzControll.mapper.MissionInfoMapper
;
import
com.example.fuzzControll.mapper.MissionInfoMapper
;
import
com.example.fuzzControll.pojo.vo.*
;
import
com.example.fuzzControll.service.FuzzLogService
;
import
com.example.fuzzControll.service.FuzzLogService
;
import
com.example.fuzzControll.tools.FileTools
;
import
com.example.fuzzControll.tools.
file.
FileTools
;
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.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/service/impl/GenerateMethodServiceImpl.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
service
.
impl
;
package
com
.
example
.
fuzzControll
.
service
.
impl
;
import
com.example.fuzzControll.conf.KittyProperties
;
import
com.example.fuzzControll.conf.KittyProperties
;
import
com.example.fuzzControll.exception.CmdException
;
import
com.example.fuzzControll.exception.
testException.
CmdException
;
import
com.example.fuzzControll.exception.FuzzException
;
import
com.example.fuzzControll.exception.
testException.
FuzzException
;
import
com.example.fuzzControll.
pojo.v
o.TestEntity
;
import
com.example.fuzzControll.
domain.b
o.TestEntity
;
import
com.example.fuzzControll.service.GenerateMethodService
;
import
com.example.fuzzControll.service.GenerateMethodService
;
import
com.example.fuzzControll.tools.CmdTools
;
import
com.example.fuzzControll.tools.
test.
CmdTools
;
import
com.example.fuzzControll.tools.TestTools
;
import
com.example.fuzzControll.tools.
test.
TestTools
;
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.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/service/impl/GetServerMessageImpl.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
service
.
impl
;
package
com
.
example
.
fuzzControll
.
service
.
impl
;
import
com.example.fuzzControll.conf.KittyProperties
;
import
com.example.fuzzControll.conf.KittyProperties
;
import
com.example.fuzzControll.exception.ServerException
;
import
com.example.fuzzControll.exception.
serverException.
ServerException
;
import
com.example.fuzzControll.service.GetServerMessageService
;
import
com.example.fuzzControll.service.GetServerMessageService
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.http.client.methods.CloseableHttpResponse
;
import
org.apache.http.client.methods.CloseableHttpResponse
;
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/service/impl/KittyFuzzPersistenceServiceImpl.java
View file @
267c45e2
...
@@ -2,14 +2,14 @@ package com.example.fuzzControll.service.impl;
...
@@ -2,14 +2,14 @@ package com.example.fuzzControll.service.impl;
import
com.example.fuzzControll.conf.KittyProperties
;
import
com.example.fuzzControll.conf.KittyProperties
;
import
com.example.fuzzControll.constents.CmdConstent
;
import
com.example.fuzzControll.constents.CmdConstent
;
import
com.example.fuzzControll.exception.MysqlException
;
import
com.example.fuzzControll.exception.
mysqlException.
MysqlException
;
import
com.example.fuzzControll.mapper.KittyMapper
;
import
com.example.fuzzControll.mapper.KittyMapper
;
import
com.example.fuzzControll.
pojo.v
o.KittyDataParams
;
import
com.example.fuzzControll.
domain.b
o.KittyDataParams
;
import
com.example.fuzzControll.
pojo
.vo.KittyResult
;
import
com.example.fuzzControll.
domain
.vo.KittyResult
;
import
com.example.fuzzControll.
pojo
.vo.KittyPackageFile
;
import
com.example.fuzzControll.
domain
.vo.KittyPackageFile
;
import
com.example.fuzzControll.service.KittyFuzzPersistenceService
;
import
com.example.fuzzControll.service.KittyFuzzPersistenceService
;
import
com.example.fuzzControll.tools.CmdTools
;
import
com.example.fuzzControll.tools.
test.
CmdTools
;
import
com.example.fuzzControll.tools.FileTools
;
import
com.example.fuzzControll.tools.
file.
FileTools
;
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.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/service/impl/MutationServiceImpl.java
View file @
267c45e2
...
@@ -2,12 +2,12 @@ package com.example.fuzzControll.service.impl;
...
@@ -2,12 +2,12 @@ package com.example.fuzzControll.service.impl;
import
com.example.fuzzControll.conf.KittyProperties
;
import
com.example.fuzzControll.conf.KittyProperties
;
import
com.example.fuzzControll.constents.MutationConstent
;
import
com.example.fuzzControll.constents.MutationConstent
;
import
com.example.fuzzControll.exception.CmdException
;
import
com.example.fuzzControll.exception.
testException.
CmdException
;
import
com.example.fuzzControll.exception.FuzzException
;
import
com.example.fuzzControll.exception.
testException.
FuzzException
;
import
com.example.fuzzControll.
pojo.v
o.TestEntity
;
import
com.example.fuzzControll.
domain.b
o.TestEntity
;
import
com.example.fuzzControll.service.MutationService
;
import
com.example.fuzzControll.service.MutationService
;
import
com.example.fuzzControll.tools.CmdTools
;
import
com.example.fuzzControll.tools.
test.
CmdTools
;
import
com.example.fuzzControll.tools.TestTools
;
import
com.example.fuzzControll.tools.
test.
TestTools
;
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.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/service/impl/ProtocolTemplateImpl.java
View file @
267c45e2
...
@@ -4,13 +4,13 @@ package com.example.fuzzControll.service.impl;
...
@@ -4,13 +4,13 @@ package com.example.fuzzControll.service.impl;
import
com.example.fuzzControll.conf.KittyProperties
;
import
com.example.fuzzControll.conf.KittyProperties
;
import
com.example.fuzzControll.constents.CmdConstent
;
import
com.example.fuzzControll.constents.CmdConstent
;
import
com.example.fuzzControll.constents.ProtocolConstent
;
import
com.example.fuzzControll.constents.ProtocolConstent
;
import
com.example.fuzzControll.exception.CmdException
;
import
com.example.fuzzControll.exception.
testException.
CmdException
;
import
com.example.fuzzControll.exception.FuzzException
;
import
com.example.fuzzControll.exception.
testException.
FuzzException
;
import
com.example.fuzzControll.
pojo.v
o.TestEntity
;
import
com.example.fuzzControll.
domain.b
o.TestEntity
;
import
com.example.fuzzControll.service.ProtocolTemplateService
;
import
com.example.fuzzControll.service.ProtocolTemplateService
;
import
com.example.fuzzControll.tools.CmdTools
;
import
com.example.fuzzControll.tools.
test.
CmdTools
;
import
com.example.fuzzControll.tools.
GlobalParameter
s
;
import
com.example.fuzzControll.tools.
system.GlobalClas
s
;
import
com.example.fuzzControll.tools.TestTools
;
import
com.example.fuzzControll.tools.
test.
TestTools
;
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.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -28,7 +28,7 @@ public class ProtocolTemplateImpl implements ProtocolTemplateService {
...
@@ -28,7 +28,7 @@ public class ProtocolTemplateImpl implements ProtocolTemplateService {
@Override
@Override
public
Map
<
String
,
List
<
String
>>
generation
(
TestEntity
testEntity
,
int
missionId
)
throws
FuzzException
,
CmdException
{
public
Map
<
String
,
List
<
String
>>
generation
(
TestEntity
testEntity
,
int
missionId
)
throws
FuzzException
,
CmdException
{
/*生成日志前先清除日志*/
/*生成日志前先清除日志*/
cmdTools
.
runCmd
(
CmdConstent
.
DELETE_FILE
+
Global
Parameter
s
.
kittyProperties
.
getLogOutPath
(),
"delete kittyLogs"
);
cmdTools
.
runCmd
(
CmdConstent
.
DELETE_FILE
+
Global
Clas
s
.
kittyProperties
.
getLogOutPath
(),
"delete kittyLogs"
);
String
cmd
=
parseParameters
(
testEntity
);
String
cmd
=
parseParameters
(
testEntity
);
if
(
cmd
==
null
||
cmd
.
equals
(
""
))
{
if
(
cmd
==
null
||
cmd
.
equals
(
""
))
{
throw
new
FuzzException
(
"cmd is null ! The number of parameters does not match!"
);
throw
new
FuzzException
(
"cmd is null ! The number of parameters does not match!"
);
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/service/impl/SeedFileServiceImpl.java
View file @
267c45e2
...
@@ -2,21 +2,17 @@ package com.example.fuzzControll.service.impl;
...
@@ -2,21 +2,17 @@ package com.example.fuzzControll.service.impl;
import
com.example.fuzzControll.conf.AflnetProperties
;
import
com.example.fuzzControll.conf.AflnetProperties
;
import
com.example.fuzzControll.constents.CmdConstent
;
import
com.example.fuzzControll.constents.CmdConstent
;
import
com.example.fuzzControll.exception.CmdException
;
import
com.example.fuzzControll.exception.testException.CmdException
;
import
com.example.fuzzControll.exception.FileException
;
import
com.example.fuzzControll.exception.fileExcption.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.
test.
CmdTools
;
import
com.example.fuzzControll.tools.FileTools
;
import
com.example.fuzzControll.tools.
file.
FileTools
;
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.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.List
;
import
java.util.List
;
import
java.util.concurrent.CountDownLatch
;
import
java.util.concurrent.locks.ReentrantLock
;
@Slf4j
@Slf4j
@Service
@Service
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/service/impl/TestServiceImpl.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
service
.
impl
;
package
com
.
example
.
fuzzControll
.
service
.
impl
;
import
com.example.fuzzControll.annotion.NeedCutBefore
;
import
com.example.fuzzControll.conf.AflnetProperties
;
import
com.example.fuzzControll.conf.AflnetProperties
;
import
com.example.fuzzControll.conf.SpringContextUtil
;
import
com.example.fuzzControll.conf.KittyProperties
;
import
com.example.fuzzControll.constents.CmdConstent
;
import
com.example.fuzzControll.constents.CmdConstent
;
import
com.example.fuzzControll.exception.AflnetException
;
import
com.example.fuzzControll.exception.
testException.
AflnetException
;
import
com.example.fuzzControll.exception.CmdException
;
import
com.example.fuzzControll.exception.
testException.
CmdException
;
import
com.example.fuzzControll.
pojo.v
o.CmdStartParams
;
import
com.example.fuzzControll.
domain.b
o.CmdStartParams
;
import
com.example.fuzzControll.service.AflnetPersistenceService
;
import
com.example.fuzzControll.service.AflnetPersistenceService
;
import
com.example.fuzzControll.service.TestService
;
import
com.example.fuzzControll.service.TestService
;
import
com.example.fuzzControll.tools.CmdTools
;
import
com.example.fuzzControll.tools.test.CmdTools
;
import
com.example.fuzzControll.tools.GlobalParameters
;
import
com.example.fuzzControll.tools.system.GlobalClass
;
import
com.example.fuzzControll.tools.TestControlTools
;
import
com.example.fuzzControll.tools.test.TestControlTools
;
import
com.example.fuzzControll.tools.system.SystemRunningParams
;
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.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -20,14 +20,13 @@ import java.text.DateFormat;
...
@@ -20,14 +20,13 @@ import java.text.DateFormat;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.concurrent.CountDownLatch
;
@Service
(
"testService"
)
@Service
(
"testService"
)
@Slf4j
@Slf4j
public
class
TestServiceImpl
implements
TestService
{
public
class
TestServiceImpl
implements
TestService
{
@Autowired
@Autowired
CmdTools
cmdTools
;
CmdTools
cmdTools
;
@Autowired
@Autowired
AflnetPersistenceService
aflnetPersistenceService
;
AflnetPersistenceService
aflnetPersistenceService
;
...
@@ -37,55 +36,25 @@ public class TestServiceImpl implements TestService {
...
@@ -37,55 +36,25 @@ public class TestServiceImpl implements TestService {
//todo 不同服务不同端口
//todo 不同服务不同端口
@Override
@Override
public
void
testStart
(
CmdStartParams
cmdStartParams
)
throws
AflnetException
,
CmdException
{
public
void
testStart
(
CmdStartParams
cmdStartParams
)
throws
AflnetException
,
CmdException
{
/*拼接指令*/
TestControlTools
.
setIsRunning
(
true
);
TestControlTools
.
setIsRunning
(
true
);
String
cmd
=
cmdTools
.
parse
(
cmdStartParams
);
String
cmd
=
cmdTools
.
parse
(
cmdStartParams
);
Date
date
=
new
Date
();
Date
date
=
new
Date
();
DateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd-hh-mm-ss-"
);
DateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd-hh-mm-ss-"
);
String
outputFileName
=
df
.
format
(
date
)
+
cmdStartParams
.
getProtopcol
()
+
"-output"
;
String
outputFileName
=
df
.
format
(
date
)
+
cmdStartParams
.
getProtopcol
()
+
"-output"
;
String
finalCmd
=
CmdConstent
.
RUN_AFLNET_BEFORE
+
outputFileName
+
CmdConstent
.
RUN_AFLNET_AFTER
+
cmd
+
aflnetProperties
.
getAflnetPath
()
+
"live555/testProgs/"
+
"testOnDemandRTSPServer 8554"
;
String
finalCmd
=
CmdConstent
.
RUN_AFLNET_BEFORE
+
outputFileName
+
CmdConstent
.
RUN_AFLNET_AFTER
+
cmd
+
aflnetProperties
.
getAflnetPath
()
+
"live555/testProgs/"
+
"testOnDemandRTSPServer 8554"
;
GlobalParameter
s
.
aflnetData
.
put
(
"aflnetName"
,
outputFileName
);
SystemRunningParam
s
.
aflnetData
.
put
(
"aflnetName"
,
outputFileName
);
log
.
info
(
"The cmd is [{}]"
,
finalCmd
);
log
.
info
(
"The cmd is [{}]"
,
finalCmd
);
/*执行指令*/
System
.
out
.
println
(
"testStart"
);
cmdTools
.
runProgramCmd
(
finalCmd
,
outputFileName
+
".zip"
);
cmdTools
.
runProgramCmd
(
finalCmd
,
outputFileName
+
".zip"
);
}
}
@Override
@Override
@NeedCutBefore
(
name
=
"aflnet"
,
function
=
"stopBackup"
)
//停止时完成数据入库
public
void
testStop
()
{
public
void
testStop
()
{
TestControlTools
.
setIsRunning
(
false
);
TestControlTools
.
setIsRunning
(
false
);
//指令终止 todo 后期需要考虑,发送终止指令停止测试
GlobalParameters
.
testTimeMessage
.
get
(
"aflnet"
).
put
(
"end"
,
System
.
currentTimeMillis
());
SystemRunningParams
.
testTimeMessage
.
get
(
"aflnet"
).
put
(
"end"
,
System
.
currentTimeMillis
());
//指令停止时间
log
.
info
(
"Aflnet has been stopped ! "
);
log
.
info
(
"Aflnet has been stopped ! "
);
try
{
new
Thread
(
new
Runnable
()
{
@Override
public
void
run
()
{
int
flag
=
0
;
String
fileName
=
GlobalParameters
.
aflnetData
.
get
(
"aflnetName"
);
String
fileZipName
=
fileName
+
".zip"
;
cmdTools
.
runCmd
(
CmdConstent
.
RUN_ZIP_FILE
+
fileZipName
+
" "
+
fileName
,
"zip file in testStart"
);
List
<
String
>
files
=
cmdTools
.
runCmd
(
CmdConstent
.
GET_FILE_NAME
+
aflnetProperties
.
getOutputPath
(),
"getSeedFiles"
);
files
.
stream
().
forEach
(
System
.
out
::
println
);
if
(!
files
.
contains
(
fileZipName
))
{
log
.
error
(
"File zip error!"
);
}
while
(
files
.
contains
(
fileZipName
)
&&
flag
==
0
)
{
//当前存在压缩包才存入
flag
=
aflnetPersistenceService
.
aflnetResultBackup
(
fileZipName
,
GlobalParameters
.
aflnetData
.
get
(
"missionName"
),
1
,
0
,
GlobalParameters
.
testTimeMessage
.
get
(
"aflnet"
).
get
(
"end"
)-
GlobalParameters
.
testTimeMessage
.
get
(
"aflnet"
).
get
(
"start"
));
}
/*清除生成的文件*/
try
{
cmdTools
.
runCmd
(
CmdConstent
.
DELETE_FILE
+
fileName
,
"delete file"
);
cmdTools
.
runCmd
(
CmdConstent
.
DELETE_FILE
+
fileZipName
,
"delete zipFile"
);
}
catch
(
CmdException
e
)
{
e
.
printStackTrace
();
log
.
error
(
"file delete failed!"
);
}
log
.
info
(
"Aflnet Logs has been backuped!"
);
}
}).
start
();
}
catch
(
Exception
e
)
{
log
.
error
(
"AflnetBackup Error!"
);
e
.
printStackTrace
();
}
}
}
}
}
fuzzIntegration/src/main/java/com/example/fuzzControll/service/impl/VulnerabilityTypeServiceImpl.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
service
.
impl
;
package
com
.
example
.
fuzzControll
.
service
.
impl
;
import
com.example.fuzzControll.conf.KittyProperties
;
import
com.example.fuzzControll.conf.KittyProperties
;
import
com.example.fuzzControll.exception.CmdException
;
import
com.example.fuzzControll.exception.
testException.
CmdException
;
import
com.example.fuzzControll.exception.FuzzException
;
import
com.example.fuzzControll.exception.
testException.
FuzzException
;
import
com.example.fuzzControll.
pojo.v
o.TestEntity
;
import
com.example.fuzzControll.
domain.b
o.TestEntity
;
import
com.example.fuzzControll.service.VulnerabilityTypeService
;
import
com.example.fuzzControll.service.VulnerabilityTypeService
;
import
com.example.fuzzControll.tools.CmdTools
;
import
com.example.fuzzControll.tools.
test.
CmdTools
;
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.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/tools/RegularTools.java
deleted
100644 → 0
View file @
deacd8b0
package
com
.
example
.
fuzzControll
.
tools
;
//todo 对ip等增加正则判断
public
class
RegularTools
{
}
fuzzIntegration/src/main/java/com/example/fuzzControll/tools/FileTools.java
→
fuzzIntegration/src/main/java/com/example/fuzzControll/tools/
file/
FileTools.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
tools
;
package
com
.
example
.
fuzzControll
.
tools
.
file
;
import
com.example.fuzzControll.conf.AflnetProperties
;
import
com.example.fuzzControll.conf.AflnetProperties
;
import
com.example.fuzzControll.conf.SpringContextUtil
;
import
com.example.fuzzControll.conf.SpringContextUtil
;
import
com.example.fuzzControll.exception.FileException
;
import
com.example.fuzzControll.exception.
fileExcption.
FileException
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.*
;
import
java.io.*
;
@Slf4j
@Slf4j
...
@@ -82,6 +78,4 @@ public class FileTools {
...
@@ -82,6 +78,4 @@ public class FileTools {
throw
new
FileException
(
"Load file failed!"
);
throw
new
FileException
(
"Load file failed!"
);
}
}
}
}
}
}
fuzzIntegration/src/main/java/com/example/fuzzControll/tools/
GlobalParameter
s.java
→
fuzzIntegration/src/main/java/com/example/fuzzControll/tools/
system/GlobalClas
s.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
tools
;
package
com
.
example
.
fuzzControll
.
tools
.
system
;
import
com.example.fuzzControll.conf.AflnetProperties
;
import
com.example.fuzzControll.conf.AflnetProperties
;
import
com.example.fuzzControll.conf.KittyProperties
;
import
com.example.fuzzControll.conf.KittyProperties
;
...
@@ -10,20 +10,14 @@ import com.example.fuzzControll.service.KittyFuzzPersistenceService;
...
@@ -10,20 +10,14 @@ import com.example.fuzzControll.service.KittyFuzzPersistenceService;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ConcurrentHashMap
;
public
class
GlobalParameters
{
/**
public
static
ConcurrentHashMap
<
String
,
String
>
aflnetData
=
new
ConcurrentHashMap
<>();
//当前aflnet任务的数据
* 系统类全局参数,负责代码调用
*/
public
class
GlobalClass
{
public
static
KittyMapper
kittyMapper
=
(
KittyMapper
)
SpringContextUtil
.
getBean
(
"KittyMapper"
);
public
static
KittyMapper
kittyMapper
=
(
KittyMapper
)
SpringContextUtil
.
getBean
(
"KittyMapper"
);
public
static
KittyProperties
kittyProperties
=
(
KittyProperties
)
SpringContextUtil
.
getBean
(
"kittyProperties"
);
public
static
KittyProperties
kittyProperties
=
(
KittyProperties
)
SpringContextUtil
.
getBean
(
"kittyProperties"
);
public
static
KittyFuzzPersistenceService
kittyFuzzPersistenceService
=(
KittyFuzzPersistenceService
)
SpringContextUtil
.
getBean
(
"KittyFuzzPersistenceService"
);
public
static
KittyFuzzPersistenceService
kittyFuzzPersistenceService
=(
KittyFuzzPersistenceService
)
SpringContextUtil
.
getBean
(
"KittyFuzzPersistenceService"
);
public
static
AflnetProperties
aflnetProperties
=
(
AflnetProperties
)
SpringContextUtil
.
getBean
(
"AflnetProperties"
);
public
static
AflnetProperties
aflnetProperties
=
(
AflnetProperties
)
SpringContextUtil
.
getBean
(
"AflnetProperties"
);
public
static
AflnetPersistenceService
aflnetPersistenceService
=
(
AflnetPersistenceService
)
SpringContextUtil
.
getBean
(
"AflnetPersistenceService"
);
public
static
AflnetPersistenceService
aflnetPersistenceService
=
(
AflnetPersistenceService
)
SpringContextUtil
.
getBean
(
"AflnetPersistenceService"
);
public
static
MissionInfoMapper
missionInfoMapper
=
(
MissionInfoMapper
)
SpringContextUtil
.
getBean
(
"MissionInfoMapper"
);
public
static
MissionInfoMapper
missionInfoMapper
=
(
MissionInfoMapper
)
SpringContextUtil
.
getBean
(
"MissionInfoMapper"
);
/**
* 系统全局测试时间参数
*/
public
static
ConcurrentHashMap
<
String
,
ConcurrentHashMap
<
String
,
Long
>>
testTimeMessage
=
new
ConcurrentHashMap
<>();
/**
* 多线程异常控制
*/
public
static
ConcurrentHashMap
<
Thread
,
String
>
ThreadState
=
new
ConcurrentHashMap
<>();
}
}
fuzzIntegration/src/main/java/com/example/fuzzControll/tools/system/SystemRunningParams.java
0 → 100644
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
tools
.
system
;
import
java.util.concurrent.ConcurrentHashMap
;
/**
* 系统运行时,全局参数
*/
public
class
SystemRunningParams
{
/**
* 系统全局测试时间参数
*/
public
static
ConcurrentHashMap
<
String
,
ConcurrentHashMap
<
String
,
Long
>>
testTimeMessage
=
new
ConcurrentHashMap
<>();
/**
* 多线程异常控制
*/
public
static
ConcurrentHashMap
<
Thread
,
String
>
ThreadState
=
new
ConcurrentHashMap
<>();
/**
* 系统中运行的aflnet当前missionId
*/
public
static
int
aflnetMissionId
=
0
;
/**
* aflnet运行时数据
*/
public
static
ConcurrentHashMap
<
String
,
String
>
aflnetData
=
new
ConcurrentHashMap
<>();
//当前aflnet任务的数据
public
static
void
init
(){
/*初始化aflnet和kitty时间参数*/
testTimeMessage
.
put
(
"aflnet"
,
new
ConcurrentHashMap
<>());
testTimeMessage
.
put
(
"kitty"
,
new
ConcurrentHashMap
<>());
/*初始化两个测试的起止时间*/
testTimeMessage
.
get
(
"aflnet"
).
put
(
"start"
,
0L
);
testTimeMessage
.
get
(
"aflnet"
).
put
(
"end"
,
0L
);
testTimeMessage
.
get
(
"kitty"
).
put
(
"start"
,
0L
);
testTimeMessage
.
get
(
"kitty"
).
put
(
"end"
,
0L
);
}
}
fuzzIntegration/src/main/java/com/example/fuzzControll/tools/CmdTools.java
→
fuzzIntegration/src/main/java/com/example/fuzzControll/tools/
test/
CmdTools.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
tools
;
package
com
.
example
.
fuzzControll
.
tools
.
test
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.example.fuzzControll.annotion.NeedCut
;
import
com.example.fuzzControll.annotion.NeedCutBefore
;
import
com.example.fuzzControll.conf.AflnetProperties
;
import
com.example.fuzzControll.domain.bo.CmdStartParams
;
import
com.example.fuzzControll.conf.SpringContextUtil
;
import
com.example.fuzzControll.domain.vo.KittyResult
;
import
com.example.fuzzControll.constents.CmdConstent
;
import
com.example.fuzzControll.domain.vo.TestReturnEntity
;
import
com.example.fuzzControll.constents.TableClassEnum
;
import
com.example.fuzzControll.exception.testException.AflnetException
;
import
com.example.fuzzControll.exception.AflnetException
;
import
com.example.fuzzControll.exception.testException.CmdException
;
import
com.example.fuzzControll.exception.CmdException
;
import
com.example.fuzzControll.exception.mysqlException.MysqlException
;
import
com.example.fuzzControll.exception.MysqlException
;
import
com.example.fuzzControll.mapper.KittyMapper
;
import
com.example.fuzzControll.pojo.vo.*
;
import
com.example.fuzzControll.service.AflnetPersistenceService
;
import
com.example.fuzzControll.service.impl.websocketClientServiceImpl
;
import
com.example.fuzzControll.service.impl.websocketClientServiceImpl
;
import
com.example.fuzzControll.tools.system.GlobalClass
;
import
com.example.fuzzControll.tools.system.SystemRunningParams
;
import
com.example.fuzzControll.tools.test.TestControlTools
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.swing.*
;
import
java.io.*
;
import
java.io.*
;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
static
org
.
bouncycastle
.
asn1
.
x500
.
style
.
RFC4519Style
.
l
;
//todo need modify
//todo need modify
@Slf4j
@Slf4j
...
@@ -57,10 +58,11 @@ public class CmdTools {
...
@@ -57,10 +58,11 @@ public class CmdTools {
* 运行需要后台运行cmd
* 运行需要后台运行cmd
* 通过websocket返回数据
* 通过websocket返回数据
*/
*/
@NeedCut
(
name
=
"aflnet"
,
moment
=
"before"
,
function
=
"b
ackup"
)
@NeedCut
Before
(
name
=
"aflnet"
,
function
=
"startB
ackup"
)
public
void
runProgramCmd
(
String
cmd
,
String
outputFileName
)
throws
AflnetException
{
public
void
runProgramCmd
(
String
cmd
,
String
outputFileName
)
throws
AflnetException
{
try
{
try
{
Process
process
=
Runtime
.
getRuntime
().
exec
(
cmd
);
Process
process
=
Runtime
.
getRuntime
().
exec
(
cmd
);
//执行模糊测试指令
/*打印模糊测试输出*/
printMessageToWeb
(
process
.
getInputStream
());
printMessageToWeb
(
process
.
getInputStream
());
printMessage
(
process
.
getErrorStream
(),
new
ArrayList
<
String
>());
printMessage
(
process
.
getErrorStream
(),
new
ArrayList
<
String
>());
process
.
waitFor
();
process
.
waitFor
();
...
@@ -80,7 +82,7 @@ public class CmdTools {
...
@@ -80,7 +82,7 @@ public class CmdTools {
List
<
String
>
out
=
Collections
.
synchronizedList
(
new
ArrayList
<
String
>());
List
<
String
>
out
=
Collections
.
synchronizedList
(
new
ArrayList
<
String
>());
List
<
String
>
error
=
Collections
.
synchronizedList
(
new
ArrayList
<
String
>());
List
<
String
>
error
=
Collections
.
synchronizedList
(
new
ArrayList
<
String
>());
try
{
try
{
GlobalParameter
s
.
testTimeMessage
.
get
(
"kitty"
).
put
(
"start"
,
System
.
currentTimeMillis
());
SystemRunningParam
s
.
testTimeMessage
.
get
(
"kitty"
).
put
(
"start"
,
System
.
currentTimeMillis
());
Process
process
=
Runtime
.
getRuntime
().
exec
(
cmd
);
Process
process
=
Runtime
.
getRuntime
().
exec
(
cmd
);
printMessageByProgramCmd
(
process
.
getInputStream
(),
out
);
printMessageByProgramCmd
(
process
.
getInputStream
(),
out
);
printMessageByProgramCmd
(
process
.
getErrorStream
(),
error
);
printMessageByProgramCmd
(
process
.
getErrorStream
(),
error
);
...
@@ -97,7 +99,7 @@ public class CmdTools {
...
@@ -97,7 +99,7 @@ public class CmdTools {
/*新开一个线程存入数据*/
/*新开一个线程存入数据*/
List
<
String
>
finalOut
=
out
;
List
<
String
>
finalOut
=
out
;
List
<
String
>
finalError
=
error
;
List
<
String
>
finalError
=
error
;
GlobalParameter
s
.
testTimeMessage
.
get
(
"kitty"
).
put
(
"end"
,
System
.
currentTimeMillis
());
SystemRunningParam
s
.
testTimeMessage
.
get
(
"kitty"
).
put
(
"end"
,
System
.
currentTimeMillis
());
new
Thread
(
new
Runnable
()
{
new
Thread
(
new
Runnable
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
...
@@ -128,6 +130,12 @@ public class CmdTools {
...
@@ -128,6 +130,12 @@ public class CmdTools {
return
result
;
return
result
;
}
}
/**
* 错误输出
* @param input
* @param result
* @return
*/
private
List
<
String
>
printMessage
(
final
InputStream
input
,
final
List
<
String
>
result
)
{
private
List
<
String
>
printMessage
(
final
InputStream
input
,
final
List
<
String
>
result
)
{
new
Thread
(
new
Runnable
()
{
new
Thread
(
new
Runnable
()
{
@Override
@Override
...
@@ -166,6 +174,12 @@ public class CmdTools {
...
@@ -166,6 +174,12 @@ public class CmdTools {
}
}
}
}
/**
* aflnet模糊测试数据键值对返回
* @param line
* @param returnEntity
* @return
*/
private
TestReturnEntity
makeReturnEntity
(
String
line
,
TestReturnEntity
returnEntity
)
{
private
TestReturnEntity
makeReturnEntity
(
String
line
,
TestReturnEntity
returnEntity
)
{
if
(
line
.
contains
(
"All set and ready to roll!"
)
||
line
.
contains
(
"american fuzzy"
)
||
line
.
contains
(
"process timing overall results"
))
{
if
(
line
.
contains
(
"All set and ready to roll!"
)
||
line
.
contains
(
"american fuzzy"
)
||
line
.
contains
(
"process timing overall results"
))
{
show
=
false
;
show
=
false
;
...
@@ -176,7 +190,8 @@ public class CmdTools {
...
@@ -176,7 +190,8 @@ public class CmdTools {
if
(
show
)
{
if
(
show
)
{
log
.
info
(
line
);
log
.
info
(
line
);
}
}
GlobalParameters
.
testTimeMessage
.
get
(
"aflnet"
).
put
(
"start"
,
System
.
currentTimeMillis
());
SystemRunningParams
.
testTimeMessage
.
get
(
"aflnet"
).
put
(
"start"
,
System
.
currentTimeMillis
());
try
{
if
(
line
.
contains
(
"run time"
))
{
if
(
line
.
contains
(
"run time"
))
{
send
=
false
;
send
=
false
;
int
run_time
=
line
.
indexOf
(
":"
);
int
run_time
=
line
.
indexOf
(
":"
);
...
@@ -263,6 +278,10 @@ public class CmdTools {
...
@@ -263,6 +278,10 @@ public class CmdTools {
int
trim
=
line
.
indexOf
(
":"
);
int
trim
=
line
.
indexOf
(
":"
);
returnEntity
.
setTrim
(
line
.
substring
(
trim
+
1
,
trim
+
10
));
returnEntity
.
setTrim
(
line
.
substring
(
trim
+
1
,
trim
+
10
));
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
"Formarting params error!"
);
throw
new
AflnetException
(
"Formarting params error!"
);
}
return
returnEntity
;
return
returnEntity
;
}
}
...
@@ -312,22 +331,22 @@ public class CmdTools {
...
@@ -312,22 +331,22 @@ public class CmdTools {
@Transactional
(
rollbackFor
=
MysqlException
.
class
)
@Transactional
(
rollbackFor
=
MysqlException
.
class
)
public
void
dataBackUpTransaction
(
String
caller
,
List
<
String
>
out
,
List
<
String
>
error
,
String
missionName
)
{
public
void
dataBackUpTransaction
(
String
caller
,
List
<
String
>
out
,
List
<
String
>
error
,
String
missionName
)
{
int
missionId
=
Global
Parameter
s
.
missionInfoMapper
.
selectTopMissionId
()
+
1
;
int
missionId
=
Global
Clas
s
.
missionInfoMapper
.
selectTopMissionId
()
+
1
;
try
{
try
{
/*kitty结果存入数据库*/
/*kitty结果存入数据库*/
KittyResult
kittyResult
=
new
KittyResult
(
missionId
,
out
.
toString
(),
error
.
toString
());
KittyResult
kittyResult
=
new
KittyResult
(
missionId
,
out
.
toString
(),
error
.
toString
());
Global
Parameter
s
.
kittyMapper
.
kittyResultsBackup
(
kittyResult
);
Global
Clas
s
.
kittyMapper
.
kittyResultsBackup
(
kittyResult
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
log
.
error
(
"kitty backup error!"
);
log
.
error
(
"kitty backup error!"
);
}
}
// /*kitty的协议模板方法的日志和数据包文件存入数据库*/
// /*kitty的协议模板方法的日志和数据包文件存入数据库*/
// if (caller.equals("protocolTemplate")) {
// if (caller.equals("protocolTemplate")) {
//// Global
Parameter
s.kittyFuzzPersistenceService.KittyPackagesBackup(missionId);
//// Global
Clas
s.kittyFuzzPersistenceService.KittyPackagesBackup(missionId);
// Global
Parameter
s.missionInfoMapper.insertMission(new MissionInfo(missionId, 2, new Date(), missionName,));
// Global
Clas
s.missionInfoMapper.insertMission(new MissionInfo(missionId, 2, new Date(), missionName,));
// } else {
// } else {
// /*存入missionInfo信息*/
// /*存入missionInfo信息*/
// Global
Parameter
s.missionInfoMapper.insertMission(new MissionInfo(missionId, 3, new Date(), missionName));
// Global
Clas
s.missionInfoMapper.insertMission(new MissionInfo(missionId, 3, new Date(), missionName));
// }
// }
}
}
}
}
\ No newline at end of file
fuzzIntegration/src/main/java/com/example/fuzzControll/tools/test/SingleCmdTools.java
0 → 100644
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
tools
.
test
;
import
com.example.fuzzControll.exception.testException.CmdException
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Component
;
import
java.io.*
;
import
java.util.ArrayList
;
import
java.util.List
;
@Slf4j
@Component
public
class
SingleCmdTools
{
public
List
<
String
>
runCmd
(
String
cmd
,
String
caller
)
throws
CmdException
{
List
<
String
>
result
=
new
ArrayList
<
String
>();
try
{
log
.
info
(
caller
+
" is running!"
);
Process
process
=
Runtime
.
getRuntime
().
exec
(
cmd
);
printMessage
(
process
.
getInputStream
(),
result
);
printMessage
(
process
.
getErrorStream
(),
new
ArrayList
<
String
>());
process
.
waitFor
();
log
.
info
(
caller
+
" end!"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
CmdException
(
caller
+
" run cmd failed!"
);
}
return
result
;
}
private
List
<
String
>
printMessage
(
final
InputStream
input
,
final
List
<
String
>
result
)
{
new
Thread
(
new
Runnable
()
{
@Override
public
void
run
()
{
Reader
reader
=
new
InputStreamReader
(
input
);
BufferedReader
bf
=
new
BufferedReader
(
reader
);
String
line
=
null
;
try
{
while
((
line
=
bf
.
readLine
())
!=
null
)
{
result
.
add
(
line
);
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}).
start
();
return
result
;
}
}
fuzzIntegration/src/main/java/com/example/fuzzControll/tools/TestControlTools.java
→
fuzzIntegration/src/main/java/com/example/fuzzControll/tools/
test/
TestControlTools.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
tools
;
package
com
.
example
.
fuzzControll
.
tools
.
test
;
public
class
TestControlTools
{
public
class
TestControlTools
{
private
static
Boolean
isRunning
;
private
static
Boolean
isRunning
;
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/tools/TestTools.java
→
fuzzIntegration/src/main/java/com/example/fuzzControll/tools/
test/
TestTools.java
View file @
267c45e2
package
com
.
example
.
fuzzControll
.
tools
;
package
com
.
example
.
fuzzControll
.
tools
.
test
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
...
fuzzIntegration/src/main/resources/application-dev.yml
View file @
267c45e2
...
@@ -41,7 +41,7 @@ spring:
...
@@ -41,7 +41,7 @@ spring:
discovery
:
discovery
:
server-addr
:
http://${nacos-docker.ip}:8848
server-addr
:
http://${nacos-docker.ip}:8848
datasource
:
datasource
:
url
:
jdbc:mysql://${mysql-docker.ip}:330
6
/fuzz?allowPublicKeyRetrieval=true&useSSL=falseuseUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url
:
jdbc:mysql://${mysql-docker.ip}:330
7
/fuzz?allowPublicKeyRetrieval=true&useSSL=falseuseUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username
:
root
username
:
root
password
:
123456
password
:
123456
driver-class-name
:
com.mysql.cj.jdbc.Driver
driver-class-name
:
com.mysql.cj.jdbc.Driver
...
...
fuzzIntegration/src/main/resources/mapper/AflnetMapper.xml
View file @
267c45e2
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.example.fuzzControll.mapper.AflnetMapper"
>
<mapper
namespace=
"com.example.fuzzControll.mapper.AflnetMapper"
>
<resultMap
type=
"com.example.fuzzControll.
pojo
.vo.AflnetResult"
id=
"AflnetResult"
>
<resultMap
type=
"com.example.fuzzControll.
domain
.vo.AflnetResult"
id=
"AflnetResult"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"id"
column=
"id"
/>
<result
property=
"missionId"
column=
"missionId"
/>
<result
property=
"missionId"
column=
"missionId"
/>
<result
property=
"file"
column=
"file"
/>
<result
property=
"file"
column=
"file"
/>
...
...
fuzzIntegration/src/main/resources/mapper/KittyMapper.xml
View file @
267c45e2
...
@@ -4,13 +4,13 @@
...
@@ -4,13 +4,13 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.example.fuzzControll.mapper.KittyMapper"
>
<mapper
namespace=
"com.example.fuzzControll.mapper.KittyMapper"
>
<resultMap
type=
"com.example.fuzzControll.
pojo
.vo.KittyResult"
id=
"KittyResult"
>
<resultMap
type=
"com.example.fuzzControll.
domain
.vo.KittyResult"
id=
"KittyResult"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"id"
column=
"id"
/>
<result
property=
"missionId"
column=
"missionId"
/>
<result
property=
"missionId"
column=
"missionId"
/>
<result
property=
"resultOut"
column=
"resultOut"
/>
<result
property=
"resultOut"
column=
"resultOut"
/>
<result
property=
"resultError"
column=
"resultError"
/>
<result
property=
"resultError"
column=
"resultError"
/>
</resultMap>
</resultMap>
<resultMap
type=
"com.example.fuzzControll.
pojo
.vo.KittyPackageFile"
id=
"kittyPackageFile"
>
<resultMap
type=
"com.example.fuzzControll.
domain
.vo.KittyPackageFile"
id=
"kittyPackageFile"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"id"
column=
"id"
/>
<result
property=
"missionId"
column=
"missionId"
/>
<result
property=
"missionId"
column=
"missionId"
/>
<result
property=
"kittyRecvFile"
column=
"kittyRecvFile"
/>
<result
property=
"kittyRecvFile"
column=
"kittyRecvFile"
/>
...
@@ -35,11 +35,11 @@
...
@@ -35,11 +35,11 @@
<select
id=
"getKittyResults"
resultMap=
"KittyResult"
>
<select
id=
"getKittyResults"
resultMap=
"KittyResult"
>
<include
refid=
"selectKittyResult"
/>
<include
refid=
"selectKittyResult"
/>
</select>
</select>
<select
id=
"getKittyPackageFileById"
resultType=
"com.example.fuzzControll.
pojo
.vo.KittyPackageFile"
>
<select
id=
"getKittyPackageFileById"
resultType=
"com.example.fuzzControll.
domain
.vo.KittyPackageFile"
>
<include
refid=
"selectKittyPackageFile"
/>
<include
refid=
"selectKittyPackageFile"
/>
where missionId=#{missionId}
where missionId=#{missionId}
</select>
</select>
<select
id=
"getKittyResultByMissionId"
resultType=
"com.example.fuzzControll.
pojo
.vo.KittyResult"
>
<select
id=
"getKittyResultByMissionId"
resultType=
"com.example.fuzzControll.
domain
.vo.KittyResult"
>
<include
refid=
"selectKittyResult"
/>
<include
refid=
"selectKittyResult"
/>
where missionId = #{missionId}
where missionId = #{missionId}
</select>
</select>
...
...
fuzzIntegration/src/main/resources/mapper/MissionInfoMapper.xml
View file @
267c45e2
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.example.fuzzControll.mapper.MissionInfoMapper"
>
<mapper
namespace=
"com.example.fuzzControll.mapper.MissionInfoMapper"
>
<resultMap
type=
"com.example.fuzzControll.
pojo.v
o.MissionInfo"
id=
"MissionInfoInDataBase"
>
<resultMap
type=
"com.example.fuzzControll.
domain.p
o.MissionInfo"
id=
"MissionInfoInDataBase"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"id"
column=
"id"
/>
<result
property=
"missionId"
column=
"missionId"
/>
<result
property=
"missionId"
column=
"missionId"
/>
<result
property=
"tableId"
column=
"tableId"
/>
<result
property=
"tableId"
column=
"tableId"
/>
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
<result
property=
"state"
column=
"state"
/>
<result
property=
"state"
column=
"state"
/>
<result
property=
"runTime"
column=
"runTime"
/>
<result
property=
"runTime"
column=
"runTime"
/>
</resultMap>
</resultMap>
<resultMap
type=
"com.example.fuzzControll.
pojo.v
o.MissionInfo"
id=
"MissionInfoInVo"
>
<resultMap
type=
"com.example.fuzzControll.
domain.p
o.MissionInfo"
id=
"MissionInfoInVo"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"id"
column=
"id"
/>
<result
property=
"missionId"
column=
"missionId"
/>
<result
property=
"missionId"
column=
"missionId"
/>
<result
property=
"createTime"
column=
"createTime"
/>
<result
property=
"createTime"
column=
"createTime"
/>
...
@@ -28,6 +28,11 @@
...
@@ -28,6 +28,11 @@
insert into missionIdInfo(missionId, tableId, createTime, missionName, state, runTime)
insert into missionIdInfo(missionId, tableId, createTime, missionName, state, runTime)
values (#{missionId}, #{tableId}, #{createTime}, #{missionName}, #{state}, #{runTime})
values (#{missionId}, #{tableId}, #{createTime}, #{missionName}, #{state}, #{runTime})
</insert>
</insert>
<update
id=
"updateMission"
>
update missionIdInfo
set state = #{state}, runTime = #{runTime}
where missionId = #{missionId}
</update>
<select
id=
"selectByMissionId"
resultMap=
"MissionInfoInVo"
>
<select
id=
"selectByMissionId"
resultMap=
"MissionInfoInVo"
>
<include
refid=
"selectMissionInfo"
/>
<include
refid=
"selectMissionInfo"
/>
and missionId = #{missionId}
and missionId = #{missionId}
...
...
fuzzbackendmaster/src/main/java/com/example/fuzzbackendmaster/controller/MissionInfoController.java
View file @
267c45e2
...
@@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.RestController;
import
java.io.IOException
;
import
java.io.IOException
;
@RestController
@RestController
@RequestMapping
(
"/
log
"
)
@RequestMapping
(
"/
mission
"
)
@CrossOrigin
@CrossOrigin
public
class
MissionInfoController
{
public
class
MissionInfoController
{
@Autowired
@Autowired
...
...
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