Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
binwalk
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
fact-depend
binwalk
Commits
dd4f2efd
Commit
dd4f2efd
authored
Sep 05, 2021
by
devttys0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added directory traversal test; fixed zip test.
parent
0988b2e2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
2 deletions
+31
-2
dirtraversal.tar
testing/tests/input-vectors/dirtraversal.tar
+0
-0
test_dirtraversal.py
testing/tests/test_dirtraversal.py
+31
-0
test_firmware_zip.py
testing/tests/test_firmware_zip.py
+0
-2
No files found.
testing/tests/input-vectors/dirtraversal.tar
0 → 100644
View file @
dd4f2efd
File added
testing/tests/test_dirtraversal.py
0 → 100644
View file @
dd4f2efd
import
os
import
binwalk
from
nose.tools
import
eq_
,
ok_
def
test_dirtraversal
():
'''
Test: Open dirtraversal.tar, scan for signatures.
Verify that dangerous symlinks have been sanitized.
'''
bad_symlink_file_list
=
[
'foo'
,
'bar'
,
'foo2'
,
'bar2'
]
good_symlink_file_list
=
[
'README_link'
,
'README2_link'
]
input_vector_file
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
"input-vectors"
,
"dirtraversal.tar"
)
scan_result
=
binwalk
.
scan
(
input_vector_file
,
signature
=
True
,
extract
=
True
,
quiet
=
True
)
# Test number of modules used
eq_
(
len
(
scan_result
),
1
)
# Make sure the bad symlinks have been sanitized and the
# good symlinks have not been sanitized.
for
result
in
scan_result
[
0
]
.
results
:
if
result
.
file
.
name
in
bad_symlink_file_list
:
assert_equal
(
os
.
path
.
realpath
(
result
.
file
.
path
),
os
.
devnull
)
elif
result
.
file
.
name
in
good_symlink_file_list
:
assert_not_equal
(
os
.
path
.
realpath
(
result
.
file
.
path
),
os
.
devnull
)
testing/tests/test_firmware_zip.py
View file @
dd4f2efd
...
@@ -10,8 +10,6 @@ def test_firmware_zip():
...
@@ -10,8 +10,6 @@ def test_firmware_zip():
'''
'''
expected_results
=
[
expected_results
=
[
[
0
,
'Zip archive data, at least v1.0 to extract, name: dir655_revB_FW_203NA/'
],
[
0
,
'Zip archive data, at least v1.0 to extract, name: dir655_revB_FW_203NA/'
],
[
51
,
'Zip archive data, at least v2.0 to extract, compressed size: 6395868, uncompressed size: 6422554, name: dir655_revB_FW_203NA/DIR655B1_FW203NAB02.bin'
],
[
6395993
,
'Zip archive data, at least v2.0 to extract, compressed size: 14243, uncompressed size: 61440, name: dir655_revB_FW_203NA/dir655_revB_release_notes_203NA.doc'
],
[
6410581
,
'End of Zip archive, footer length: 22'
],
[
6410581
,
'End of Zip archive, footer length: 22'
],
]
]
...
...
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