Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
unifuzz-validate
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
文周繁
unifuzz-validate
Commits
90677d7a
Commit
90677d7a
authored
Jan 14, 2025
by
文周繁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add vulnerability validation
parent
f1150a83
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
10 deletions
+24
-10
validation.py
validation.py
+24
-10
No files found.
validation.py
View file @
90677d7a
...
...
@@ -2,16 +2,17 @@ import sys
import
subprocess
import
os
import
re
# pymongo==3.13.0
import
pymongo
from
bson.objectid
import
ObjectId
from
gridfs
import
GridFS
# 二进制程序保存的路径
binary_file_path
=
"/home/
hunter/Documents
/validate_script/"
binary_file_path
=
"/home/
fuzz_dir
/validate_script/"
# asan编译的二进制程序保存的路径
asan_file_path
=
"/home/
hunter/Documents
/validate_script/asan_software"
asan_file_path
=
"/home/
fuzz_dir
/validate_script/asan_software"
# crash的种子保存的路径
crashes_file_path
=
"/home/
hunter/Documents
/validate_script/crashes/"
crashes_file_path
=
"/home/
fuzz_dir
/validate_script/crashes/"
pattern_valgrind_head
=
re
.
compile
(
r'==\d+=='
)
pattern_valgrind_tail
=
re
.
compile
(
r'==\d+== ERROR SUMMARY: [1-9]+'
)
...
...
@@ -97,17 +98,19 @@ def exec_command(crashes_collection, usage, command, seed_id: ObjectId):
def
main
(
argv
):
mongo_address
=
argv
[
0
]
mongo_port
=
argv
[
1
]
db_name
=
argv
[
3
]
default_db_name
=
argv
[
4
]
parameter
=
argv
[
5
]
software_id
=
argv
[
6
]
task_id
=
argv
[
7
]
db_name
=
argv
[
2
]
default_db_name
=
argv
[
3
]
parameter
=
argv
[
4
]
software_id
=
argv
[
5
]
task_id
=
argv
[
6
]
host_node_id
=
argv
[
7
]
fs_name
=
"fs"
mongo_client
=
pymongo
.
MongoClient
(
f
"mongodb://{mongo_address}:{mongo_port}/"
)
db
=
mongo_client
[
db_name
]
default_db
=
mongo_client
[
default_db_name
]
task_collection
=
default_db
[
"task"
]
host_node_collection
=
default_db
[
"host_node"
]
# 获取产生crash的种子
crashes_collection
=
db
[
"crashes"
]
...
...
@@ -120,6 +123,11 @@ def main(argv):
crashes_file_paths
=
search_file
(
crashes_file_path
)
try
:
task_collection
.
update_one
({
"_id"
:
ObjectId
(
task_id
)},
{
"$set"
:
{
"verification"
:
"VERIFYING"
}})
host_node
=
host_node_collection
.
find_one
({
"_id"
:
ObjectId
(
host_node_id
)})
used_cpu
=
host_node
[
"used_cpu"
]
host_node_collection
.
update_one
({
"_id"
:
ObjectId
(
host_node_id
)},
{
"$set"
:
{
"used_cpu"
:
int
(
used_cpu
)
+
1
}})
# 获取二进制程序
binary_collection
=
db
[
"binary"
]
binary_ret
=
binary_collection
.
find_one
()
...
...
@@ -128,6 +136,7 @@ def main(argv):
binary_software_file
.
write
(
binary_ret
[
"code"
])
binary_software_file
.
close
()
os
.
system
(
f
"chmod +x {binary_software}"
)
print
(
"binary donwload successfully"
)
generation_command
(
crashes_collection
,
binary_software
,
parameter
,
crashes_file_paths
,
"valgrind"
)
# 获取asan编译的二进制程序
...
...
@@ -135,6 +144,7 @@ def main(argv):
software
=
software_collection
.
find_one
({
"_id"
:
ObjectId
(
software_id
)})
fs
=
GridFS
(
default_db
,
fs_name
)
# 根据ObjectId查找文件
print
(
software
[
"asan_file"
])
asan_file_data
=
fs
.
get
(
software
[
"asan_file"
])
if
asan_file_data
:
# 确保下载目录存在
...
...
@@ -143,10 +153,14 @@ def main(argv):
with
open
(
asan_file_path
,
"wb"
)
as
f
:
f
.
write
(
asan_file_data
.
read
())
os
.
system
(
f
"chmod +x {asan_file_path}"
)
print
(
"asan_file download successfully"
)
generation_command
(
crashes_collection
,
asan_file_path
,
parameter
,
crashes_file_paths
,
""
)
finally
:
task_collection
=
default_db
[
"task"
]
task_collection
.
update_one
({
"_id"
:
ObjectId
(
task_id
)},
{
"$set"
:
{
"verification"
:
"VERIFIED"
}})
host_node
=
host_node_collection
.
find_one
({
"_id"
:
ObjectId
(
host_node_id
)})
used_cpu
=
host_node
[
"used_cpu"
]
if
int
(
used_cpu
)
>=
1
:
host_node_collection
.
update_one
({
"_id"
:
ObjectId
(
host_node_id
)},
{
"$set"
:
{
"used_cpu"
:
int
(
used_cpu
)
-
1
}})
if
__name__
==
"__main__"
:
...
...
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