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
827f3e7d
Commit
827f3e7d
authored
Jan 08, 2014
by
devttys0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Plugin classes no longer need to be named 'Plugin'
parent
68a99e87
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
15 deletions
+21
-15
plugin.py
src/binwalk/core/plugin.py
+15
-9
compressd.py
src/binwalk/plugins/compressd.py
+2
-2
cpio.py
src/binwalk/plugins/cpio.py
+1
-1
lzmamod.py
src/binwalk/plugins/lzmamod.py
+1
-1
tar.py
src/binwalk/plugins/tar.py
+1
-1
zlibvalid.py
src/binwalk/plugins/zlibvalid.py
+1
-1
No files found.
src/binwalk/core/plugin.py
View file @
827f3e7d
import
os
import
os
import
sys
import
sys
import
imp
import
imp
import
inspect
import
binwalk.core.settings
import
binwalk.core.settings
from
binwalk.core.compat
import
*
from
binwalk.core.compat
import
*
...
@@ -95,7 +96,6 @@ class Plugins(object):
...
@@ -95,7 +96,6 @@ class Plugins(object):
SCAN
=
'scan'
SCAN
=
'scan'
PRESCAN
=
'pre_scan'
PRESCAN
=
'pre_scan'
POSTSCAN
=
'post_scan'
POSTSCAN
=
'post_scan'
PLUGIN
=
'Plugin'
MODULE_EXTENSION
=
'.py'
MODULE_EXTENSION
=
'.py'
def
__init__
(
self
,
parent
=
None
):
def
__init__
(
self
,
parent
=
None
):
...
@@ -126,6 +126,12 @@ class Plugins(object):
...
@@ -126,6 +126,12 @@ class Plugins(object):
except
Exception
as
e
:
except
Exception
as
e
:
sys
.
stderr
.
write
(
"WARNING:
%
s.
%
s failed:
%
s
\n
"
%
(
callback
.
__module__
,
callback
.
__name__
,
e
))
sys
.
stderr
.
write
(
"WARNING:
%
s.
%
s failed:
%
s
\n
"
%
(
callback
.
__module__
,
callback
.
__name__
,
e
))
def
_find_plugin_class
(
self
,
plugin
):
for
(
name
,
klass
)
in
inspect
.
getmembers
(
plugin
,
inspect
.
isclass
):
if
issubclass
(
klass
,
Plugin
)
and
klass
!=
Plugin
:
return
klass
raise
Exception
(
"Failed to locate Plugin class in "
+
plugin
)
def
list_plugins
(
self
):
def
list_plugins
(
self
):
'''
'''
Obtain a list of all user and system plugin modules.
Obtain a list of all user and system plugin modules.
...
@@ -150,16 +156,16 @@ class Plugins(object):
...
@@ -150,16 +156,16 @@ class Plugins(object):
plugins
=
{
plugins
=
{
'user'
:
{
'user'
:
{
'modules'
:
[],
'modules'
:
[],
'descriptions'
:
{},
'descriptions'
:
{},
'enabled'
:
{},
'enabled'
:
{},
'path'
:
None
,
'path'
:
None
,
},
},
'system'
:
{
'system'
:
{
'modules'
:
[],
'modules'
:
[],
'descriptions'
:
{},
'descriptions'
:
{},
'enabled'
:
{},
'enabled'
:
{},
'path'
:
None
,
'path'
:
None
,
}
}
}
}
...
@@ -172,7 +178,7 @@ class Plugins(object):
...
@@ -172,7 +178,7 @@ class Plugins(object):
try
:
try
:
plugin
=
imp
.
load_source
(
module
,
os
.
path
.
join
(
plugins
[
key
][
'path'
],
file_name
))
plugin
=
imp
.
load_source
(
module
,
os
.
path
.
join
(
plugins
[
key
][
'path'
],
file_name
))
plugin_class
=
getattr
(
plugin
,
self
.
PLUGIN
)
plugin_class
=
self
.
_find_plugin_class
(
plugin
)
plugins
[
key
][
'enabled'
][
module
]
=
True
plugins
[
key
][
'enabled'
][
module
]
=
True
plugins
[
key
][
'modules'
]
.
append
(
module
)
plugins
[
key
][
'modules'
]
.
append
(
module
)
...
@@ -201,7 +207,7 @@ class Plugins(object):
...
@@ -201,7 +207,7 @@ class Plugins(object):
try
:
try
:
plugin
=
imp
.
load_source
(
module
,
file_path
)
plugin
=
imp
.
load_source
(
module
,
file_path
)
plugin_class
=
getattr
(
plugin
,
self
.
PLUGIN
)
plugin_class
=
self
.
_find_plugin_class
(
plugin
)
class_instance
=
plugin_class
(
self
.
parent
)
class_instance
=
plugin_class
(
self
.
parent
)
if
not
class_instance
.
_enabled
:
if
not
class_instance
.
_enabled
:
...
...
src/binwalk/plugins/compressd.py
View file @
827f3e7d
import
binwalk.core.C
import
binwalk.core.C
from
binwalk.core.common
import
*
import
binwalk.core.plugin
import
binwalk.core.plugin
from
binwalk.core.common
import
*
class
Plugin
(
binwalk
.
core
.
plugin
.
Plugin
):
class
Compressd
Plugin
(
binwalk
.
core
.
plugin
.
Plugin
):
'''
'''
Searches for and validates compress'd data.
Searches for and validates compress'd data.
'''
'''
...
...
src/binwalk/plugins/cpio.py
View file @
827f3e7d
import
binwalk.core.plugin
import
binwalk.core.plugin
class
Plugin
(
binwalk
.
core
.
plugin
.
Plugin
):
class
CPIO
Plugin
(
binwalk
.
core
.
plugin
.
Plugin
):
'''
'''
Ensures that ASCII CPIO archive entries only get extracted once.
Ensures that ASCII CPIO archive entries only get extracted once.
'''
'''
...
...
src/binwalk/plugins/lzmamod.py
View file @
827f3e7d
...
@@ -4,7 +4,7 @@ import binwalk.core.plugin
...
@@ -4,7 +4,7 @@ import binwalk.core.plugin
from
binwalk.core.compat
import
*
from
binwalk.core.compat
import
*
from
binwalk.core.common
import
BlockFile
from
binwalk.core.common
import
BlockFile
class
Plugin
(
binwalk
.
core
.
plugin
.
Plugin
):
class
LZMAMod
Plugin
(
binwalk
.
core
.
plugin
.
Plugin
):
'''
'''
Finds and extracts modified LZMA files commonly found in cable modems.
Finds and extracts modified LZMA files commonly found in cable modems.
Based on Bernardo Rodrigues' work: http://w00tsec.blogspot.com/2013/11/unpacking-firmware-images-from-cable.html
Based on Bernardo Rodrigues' work: http://w00tsec.blogspot.com/2013/11/unpacking-firmware-images-from-cable.html
...
...
src/binwalk/plugins/tar.py
View file @
827f3e7d
...
@@ -2,7 +2,7 @@ import time
...
@@ -2,7 +2,7 @@ import time
import
math
import
math
import
binwalk.core.plugin
import
binwalk.core.plugin
class
Plugin
(
binwalk
.
core
.
plugin
.
Plugin
):
class
Tar
Plugin
(
binwalk
.
core
.
plugin
.
Plugin
):
MODULES
=
[
'Signature'
]
MODULES
=
[
'Signature'
]
...
...
src/binwalk/plugins/zlibvalid.py
View file @
827f3e7d
...
@@ -2,7 +2,7 @@ import binwalk.core.C
...
@@ -2,7 +2,7 @@ import binwalk.core.C
import
binwalk.core.plugin
import
binwalk.core.plugin
from
binwalk.core.common
import
BlockFile
from
binwalk.core.common
import
BlockFile
class
Plugin
(
binwalk
.
core
.
plugin
.
Plugin
):
class
Zlib
Plugin
(
binwalk
.
core
.
plugin
.
Plugin
):
'''
'''
Searches for and validates zlib compressed data.
Searches for and validates zlib compressed data.
'''
'''
...
...
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