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-gitdep
binwalk
Commits
38bc437f
Commit
38bc437f
authored
May 11, 2014
by
devttys0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for multiple commands in extract.conf; added auto-mounting for ext2 and romfs.
parent
47b521cd
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
6 deletions
+11
-6
extract.conf
src/binwalk/config/extract.conf
+2
-2
extractor.py
src/binwalk/modules/extractor.py
+9
-4
No files found.
src/binwalk/config/extract.conf
View file @
38bc437f
...
@@ -29,8 +29,8 @@
...
@@ -29,8 +29,8 @@
^
bff
volume
entry
:
bff
:/
opt
/
firmware
-
mod
-
kit
/
src
/
bff
/
bffxtractor
.
py
'%e'
^
bff
volume
entry
:
bff
:/
opt
/
firmware
-
mod
-
kit
/
src
/
bff
/
bffxtractor
.
py
'%e'
^
wdk
file
system
:
wdk
:/
opt
/
firmware
-
mod
-
kit
/
src
/
firmware
-
tools
/
unwdk
.
py
'%e'
^
wdk
file
system
:
wdk
:/
opt
/
firmware
-
mod
-
kit
/
src
/
firmware
-
tools
/
unwdk
.
py
'%e'
^
zlib
header
:
zlib
:/
opt
/
firmware
-
mod
-
kit
/
src
/
firmware
-
tools
/
unzlib
.
py
'%e'
^
zlib
header
:
zlib
:/
opt
/
firmware
-
mod
-
kit
/
src
/
firmware
-
tools
/
unzlib
.
py
'%e'
^
ext2
filesystem
:
ext2
:
/
opt
/
firmware
-
mod
-
kit
/
src
/
mountcp
/
mountcp
'%e'
ext2
-
root
^
ext2
filesystem
:
ext2
:
mkdir
ext2
-
root
&&
mount
-
t
ext2
'%e'
ext2
-
root
^
romfs
filesystem
:
romfs
:
/
opt
/
firmware
-
mod
-
kit
/
src
/
mountcp
/
mountcp
'%e'
romfs
-
root
^
romfs
filesystem
:
romfs
:
mkdir
romfs
-
root
&&
mount
-
t
romfs
'%e'
romfs
-
root
# These paths are for the depreciated firmware-mod-kit file paths, which included the 'trunk' directory.
# These paths are for the depreciated firmware-mod-kit file paths, which included the 'trunk' directory.
# These will only be run if the above file paths don't exist.
# These will only be run if the above file paths don't exist.
...
...
src/binwalk/modules/extractor.py
View file @
38bc437f
...
@@ -543,6 +543,7 @@ class Extractor(Module):
...
@@ -543,6 +543,7 @@ class Extractor(Module):
Returns True on success, False on failure, or None if the external extraction utility could not be found.
Returns True on success, False on failure, or None if the external extraction utility could not be found.
'''
'''
tmp
=
None
tmp
=
None
rval
=
0
retval
=
True
retval
=
True
binwalk
.
core
.
common
.
debug
(
"Running extractor '
%
s'"
%
str
(
cmd
))
binwalk
.
core
.
common
.
debug
(
"Running extractor '
%
s'"
%
str
(
cmd
))
...
@@ -560,17 +561,21 @@ class Extractor(Module):
...
@@ -560,17 +561,21 @@ class Extractor(Module):
if
not
binwalk
.
core
.
common
.
DEBUG
:
if
not
binwalk
.
core
.
common
.
DEBUG
:
tmp
=
tempfile
.
TemporaryFile
()
tmp
=
tempfile
.
TemporaryFile
()
# Execute.
for
command
in
cmd
.
split
(
"&&"
):
# Replace all instances of FILE_NAME_PLACEHOLDER in the command with fname
# Replace all instances of FILE_NAME_PLACEHOLDER in the command with fname
cmd
=
cmd
.
replace
(
self
.
FILE_NAME_PLACEHOLDER
,
fname
)
command
=
command
.
strip
()
.
replace
(
self
.
FILE_NAME_PLACEHOLDER
,
fname
)
binwalk
.
core
.
common
.
debug
(
"subprocess.call(
%
s, stdout=
%
s, stderr=
%
s)"
%
(
command
,
str
(
tmp
),
str
(
tmp
)))
rval
=
subprocess
.
call
(
shlex
.
split
(
command
),
stdout
=
tmp
,
stderr
=
tmp
)
binwalk
.
core
.
common
.
debug
(
'External extractor command "
%
s" completed with return code
%
d'
%
(
cmd
,
rval
))
# Execute.
rval
=
subprocess
.
call
(
shlex
.
split
(
cmd
),
stdout
=
tmp
,
stderr
=
tmp
)
if
rval
==
0
:
if
rval
==
0
:
retval
=
True
retval
=
True
else
:
else
:
retval
=
False
retval
=
False
break
binwalk
.
core
.
common
.
debug
(
'External extractor command "
%
s" completed with return code
%
d'
%
(
cmd
,
rval
))
except
KeyboardInterrupt
as
e
:
except
KeyboardInterrupt
as
e
:
raise
e
raise
e
except
Exception
as
e
:
except
Exception
as
e
:
...
...
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