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
e8df61c8
Commit
e8df61c8
authored
9 months ago
by
钱炳权
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
测试参数可存入
parent
5148ec7b
qbq-dev
Show whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
320 additions
and
40 deletions
+320
-40
aroundAop.java
...src/main/java/com/example/fuzzControll/aop/aroundAop.java
+0
-0
FuzzParamsController.java
...troll/controller/dataController/FuzzParamsController.java
+3
-3
AlfnetController.java
...zControll/controller/testController/AlfnetController.java
+0
-1
KittyController.java
...zzControll/controller/testController/KittyController.java
+4
-4
FuzzParams.java
...n/java/com/example/fuzzControll/domain/bo/FuzzParams.java
+53
-0
FuzzParamsMapper.java
...ava/com/example/fuzzControll/mapper/FuzzParamsMapper.java
+1
-1
FuzzParamsService.java
...a/com/example/fuzzControll/service/FuzzParamsService.java
+1
-1
GenerateMethodService.java
...m/example/fuzzControll/service/GenerateMethodService.java
+1
-1
MutationService.java
...ava/com/example/fuzzControll/service/MutationService.java
+1
-1
ProtocolTemplateService.java
...example/fuzzControll/service/ProtocolTemplateService.java
+1
-1
VulnerabilityTypeService.java
...xample/fuzzControll/service/VulnerabilityTypeService.java
+1
-1
FuzzParamsServiceImpl.java
...mple/fuzzControll/service/impl/FuzzParamsServiceImpl.java
+3
-3
GenerateMethodServiceImpl.java
.../fuzzControll/service/impl/GenerateMethodServiceImpl.java
+16
-2
MutationServiceImpl.java
...xample/fuzzControll/service/impl/MutationServiceImpl.java
+15
-2
ProtocolTemplateImpl.java
...ample/fuzzControll/service/impl/ProtocolTemplateImpl.java
+14
-1
TestServiceImpl.java
...om/example/fuzzControll/service/impl/TestServiceImpl.java
+14
-0
VulnerabilityTypeServiceImpl.java
...zzControll/service/impl/VulnerabilityTypeServiceImpl.java
+15
-2
JsonUtils.java
...n/java/com/example/fuzzControll/tools/test/JsonUtils.java
+13
-0
application-dev.yml
fuzzIntegration/src/main/resources/application-dev.yml
+6
-5
application.yml
fuzzIntegration/src/main/resources/application.yml
+1
-1
FuzzParamsMapper.xml
...ntegration/src/main/resources/mapper/FuzzParamsMapper.xml
+5
-4
FuzzParamsController.java
...le/fuzzbackendmaster/controller/FuzzParamsController.java
+60
-0
TestController.java
.../example/fuzzbackendmaster/controller/TestController.java
+1
-1
FuzzParams.java
...ava/com/example/fuzzbackendmaster/pojo/vo/FuzzParams.java
+68
-0
FuzzIntegrationFileApi.java
...ple/fuzzbackendmaster/service/FuzzIntegrationFileApi.java
+22
-4
application-dev.yml
fuzzbackendmaster/src/main/resources/application-dev.yml
+1
-1
No files found.
fuzzIntegration/src/main/java/com/example/fuzzControll/aop/aroundAop.java
View file @
e8df61c8
This diff is collapsed.
Click to expand it.
fuzzIntegration/src/main/java/com/example/fuzzControll/controller/dataController/FuzzParamsController.java
View file @
e8df61c8
...
...
@@ -36,11 +36,11 @@ public class FuzzParamsController {
/**
* 跟据id获取参数
*/
@RequestMapping
(
value
=
"/getParam/{
i
d}"
,
method
=
RequestMethod
.
GET
)
public
AjaxResult
getById
(
@PathVariable
(
"
id"
)
int
i
d
)
{
@RequestMapping
(
value
=
"/getParam/{
missionI
d}"
,
method
=
RequestMethod
.
GET
)
public
AjaxResult
getById
(
@PathVariable
(
"
missionId"
)
int
missionI
d
)
{
FuzzParams
result
;
try
{
result
=
fuzzParamsService
.
getFuzzParamById
(
i
d
);
result
=
fuzzParamsService
.
getFuzzParamById
(
missionI
d
);
}
catch
(
Exception
e
)
{
log
.
error
(
"Get params of fuzz with id error:{}"
,
e
.
getMessage
());
return
AjaxResult
.
error
();
...
...
This diff is collapsed.
Click to expand it.
fuzzIntegration/src/main/java/com/example/fuzzControll/controller/testController/AlfnetController.java
View file @
e8df61c8
...
...
@@ -30,7 +30,6 @@ public class AlfnetController {
*/
@RequestMapping
(
value
=
"/testStart"
,
method
=
RequestMethod
.
POST
)
public
AjaxResult
start
(
@RequestBody
final
CmdStartParams
cmdStartParams
)
{
//todo 捕获子线程错误
try
{
SystemRunningParams
.
aflnetData
.
put
(
"missionName"
,
cmdStartParams
.
getProtopcol
());
Thread
subThread
=
new
Thread
(
new
Runnable
()
{
...
...
This diff is collapsed.
Click to expand it.
fuzzIntegration/src/main/java/com/example/fuzzControll/controller/testController/KittyController.java
View file @
e8df61c8
...
...
@@ -43,7 +43,7 @@ public class KittyController {
public
AjaxResult
protocolTemplate
(
@RequestBody
TestEntity
testEntity
)
{
try
{
SystemRunningParams
.
kittyData
.
put
(
"missionName"
,
testEntity
.
getTestClassName
());
Map
<
String
,
List
<
String
>>
result
=
protocolTemplateService
.
generation
(
testEntity
,
1
);
Map
<
String
,
List
<
String
>>
result
=
protocolTemplateService
.
generation
(
testEntity
);
return
AjaxResult
.
success
(
result
==
null
?
"模板文件生成未成功运行!第三方接口可能存在问题。"
:
result
);
}
catch
(
CmdException
|
FuzzException
e
)
{
log
.
error
(
e
.
getDefaultMessage
());
...
...
@@ -58,7 +58,7 @@ public class KittyController {
public
AjaxResult
generate
(
@RequestBody
TestEntity
testEntity
)
{
try
{
SystemRunningParams
.
kittyData
.
put
(
"missionName"
,
testEntity
.
getTestClassName
());
Map
<
String
,
List
<
String
>>
result
=
generateMethodService
.
generation
(
testEntity
,
1
);
Map
<
String
,
List
<
String
>>
result
=
generateMethodService
.
generation
(
testEntity
);
return
AjaxResult
.
success
(
result
==
null
?
"生成方法未成功运行!第三方接口可能存在问题。"
:
result
);
}
catch
(
CmdException
|
FuzzException
e
)
{
log
.
error
(
e
.
getDefaultMessage
());
...
...
@@ -73,7 +73,7 @@ public class KittyController {
public
AjaxResult
mutation
(
@RequestBody
TestEntity
testEntity
)
{
try
{
SystemRunningParams
.
kittyData
.
put
(
"missionName"
,
testEntity
.
getTestClassName
());
Map
<
String
,
List
<
String
>>
result
=
mutationService
.
generation
(
testEntity
,
1
);
Map
<
String
,
List
<
String
>>
result
=
mutationService
.
generation
(
testEntity
);
return
AjaxResult
.
success
(
result
==
null
?
"mutationTest未成功运行!第三方接口可能存在问题。"
:
result
);
}
catch
(
CmdException
|
FuzzException
e
)
{
log
.
error
(
e
.
getDefaultMessage
());
...
...
@@ -88,7 +88,7 @@ public class KittyController {
public
AjaxResult
vulnerability
(
@RequestBody
TestEntity
testEntity
)
{
try
{
SystemRunningParams
.
kittyData
.
put
(
"missionName"
,
testEntity
.
getTestClassName
());
Map
<
String
,
List
<
String
>>
result
=
vulnerabilityTypeService
.
generation
(
testEntity
,
1
);
Map
<
String
,
List
<
String
>>
result
=
vulnerabilityTypeService
.
generation
(
testEntity
);
return
AjaxResult
.
success
(
result
==
null
?
"漏洞类型未成功运行!第三方接口可能存在问题。"
:
result
);
}
catch
(
CmdException
|
FuzzException
e
)
{
log
.
error
(
e
.
getDefaultMessage
());
...
...
This diff is collapsed.
Click to expand it.
fuzzIntegration/src/main/java/com/example/fuzzControll/domain/bo/FuzzParams.java
View file @
e8df61c8
...
...
@@ -13,8 +13,61 @@ import java.util.Date;
@Getter
@Setter
public
class
FuzzParams
{
private
int
id
;
private
String
params
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
private
Date
editTime
;
private
int
missionId
;
public
FuzzParams
()
{
}
public
FuzzParams
(
int
id
,
String
params
,
Date
editTime
,
int
missionId
)
{
this
.
id
=
id
;
this
.
params
=
params
;
this
.
editTime
=
editTime
;
this
.
missionId
=
missionId
;
}
public
FuzzParams
(
String
params
,
Date
editTime
,
int
missionId
)
{
this
.
params
=
params
;
this
.
editTime
=
editTime
;
this
.
missionId
=
missionId
;
}
public
int
getId
()
{
return
id
;
}
public
void
setId
(
int
id
)
{
this
.
id
=
id
;
}
public
String
getParams
()
{
return
params
;
}
public
void
setParams
(
String
params
)
{
this
.
params
=
params
;
}
public
Date
getEditTime
()
{
return
editTime
;
}
public
void
setEditTime
(
Date
editTime
)
{
this
.
editTime
=
editTime
;
}
public
int
getMissionId
()
{
return
missionId
;
}
public
void
setMissionId
(
int
missionId
)
{
this
.
missionId
=
missionId
;
}
}
This diff is collapsed.
Click to expand it.
fuzzIntegration/src/main/java/com/example/fuzzControll/mapper/FuzzParamsMapper.java
View file @
e8df61c8
...
...
@@ -10,7 +10,7 @@ import java.util.List;
@Mapper
@Component
(
"FuzzParamsMapper"
)
public
interface
FuzzParamsMapper
{
void
saveFuzzParams
(
FuzzParams
fuzzParams
);
boolean
saveFuzzParams
(
FuzzParams
fuzzParams
);
List
<
FuzzParams
>
getFuzzParamsList
();
FuzzParams
getFuzzParamsById
(
int
id
);
...
...
This diff is collapsed.
Click to expand it.
fuzzIntegration/src/main/java/com/example/fuzzControll/service/FuzzParamsService.java
View file @
e8df61c8
...
...
@@ -8,7 +8,7 @@ import java.util.List;
public
interface
FuzzParamsService
{
List
<
FuzzParams
>
getFuzzParamsList
();
FuzzParams
getFuzzParamById
(
int
i
d
);
FuzzParams
getFuzzParamById
(
int
missionI
d
);
//todo 使用切面在运行时插入参数
boolean
saveFuzzParams
(
FuzzParams
fuzzParams
);
...
...
This diff is collapsed.
Click to expand it.
fuzzIntegration/src/main/java/com/example/fuzzControll/service/GenerateMethodService.java
View file @
e8df61c8
...
...
@@ -6,5 +6,5 @@ import java.util.List;
import
java.util.Map
;
public
interface
GenerateMethodService
{
Map
<
String
,
List
<
String
>>
generation
(
TestEntity
testEntity
,
int
missionId
);
Map
<
String
,
List
<
String
>>
generation
(
TestEntity
testEntity
);
}
This diff is collapsed.
Click to expand it.
fuzzIntegration/src/main/java/com/example/fuzzControll/service/MutationService.java
View file @
e8df61c8
...
...
@@ -6,5 +6,5 @@ import java.util.List;
import
java.util.Map
;
public
interface
MutationService
{
Map
<
String
,
List
<
String
>>
generation
(
TestEntity
testEntity
,
int
missionId
);
Map
<
String
,
List
<
String
>>
generation
(
TestEntity
testEntity
);
}
This diff is collapsed.
Click to expand it.
fuzzIntegration/src/main/java/com/example/fuzzControll/service/ProtocolTemplateService.java
View file @
e8df61c8
...
...
@@ -6,6 +6,6 @@ import java.util.List;
import
java.util.Map
;
public
interface
ProtocolTemplateService
{
Map
<
String
,
List
<
String
>>
generation
(
TestEntity
testEntity
,
int
missionId
);
Map
<
String
,
List
<
String
>>
generation
(
TestEntity
testEntity
);
}
This diff is collapsed.
Click to expand it.
fuzzIntegration/src/main/java/com/example/fuzzControll/service/VulnerabilityTypeService.java
View file @
e8df61c8
...
...
@@ -6,5 +6,5 @@ import java.util.List;
import
java.util.Map
;
public
interface
VulnerabilityTypeService
{
Map
<
String
,
List
<
String
>>
generation
(
TestEntity
testEntity
,
int
missionId
);
Map
<
String
,
List
<
String
>>
generation
(
TestEntity
testEntity
);
}
This diff is collapsed.
Click to expand it.
fuzzIntegration/src/main/java/com/example/fuzzControll/service/impl/FuzzParamsServiceImpl.java
View file @
e8df61c8
...
...
@@ -30,10 +30,10 @@ public class FuzzParamsServiceImpl implements FuzzParamsService {
}
@Override
public
FuzzParams
getFuzzParamById
(
int
i
d
)
{
public
FuzzParams
getFuzzParamById
(
int
missionI
d
)
{
FuzzParams
fuzzParams
=
null
;
try
{
fuzzParams
=
fuzzParamsMapper
.
getFuzzParamsById
(
i
d
);
fuzzParams
=
fuzzParamsMapper
.
getFuzzParamsById
(
missionI
d
);
}
catch
(
Exception
e
)
{
log
.
error
(
"FuzzParamsService.getFuzzParamById error:{}"
,
e
.
getMessage
());
throw
new
RuntimeException
(
e
);
...
...
@@ -43,7 +43,7 @@ public class FuzzParamsServiceImpl implements FuzzParamsService {
@Override
public
boolean
saveFuzzParams
(
FuzzParams
fuzzParams
)
{
return
f
alse
;
return
f
uzzParamsMapper
.
saveFuzzParams
(
fuzzParams
)
;
}
@Override
...
...
This diff is collapsed.
Click to expand it.
fuzzIntegration/src/main/java/com/example/fuzzControll/service/impl/GenerateMethodServiceImpl.java
View file @
e8df61c8
package
com
.
example
.
fuzzControll
.
service
.
impl
;
import
com.alibaba.fastjson2.JSON
;
import
com.example.fuzzControll.annotion.NeedCutAround
;
import
com.example.fuzzControll.annotion.NeedCutBefore
;
import
com.example.fuzzControll.conf.KittyProperties
;
import
com.example.fuzzControll.domain.bo.FuzzParams
;
import
com.example.fuzzControll.exception.testException.AflnetException
;
import
com.example.fuzzControll.exception.testException.CmdException
;
import
com.example.fuzzControll.exception.testException.FuzzException
;
import
com.example.fuzzControll.domain.bo.TestEntity
;
import
com.example.fuzzControll.service.FuzzParamsService
;
import
com.example.fuzzControll.service.GenerateMethodService
;
import
com.example.fuzzControll.tools.system.GlobalClass
;
import
com.example.fuzzControll.tools.test.TestCmdTools
;
import
com.example.fuzzControll.tools.test.TestTools
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -22,10 +28,18 @@ public class GenerateMethodServiceImpl implements GenerateMethodService {
TestCmdTools
cmdTools
=
new
TestCmdTools
();
@Autowired
KittyProperties
kitty
;
@Autowired
FuzzParamsService
fuzzParamsService
;
@Override
@NeedCutAround
(
name
=
"kitty"
,
function
=
"generation"
)
public
Map
<
String
,
List
<
String
>>
generation
(
TestEntity
testEntity
,
int
missionId
)
throws
FuzzException
,
CmdException
{
public
Map
<
String
,
List
<
String
>>
generation
(
TestEntity
testEntity
)
throws
FuzzException
,
CmdException
{
/*存入参数*/
int
missionId
=
GlobalClass
.
missionInfoMapper
.
selectTopMissionId
();
boolean
flag
=
fuzzParamsService
.
saveFuzzParams
(
new
FuzzParams
(
JSON
.
toJSONString
(
testEntity
.
getParamJson
()),
new
Date
(),
missionId
));
if
(!
flag
)
{
throw
new
AflnetException
(
"Save params error!"
);
}
/*运行指令*/
String
cmd
=
parseParameters
(
testEntity
);
if
(
cmd
.
isEmpty
())
{
throw
new
FuzzException
(
"cmd is null ! The number of parameters does not match!"
);
...
...
This diff is collapsed.
Click to expand it.
fuzzIntegration/src/main/java/com/example/fuzzControll/service/impl/MutationServiceImpl.java
View file @
e8df61c8
package
com
.
example
.
fuzzControll
.
service
.
impl
;
import
com.alibaba.fastjson2.JSON
;
import
com.example.fuzzControll.annotion.NeedCutAfter
;
import
com.example.fuzzControll.annotion.NeedCutAround
;
import
com.example.fuzzControll.annotion.NeedCutBefore
;
import
com.example.fuzzControll.conf.KittyProperties
;
import
com.example.fuzzControll.constents.MutationConstent
;
import
com.example.fuzzControll.domain.bo.FuzzParams
;
import
com.example.fuzzControll.exception.testException.AflnetException
;
import
com.example.fuzzControll.exception.testException.CmdException
;
import
com.example.fuzzControll.exception.testException.FuzzException
;
import
com.example.fuzzControll.domain.bo.TestEntity
;
import
com.example.fuzzControll.service.FuzzParamsService
;
import
com.example.fuzzControll.service.MutationService
;
import
com.example.fuzzControll.tools.system.GlobalClass
;
import
com.example.fuzzControll.tools.test.TestCmdTools
;
import
com.example.fuzzControll.tools.test.TestTools
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -24,11 +30,18 @@ class MutationServiceImpl implements MutationService {
TestCmdTools
cmdTools
=
new
TestCmdTools
();
@Autowired
KittyProperties
kitty
;
@Autowired
FuzzParamsService
fuzzParamsService
;
@Override
@NeedCutAround
(
name
=
"kitty"
,
function
=
"generation"
)
public
Map
<
String
,
List
<
String
>>
generation
(
TestEntity
testEntity
,
int
missionId
)
throws
FuzzException
,
CmdException
{
public
Map
<
String
,
List
<
String
>>
generation
(
TestEntity
testEntity
)
throws
FuzzException
,
CmdException
{
/*存入参数*/
int
missionId
=
GlobalClass
.
missionInfoMapper
.
selectTopMissionId
();
boolean
flag
=
fuzzParamsService
.
saveFuzzParams
(
new
FuzzParams
(
JSON
.
toJSONString
(
testEntity
.
getParamJson
()),
new
Date
(),
missionId
));
if
(!
flag
)
{
throw
new
AflnetException
(
"Save params error!"
);
}
String
cmd
=
parseParameters
(
testEntity
);
if
(
cmd
.
isEmpty
())
{
throw
new
FuzzException
(
"cmd is null ! The number of parameters does not match!"
);
...
...
This diff is collapsed.
Click to expand it.
fuzzIntegration/src/main/java/com/example/fuzzControll/service/impl/ProtocolTemplateImpl.java
View file @
e8df61c8
package
com
.
example
.
fuzzControll
.
service
.
impl
;
import
com.alibaba.fastjson2.JSON
;
import
com.example.fuzzControll.annotion.NeedCutAround
;
import
com.example.fuzzControll.annotion.NeedCutBefore
;
import
com.example.fuzzControll.conf.KittyProperties
;
import
com.example.fuzzControll.constents.CmdConstent
;
import
com.example.fuzzControll.constents.ProtocolConstent
;
import
com.example.fuzzControll.domain.bo.FuzzParams
;
import
com.example.fuzzControll.exception.testException.AflnetException
;
import
com.example.fuzzControll.exception.testException.CmdException
;
import
com.example.fuzzControll.exception.testException.FuzzException
;
import
com.example.fuzzControll.domain.bo.TestEntity
;
import
com.example.fuzzControll.service.FuzzParamsService
;
import
com.example.fuzzControll.service.ProtocolTemplateService
;
import
com.example.fuzzControll.tools.system.GlobalClass
;
import
com.example.fuzzControll.tools.test.SingleCmdTools
;
...
...
@@ -18,6 +22,7 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -28,10 +33,18 @@ public class ProtocolTemplateImpl implements ProtocolTemplateService {
TestCmdTools
testCmdTools
=
new
TestCmdTools
();
@Autowired
KittyProperties
kitty
;
@Autowired
FuzzParamsService
fuzzParamsService
;
@Override
@NeedCutAround
(
name
=
"kitty"
,
function
=
"generation"
)
public
Map
<
String
,
List
<
String
>>
generation
(
TestEntity
testEntity
,
int
missionId
)
throws
FuzzException
,
CmdException
{
public
Map
<
String
,
List
<
String
>>
generation
(
TestEntity
testEntity
)
throws
FuzzException
,
CmdException
{
/*存入参数*/
int
missionId
=
GlobalClass
.
missionInfoMapper
.
selectTopMissionId
();
boolean
flag
=
fuzzParamsService
.
saveFuzzParams
(
new
FuzzParams
(
JSON
.
toJSONString
(
testEntity
.
getParamJson
()),
new
Date
(),
missionId
));
if
(!
flag
)
{
throw
new
AflnetException
(
"Save params error!"
);
}
/*生成日志前先清除日志*/
singleCmdTools
.
runCmd
(
CmdConstent
.
DELETE_FILE
+
GlobalClass
.
kittyProperties
.
getLogOutPath
(),
"delete kittyLogs"
);
String
cmd
=
parseParameters
(
testEntity
);
...
...
This diff is collapsed.
Click to expand it.
fuzzIntegration/src/main/java/com/example/fuzzControll/service/impl/TestServiceImpl.java
View file @
e8df61c8
package
com
.
example
.
fuzzControll
.
service
.
impl
;
import
com.alibaba.fastjson2.JSON
;
import
com.example.fuzzControll.annotion.NeedCutBefore
;
import
com.example.fuzzControll.conf.AflnetProperties
;
import
com.example.fuzzControll.constents.CmdConstent
;
import
com.example.fuzzControll.domain.bo.FuzzParams
;
import
com.example.fuzzControll.exception.testException.AflnetException
;
import
com.example.fuzzControll.exception.testException.CmdException
;
import
com.example.fuzzControll.domain.bo.CmdStartParams
;
import
com.example.fuzzControll.service.AflnetPersistenceService
;
import
com.example.fuzzControll.service.FuzzParamsService
;
import
com.example.fuzzControll.service.TestService
;
import
com.example.fuzzControll.tools.system.GlobalClass
;
import
com.example.fuzzControll.tools.test.JsonUtils
;
import
com.example.fuzzControll.tools.test.TestCmdTools
;
import
com.example.fuzzControll.tools.test.TestControlTools
;
import
com.example.fuzzControll.tools.system.SystemRunningParams
;
...
...
@@ -30,10 +35,19 @@ public class TestServiceImpl implements TestService {
@Autowired
AflnetProperties
aflnetProperties
;
@Autowired
FuzzParamsService
fuzzParamsService
;
//todo 不同服务不同端口
@Override
public
void
testStart
(
CmdStartParams
cmdStartParams
)
throws
AflnetException
,
CmdException
{
/*存入参数*/
System
.
out
.
println
(
JSON
.
toJSONString
(
cmdStartParams
));
int
missionId
=
GlobalClass
.
missionInfoMapper
.
selectTopMissionId
()
+
1
;
boolean
flag
=
fuzzParamsService
.
saveFuzzParams
(
new
FuzzParams
(
JSON
.
toJSONString
(
cmdStartParams
),
new
Date
(),
missionId
));
if
(!
flag
)
{
throw
new
AflnetException
(
"Save params error!"
);
}
/*拼接指令*/
TestControlTools
.
setIsRunning
(
true
);
String
cmd
=
cmdTools
.
parse
(
cmdStartParams
);
...
...
This diff is collapsed.
Click to expand it.
fuzzIntegration/src/main/java/com/example/fuzzControll/service/impl/VulnerabilityTypeServiceImpl.java
View file @
e8df61c8
package
com
.
example
.
fuzzControll
.
service
.
impl
;
import
com.alibaba.fastjson2.JSON
;
import
com.example.fuzzControll.annotion.NeedCutAround
;
import
com.example.fuzzControll.annotion.NeedCutBefore
;
import
com.example.fuzzControll.conf.KittyProperties
;
import
com.example.fuzzControll.domain.bo.FuzzParams
;
import
com.example.fuzzControll.exception.testException.AflnetException
;
import
com.example.fuzzControll.exception.testException.CmdException
;
import
com.example.fuzzControll.exception.testException.FuzzException
;
import
com.example.fuzzControll.domain.bo.TestEntity
;
import
com.example.fuzzControll.service.FuzzParamsService
;
import
com.example.fuzzControll.service.VulnerabilityTypeService
;
import
com.example.fuzzControll.tools.system.GlobalClass
;
import
com.example.fuzzControll.tools.test.TestCmdTools
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -21,10 +27,17 @@ public class VulnerabilityTypeServiceImpl implements VulnerabilityTypeService {
TestCmdTools
cmdTools
=
new
TestCmdTools
();
@Autowired
KittyProperties
kitty
;
@Autowired
FuzzParamsService
fuzzParamsService
;
@Override
@NeedCutAround
(
name
=
"kitty"
,
function
=
"generation"
)
public
Map
<
String
,
List
<
String
>>
generation
(
TestEntity
testEntity
,
int
missionId
)
throws
FuzzException
,
CmdException
{
public
Map
<
String
,
List
<
String
>>
generation
(
TestEntity
testEntity
)
throws
FuzzException
,
CmdException
{
/*存入参数*/
int
missionId
=
GlobalClass
.
missionInfoMapper
.
selectTopMissionId
();
boolean
flag
=
fuzzParamsService
.
saveFuzzParams
(
new
FuzzParams
(
JSON
.
toJSONString
(
testEntity
.
getParamJson
()),
new
Date
(),
missionId
));
if
(!
flag
)
{
throw
new
AflnetException
(
"Save params error!"
);
}
String
cmd
=
parseParameters
(
testEntity
);
if
(
cmd
.
isEmpty
())
{
throw
new
FuzzException
(
"cmd is null ! The number of parameters does not match!"
);
...
...
This diff is collapsed.
Click to expand it.
fuzzIntegration/src/main/java/com/example/fuzzControll/tools/test/JsonUtils.java
0 → 100644
View file @
e8df61c8
package
com
.
example
.
fuzzControll
.
tools
.
test
;
import
com.alibaba.fastjson2.JSON
;
import
com.example.fuzzControll.domain.bo.TestEntity
;
/**
* json相关工具
*/
public
class
JsonUtils
{
public
static
String
EntityToJsonString
(
TestEntity
testEntity
){
return
JSON
.
toJSONString
(
testEntity
.
getParamJson
());
}
}
This diff is collapsed.
Click to expand it.
fuzzIntegration/src/main/resources/application-dev.yml
View file @
e8df61c8
...
...
@@ -41,7 +41,7 @@ spring:
discovery
:
server-addr
:
http://${nacos-docker.ip}:8848
datasource
:
url
:
jdbc:mysql://${mysql-docker.ip}:
3307
/fuzz?allowPublicKeyRetrieval=true&useSSL=falseuseUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url
:
jdbc:mysql://${mysql-docker.ip}:
${mysql-docker.port}
/fuzz?allowPublicKeyRetrieval=true&useSSL=falseuseUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username
:
root
password
:
123456
driver-class-name
:
com.mysql.cj.jdbc.Driver
...
...
@@ -49,10 +49,11 @@ integrationpath:
webSocketUri
:
ws://${fuzzmaster-docker.ip}:8101/websocket/testResult/
nacos-docker
:
ip
:
192.168.50.2
47
ip
:
192.168.50.2
51
fuzzmaster-docker
:
ip
:
192.168.50.2
47
ip
:
192.168.50.2
51
mysql-docker
:
ip
:
192.168.50.247
\ No newline at end of file
ip
:
192.168.50.251
port
:
3307
\ No newline at end of file
This diff is collapsed.
Click to expand it.
fuzzIntegration/src/main/resources/application.yml
View file @
e8df61c8
...
...
@@ -5,6 +5,6 @@ spring:
active
:
dev
#默认为开发环境
server
:
port
:
810
3
port
:
810
4
This diff is collapsed.
Click to expand it.
fuzzIntegration/src/main/resources/mapper/FuzzParamsMapper.xml
View file @
e8df61c8
...
...
@@ -8,20 +8,21 @@
<result
property=
"id"
column=
"id"
/>
<result
property=
"params"
column=
"params"
/>
<result
property=
"editTime"
column=
"editTime"
/>
<result
property=
"missionId"
column=
"missionId"
/>
</resultMap>
<sql
id=
"selectFuzzParams"
>
select id, params,editTime from fuzz_params
select id, params,editTime
,missionId
from fuzz_params
</sql>
<insert
id=
"saveFuzzParams"
>
insert into fuzz_params(id, params,editTime
) values(#{id}, #{params},#{editTime
})
insert into fuzz_params(id, params,editTime
,missionId) values(#{id}, #{params},#{editTime},#{missionId
})
</insert>
<update
id=
"editFuzzParams"
>
update fuzz_params set params = #{params} ,editTime = #{editTime} where missionId = #{missionId}
</update>
<select
id=
"getFuzzParamsById"
resultMap=
"fuzzParams"
>
<include
refid=
"selectFuzzParams"
/>
where
id = #{i
d}
where
missionId = #{missionI
d}
</select>
<select
id=
"getFuzzParamsList"
resultMap=
"fuzzParams"
>
<include
refid=
"selectFuzzParams"
/>
...
...
This diff is collapsed.
Click to expand it.
fuzzbackendmaster/src/main/java/com/example/fuzzbackendmaster/controller/FuzzParamsController.java
0 → 100644
View file @
e8df61c8
package
com
.
example
.
fuzzbackendmaster
.
controller
;
import
com.example.fuzzbackendmaster.pojo.vo.AjaxResult
;
import
com.example.fuzzbackendmaster.pojo.vo.FuzzParams
;
import
com.example.fuzzbackendmaster.service.FuzzIntegrationFileApi
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
@RestController
@RequestMapping
(
"/fuzzParams"
)
@Slf4j
public
class
FuzzParamsController
{
@Autowired
FuzzIntegrationFileApi
fuzzIntegrationFileApi
;
/**
* 获取参数列表
*/
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
public
AjaxResult
list
()
{
try
{
return
AjaxResult
.
success
(
fuzzIntegrationFileApi
.
getFuzzParamsList
());
}
catch
(
Exception
e
)
{
log
.
error
(
"Get params of fuzz error:{}"
,
e
.
getMessage
());
return
AjaxResult
.
error
();
}
}
/**
* 跟据id获取参数
*/
@RequestMapping
(
value
=
"/getParam/{id}"
,
method
=
RequestMethod
.
GET
)
public
AjaxResult
getById
(
@PathVariable
(
"id"
)
int
id
)
{
FuzzParams
result
;
try
{
return
AjaxResult
.
success
(
fuzzIntegrationFileApi
.
getFuzzParamById
(
id
));
}
catch
(
Exception
e
)
{
log
.
error
(
"Get params of fuzz with id error:{}"
,
e
.
getMessage
());
return
AjaxResult
.
error
();
}
}
/**
* 跟据id修改参数
*/
@RequestMapping
(
value
=
"/editParam"
,
method
=
RequestMethod
.
POST
)
public
AjaxResult
editById
(
@RequestBody
FuzzParams
fuzzParams
)
{
try
{
return
AjaxResult
.
success
(
fuzzIntegrationFileApi
.
editFuzzParams
(
fuzzParams
));
}
catch
(
Exception
e
)
{
log
.
error
(
"Edit params with id error:{}"
,
e
.
getMessage
());
return
AjaxResult
.
error
();
}
}
}
This diff is collapsed.
Click to expand it.
fuzzbackendmaster/src/main/java/com/example/fuzzbackendmaster/controller/TestController.java
View file @
e8df61c8
...
...
@@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.*;
*/
@Slf4j
@RestController
@RequestMapping
(
"/
aflne
t"
)
@RequestMapping
(
"/
tes
t"
)
@CrossOrigin
public
class
TestController
{
@Autowired
...
...
This diff is collapsed.
Click to expand it.
fuzzbackendmaster/src/main/java/com/example/fuzzbackendmaster/pojo/vo/FuzzParams.java
0 → 100644
View file @
e8df61c8
package
com
.
example
.
fuzzbackendmaster
.
pojo
.
vo
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
lombok.Getter
;
import
lombok.Setter
;
import
java.util.Date
;
@Data
@Getter
@Setter
public
class
FuzzParams
{
private
int
id
;
private
String
params
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
private
Date
editTime
;
private
int
missionId
;
public
FuzzParams
()
{
}
public
FuzzParams
(
int
id
,
String
params
,
Date
editTime
,
int
missionId
)
{
this
.
id
=
id
;
this
.
params
=
params
;
this
.
editTime
=
editTime
;
this
.
missionId
=
missionId
;
}
public
FuzzParams
(
String
params
,
Date
editTime
,
int
missionId
)
{
this
.
params
=
params
;
this
.
editTime
=
editTime
;
this
.
missionId
=
missionId
;
}
public
void
setId
(
int
id
)
{
this
.
id
=
id
;
}
public
int
getMissionId
()
{
return
missionId
;
}
public
void
setMissionId
(
int
missionId
)
{
this
.
missionId
=
missionId
;
}
public
void
setParams
(
String
params
)
{
this
.
params
=
params
;
}
public
void
setEditTime
(
Date
editTime
)
{
this
.
editTime
=
editTime
;
}
public
int
getId
()
{
return
id
;
}
public
String
getParams
()
{
return
params
;
}
public
Date
getEditTime
()
{
return
editTime
;
}
}
This diff is collapsed.
Click to expand it.
fuzzbackendmaster/src/main/java/com/example/fuzzbackendmaster/service/FuzzIntegrationFileApi.java
View file @
e8df61c8
package
com
.
example
.
fuzzbackendmaster
.
service
;
import
com.example.fuzzbackendmaster.pojo.vo.AjaxResult
;
import
com.example.fuzzbackendmaster.pojo.vo.CmdStartParams
;
import
com.example.fuzzbackendmaster.pojo.vo.FuzzLogTransEntity
;
import
com.example.fuzzbackendmaster.pojo.vo.TestEntity
;
import
com.example.fuzzbackendmaster.pojo.vo.*
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.http.MediaType
;
import
org.springframework.stereotype.Component
;
...
...
@@ -84,4 +81,25 @@ public interface FuzzIntegrationFileApi {
*/
@RequestMapping
(
value
=
"/mission/getList"
,
method
=
RequestMethod
.
GET
)
AjaxResult
selectMissionInfoList
();
/**
* 查询测试参数
*/
@RequestMapping
(
value
=
"/fuzzParams/list"
,
method
=
RequestMethod
.
GET
)
AjaxResult
getFuzzParamsList
();
/**
* 跟据id查参数
* @param missionId
* @return
*/
@RequestMapping
(
value
=
"/fuzzParams/getParam/{missionId}"
,
method
=
RequestMethod
.
GET
)
AjaxResult
getFuzzParamById
(
@PathVariable
(
"missionId"
)
int
missionId
);
/**
* 编辑参数
* @param fuzzParams
* @return
*/
@RequestMapping
(
value
=
"/fuzzParams/editParam"
,
method
=
RequestMethod
.
POST
)
AjaxResult
editFuzzParams
(
FuzzParams
fuzzParams
);
}
This diff is collapsed.
Click to expand it.
fuzzbackendmaster/src/main/resources/application-dev.yml
View file @
e8df61c8
...
...
@@ -20,4 +20,4 @@ spring:
server-addr
:
http://${nacos-docker.ip}:8848
nacos-docker
:
ip
:
192.168.50.2
47
ip
:
192.168.50.2
51
This diff is collapsed.
Click to expand it.
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