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
3f6bd303
Commit
3f6bd303
authored
a year ago
by
钱炳权
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善后端异常处理,即使cmd运行但是没有数据写入和修改依旧显示未成功。
parent
a73cc0e0
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
40 changed files
with
297 additions
and
185 deletions
+297
-185
README.md
fuzzbackend/README.md
+1
-0
pom.xml
fuzzbackend/pom.xml
+8
-0
KittyProperties.java
...n/java/com/example/fuzzControll/conf/KittyProperties.java
+1
-1
SeedProperties.java
...in/java/com/example/fuzzControll/conf/SeedProperties.java
+1
-1
CmdConstent.java
.../java/com/example/fuzzControll/constents/CmdConstent.java
+5
-3
MutationConstent.java
.../com/example/fuzzControll/constents/MutationConstent.java
+1
-1
ProtocolConstent.java
.../com/example/fuzzControll/constents/ProtocolConstent.java
+1
-1
KittyServerMessageController.java
...fuzzControll/controller/KittyServerMessageController.java
+5
-5
SeedFileController.java
...m/example/fuzzControll/controller/SeedFileController.java
+3
-3
TestClassController.java
.../example/fuzzControll/controller/TestClassController.java
+14
-14
TestControler.java
...va/com/example/fuzzControll/controller/TestControler.java
+5
-5
AflnetException.java
...a/com/example/fuzzControll/exception/AflnetException.java
+9
-0
BaseException.java
...ava/com/example/fuzzControll/exception/BaseException.java
+22
-0
CmdException.java
...java/com/example/fuzzControll/exception/CmdException.java
+11
-0
FileException.java
...ava/com/example/fuzzControll/exception/FileException.java
+11
-0
FuzzException.java
...ava/com/example/fuzzControll/exception/FuzzException.java
+8
-0
ServerException.java
...a/com/example/fuzzControll/exception/ServerException.java
+8
-0
CmdStartParams.java
...java/com/example/fuzzControll/pojo/vo/CmdStartParams.java
+1
-1
TestEntity.java
...ain/java/com/example/fuzzControll/pojo/vo/TestEntity.java
+1
-1
TestReturnEntity.java
...va/com/example/fuzzControll/pojo/vo/TestReturnEntity.java
+1
-1
GenerateMethodService.java
...m/example/fuzzControll/service/GenerateMethodService.java
+3
-3
GetServerMessageService.java
...example/fuzzControll/service/GetServerMessageService.java
+1
-4
MutationService.java
...ava/com/example/fuzzControll/service/MutationService.java
+3
-3
ProtocolTemplateService.java
...example/fuzzControll/service/ProtocolTemplateService.java
+3
-3
SeedFileService.java
...ava/com/example/fuzzControll/service/SeedFileService.java
+2
-1
TestService.java
...in/java/com/example/fuzzControll/service/TestService.java
+3
-3
VulnerabilityTypeService.java
...xample/fuzzControll/service/VulnerabilityTypeService.java
+3
-3
GenerateMethodServiceImpl.java
.../fuzzControll/service/impl/GenerateMethodServiceImpl.java
+13
-12
GetServerMessageImpl.java
...ample/fuzzControll/service/impl/GetServerMessageImpl.java
+17
-17
MutationServiceImpl.java
...xample/fuzzControll/service/impl/MutationServiceImpl.java
+22
-20
ProtocolTemplateImpl.java
...ample/fuzzControll/service/impl/ProtocolTemplateImpl.java
+0
-0
SeedFileServiceImpl.java
...xample/fuzzControll/service/impl/SeedFileServiceImpl.java
+60
-0
TestServiceImpl.java
...om/example/fuzzControll/service/impl/TestServiceImpl.java
+13
-13
VulnerabilityTypeServiceImpl.java
...zzControll/service/impl/VulnerabilityTypeServiceImpl.java
+11
-10
seedFileServiceImpl.java
...xample/fuzzControll/service/impl/seedFileServiceImpl.java
+0
-36
CmdTools.java
...rc/main/java/com/example/fuzzControll/tools/CmdTools.java
+13
-11
FileTools.java
...c/main/java/com/example/fuzzControll/tools/FileTools.java
+9
-5
RegularTools.java
...ain/java/com/example/fuzzControll/tools/RegularTools.java
+1
-1
TestControlTools.java
...java/com/example/fuzzControll/tools/TestControlTools.java
+2
-2
TestTools.java
...c/main/java/com/example/fuzzControll/tools/TestTools.java
+1
-1
No files found.
fuzzbackend/README.md
0 → 100644
View file @
3f6bd303
## ferofuzz
This diff is collapsed.
Click to expand it.
fuzzbackend/pom.xml
View file @
3f6bd303
...
@@ -101,6 +101,14 @@
...
@@ -101,6 +101,14 @@
</execution>
</execution>
</executions>
</executions>
</plugin>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-compiler-plugin
</artifactId>
<configuration>
<source>
7
</source>
<target>
7
</target>
</configuration>
</plugin>
</plugins>
</plugins>
...
...
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/conf/
k
ittyProperties.java
→
fuzzbackend/src/main/java/com/example/fuzzControll/conf/
K
ittyProperties.java
View file @
3f6bd303
...
@@ -5,7 +5,7 @@ import org.springframework.stereotype.Component;
...
@@ -5,7 +5,7 @@ import org.springframework.stereotype.Component;
@Component
(
"kittyProperties"
)
@Component
(
"kittyProperties"
)
@ConfigurationProperties
(
prefix
=
"kitty"
)
@ConfigurationProperties
(
prefix
=
"kitty"
)
public
class
k
ittyProperties
{
public
class
K
ittyProperties
{
String
path
;
String
path
;
String
venvPath
;
String
venvPath
;
String
methodPath
;
String
methodPath
;
...
...
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/conf/
s
eedProperties.java
→
fuzzbackend/src/main/java/com/example/fuzzControll/conf/
S
eedProperties.java
View file @
3f6bd303
...
@@ -5,7 +5,7 @@ import org.springframework.stereotype.Component;
...
@@ -5,7 +5,7 @@ import org.springframework.stereotype.Component;
@Component
(
"seedProperties"
)
@Component
(
"seedProperties"
)
@ConfigurationProperties
(
prefix
=
"filepath"
)
@ConfigurationProperties
(
prefix
=
"filepath"
)
public
class
s
eedProperties
{
public
class
S
eedProperties
{
String
seedPath
;
String
seedPath
;
public
String
getSeedPath
()
{
public
String
getSeedPath
()
{
...
...
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/constents/
c
mdConstent.java
→
fuzzbackend/src/main/java/com/example/fuzzControll/constents/
C
mdConstent.java
View file @
3f6bd303
package
com
.
example
.
fuzzControll
.
constents
;
package
com
.
example
.
fuzzControll
.
constents
;
import
com.example.fuzzControll.conf.SpringContextUtil
;
import
com.example.fuzzControll.conf.SpringContextUtil
;
import
com.example.fuzzControll.conf.
k
ittyProperties
;
import
com.example.fuzzControll.conf.
K
ittyProperties
;
public
class
c
mdConstent
{
public
class
C
mdConstent
{
static
kittyProperties
kittyProperties
=
(
k
ittyProperties
)
SpringContextUtil
.
getBean
(
"kittyProperties"
);
static
KittyProperties
kittyProperties
=
(
K
ittyProperties
)
SpringContextUtil
.
getBean
(
"kittyProperties"
);
public
static
final
String
GET_FILE_NAME
=
"ls -h "
;
public
static
final
String
GET_FILE_NAME
=
"ls -h "
;
public
static
final
String
DELETE_FILE
=
"sudo rm -r "
;
public
static
final
String
DELETE_FILE
=
"sudo rm -r "
;
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
RUN_AFLNET
=
"afl-fuzz -d -i "
+
kittyProperties
.
getAflnetPath
()+
"aflnet/tutorials/live555/in-rtsp -o out-live8 "
+
public
static
final
String
RUN_AFLNET
=
"afl-fuzz -d -i "
+
kittyProperties
.
getAflnetPath
()+
"aflnet/tutorials/live555/in-rtsp -o out-live8 "
+
"-x "
+
kittyProperties
.
getAflnetPath
()+
"aflnet/tutorials/live555/rtsp.dict "
;
"-x "
+
kittyProperties
.
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"
;
...
...
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/constents/
m
utationConstent.java
→
fuzzbackend/src/main/java/com/example/fuzzControll/constents/
M
utationConstent.java
View file @
3f6bd303
package
com
.
example
.
fuzzControll
.
constents
;
package
com
.
example
.
fuzzControll
.
constents
;
public
class
m
utationConstent
{
public
class
M
utationConstent
{
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 "
;
public
static
final
String
TEST_MUTATION_STRATEGY
=
"test_mutation_strategy.py "
;
public
static
final
String
TEST_MUTATION_STRATEGY
=
"test_mutation_strategy.py "
;
...
...
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/constents/
p
rotocolConstent.java
→
fuzzbackend/src/main/java/com/example/fuzzControll/constents/
P
rotocolConstent.java
View file @
3f6bd303
package
com
.
example
.
fuzzControll
.
constents
;
package
com
.
example
.
fuzzControll
.
constents
;
public
class
p
rotocolConstent
{
public
class
P
rotocolConstent
{
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 "
;
public
static
final
String
DHCP
=
"dhcp_scapy.py "
;
public
static
final
String
DHCP
=
"dhcp_scapy.py "
;
...
...
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/controller/
k
ittyServerMessageController.java
→
fuzzbackend/src/main/java/com/example/fuzzControll/controller/
K
ittyServerMessageController.java
View file @
3f6bd303
package
com
.
example
.
fuzzControll
.
controller
;
package
com
.
example
.
fuzzControll
.
controller
;
import
com.example.fuzzControll.pojo.vo.AjaxResult
;
import
com.example.fuzzControll.pojo.vo.AjaxResult
;
import
com.example.fuzzControll.service.
g
etServerMessageService
;
import
com.example.fuzzControll.service.
G
etServerMessageService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
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
;
...
@@ -12,9 +12,9 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -12,9 +12,9 @@ import org.springframework.web.bind.annotation.RestController;
*/
*/
@RestController
@RestController
@RequestMapping
(
"/kittyServer"
)
@RequestMapping
(
"/kittyServer"
)
public
class
k
ittyServerMessageController
{
public
class
K
ittyServerMessageController
{
@Autowired
@Autowired
g
etServerMessageService
getServerMessageService
;
G
etServerMessageService
getServerMessageService
;
/**
/**
* 获取服务器stats信息
* 获取服务器stats信息
*/
*/
...
@@ -45,7 +45,7 @@ public class kittyServerMessageController {
...
@@ -45,7 +45,7 @@ public class kittyServerMessageController {
try
{
try
{
return
AjaxResult
.
success
(
getServerMessageService
.
getStages
());
return
AjaxResult
.
success
(
getServerMessageService
.
getStages
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
return
AjaxResult
.
error
(
"sta
t
s信息获取失败!"
);
return
AjaxResult
.
error
(
"sta
ge
s信息获取失败!"
);
}
}
}
}
/**
/**
...
@@ -56,7 +56,7 @@ public class kittyServerMessageController {
...
@@ -56,7 +56,7 @@ public class kittyServerMessageController {
try
{
try
{
return
AjaxResult
.
success
(
getServerMessageService
.
getReport
());
return
AjaxResult
.
success
(
getServerMessageService
.
getReport
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
return
AjaxResult
.
error
(
"
stats
信息获取失败!"
);
return
AjaxResult
.
error
(
"
report
信息获取失败!"
);
}
}
}
}
}
}
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/controller/
s
eedFileController.java
→
fuzzbackend/src/main/java/com/example/fuzzControll/controller/
S
eedFileController.java
View file @
3f6bd303
package
com
.
example
.
fuzzControll
.
controller
;
package
com
.
example
.
fuzzControll
.
controller
;
import
com.example.fuzzControll.pojo.vo.AjaxResult
;
import
com.example.fuzzControll.pojo.vo.AjaxResult
;
import
com.example.fuzzControll.service.
s
eedFileService
;
import
com.example.fuzzControll.service.
S
eedFileService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
@@ -16,10 +16,10 @@ import java.util.List;
...
@@ -16,10 +16,10 @@ import java.util.List;
*/
*/
@RestController
@RestController
@RequestMapping
(
"/seedFile"
)
@RequestMapping
(
"/seedFile"
)
public
class
s
eedFileController
{
public
class
S
eedFileController
{
@Autowired
@Autowired
s
eedFileService
service
;
S
eedFileService
service
;
/**
/**
* 种子文件查询接口
* 种子文件查询接口
...
...
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/controller/
t
estClassController.java
→
fuzzbackend/src/main/java/com/example/fuzzControll/controller/
T
estClassController.java
View file @
3f6bd303
package
com
.
example
.
fuzzControll
.
controller
;
package
com
.
example
.
fuzzControll
.
controller
;
import
com.example.fuzzControll.pojo.vo.AjaxResult
;
import
com.example.fuzzControll.pojo.vo.AjaxResult
;
import
com.example.fuzzControll.pojo.vo.
t
estEntity
;
import
com.example.fuzzControll.pojo.vo.
T
estEntity
;
import
com.example.fuzzControll.service.
g
enerateMethodService
;
import
com.example.fuzzControll.service.
G
enerateMethodService
;
import
com.example.fuzzControll.service.
m
utationService
;
import
com.example.fuzzControll.service.
M
utationService
;
import
com.example.fuzzControll.service.
p
rotocolTemplateService
;
import
com.example.fuzzControll.service.
P
rotocolTemplateService
;
import
com.example.fuzzControll.service.
v
ulnerabilityTypeService
;
import
com.example.fuzzControll.service.
V
ulnerabilityTypeService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
@@ -20,20 +20,20 @@ import java.util.Map;
...
@@ -20,20 +20,20 @@ import java.util.Map;
*/
*/
@RestController
@RestController
@RequestMapping
(
"/testClass"
)
@RequestMapping
(
"/testClass"
)
public
class
t
estClassController
{
public
class
T
estClassController
{
@Autowired
@Autowired
g
enerateMethodService
generateMethodService
;
G
enerateMethodService
generateMethodService
;
@Autowired
@Autowired
m
utationService
mutationService
;
M
utationService
mutationService
;
@Autowired
@Autowired
p
rotocolTemplateService
protocolTemplateService
;
P
rotocolTemplateService
protocolTemplateService
;
@Autowired
@Autowired
v
ulnerabilityTypeService
vulnerabilityTypeService
;
V
ulnerabilityTypeService
vulnerabilityTypeService
;
/**
/**
* 模板
* 模板
*/
*/
@RequestMapping
(
value
=
"/protocolTemplate"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/protocolTemplate"
,
method
=
RequestMethod
.
POST
)
public
AjaxResult
protocolTemplate
(
@RequestBody
t
estEntity
testEntity
)
{
public
AjaxResult
protocolTemplate
(
@RequestBody
T
estEntity
testEntity
)
{
try
{
try
{
Map
<
String
,
List
<
String
>>
result
=
protocolTemplateService
.
generation
(
testEntity
);
Map
<
String
,
List
<
String
>>
result
=
protocolTemplateService
.
generation
(
testEntity
);
return
AjaxResult
.
success
(
result
==
null
?
"模板文件生成未成功运行"
:
result
);
return
AjaxResult
.
success
(
result
==
null
?
"模板文件生成未成功运行"
:
result
);
...
@@ -46,7 +46,7 @@ public class testClassController {
...
@@ -46,7 +46,7 @@ public class testClassController {
*生成方法
*生成方法
*/
*/
@RequestMapping
(
value
=
"/generate"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/generate"
,
method
=
RequestMethod
.
POST
)
public
AjaxResult
generate
(
@RequestBody
t
estEntity
testEntity
)
{
public
AjaxResult
generate
(
@RequestBody
T
estEntity
testEntity
)
{
try
{
try
{
Map
<
String
,
List
<
String
>>
result
=
generateMethodService
.
generation
(
testEntity
);
Map
<
String
,
List
<
String
>>
result
=
generateMethodService
.
generation
(
testEntity
);
return
AjaxResult
.
success
(
result
==
null
?
"生成方法未成功运行"
:
result
);
return
AjaxResult
.
success
(
result
==
null
?
"生成方法未成功运行"
:
result
);
...
@@ -59,7 +59,7 @@ public class testClassController {
...
@@ -59,7 +59,7 @@ public class testClassController {
*变异方法
*变异方法
*/
*/
@RequestMapping
(
value
=
"/mutation"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/mutation"
,
method
=
RequestMethod
.
POST
)
public
AjaxResult
mutation
(
@RequestBody
t
estEntity
testEntity
)
{
public
AjaxResult
mutation
(
@RequestBody
T
estEntity
testEntity
)
{
try
{
try
{
Map
<
String
,
List
<
String
>>
result
=
mutationService
.
generation
(
testEntity
);
Map
<
String
,
List
<
String
>>
result
=
mutationService
.
generation
(
testEntity
);
return
AjaxResult
.
success
(
result
==
null
?
"mutationTest未成功运行"
:
result
);
return
AjaxResult
.
success
(
result
==
null
?
"mutationTest未成功运行"
:
result
);
...
@@ -72,7 +72,7 @@ public class testClassController {
...
@@ -72,7 +72,7 @@ public class testClassController {
*漏洞类型
*漏洞类型
*/
*/
@RequestMapping
(
value
=
"/vulnerabilityType"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/vulnerabilityType"
,
method
=
RequestMethod
.
POST
)
public
AjaxResult
upload
(
@RequestBody
t
estEntity
testEntity
)
{
public
AjaxResult
upload
(
@RequestBody
T
estEntity
testEntity
)
{
try
{
try
{
Map
<
String
,
List
<
String
>>
result
=
vulnerabilityTypeService
.
generation
(
testEntity
);
Map
<
String
,
List
<
String
>>
result
=
vulnerabilityTypeService
.
generation
(
testEntity
);
return
AjaxResult
.
success
(
result
==
null
?
"漏洞类型未成功运行"
:
result
);
return
AjaxResult
.
success
(
result
==
null
?
"漏洞类型未成功运行"
:
result
);
...
...
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/controller/
t
estControler.java
→
fuzzbackend/src/main/java/com/example/fuzzControll/controller/
T
estControler.java
View file @
3f6bd303
package
com
.
example
.
fuzzControll
.
controller
;
package
com
.
example
.
fuzzControll
.
controller
;
import
com.example.fuzzControll.pojo.vo.AjaxResult
;
import
com.example.fuzzControll.pojo.vo.AjaxResult
;
import
com.example.fuzzControll.pojo.vo.
c
mdStartParams
;
import
com.example.fuzzControll.pojo.vo.
C
mdStartParams
;
import
com.example.fuzzControll.service.
t
estService
;
import
com.example.fuzzControll.service.
T
estService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
@@ -14,15 +14,15 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -14,15 +14,15 @@ import org.springframework.web.bind.annotation.RestController;
*/
*/
@RestController
@RestController
@RequestMapping
(
"/test"
)
@RequestMapping
(
"/test"
)
public
class
t
estControler
{
public
class
T
estControler
{
@Autowired
@Autowired
t
estService
service
;
T
estService
service
;
/**
/**
* 测试启动
* 测试启动
*/
*/
@RequestMapping
(
value
=
"/testStart"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/testStart"
,
method
=
RequestMethod
.
POST
)
public
AjaxResult
list
(
@RequestBody
final
c
mdStartParams
cmdStartParams
)
{
public
AjaxResult
list
(
@RequestBody
final
C
mdStartParams
cmdStartParams
)
{
try
{
try
{
new
Thread
(
new
Runnable
()
{
new
Thread
(
new
Runnable
()
{
@Override
@Override
...
...
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/exception/AflnetException.java
0 → 100644
View file @
3f6bd303
package
com
.
example
.
fuzzControll
.
exception
;
public
class
AflnetException
extends
BaseException
{
private
static
final
long
serialVersionUID
=
1L
;
public
AflnetException
(
String
defaultMessage
)
{
super
(
defaultMessage
,
"aflnet"
);
}
}
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/exception/BaseException.java
0 → 100644
View file @
3f6bd303
package
com
.
example
.
fuzzControll
.
exception
;
/**
* 基础异常
*/
public
class
BaseException
extends
RuntimeException
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 错误消息
*/
private
String
defaultMessage
;
/**
* 所属模块
*/
private
String
module
;
public
BaseException
(
String
defaultMessage
,
String
module
)
{
this
.
defaultMessage
=
defaultMessage
;
this
.
module
=
module
;
}
}
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/exception/CmdException.java
0 → 100644
View file @
3f6bd303
package
com
.
example
.
fuzzControll
.
exception
;
/**
* cmd运行异常
*/
public
class
CmdException
extends
BaseException
{
private
static
final
long
serialVersionUID
=
1L
;
public
CmdException
(
String
defaultMessage
)
{
super
(
defaultMessage
,
"cmd"
);
}
}
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/exception/FileException.java
0 → 100644
View file @
3f6bd303
package
com
.
example
.
fuzzControll
.
exception
;
/**
* 文件操作异常
*/
public
class
FileException
extends
BaseException
{
private
static
final
long
serialVersionUID
=
1L
;
public
FileException
(
String
defaultMessage
)
{
super
(
defaultMessage
,
"file"
);
}
}
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/exception/FuzzException.java
0 → 100644
View file @
3f6bd303
package
com
.
example
.
fuzzControll
.
exception
;
public
class
FuzzException
extends
BaseException
{
private
static
final
long
serialVersionUID
=
1L
;
public
FuzzException
(
String
defaultMessage
)
{
super
(
defaultMessage
,
"fuzz"
);
}
}
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/exception/ServerException.java
0 → 100644
View file @
3f6bd303
package
com
.
example
.
fuzzControll
.
exception
;
public
class
ServerException
extends
BaseException
{
private
static
final
long
serialVersionUID
=
1L
;
public
ServerException
(
String
defaultMessage
)
{
super
(
defaultMessage
,
"server"
);
}
}
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/pojo/vo/
c
mdStartParams.java
→
fuzzbackend/src/main/java/com/example/fuzzControll/pojo/vo/
C
mdStartParams.java
View file @
3f6bd303
...
@@ -7,7 +7,7 @@ import lombok.Setter;
...
@@ -7,7 +7,7 @@ import lombok.Setter;
@Data
@Data
@Getter
@Getter
@Setter
@Setter
public
class
c
mdStartParams
{
public
class
C
mdStartParams
{
String
netinfo
;
//netInfo
String
netinfo
;
//netInfo
String
protopcol
;
//protocol
String
protopcol
;
//protocol
int
waiting
;
//usec
int
waiting
;
//usec
...
...
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/pojo/vo/
t
estEntity.java
→
fuzzbackend/src/main/java/com/example/fuzzControll/pojo/vo/
T
estEntity.java
View file @
3f6bd303
...
@@ -7,7 +7,7 @@ import lombok.Setter;
...
@@ -7,7 +7,7 @@ import lombok.Setter;
@Data
@Data
@Getter
@Getter
@Setter
@Setter
public
class
t
estEntity
{
public
class
T
estEntity
{
String
testClassName
;
String
testClassName
;
String
[]
paramJson
;
String
[]
paramJson
;
}
}
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/pojo/vo/
t
estReturnEntity.java
→
fuzzbackend/src/main/java/com/example/fuzzControll/pojo/vo/
T
estReturnEntity.java
View file @
3f6bd303
...
@@ -3,7 +3,7 @@ package com.example.fuzzControll.pojo.vo;
...
@@ -3,7 +3,7 @@ package com.example.fuzzControll.pojo.vo;
import
lombok.Data
;
import
lombok.Data
;
@Data
@Data
public
class
t
estReturnEntity
{
public
class
T
estReturnEntity
{
String
run_time
;
String
run_time
;
String
cycles_done
;
String
cycles_done
;
String
last_new_path
;
String
last_new_path
;
...
...
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/service/
g
enerateMethodService.java
→
fuzzbackend/src/main/java/com/example/fuzzControll/service/
G
enerateMethodService.java
View file @
3f6bd303
package
com
.
example
.
fuzzControll
.
service
;
package
com
.
example
.
fuzzControll
.
service
;
import
com.example.fuzzControll.pojo.vo.
t
estEntity
;
import
com.example.fuzzControll.pojo.vo.
T
estEntity
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
public
interface
g
enerateMethodService
{
public
interface
G
enerateMethodService
{
Map
<
String
,
List
<
String
>>
generation
(
t
estEntity
testEntity
);
Map
<
String
,
List
<
String
>>
generation
(
T
estEntity
testEntity
);
}
}
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/service/
g
etServerMessageService.java
→
fuzzbackend/src/main/java/com/example/fuzzControll/service/
G
etServerMessageService.java
View file @
3f6bd303
package
com
.
example
.
fuzzControll
.
service
;
package
com
.
example
.
fuzzControll
.
service
;
import
java.util.List
;
public
interface
GetServerMessageService
{
import
java.util.Map
;
public
interface
getServerMessageService
{
String
getStats
();
String
getStats
();
String
getTemplateInfo
();
String
getTemplateInfo
();
...
...
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/service/
m
utationService.java
→
fuzzbackend/src/main/java/com/example/fuzzControll/service/
M
utationService.java
View file @
3f6bd303
package
com
.
example
.
fuzzControll
.
service
;
package
com
.
example
.
fuzzControll
.
service
;
import
com.example.fuzzControll.pojo.vo.
t
estEntity
;
import
com.example.fuzzControll.pojo.vo.
T
estEntity
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
public
interface
m
utationService
{
public
interface
M
utationService
{
Map
<
String
,
List
<
String
>>
generation
(
t
estEntity
testEntity
);
Map
<
String
,
List
<
String
>>
generation
(
T
estEntity
testEntity
);
}
}
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/service/
p
rotocolTemplateService.java
→
fuzzbackend/src/main/java/com/example/fuzzControll/service/
P
rotocolTemplateService.java
View file @
3f6bd303
package
com
.
example
.
fuzzControll
.
service
;
package
com
.
example
.
fuzzControll
.
service
;
import
com.example.fuzzControll.pojo.vo.
t
estEntity
;
import
com.example.fuzzControll.pojo.vo.
T
estEntity
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
public
interface
p
rotocolTemplateService
{
public
interface
P
rotocolTemplateService
{
Map
<
String
,
List
<
String
>>
generation
(
t
estEntity
testEntity
);
Map
<
String
,
List
<
String
>>
generation
(
T
estEntity
testEntity
);
}
}
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/service/
s
eedFileService.java
→
fuzzbackend/src/main/java/com/example/fuzzControll/service/
S
eedFileService.java
View file @
3f6bd303
...
@@ -4,10 +4,11 @@ import org.springframework.web.multipart.MultipartFile;
...
@@ -4,10 +4,11 @@ import org.springframework.web.multipart.MultipartFile;
import
java.util.List
;
import
java.util.List
;
public
interface
s
eedFileService
{
public
interface
S
eedFileService
{
public
List
<
String
>
getSeedFiles
();
public
List
<
String
>
getSeedFiles
();
void
delFile
(
String
fileName
);
void
delFile
(
String
fileName
);
void
upload
(
MultipartFile
file
);
void
upload
(
MultipartFile
file
);
int
getSeedFileCount
();
}
}
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/service/
t
estService.java
→
fuzzbackend/src/main/java/com/example/fuzzControll/service/
T
estService.java
View file @
3f6bd303
package
com
.
example
.
fuzzControll
.
service
;
package
com
.
example
.
fuzzControll
.
service
;
import
com.example.fuzzControll.pojo.vo.
c
mdStartParams
;
import
com.example.fuzzControll.pojo.vo.
C
mdStartParams
;
public
interface
t
estService
{
public
interface
T
estService
{
void
testStart
(
c
mdStartParams
cmdStartParams
);
void
testStart
(
C
mdStartParams
cmdStartParams
);
void
testStop
();
void
testStop
();
...
...
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/service/
v
ulnerabilityTypeService.java
→
fuzzbackend/src/main/java/com/example/fuzzControll/service/
V
ulnerabilityTypeService.java
View file @
3f6bd303
package
com
.
example
.
fuzzControll
.
service
;
package
com
.
example
.
fuzzControll
.
service
;
import
com.example.fuzzControll.pojo.vo.
t
estEntity
;
import
com.example.fuzzControll.pojo.vo.
T
estEntity
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
public
interface
v
ulnerabilityTypeService
{
public
interface
V
ulnerabilityTypeService
{
Map
<
String
,
List
<
String
>>
generation
(
t
estEntity
testEntity
);
Map
<
String
,
List
<
String
>>
generation
(
T
estEntity
testEntity
);
}
}
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/service/impl/
g
enerateMethodServiceImpl.java
→
fuzzbackend/src/main/java/com/example/fuzzControll/service/impl/
G
enerateMethodServiceImpl.java
View file @
3f6bd303
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.pojo.vo.testEntity
;
import
com.example.fuzzControll.exception.FuzzException
;
import
com.example.fuzzControll.service.generateMethodService
;
import
com.example.fuzzControll.pojo.vo.TestEntity
;
import
com.example.fuzzControll.tools.cmdTools
;
import
com.example.fuzzControll.service.GenerateMethodService
;
import
com.example.fuzzControll.tools.testTools
;
import
com.example.fuzzControll.tools.CmdTools
;
import
com.example.fuzzControll.tools.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
;
...
@@ -14,13 +15,13 @@ import java.util.Map;
...
@@ -14,13 +15,13 @@ import java.util.Map;
@Service
@Service
@Slf4j
@Slf4j
public
class
generateMethodServiceImpl
implements
g
enerateMethodService
{
public
class
GenerateMethodServiceImpl
implements
G
enerateMethodService
{
cmdTools
cmdTools
=
new
c
mdTools
();
CmdTools
cmdTools
=
new
C
mdTools
();
@Autowired
@Autowired
k
ittyProperties
kitty
;
K
ittyProperties
kitty
;
@Override
@Override
public
Map
<
String
,
List
<
String
>>
generation
(
testEntity
testEntity
)
{
public
Map
<
String
,
List
<
String
>>
generation
(
TestEntity
testEntity
)
throws
FuzzException
{
String
cmd
=
parseParameters
(
testEntity
);
String
cmd
=
parseParameters
(
testEntity
);
if
(
cmd
.
isEmpty
())
{
if
(
cmd
.
isEmpty
())
{
return
null
;
return
null
;
...
@@ -28,7 +29,7 @@ public class generateMethodServiceImpl implements generateMethodService {
...
@@ -28,7 +29,7 @@ public class generateMethodServiceImpl implements generateMethodService {
return
cmdTools
.
runProgramCmdAndResult
(
cmd
);
return
cmdTools
.
runProgramCmdAndResult
(
cmd
);
}
}
public
String
parseParameters
(
t
estEntity
testEntity
)
{
public
String
parseParameters
(
T
estEntity
testEntity
)
{
switch
(
testEntity
.
getTestClassName
().
toLowerCase
())
{
switch
(
testEntity
.
getTestClassName
().
toLowerCase
())
{
case
"foreach"
:
case
"foreach"
:
return
cmd
(
testEntity
,
"-f"
);
return
cmd
(
testEntity
,
"-f"
);
...
@@ -56,8 +57,8 @@ public class generateMethodServiceImpl implements generateMethodService {
...
@@ -56,8 +57,8 @@ public class generateMethodServiceImpl implements generateMethodService {
}
}
}
}
private
String
cmd
(
t
estEntity
testEntity
,
String
cmd
)
{
private
String
cmd
(
T
estEntity
testEntity
,
String
cmd
)
{
if
(!
t
estTools
.
paramsLenghtTest
(
testEntity
.
getParamJson
().
length
,
5
,
"generationMethod"
))
if
(!
T
estTools
.
paramsLenghtTest
(
testEntity
.
getParamJson
().
length
,
5
,
"generationMethod"
))
return
""
;
return
""
;
String
target_host
=
null
;
String
target_host
=
null
;
String
target_port
=
null
;
String
target_port
=
null
;
...
...
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/service/impl/
g
etServerMessageImpl.java
→
fuzzbackend/src/main/java/com/example/fuzzControll/service/impl/
G
etServerMessageImpl.java
View file @
3f6bd303
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.service.getServerMessageService
;
import
com.example.fuzzControll.exception.ServerException
;
import
com.example.fuzzControll.service.GetServerMessageService
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.http.HttpStatus
;
import
org.apache.http.client.methods.CloseableHttpResponse
;
import
org.apache.http.client.methods.CloseableHttpResponse
;
import
org.apache.http.client.methods.HttpGet
;
import
org.apache.http.client.methods.HttpGet
;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.apache.http.impl.client.CloseableHttpClient
;
...
@@ -12,18 +12,13 @@ import org.apache.http.util.EntityUtils;
...
@@ -12,18 +12,13 @@ import org.apache.http.util.EntityUtils;
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
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@Slf4j
@Slf4j
@Service
(
"getServerMessageService"
)
@Service
(
"getServerMessageService"
)
public
class
getServerMessageImpl
implements
g
etServerMessageService
{
public
class
GetServerMessageImpl
implements
G
etServerMessageService
{
@Autowired
@Autowired
k
ittyProperties
kitty
;
K
ittyProperties
kitty
;
public
String
getServerMsg
(
String
messageName
)
{
public
String
getServerMsg
(
String
messageName
)
throws
ServerException
{
switch
(
messageName
)
{
switch
(
messageName
)
{
case
"templateInfo"
:
{
case
"templateInfo"
:
{
HttpGet
httpGetTemplateInfo
=
new
HttpGet
(
kitty
.
getTemplateInfoHttp
());
HttpGet
httpGetTemplateInfo
=
new
HttpGet
(
kitty
.
getTemplateInfoHttp
());
...
@@ -32,6 +27,7 @@ public class getServerMessageImpl implements getServerMessageService {
...
@@ -32,6 +27,7 @@ public class getServerMessageImpl implements getServerMessageService {
return
EntityUtils
.
toString
(
templateInfoResponse
.
getEntity
(),
"utf-8"
);
return
EntityUtils
.
toString
(
templateInfoResponse
.
getEntity
(),
"utf-8"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"templateInfo http error!"
);
log
.
error
(
"templateInfo http error!"
);
throw
new
ServerException
(
"get server templateInfo error !"
);
}
}
}
}
case
"stats"
:
{
case
"stats"
:
{
...
@@ -41,6 +37,7 @@ public class getServerMessageImpl implements getServerMessageService {
...
@@ -41,6 +37,7 @@ public class getServerMessageImpl implements getServerMessageService {
return
EntityUtils
.
toString
(
statsResponse
.
getEntity
(),
"utf-8"
);
return
EntityUtils
.
toString
(
statsResponse
.
getEntity
(),
"utf-8"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"stats http error!"
);
log
.
error
(
"stats http error!"
);
throw
new
ServerException
(
"get server stats error !"
);
}
}
}
}
case
"report"
:
{
case
"report"
:
{
...
@@ -50,6 +47,8 @@ public class getServerMessageImpl implements getServerMessageService {
...
@@ -50,6 +47,8 @@ public class getServerMessageImpl implements getServerMessageService {
return
EntityUtils
.
toString
(
reportResponse
.
getEntity
(),
"utf-8"
);
return
EntityUtils
.
toString
(
reportResponse
.
getEntity
(),
"utf-8"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"report http error!"
);
log
.
error
(
"report http error!"
);
throw
new
ServerException
(
"get server report error !"
);
}
}
}
}
case
"stages"
:
{
case
"stages"
:
{
...
@@ -59,6 +58,7 @@ public class getServerMessageImpl implements getServerMessageService {
...
@@ -59,6 +58,7 @@ public class getServerMessageImpl implements getServerMessageService {
return
EntityUtils
.
toString
(
stagesResponse
.
getEntity
(),
"utf-8"
);
return
EntityUtils
.
toString
(
stagesResponse
.
getEntity
(),
"utf-8"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"stages http error!"
);
log
.
error
(
"stages http error!"
);
throw
new
ServerException
(
"get server stages error !"
);
}
}
}
}
default
:
default
:
...
@@ -67,22 +67,22 @@ public class getServerMessageImpl implements getServerMessageService {
...
@@ -67,22 +67,22 @@ public class getServerMessageImpl implements getServerMessageService {
}
}
@Override
@Override
public
String
getStats
()
{
public
String
getStats
()
throws
ServerException
{
return
getServerMsg
(
"stats"
);
return
getServerMsg
(
"stats"
);
}
}
@Override
@Override
public
String
getTemplateInfo
()
{
public
String
getTemplateInfo
()
throws
ServerException
{
return
getServerMsg
(
"templateInfo"
);
return
getServerMsg
(
"templateInfo"
);
}
}
@Override
@Override
public
String
getStages
()
{
public
String
getStages
()
throws
ServerException
{
return
getServerMsg
(
"
report
"
);
return
getServerMsg
(
"
stages
"
);
}
}
@Override
@Override
public
String
getReport
()
{
public
String
getReport
()
throws
ServerException
{
return
getServerMsg
(
"
stages
"
);
return
getServerMsg
(
"
report
"
);
}
}
}
}
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/service/impl/
m
utationServiceImpl.java
→
fuzzbackend/src/main/java/com/example/fuzzControll/service/impl/
M
utationServiceImpl.java
View file @
3f6bd303
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.constents.mutationConstent
;
import
com.example.fuzzControll.constents.MutationConstent
;
import
com.example.fuzzControll.pojo.vo.testEntity
;
import
com.example.fuzzControll.exception.FuzzException
;
import
com.example.fuzzControll.service.mutationService
;
import
com.example.fuzzControll.pojo.vo.TestEntity
;
import
com.example.fuzzControll.tools.cmdTools
;
import
com.example.fuzzControll.service.MutationService
;
import
com.example.fuzzControll.tools.testTools
;
import
com.example.fuzzControll.tools.CmdTools
;
import
com.example.fuzzControll.tools.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
;
...
@@ -15,14 +16,14 @@ import java.util.Map;
...
@@ -15,14 +16,14 @@ import java.util.Map;
@Service
(
"mutationService"
)
@Service
(
"mutationService"
)
@Slf4j
@Slf4j
class
mutationServiceImpl
implements
m
utationService
{
class
MutationServiceImpl
implements
M
utationService
{
cmdTools
cmdTools
=
new
c
mdTools
();
CmdTools
cmdTools
=
new
C
mdTools
();
@Autowired
@Autowired
k
ittyProperties
kitty
;
K
ittyProperties
kitty
;
@Override
@Override
public
Map
<
String
,
List
<
String
>>
generation
(
testEntity
testEntity
)
{
public
Map
<
String
,
List
<
String
>>
generation
(
TestEntity
testEntity
)
throws
FuzzException
{
String
cmd
=
parseParameters
(
testEntity
);
String
cmd
=
parseParameters
(
testEntity
);
if
(
cmd
.
isEmpty
())
{
if
(
cmd
.
isEmpty
())
{
return
null
;
return
null
;
...
@@ -30,7 +31,7 @@ class mutationServiceImpl implements mutationService {
...
@@ -30,7 +31,7 @@ class mutationServiceImpl implements mutationService {
return
cmdTools
.
runProgramCmdAndResult
(
cmd
);
return
cmdTools
.
runProgramCmdAndResult
(
cmd
);
}
}
public
String
parseParameters
(
t
estEntity
testEntity
)
{
public
String
parseParameters
(
T
estEntity
testEntity
)
{
switch
(
testEntity
.
getTestClassName
().
toLowerCase
())
{
switch
(
testEntity
.
getTestClassName
().
toLowerCase
())
{
case
"bit"
:
case
"bit"
:
return
variationGranularityCmd
(
testEntity
,
1
);
return
variationGranularityCmd
(
testEntity
,
1
);
...
@@ -96,8 +97,8 @@ class mutationServiceImpl implements mutationService {
...
@@ -96,8 +97,8 @@ class mutationServiceImpl implements mutationService {
}
}
}
}
private
String
distortionLibCmd
(
t
estEntity
testEntity
,
int
methodNum
)
{
private
String
distortionLibCmd
(
T
estEntity
testEntity
,
int
methodNum
)
{
if
(!
t
estTools
.
paramsLenghtTest
(
testEntity
.
getParamJson
().
length
,
2
,
"distortionLib"
+
methodNum
))
if
(!
T
estTools
.
paramsLenghtTest
(
testEntity
.
getParamJson
().
length
,
2
,
"distortionLib"
+
methodNum
))
return
""
;
return
""
;
String
dst_ip
=
null
;
String
dst_ip
=
null
;
String
dst_port
=
null
;
String
dst_port
=
null
;
...
@@ -107,12 +108,12 @@ class mutationServiceImpl implements mutationService {
...
@@ -107,12 +108,12 @@ class mutationServiceImpl implements mutationService {
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"distortionLib [{}] 参数解析失败!"
,
methodNum
);
log
.
error
(
"distortionLib [{}] 参数解析失败!"
,
methodNum
);
}
}
return
kitty
.
getVenvPath
()
+
" "
+
kitty
.
getMutationPath
()
+
m
utationConstent
.
TEST_MUTATED_LIBS
+
" -g "
+
methodNum
+
" -d "
+
dst_ip
+
" -p "
+
dst_port
;
return
kitty
.
getVenvPath
()
+
" "
+
kitty
.
getMutationPath
()
+
M
utationConstent
.
TEST_MUTATED_LIBS
+
" -g "
+
methodNum
+
" -d "
+
dst_ip
+
" -p "
+
dst_port
;
}
}
private
String
variationGranularityCmd
(
t
estEntity
testEntity
,
int
methodNum
)
{
private
String
variationGranularityCmd
(
T
estEntity
testEntity
,
int
methodNum
)
{
if
(!
t
estTools
.
paramsLenghtTest
(
testEntity
.
getParamJson
().
length
,
2
,
"variationGranularity"
+
methodNum
))
if
(!
T
estTools
.
paramsLenghtTest
(
testEntity
.
getParamJson
().
length
,
2
,
"variationGranularity"
+
methodNum
))
return
""
;
return
""
;
String
dst_ip
=
null
;
String
dst_ip
=
null
;
String
dst_port
=
null
;
String
dst_port
=
null
;
...
@@ -122,10 +123,10 @@ class mutationServiceImpl implements mutationService {
...
@@ -122,10 +123,10 @@ class mutationServiceImpl implements mutationService {
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"variationGranularity [{}] 参数解析失败!"
,
methodNum
);
log
.
error
(
"variationGranularity [{}] 参数解析失败!"
,
methodNum
);
}
}
return
kitty
.
getVenvPath
()
+
" "
+
kitty
.
getMutationPath
()
+
m
utationConstent
.
TEST_GRANULARITY_BIT_BYTE
+
" -g "
+
methodNum
+
" -d "
+
dst_ip
+
" -p "
+
dst_port
;
return
kitty
.
getVenvPath
()
+
" "
+
kitty
.
getMutationPath
()
+
M
utationConstent
.
TEST_GRANULARITY_BIT_BYTE
+
" -g "
+
methodNum
+
" -d "
+
dst_ip
+
" -p "
+
dst_port
;
}
}
private
String
mutationStrategyCmd
(
t
estEntity
testEntity
,
int
methodNum
)
{
private
String
mutationStrategyCmd
(
T
estEntity
testEntity
,
int
methodNum
)
{
if
(!
t
estTools
.
paramsLenghtTest
(
testEntity
.
getParamJson
().
length
,
2
,
"mutationStrategy"
+
methodNum
))
if
(!
T
estTools
.
paramsLenghtTest
(
testEntity
.
getParamJson
().
length
,
2
,
"mutationStrategy"
+
methodNum
))
return
""
;
return
""
;
String
dst_ip
=
null
;
String
dst_ip
=
null
;
String
dst_port
=
null
;
String
dst_port
=
null
;
...
@@ -135,7 +136,7 @@ class mutationServiceImpl implements mutationService {
...
@@ -135,7 +136,7 @@ class mutationServiceImpl implements mutationService {
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"mutationStrategy [{}] 参数解析失败!"
,
methodNum
);
log
.
error
(
"mutationStrategy [{}] 参数解析失败!"
,
methodNum
);
}
}
return
kitty
.
getVenvPath
()
+
" "
+
kitty
.
getMutationPath
()
+
m
utationConstent
.
TEST_MUTATION_STRATEGY
+
" -g "
+
methodNum
+
" -d "
+
dst_ip
+
" -p "
+
dst_port
;
return
kitty
.
getVenvPath
()
+
" "
+
kitty
.
getMutationPath
()
+
M
utationConstent
.
TEST_MUTATION_STRATEGY
+
" -g "
+
methodNum
+
" -d "
+
dst_ip
+
" -p "
+
dst_port
;
}
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/service/impl/
p
rotocolTemplateImpl.java
→
fuzzbackend/src/main/java/com/example/fuzzControll/service/impl/
P
rotocolTemplateImpl.java
View file @
3f6bd303
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/service/impl/SeedFileServiceImpl.java
0 → 100644
View file @
3f6bd303
package
com
.
example
.
fuzzControll
.
service
.
impl
;
import
com.example.fuzzControll.conf.SeedProperties
;
import
com.example.fuzzControll.constents.CmdConstent
;
import
com.example.fuzzControll.exception.CmdException
;
import
com.example.fuzzControll.exception.FileException
;
import
com.example.fuzzControll.service.SeedFileService
;
import
com.example.fuzzControll.tools.CmdTools
;
import
com.example.fuzzControll.tools.FileTools
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.ArrayList
;
import
java.util.List
;
@Service
public
class
SeedFileServiceImpl
implements
SeedFileService
{
CmdTools
cmdTools
=
new
CmdTools
();
FileTools
fileTools
=
new
FileTools
();
@Autowired
SeedProperties
properties
;
@Override
public
List
<
String
>
getSeedFiles
()
throws
CmdException
{
return
cmdTools
.
runCmd
(
CmdConstent
.
GET_FILE_NAME
+
properties
.
getSeedPath
());
}
//todo 同步修改可能会出现问题
@Override
public
void
delFile
(
String
fileName
)
throws
CmdException
{
int
fileCountBefore
=
getSeedFileCount
();
cmdTools
.
runCmd
(
CmdConstent
.
DELETE_FILE
+
properties
.
getSeedPath
()
+
"/"
+
fileName
);
int
fileCountAfter
=
getSeedFileCount
();
if
(
fileCountAfter
==
fileCountBefore
){
throw
new
CmdException
(
"delete cmd error !The file has not changed."
);
}
}
@Override
public
void
upload
(
MultipartFile
file
)
throws
FileException
{
int
fileCountBefore
=
getSeedFileCount
();
fileTools
.
load
(
file
);
int
fileCountAfter
=
getSeedFileCount
();
if
(
fileCountAfter
==
fileCountBefore
){
throw
new
CmdException
(
"upload file error !The file failed to be submitted."
);
}
}
/**
*
* 获取种子文件目录下文件数量
*/
@Override
public
int
getSeedFileCount
()
throws
CmdException
{
List
<
String
>
files
=
cmdTools
.
runCmd
(
CmdConstent
.
GET_FILE_NAME
+
properties
.
getSeedPath
());
int
count
=
files
.
size
();
return
count
;
}
}
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/service/impl/
t
estServiceImpl.java
→
fuzzbackend/src/main/java/com/example/fuzzControll/service/impl/
T
estServiceImpl.java
View file @
3f6bd303
package
com
.
example
.
fuzzControll
.
service
.
impl
;
package
com
.
example
.
fuzzControll
.
service
.
impl
;
import
com.example.fuzzControll.conf.SpringContextUtil
;
import
com.example.fuzzControll.conf.SpringContextUtil
;
import
com.example.fuzzControll.conf.
k
ittyProperties
;
import
com.example.fuzzControll.conf.
K
ittyProperties
;
import
com.example.fuzzControll.constents.
c
mdConstent
;
import
com.example.fuzzControll.constents.
C
mdConstent
;
import
com.example.fuzzControll.pojo.vo.
c
mdStartParams
;
import
com.example.fuzzControll.pojo.vo.
C
mdStartParams
;
import
com.example.fuzzControll.service.
t
estService
;
import
com.example.fuzzControll.service.
T
estService
;
import
com.example.fuzzControll.tools.
c
mdTools
;
import
com.example.fuzzControll.tools.
C
mdTools
;
import
com.example.fuzzControll.tools.
t
estControlTools
;
import
com.example.fuzzControll.tools.
T
estControlTools
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
@Service
(
"testService"
)
@Service
(
"testService"
)
public
class
testServiceImpl
implements
t
estService
{
public
class
TestServiceImpl
implements
T
estService
{
kittyProperties
kittyProperties
=
(
k
ittyProperties
)
SpringContextUtil
.
getBean
(
"kittyProperties"
);
KittyProperties
kittyProperties
=
(
K
ittyProperties
)
SpringContextUtil
.
getBean
(
"kittyProperties"
);
cmdTools
cmdTools
=
new
c
mdTools
();
CmdTools
cmdTools
=
new
C
mdTools
();
//todo 不同服务不同端口
//todo 不同服务不同端口
@Override
@Override
public
void
testStart
(
c
mdStartParams
cmdStartParams
)
{
public
void
testStart
(
C
mdStartParams
cmdStartParams
)
{
t
estControlTools
.
setIsRunning
(
true
);
T
estControlTools
.
setIsRunning
(
true
);
String
cmd
=
cmdTools
.
parse
(
cmdStartParams
);
String
cmd
=
cmdTools
.
parse
(
cmdStartParams
);
String
finalCmd
=
c
mdConstent
.
RUN_AFLNET
+
cmd
+
kittyProperties
.
getAflnetPath
()+
"live555/testProgs/testOnDemandRTSPServer 8554"
;
String
finalCmd
=
C
mdConstent
.
RUN_AFLNET
+
cmd
+
kittyProperties
.
getAflnetPath
()+
"live555/testProgs/testOnDemandRTSPServer 8554"
;
cmdTools
.
runProgramCmd
(
finalCmd
);
cmdTools
.
runProgramCmd
(
finalCmd
);
}
}
@Override
@Override
public
void
testStop
()
{
public
void
testStop
()
{
t
estControlTools
.
setIsRunning
(
false
);
T
estControlTools
.
setIsRunning
(
false
);
}
}
}
}
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/service/impl/
v
ulnerabilityTypeServiceImpl.java
→
fuzzbackend/src/main/java/com/example/fuzzControll/service/impl/
V
ulnerabilityTypeServiceImpl.java
View file @
3f6bd303
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.pojo.vo.testEntity
;
import
com.example.fuzzControll.exception.FuzzException
;
import
com.example.fuzzControll.service.vulnerabilityTypeService
;
import
com.example.fuzzControll.pojo.vo.TestEntity
;
import
com.example.fuzzControll.tools.cmdTools
;
import
com.example.fuzzControll.service.VulnerabilityTypeService
;
import
com.example.fuzzControll.tools.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
;
...
@@ -13,18 +14,18 @@ import java.util.Map;
...
@@ -13,18 +14,18 @@ import java.util.Map;
@Slf4j
@Slf4j
@Service
(
"vulnerabilityTypeService"
)
@Service
(
"vulnerabilityTypeService"
)
public
class
vulnerabilityTypeServiceImpl
implements
v
ulnerabilityTypeService
{
public
class
VulnerabilityTypeServiceImpl
implements
V
ulnerabilityTypeService
{
cmdTools
cmdTools
=
new
c
mdTools
();
CmdTools
cmdTools
=
new
C
mdTools
();
@Autowired
@Autowired
k
ittyProperties
kitty
;
K
ittyProperties
kitty
;
@Override
@Override
public
Map
<
String
,
List
<
String
>>
generation
(
testEntity
testEntity
)
{
public
Map
<
String
,
List
<
String
>>
generation
(
TestEntity
testEntity
)
throws
FuzzException
{
String
cmd
=
parseParameters
(
testEntity
);
String
cmd
=
parseParameters
(
testEntity
);
return
cmdTools
.
runProgramCmdAndResult
(
cmd
);
return
cmdTools
.
runProgramCmdAndResult
(
cmd
);
}
}
public
String
parseParameters
(
t
estEntity
testEntity
)
{
public
String
parseParameters
(
T
estEntity
testEntity
)
{
switch
(
testEntity
.
getTestClassName
().
toLowerCase
())
{
switch
(
testEntity
.
getTestClassName
().
toLowerCase
())
{
case
"array_index_out_of_bounds_vulnerabilit"
:
//have error
case
"array_index_out_of_bounds_vulnerabilit"
:
//have error
return
cmd
(
testEntity
,
0
);
return
cmd
(
testEntity
,
0
);
...
@@ -56,7 +57,7 @@ public class vulnerabilityTypeServiceImpl implements vulnerabilityTypeService {
...
@@ -56,7 +57,7 @@ public class vulnerabilityTypeServiceImpl implements vulnerabilityTypeService {
}
}
}
}
private
String
cmd
(
t
estEntity
testEntity
,
int
kindNum
)
{
private
String
cmd
(
T
estEntity
testEntity
,
int
kindNum
)
{
return
kitty
.
getVenvPath
()
+
" "
+
kitty
.
getVulnerabilityTypePath
()
+
"vul_types_test.py "
+
kindNum
;
return
kitty
.
getVenvPath
()
+
" "
+
kitty
.
getVulnerabilityTypePath
()
+
"vul_types_test.py "
+
kindNum
;
}
}
//todo 还有很多类型要写
//todo 还有很多类型要写
...
...
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/service/impl/seedFileServiceImpl.java
deleted
100644 → 0
View file @
a73cc0e0
package
com
.
example
.
fuzzControll
.
service
.
impl
;
import
com.example.fuzzControll.conf.seedProperties
;
import
com.example.fuzzControll.constents.cmdConstent
;
import
com.example.fuzzControll.service.seedFileService
;
import
com.example.fuzzControll.tools.cmdTools
;
import
com.example.fuzzControll.tools.fileTools
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.List
;
@Service
public
class
seedFileServiceImpl
implements
seedFileService
{
cmdTools
cmdTools
=
new
cmdTools
();
fileTools
fileTools
=
new
fileTools
();
@Autowired
seedProperties
properties
;
@Override
public
List
<
String
>
getSeedFiles
()
{
return
cmdTools
.
runCmd
(
cmdConstent
.
GET_FILE_NAME
+
properties
.
getSeedPath
());
}
//todo 没有执行结果提示,
@Override
public
void
delFile
(
String
fileName
)
{
cmdTools
.
runCmd
(
cmdConstent
.
DELETE_FILE
+
properties
.
getSeedPath
()+
"/"
+
fileName
);
}
@Override
public
void
upload
(
MultipartFile
file
)
{
fileTools
.
load
(
file
);
}
}
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/tools/
c
mdTools.java
→
fuzzbackend/src/main/java/com/example/fuzzControll/tools/
C
mdTools.java
View file @
3f6bd303
...
@@ -3,8 +3,10 @@ package com.example.fuzzControll.tools;
...
@@ -3,8 +3,10 @@ package com.example.fuzzControll.tools;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.example.fuzzControll.conf.SpringContextUtil
;
import
com.example.fuzzControll.conf.SpringContextUtil
;
import
com.example.fuzzControll.controller.WebSocket
;
import
com.example.fuzzControll.controller.WebSocket
;
import
com.example.fuzzControll.pojo.vo.cmdStartParams
;
import
com.example.fuzzControll.exception.CmdException
;
import
com.example.fuzzControll.pojo.vo.testReturnEntity
;
import
com.example.fuzzControll.exception.FuzzException
;
import
com.example.fuzzControll.pojo.vo.CmdStartParams
;
import
com.example.fuzzControll.pojo.vo.TestReturnEntity
;
import
java.io.*
;
import
java.io.*
;
...
@@ -12,14 +14,14 @@ import java.util.*;
...
@@ -12,14 +14,14 @@ import java.util.*;
//todo need modify
//todo need modify
public
class
c
mdTools
{
public
class
C
mdTools
{
Boolean
send
=
false
;
Boolean
send
=
false
;
WebSocket
socket
=
(
WebSocket
)
SpringContextUtil
.
getBean
(
"WebSocket"
);
WebSocket
socket
=
(
WebSocket
)
SpringContextUtil
.
getBean
(
"WebSocket"
);
/**
/**
* 运行不需要后台运行cmd
* 运行不需要后台运行cmd
*/
*/
public
List
<
String
>
runCmd
(
String
cmd
)
{
public
List
<
String
>
runCmd
(
String
cmd
)
throws
CmdException
{
List
<
String
>
result
=
new
ArrayList
<
String
>();
List
<
String
>
result
=
new
ArrayList
<
String
>();
try
{
try
{
Process
process
=
Runtime
.
getRuntime
().
exec
(
cmd
);
Process
process
=
Runtime
.
getRuntime
().
exec
(
cmd
);
...
@@ -27,7 +29,7 @@ public class cmdTools {
...
@@ -27,7 +29,7 @@ public class cmdTools {
printMessage
(
process
.
getErrorStream
(),
new
ArrayList
<
String
>());
printMessage
(
process
.
getErrorStream
(),
new
ArrayList
<
String
>());
process
.
waitFor
();
process
.
waitFor
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
throw
new
CmdException
(
"run delete or search cmd error !"
);
}
}
return
result
;
return
result
;
...
@@ -54,7 +56,7 @@ public class cmdTools {
...
@@ -54,7 +56,7 @@ public class cmdTools {
* 运行需要后台运行cmd
* 运行需要后台运行cmd
* 将数据存入文件中
* 将数据存入文件中
*/
*/
public
Map
<
String
,
List
<
String
>>
runProgramCmdAndResult
(
String
cmd
)
{
public
Map
<
String
,
List
<
String
>>
runProgramCmdAndResult
(
String
cmd
)
throws
FuzzException
{
Map
<
String
,
List
<
String
>>
result
=
new
HashMap
();
Map
<
String
,
List
<
String
>>
result
=
new
HashMap
();
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
>());
...
@@ -64,7 +66,7 @@ public class cmdTools {
...
@@ -64,7 +66,7 @@ public class cmdTools {
printMessageByProgramCmd
(
process
.
getErrorStream
(),
error
);
printMessageByProgramCmd
(
process
.
getErrorStream
(),
error
);
process
.
waitFor
();
process
.
waitFor
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
throw
new
FuzzException
(
"run fuzz error !"
);
}
}
result
.
put
(
"out"
,
out
);
result
.
put
(
"out"
,
out
);
result
.
put
(
"error"
,
error
);
result
.
put
(
"error"
,
error
);
...
@@ -115,8 +117,8 @@ public class cmdTools {
...
@@ -115,8 +117,8 @@ public class cmdTools {
Reader
reader
=
new
InputStreamReader
(
input
);
Reader
reader
=
new
InputStreamReader
(
input
);
BufferedReader
bf
=
new
BufferedReader
(
reader
);
BufferedReader
bf
=
new
BufferedReader
(
reader
);
String
line
=
null
;
String
line
=
null
;
testReturnEntity
returnEntity
=
new
t
estReturnEntity
();
TestReturnEntity
returnEntity
=
new
T
estReturnEntity
();
while
((
line
=
bf
.
readLine
())
!=
null
&&
t
estControlTools
.
getIsRunning
())
{
while
((
line
=
bf
.
readLine
())
!=
null
&&
T
estControlTools
.
getIsRunning
())
{
makeReturnEntity
(
line
,
returnEntity
);
makeReturnEntity
(
line
,
returnEntity
);
if
(
send
)
{
if
(
send
)
{
String
data
=
JSONObject
.
toJSONString
(
returnEntity
);
String
data
=
JSONObject
.
toJSONString
(
returnEntity
);
...
@@ -125,7 +127,7 @@ public class cmdTools {
...
@@ -125,7 +127,7 @@ public class cmdTools {
}
}
}
}
private
testReturnEntity
makeReturnEntity
(
String
line
,
t
estReturnEntity
returnEntity
)
{
private
TestReturnEntity
makeReturnEntity
(
String
line
,
T
estReturnEntity
returnEntity
)
{
if
(
line
.
contains
(
"run time"
))
{
if
(
line
.
contains
(
"run time"
))
{
send
=
false
;
send
=
false
;
int
run_time
=
line
.
indexOf
(
":"
);
int
run_time
=
line
.
indexOf
(
":"
);
...
@@ -215,7 +217,7 @@ public class cmdTools {
...
@@ -215,7 +217,7 @@ public class cmdTools {
return
returnEntity
;
return
returnEntity
;
}
}
public
String
parse
(
c
mdStartParams
cmdStartParams
)
{
public
String
parse
(
C
mdStartParams
cmdStartParams
)
{
StringBuilder
cmd
=
new
StringBuilder
();
StringBuilder
cmd
=
new
StringBuilder
();
if
(
cmdStartParams
.
getNetinfo
()
!=
""
)
{
if
(
cmdStartParams
.
getNetinfo
()
!=
""
)
{
cmd
.
append
(
" -N "
+
cmdStartParams
.
getNetinfo
());
cmd
.
append
(
" -N "
+
cmdStartParams
.
getNetinfo
());
...
...
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/tools/
f
ileTools.java
→
fuzzbackend/src/main/java/com/example/fuzzControll/tools/
F
ileTools.java
View file @
3f6bd303
package
com
.
example
.
fuzzControll
.
tools
;
package
com
.
example
.
fuzzControll
.
tools
;
import
com.example.fuzzControll.conf.SpringContextUtil
;
import
com.example.fuzzControll.conf.SpringContextUtil
;
import
com.example.fuzzControll.conf.seedProperties
;
import
com.example.fuzzControll.conf.SeedProperties
;
import
com.example.fuzzControll.exception.FileException
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.BufferedInputStream
;
import
java.io.BufferedInputStream
;
...
@@ -9,10 +10,13 @@ import java.io.BufferedOutputStream;
...
@@ -9,10 +10,13 @@ import java.io.BufferedOutputStream;
import
java.io.FileOutputStream
;
import
java.io.FileOutputStream
;
import
java.io.InputStream
;
import
java.io.InputStream
;
public
class
f
ileTools
{
public
class
F
ileTools
{
seedProperties
properties
=
(
s
eedProperties
)
SpringContextUtil
.
getBean
(
"seedProperties"
);
SeedProperties
properties
=
(
S
eedProperties
)
SpringContextUtil
.
getBean
(
"seedProperties"
);
public
void
load
(
MultipartFile
file
)
{
public
void
load
(
MultipartFile
file
)
throws
FileException
{
if
(
file
==
null
){
throw
new
FileException
(
"upload file is null !"
);
}
try
(
InputStream
inputStream
=
file
.
getInputStream
();
try
(
InputStream
inputStream
=
file
.
getInputStream
();
FileOutputStream
outputStream
=
new
FileOutputStream
(
properties
.
getSeedPath
()
+
"/"
+
file
.
getOriginalFilename
());)
{
FileOutputStream
outputStream
=
new
FileOutputStream
(
properties
.
getSeedPath
()
+
"/"
+
file
.
getOriginalFilename
());)
{
BufferedInputStream
bufferedInputStream
=
new
BufferedInputStream
(
inputStream
);
BufferedInputStream
bufferedInputStream
=
new
BufferedInputStream
(
inputStream
);
...
@@ -24,7 +28,7 @@ public class fileTools {
...
@@ -24,7 +28,7 @@ public class fileTools {
bufferedOutputStream
.
write
(
buffer
,
0
,
bytesRead
);
bufferedOutputStream
.
write
(
buffer
,
0
,
bytesRead
);
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
throw
new
FileException
(
"write file error !"
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/tools/
r
egularTools.java
→
fuzzbackend/src/main/java/com/example/fuzzControll/tools/
R
egularTools.java
View file @
3f6bd303
package
com
.
example
.
fuzzControll
.
tools
;
package
com
.
example
.
fuzzControll
.
tools
;
//todo 对ip等增加正则判断
//todo 对ip等增加正则判断
public
class
r
egularTools
{
public
class
R
egularTools
{
}
}
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/tools/
t
estControlTools.java
→
fuzzbackend/src/main/java/com/example/fuzzControll/tools/
T
estControlTools.java
View file @
3f6bd303
package
com
.
example
.
fuzzControll
.
tools
;
package
com
.
example
.
fuzzControll
.
tools
;
public
class
t
estControlTools
{
public
class
T
estControlTools
{
private
static
Boolean
isRunning
;
private
static
Boolean
isRunning
;
public
static
Boolean
getIsRunning
()
{
public
static
Boolean
getIsRunning
()
{
...
@@ -8,6 +8,6 @@ public class testControlTools {
...
@@ -8,6 +8,6 @@ public class testControlTools {
}
}
public
static
void
setIsRunning
(
Boolean
isRunning
)
{
public
static
void
setIsRunning
(
Boolean
isRunning
)
{
t
estControlTools
.
isRunning
=
isRunning
;
T
estControlTools
.
isRunning
=
isRunning
;
}
}
}
}
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/tools/
t
estTools.java
→
fuzzbackend/src/main/java/com/example/fuzzControll/tools/
T
estTools.java
View file @
3f6bd303
...
@@ -3,7 +3,7 @@ package com.example.fuzzControll.tools;
...
@@ -3,7 +3,7 @@ package com.example.fuzzControll.tools;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
@Slf4j
@Slf4j
public
class
t
estTools
{
public
class
T
estTools
{
public
static
boolean
paramsLenghtTest
(
int
paramsLen
,
int
needParamsLen
,
String
name
){
public
static
boolean
paramsLenghtTest
(
int
paramsLen
,
int
needParamsLen
,
String
name
){
Boolean
isOk
=
paramsLen
==
needParamsLen
;
Boolean
isOk
=
paramsLen
==
needParamsLen
;
if
(!
isOk
){
if
(!
isOk
){
...
...
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