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
3976f673
Commit
3976f673
authored
a year ago
by
钱炳权
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
exception is changed
parent
f9e51c78
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
36 additions
and
7 deletions
+36
-7
KittyServerMessageController.java
...fuzzControll/controller/KittyServerMessageController.java
+8
-0
SeedFileController.java
...m/example/fuzzControll/controller/SeedFileController.java
+4
-3
TestControler.java
...va/com/example/fuzzControll/controller/TestControler.java
+5
-0
ProtocolTemplateImpl.java
...ample/fuzzControll/service/impl/ProtocolTemplateImpl.java
+11
-2
TestServiceImpl.java
...om/example/fuzzControll/service/impl/TestServiceImpl.java
+3
-1
CmdTools.java
...rc/main/java/com/example/fuzzControll/tools/CmdTools.java
+5
-1
No files found.
fuzzbackend/src/main/java/com/example/fuzzControll/controller/KittyServerMessageController.java
View file @
3976f673
...
...
@@ -2,16 +2,20 @@ package com.example.fuzzControll.controller;
import
com.example.fuzzControll.pojo.vo.AjaxResult
;
import
com.example.fuzzControll.service.GetServerMessageService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Arrays
;
/**
* kitty服务器信息
*/
@RestController
@RequestMapping
(
"/kittyServer"
)
@Slf4j
public
class
KittyServerMessageController
{
@Autowired
GetServerMessageService
getServerMessageService
;
...
...
@@ -23,6 +27,7 @@ public class KittyServerMessageController {
try
{
return
AjaxResult
.
success
(
getServerMessageService
.
getStats
());
}
catch
(
Exception
e
)
{
log
.
error
(
Arrays
.
toString
(
e
.
getStackTrace
()));
return
AjaxResult
.
error
(
"stats信息获取失败!"
);
}
}
...
...
@@ -34,6 +39,7 @@ public class KittyServerMessageController {
try
{
return
AjaxResult
.
success
(
getServerMessageService
.
getTemplateInfo
());
}
catch
(
Exception
e
)
{
log
.
error
(
Arrays
.
toString
(
e
.
getStackTrace
()));
return
AjaxResult
.
error
(
"templateInfo信息获取失败!"
);
}
}
...
...
@@ -45,6 +51,7 @@ public class KittyServerMessageController {
try
{
return
AjaxResult
.
success
(
getServerMessageService
.
getStages
());
}
catch
(
Exception
e
)
{
log
.
error
(
Arrays
.
toString
(
e
.
getStackTrace
()));
return
AjaxResult
.
error
(
"stages信息获取失败!"
);
}
}
...
...
@@ -56,6 +63,7 @@ public class KittyServerMessageController {
try
{
return
AjaxResult
.
success
(
getServerMessageService
.
getReport
());
}
catch
(
Exception
e
)
{
log
.
error
(
Arrays
.
toString
(
e
.
getStackTrace
()));
return
AjaxResult
.
error
(
"report信息获取失败!"
);
}
}
...
...
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/controller/SeedFileController.java
View file @
3976f673
...
...
@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.Arrays
;
import
java.util.List
;
/**
...
...
@@ -32,7 +33,7 @@ public class SeedFileController {
try
{
files
=
service
.
getSeedFiles
();
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
toString
(
));
log
.
error
(
Arrays
.
toString
(
e
.
getStackTrace
()
));
return
AjaxResult
.
error
(
"种子文件获取失败!"
);
}
return
AjaxResult
.
success
(
files
);
...
...
@@ -46,7 +47,7 @@ public class SeedFileController {
try
{
service
.
delFile
(
fileName
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
toString
(
));
log
.
error
(
Arrays
.
toString
(
e
.
getStackTrace
()
));
return
AjaxResult
.
error
(
"种子文件删除失败!"
);
}
return
AjaxResult
.
success
(
"种子文件删除成功!"
);
...
...
@@ -59,7 +60,7 @@ public class SeedFileController {
try
{
service
.
upload
(
file
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
toString
(
));
log
.
error
(
Arrays
.
toString
(
e
.
getStackTrace
()
));
return
AjaxResult
.
error
(
"种子文件upload失败!"
);
}
return
AjaxResult
.
success
(
"种子文件upload成功!"
);
...
...
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/controller/TestControler.java
View file @
3976f673
...
...
@@ -3,15 +3,19 @@ package com.example.fuzzControll.controller;
import
com.example.fuzzControll.pojo.vo.AjaxResult
;
import
com.example.fuzzControll.pojo.vo.CmdStartParams
;
import
com.example.fuzzControll.service.TestService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Arrays
;
/**
* aflnet测试控制
*/
@Slf4j
@RestController
@RequestMapping
(
"/test"
)
public
class
TestControler
{
...
...
@@ -31,6 +35,7 @@ public class TestControler {
}
}).
start
();
}
catch
(
Exception
e
)
{
log
.
error
(
Arrays
.
toString
(
e
.
getStackTrace
()));
return
AjaxResult
.
error
(
"测试启动失败!"
);
}
return
AjaxResult
.
success
(
"测试启动成功!"
);
...
...
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/service/impl/ProtocolTemplateImpl.java
View file @
3976f673
...
...
@@ -32,6 +32,9 @@ public class ProtocolTemplateImpl implements ProtocolTemplateService {
}
public
String
parseParameters
(
TestEntity
testEntity
)
{
if
(
testEntity
==
null
){
throw
new
FuzzException
(
"testEntity is null!"
);
}
switch
(
testEntity
.
getTestClassName
().
toLowerCase
())
{
case
"arp"
:
return
arpCmd
(
testEntity
);
...
...
@@ -645,7 +648,7 @@ public class ProtocolTemplateImpl implements ProtocolTemplateService {
return
""
;
return
kitty
.
getVenvPath
()
+
" "
+
kitty
.
getPath
()
+
ProtocolConstent
.
HDLC
;
}
//todo need change
private
String
ftpCmd
(
TestEntity
testEntity
)
{
if
(!
TestTools
.
paramsLenghtTest
(
testEntity
.
getParamJson
().
length
,
2
,
"ftp"
))
return
""
;
...
...
@@ -656,6 +659,7 @@ public class ProtocolTemplateImpl implements ProtocolTemplateService {
target_port
=
testEntity
.
getParamJson
()[
1
];
}
catch
(
Exception
e
)
{
log
.
error
(
"ftp参数解析失败!"
);
throw
new
FuzzException
(
"count of params is not match!"
);
}
return
kitty
.
getVenvPath
()
+
" "
+
kitty
.
getPath
()
+
ProtocolConstent
.
FTP
+
target_host
+
" "
+
target_port
;
}
...
...
@@ -670,6 +674,7 @@ public class ProtocolTemplateImpl implements ProtocolTemplateService {
target_port
=
testEntity
.
getParamJson
()[
1
];
}
catch
(
Exception
e
)
{
log
.
error
(
"frp参数解析失败!"
);
throw
new
FuzzException
(
"count of params is not match!"
);
}
return
kitty
.
getVenvPath
()
+
" "
+
kitty
.
getPath
()
+
ProtocolConstent
.
FRP
+
target_host
+
" "
+
target_port
;
}
...
...
@@ -684,6 +689,7 @@ public class ProtocolTemplateImpl implements ProtocolTemplateService {
dst_port
=
testEntity
.
getParamJson
()[
1
];
}
catch
(
Exception
e
)
{
log
.
error
(
"dns参数解析失败!"
);
throw
new
FuzzException
(
"count of params is not match!"
);
}
return
kitty
.
getVenvPath
()
+
" "
+
kitty
.
getPath
()
+
ProtocolConstent
.
DNS
+
dst_ip
+
" "
+
dst_port
;
}
...
...
@@ -698,6 +704,7 @@ public class ProtocolTemplateImpl implements ProtocolTemplateService {
dst_port
=
testEntity
.
getParamJson
()[
1
];
}
catch
(
Exception
e
)
{
log
.
error
(
"dhcp参数解析失败!"
);
throw
new
FuzzException
(
"count of params is not match!"
);
}
return
kitty
.
getVenvPath
()
+
" "
+
kitty
.
getPath
()
+
ProtocolConstent
.
DHCP
+
dst_ip
+
" "
+
dst_port
;
}
...
...
@@ -716,11 +723,12 @@ public class ProtocolTemplateImpl implements ProtocolTemplateService {
dst_port
=
testEntity
.
getParamJson
()[
3
];
}
catch
(
Exception
e
)
{
log
.
error
(
"bgp参数解析失败!"
);
throw
new
FuzzException
(
"count of params is not match!"
);
}
return
kitty
.
getVenvPath
()
+
" "
+
kitty
.
getPath
()
+
ProtocolConstent
.
BGP
+
src_ip
+
" "
+
src_port
+
" "
+
dst_ip
+
" "
+
dst_port
;
}
public
String
arpCmd
(
TestEntity
testEntity
)
{
public
String
arpCmd
(
TestEntity
testEntity
)
throws
FuzzException
{
if
(!
TestTools
.
paramsLenghtTest
(
testEntity
.
getParamJson
().
length
,
2
,
"arp"
))
return
""
;
String
dst_mac
=
null
;
...
...
@@ -730,6 +738,7 @@ public class ProtocolTemplateImpl implements ProtocolTemplateService {
src_mac
=
testEntity
.
getParamJson
()[
1
];
}
catch
(
Exception
e
)
{
log
.
error
(
"arp参数解析失败!"
);
throw
new
FuzzException
(
"count of params is not match!"
);
}
return
kitty
.
getVenvPath
()
+
" "
+
kitty
.
getPath
()
+
ProtocolConstent
.
ARP
+
dst_mac
+
" "
+
src_mac
;
}
...
...
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/service/impl/TestServiceImpl.java
View file @
3976f673
...
...
@@ -3,6 +3,8 @@ package com.example.fuzzControll.service.impl;
import
com.example.fuzzControll.conf.SpringContextUtil
;
import
com.example.fuzzControll.conf.KittyProperties
;
import
com.example.fuzzControll.constents.CmdConstent
;
import
com.example.fuzzControll.exception.AflnetException
;
import
com.example.fuzzControll.exception.CmdException
;
import
com.example.fuzzControll.pojo.vo.CmdStartParams
;
import
com.example.fuzzControll.service.TestService
;
import
com.example.fuzzControll.tools.CmdTools
;
...
...
@@ -17,7 +19,7 @@ public class TestServiceImpl implements TestService {
//todo 不同服务不同端口
@Override
public
void
testStart
(
CmdStartParams
cmdStartParams
)
{
public
void
testStart
(
CmdStartParams
cmdStartParams
)
throws
AflnetException
{
TestControlTools
.
setIsRunning
(
true
);
String
cmd
=
cmdTools
.
parse
(
cmdStartParams
);
String
finalCmd
=
CmdConstent
.
RUN_AFLNET
+
cmd
+
kittyProperties
.
getAflnetPath
()+
"live555/testProgs/testOnDemandRTSPServer 8554"
;
...
...
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/java/com/example/fuzzControll/tools/CmdTools.java
View file @
3976f673
...
...
@@ -3,6 +3,7 @@ package com.example.fuzzControll.tools;
import
com.alibaba.fastjson.JSONObject
;
import
com.example.fuzzControll.conf.SpringContextUtil
;
import
com.example.fuzzControll.controller.WebSocket
;
import
com.example.fuzzControll.exception.AflnetException
;
import
com.example.fuzzControll.exception.CmdException
;
import
com.example.fuzzControll.exception.FuzzException
;
import
com.example.fuzzControll.pojo.vo.CmdStartParams
;
...
...
@@ -217,7 +218,10 @@ public class CmdTools {
return
returnEntity
;
}
public
String
parse
(
CmdStartParams
cmdStartParams
)
{
public
String
parse
(
CmdStartParams
cmdStartParams
)
throws
AflnetException
{
if
(
cmdStartParams
==
null
){
throw
new
AflnetException
(
"CmdStartParams is null!"
);
}
StringBuilder
cmd
=
new
StringBuilder
();
if
(
cmdStartParams
.
getNetinfo
()
!=
""
)
{
cmd
.
append
(
" -N "
+
cmdStartParams
.
getNetinfo
());
...
...
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