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
e47c4040
Commit
e47c4040
authored
May 23, 2024
by
钱炳权
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
aflnet日志文件和kitty日志结果文件下载功能完成
parent
e8313a6d
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
23 additions
and
20 deletions
+23
-20
ServerClassEnum.java
...a/com/example/fuzzControll/constents/ServerClassEnum.java
+5
-0
KittyFuzzPersistenceServiceImpl.java
...ontroll/service/impl/KittyFuzzPersistenceServiceImpl.java
+0
-5
TestServiceImpl.java
...om/example/fuzzControll/service/impl/TestServiceImpl.java
+6
-2
CmdTools.java
...rc/main/java/com/example/fuzzControll/tools/CmdTools.java
+11
-9
FileTools.java
...c/main/java/com/example/fuzzControll/tools/FileTools.java
+0
-3
TestController.java
.../example/fuzzbackendmaster/controller/TestController.java
+1
-1
No files found.
fuzzIntegration/src/main/java/com/example/fuzzControll/constents/ServerClassEnum.java
0 → 100644
View file @
e47c4040
package
com
.
example
.
fuzzControll
.
constents
;
public
enum
ServerClassEnum
{
}
fuzzIntegration/src/main/java/com/example/fuzzControll/service/impl/KittyFuzzPersistenceServiceImpl.java
View file @
e47c4040
...
...
@@ -38,7 +38,6 @@ public class KittyFuzzPersistenceServiceImpl implements KittyFuzzPersistenceServ
if
(
files
.
size
()
>
3
)
{
log
.
error
(
"kittyLogs backup failed!"
);
}
System
.
out
.
println
(
"1"
);
List
<
String
>
logFiles
=
null
;
try
{
logFiles
=
files
.
stream
().
filter
(
file
->
file
.
contains
(
"pcap"
)).
collect
(
Collectors
.
toList
());
...
...
@@ -46,9 +45,7 @@ public class KittyFuzzPersistenceServiceImpl implements KittyFuzzPersistenceServ
log
.
error
(
"There is no file!"
);
e
.
printStackTrace
();
}
System
.
out
.
println
(
"2"
);
logFiles
.
forEach
(
System
.
out
::
println
);
System
.
out
.
println
(
"3"
);
//todo 需要传入任务id
KittyPackageFile
kittyPackageFile
=
new
KittyPackageFile
(
missionId
,
""
,
""
,
new
byte
[
1
],
...
...
@@ -56,8 +53,6 @@ public class KittyFuzzPersistenceServiceImpl implements KittyFuzzPersistenceServ
// KittyPackageFile kittyPackageFile = new KittyPackageFile(missionId, logFiles.get(0), logFiles.get(1),
// fileTools.fileReadAndTranstoBytes(kittyProperties.getLogOutPath(), logFiles.get(0)),
// fileTools.fileReadAndTranstoBytes(kittyProperties.getLogOutPath(), logFiles.get(1)));
System
.
out
.
println
(
kittyPackageFile
);
System
.
out
.
println
(
"4"
);
return
kittyMapper
.
kittyPackagesBackup
(
kittyPackageFile
);
}
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/service/impl/TestServiceImpl.java
View file @
e47c4040
...
...
@@ -41,7 +41,7 @@ public class TestServiceImpl implements TestService {
Date
date
=
new
Date
();
DateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd-hh-mm-ss-"
);
String
outputFileName
=
df
.
format
(
date
)+
cmdStartParams
.
getProtopcol
()+
"-output"
;
String
finalCmd
=
CmdConstent
.
RUN_AFLNET_BEFORE
+
outputFileName
+
CmdConstent
.
RUN_AFLNET_AFTER
+
cmd
+
aflnetProperties
.
getAflnetPath
()
+
"live555/testProgs/testOnDemandRTSPServer 8554"
;
String
finalCmd
=
CmdConstent
.
RUN_AFLNET_BEFORE
+
outputFileName
+
CmdConstent
.
RUN_AFLNET_AFTER
+
cmd
+
aflnetProperties
.
getAflnetPath
()
+
"live555/testProgs/
"
+
"
testOnDemandRTSPServer 8554"
;
GlobalParameters
.
aflnetData
.
put
(
"aflnetName"
,
outputFileName
);
log
.
info
(
"The cmd is [{}]"
,
finalCmd
);
cmdTools
.
runProgramCmd
(
finalCmd
,
outputFileName
+
".zip"
);
...
...
@@ -62,6 +62,10 @@ public class TestServiceImpl implements TestService {
String
fileZipName
=
fileName
+
".zip"
;
cmdTools
.
runCmd
(
CmdConstent
.
RUN_ZIP_FILE
+
fileZipName
+
" "
+
fileName
,
"zip file in testStart"
);
List
<
String
>
files
=
cmdTools
.
runCmd
(
CmdConstent
.
GET_FILE_NAME
+
aflnetProperties
.
getOutputPath
(),
"getSeedFiles"
);
files
.
stream
().
forEach
(
System
.
out
::
println
);
if
(!
files
.
contains
(
fileZipName
)){
log
.
error
(
"File zip error!"
);
}
while
(
files
.
contains
(
fileZipName
)
&&
flag
==
0
)
{
//当前存在压缩包才存入
flag
=
aflnetPersistenceService
.
aflnetResultBackup
(
fileZipName
,
GlobalParameters
.
aflnetData
.
get
(
"missionName"
));
}
...
...
@@ -74,7 +78,7 @@ public class TestServiceImpl implements TestService {
log
.
error
(
"file delete failed!"
);
}
log
.
info
(
"
kittyLog
has been backuped!"
);
log
.
info
(
"
Aflnet Logs
has been backuped!"
);
}
}).
start
();
}
catch
(
Exception
e
)
{
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/tools/CmdTools.java
View file @
e47c4040
...
...
@@ -35,10 +35,12 @@ public class CmdTools {
public
List
<
String
>
runCmd
(
String
cmd
,
String
caller
)
throws
CmdException
{
List
<
String
>
result
=
new
ArrayList
<
String
>();
try
{
log
.
info
(
caller
+
" is running!"
);
Process
process
=
Runtime
.
getRuntime
().
exec
(
cmd
);
printMessage
(
process
.
getInputStream
(),
result
);
printMessage
(
process
.
getErrorStream
(),
new
ArrayList
<
String
>());
process
.
waitFor
();
log
.
info
(
caller
+
" end!"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
CmdException
(
caller
+
" run cmd failed!"
);
...
...
@@ -262,37 +264,37 @@ public class CmdTools {
}
StringBuilder
cmd
=
new
StringBuilder
();
if
(
cmdStartParams
.
getNetinfo
()
!=
""
&&
cmdStartParams
.
getNetinfo
()
!=
null
)
{
cmd
.
append
(
" -N "
+
cmdStartParams
.
getNetinfo
());
cmd
.
append
(
" -N "
+
cmdStartParams
.
getNetinfo
()
+
" "
);
}
else
{
log
.
error
(
"There is no netinfo !"
);
throw
new
AflnetException
(
"There is no netinfo !"
);
}
if
(
cmdStartParams
.
getProtopcol
()
!=
""
)
{
cmd
.
append
(
" -P "
+
cmdStartParams
.
getProtopcol
());
cmd
.
append
(
" -P "
+
cmdStartParams
.
getProtopcol
()
+
" "
);
}
if
(
cmdStartParams
.
getWaiting
()
!=
0
)
{
cmd
.
append
(
" -D "
+
cmdStartParams
.
getWaiting
());
cmd
.
append
(
" -D "
+
cmdStartParams
.
getWaiting
()
+
" "
);
}
if
(
cmdStartParams
.
getNsname
()
!=
""
)
{
cmd
.
append
(
" -e "
+
cmdStartParams
.
getNsname
());
cmd
.
append
(
" -e "
+
cmdStartParams
.
getNsname
()
+
" "
);
}
if
(
cmdStartParams
.
getKill
())
{
cmd
.
append
(
" -K "
);
}
if
(
cmdStartParams
.
getAwareMode
())
{
cmd
.
append
(
" -E "
);
cmd
.
append
(
" -E "
+
" "
);
}
if
(
cmdStartParams
.
getRegionMutationOperators
())
{
cmd
.
append
(
" -R "
);
cmd
.
append
(
" -R "
+
" "
);
}
if
(
cmdStartParams
.
getFalseNegativeMode
())
{
cmd
.
append
(
" -F "
);
cmd
.
append
(
" -F "
+
" "
);
}
if
(
cmdStartParams
.
getScript
()
!=
""
)
{
cmd
.
append
(
" -c "
+
cmdStartParams
.
getScript
());
cmd
.
append
(
" -c "
+
cmdStartParams
.
getScript
()
+
" "
);
}
if
(
cmdStartParams
.
getStateSelectionAlgo
()
!=
0
)
{
cmd
.
append
(
" -q "
+
cmdStartParams
.
getStateSelectionAlgo
());
cmd
.
append
(
" -q "
+
cmdStartParams
.
getStateSelectionAlgo
()
+
" "
);
}
if
(
cmdStartParams
.
getSeedSelectionAlgo
()
!=
0
)
{
cmd
.
append
(
" -s "
+
cmdStartParams
.
getSeedSelectionAlgo
()
+
" "
);
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/tools/FileTools.java
View file @
e47c4040
...
...
@@ -49,16 +49,13 @@ public class FileTools {
FileInputStream
inputStream
=
new
FileInputStream
(
file
);
BufferedInputStream
bufferedInputStream
=
new
BufferedInputStream
(
inputStream
);)
{
System
.
out
.
println
(
"1-2"
);
if
(
file
.
length
()
>
Integer
.
MAX_VALUE
&&
file
.
length
()
<=
0
)
{
log
.
error
(
"KittyLogFile is too long or has no content!"
);
}
System
.
out
.
println
(
"1-3"
);
int
bytesRead
;
while
((
bytesRead
=
bufferedInputStream
.
read
(
buffer
))
!=
-
1
)
{
System
.
out
.
println
(
buffer
.
length
);
}
System
.
out
.
println
(
"1-5"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
...
...
fuzzbackendmaster/src/main/java/com/example/fuzzbackendmaster/controller/TestController.java
View file @
e47c4040
...
...
@@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.*;
*/
@Slf4j
@RestController
@RequestMapping
(
"/
tes
t"
)
@RequestMapping
(
"/
aflne
t"
)
@CrossOrigin
public
class
TestController
{
@Autowired
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment