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
371f366d
Commit
371f366d
authored
Mar 27, 2015
by
devttys0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed unused custom __del__ methods to prevent memory leaks
parent
253da78e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
28 deletions
+8
-28
module.py
src/binwalk/core/module.py
+0
-3
plugin.py
src/binwalk/core/plugin.py
+8
-11
general.py
src/binwalk/modules/general.py
+0
-14
No files found.
src/binwalk/core/module.py
View file @
371f366d
...
...
@@ -245,9 +245,6 @@ class Module(object):
except
AttributeError
as
e
:
pass
def
__del__
(
self
):
return
None
def
__enter__
(
self
):
return
self
...
...
src/binwalk/core/plugin.py
View file @
371f366d
...
...
@@ -25,7 +25,7 @@ class Plugin(object):
Returns None.
'''
self
.
module
=
module
if
not
self
.
MODULES
or
self
.
module
.
name
in
self
.
MODULES
:
self
.
_enabled
=
True
self
.
init
()
...
...
@@ -79,8 +79,8 @@ class Plugins(object):
The contents of this dictionary key may be modified as necessary by the plugin.
o callback(self, results)
This method is called every time a valid result is found in the file being scanned. It is passed a
dictionary of results. This dictionary is identical to that passed to Binwalk.single_scan's callback
This method is called every time a valid result is found in the file being scanned. It is passed a
dictionary of results. This dictionary is identical to that passed to Binwalk.single_scan's callback
function, and its contents may be modified as necessary by the plugin.
o post_scan(self, fd)
...
...
@@ -91,7 +91,7 @@ class Plugins(object):
Values returned by callback affect only that specific scan result.
Values returned by post_scan are ignored since the scan of that file has already been completed.
By default, all plugins are loaded during binwalk signature scans. Plugins that wish to be disabled by
By default, all plugins are loaded during binwalk signature scans. Plugins that wish to be disabled by
default may create a class variable named 'ENABLED' and set it to False. If ENABLED is set to False, the
plugin will only be loaded if it is explicitly named in the plugins whitelist.
'''
...
...
@@ -108,9 +108,6 @@ class Plugins(object):
self
.
parent
=
parent
self
.
settings
=
binwalk
.
core
.
settings
.
Settings
()
def
__del__
(
self
):
pass
def
__enter__
(
self
):
return
self
...
...
@@ -182,8 +179,8 @@ class Plugins(object):
for
file_name
in
os
.
listdir
(
plugins
[
key
][
'path'
]):
if
file_name
.
endswith
(
self
.
MODULE_EXTENSION
):
module
=
file_name
[:
-
len
(
self
.
MODULE_EXTENSION
)]
try
:
try
:
plugin
=
imp
.
load_source
(
module
,
os
.
path
.
join
(
plugins
[
key
][
'path'
],
file_name
))
plugin_class
=
self
.
_find_plugin_class
(
plugin
)
...
...
@@ -194,7 +191,7 @@ class Plugins(object):
except
Exception
as
e
:
binwalk
.
core
.
common
.
warning
(
"Error loading plugin '
%
s':
%
s"
%
(
file_name
,
str
(
e
)))
plugins
[
key
][
'enabled'
][
module
]
=
False
try
:
plugins
[
key
][
'descriptions'
][
module
]
=
plugin_class
.
__doc__
.
strip
()
.
split
(
'
\n
'
)[
0
]
except
KeyboardInterrupt
as
e
:
...
...
@@ -245,7 +242,7 @@ class Plugins(object):
raise
e
except
Exception
as
e
:
pass
except
KeyboardInterrupt
as
e
:
raise
e
except
Exception
as
e
:
...
...
src/binwalk/modules/general.py
View file @
371f366d
...
...
@@ -124,20 +124,6 @@ class General(Module):
def
reset
(
self
):
pass
#for fp in self.target_files:
# fp.reset()
def
__del__
(
self
):
self
.
_cleanup
()
def
__exit__
(
self
,
a
,
b
,
c
):
self
.
_cleanup
()
def
_cleanup
(
self
):
pass
#if hasattr(self, 'target_files'):
# for fp in self.target_files:
# fp.close()
def
_set_verbosity
(
self
):
'''
...
...
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