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
b24fe1c7
Commit
b24fe1c7
authored
Oct 02, 2014
by
devttys0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added zlibextractor plugin; removed FMK zlib extraction dependency
parent
38ac8074
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
49 additions
and
11 deletions
+49
-11
extract.conf
src/binwalk/config/extract.conf
+2
-2
disasm.py
src/binwalk/modules/disasm.py
+6
-1
extractor.py
src/binwalk/modules/extractor.py
+0
-0
general.py
src/binwalk/modules/general.py
+0
-4
signature.py
src/binwalk/modules/signature.py
+4
-4
zlibextract.py
src/binwalk/plugins/zlibextract.py
+37
-0
No files found.
src/binwalk/config/extract.conf
View file @
b24fe1c7
...
...
@@ -27,13 +27,13 @@
# These assume the firmware-mod-kit is installed to /opt/firmware-mod-kit.
# If not, change the file paths appropriately.
^
squashfs
filesystem
:
squashfs
:/
opt
/
firmware
-
mod
-
kit
/
unsquashfs_all
.
sh
'%e'
^
jffs2
filesystem
:
jffs2
:/
opt
/
firmware
-
mod
-
kit
/
src
/
jffs2
/
unjffs2
'%e'
^
ascii
cpio
archive
:
cpio
:/
opt
/
firmware
-
mod
-
kit
/
uncpio
.
sh
'%e'
#^squashfs filesystem:squashfs:/opt/firmware-mod-kit/unsquashfs_all.sh '%e'
#^cramfs filesystem:cramfs:/opt/firmware-mod-kit/uncramfs_all.sh '%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'
^
zlib
compressed
data
:
zlib
:/
opt
/
firmware
-
mod
-
kit
/
src
/
firmware
-
tools
/
unzlib
.
py
'%e'
#
^zlib compressed data:zlib:/opt/firmware-mod-kit/src/firmware-tools/unzlib.py '%e'
^
cramfs
filesystem
:
cramfs
:
mkdir
cramfs
-
root
&&
mount
-
t
cramfs
'%e'
cramfs
-
root
^
ext2
filesystem
:
ext2
:
mkdir
ext2
-
root
&&
mount
-
t
ext2
'%e'
ext2
-
root
...
...
src/binwalk/modules/disasm.py
View file @
b24fe1c7
...
...
@@ -31,10 +31,15 @@ class Disasm(Module):
type
=
int
,
kwargs
=
{
'min_insn_count'
:
0
},
description
=
'Minimum number of consecutive instructions to be considered valid (default:
%
d)'
%
DEFAULT_MIN_INSN_COUNT
),
Option
(
long
=
'continue'
,
short
=
'k'
,
kwargs
=
{
'keep_going'
:
True
},
description
=
"Don't stop at the first match"
),
]
KWARGS
=
[
Kwarg
(
name
=
'enabled'
,
default
=
False
),
Kwarg
(
name
=
'keep_going'
,
default
=
False
),
Kwarg
(
name
=
'min_insn_count'
,
default
=
DEFAULT_MIN_INSN_COUNT
),
]
...
...
@@ -146,7 +151,7 @@ class Disasm(Module):
if
self
.
config
.
verbose
:
for
(
position
,
size
,
mnem
,
opnds
)
in
result
.
insns
:
self
.
result
(
offset
=
position
,
file
=
fp
,
description
=
"
\t\t
%
s
%
s"
%
(
mnem
,
opnds
))
if
not
self
.
config
.
keep_going
:
if
not
self
.
keep_going
:
return
total_read
+=
dlen
...
...
src/binwalk/modules/extractor.py
View file @
b24fe1c7
src/binwalk/modules/general.py
View file @
b24fe1c7
...
...
@@ -34,10 +34,6 @@ class General(Module):
type
=
int
,
kwargs
=
{
'block'
:
0
},
description
=
'Set file block size'
),
Option
(
long
=
'continue'
,
short
=
'k'
,
kwargs
=
{
'keep_going'
:
True
},
description
=
"Don't stop at the first match"
),
Option
(
long
=
'swap'
,
short
=
'g'
,
type
=
int
,
...
...
src/binwalk/modules/signature.py
View file @
b24fe1c7
...
...
@@ -24,10 +24,10 @@ class Signature(Module):
long
=
'opcodes'
,
kwargs
=
{
'enabled'
:
True
,
'search_for_opcodes'
:
True
},
description
=
'Scan target file(s) for common executable opcode signatures'
),
Option
(
short
=
'C'
,
long
=
'cast'
,
kwargs
=
{
'enabled'
:
True
,
'cast_data_types'
:
True
},
description
=
'Cast offsets as a given data type (use -y to specify the data type / endianness)'
),
#
Option(short='C',
#
long='cast',
#
kwargs={'enabled' : True, 'cast_data_types' : True},
#
description='Cast offsets as a given data type (use -y to specify the data type / endianness)'),
Option
(
short
=
'm'
,
long
=
'magic'
,
kwargs
=
{
'enabled'
:
True
,
'magic_files'
:
[]},
...
...
src/binwalk/plugins/zlibextract.py
0 → 100644
View file @
b24fe1c7
import
os
import
zlib
import
binwalk.core.common
import
binwalk.core.plugin
class
ZLIBExtractPlugin
(
binwalk
.
core
.
plugin
.
Plugin
):
'''
Zlib extractor plugin.
'''
MODULES
=
[
'Signature'
]
def
init
(
self
):
# If the extractor is enabled for the module we're currently loaded
# into, then register self.extractor as a zlib extraction rule.
if
self
.
module
.
extractor
.
enabled
:
self
.
module
.
extractor
.
add_rule
(
txtrule
=
None
,
regex
=
"^zlib compressed data"
,
extension
=
"zlib"
,
cmd
=
self
.
extractor
)
def
extractor
(
self
,
fname
):
outfile
=
os
.
path
.
splitext
(
fname
)[
0
]
#print ("Extracting from '%s' to '%s'" % (fname, outfile))
try
:
fpin
=
binwalk
.
core
.
common
.
BlockFile
(
fname
)
fpout
=
binwalk
.
core
.
common
.
BlockFile
(
outfile
,
'w'
)
plaintext
=
zlib
.
decompress
(
fpin
.
read
())
fpout
.
write
(
plaintext
)
fpin
.
close
()
fpout
.
close
()
except
Exception
,
e
:
pass
#print ("Failed to decompress data:", str(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