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
cd8ca7a7
Commit
cd8ca7a7
authored
Aug 20, 2018
by
devttys0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor code clean-up after lint testing.
parent
a4945a93
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
10 additions
and
24 deletions
+10
-24
common.py
src/binwalk/core/common.py
+6
-6
magic.py
src/binwalk/core/magic.py
+3
-4
module.py
src/binwalk/core/module.py
+0
-3
plugin.py
src/binwalk/core/plugin.py
+0
-1
settings.py
src/binwalk/core/settings.py
+1
-1
statuserver.py
src/binwalk/core/statuserver.py
+0
-1
compression.py
src/binwalk/modules/compression.py
+0
-4
extractor.py
src/binwalk/modules/extractor.py
+0
-1
hexdiff.py
src/binwalk/modules/hexdiff.py
+0
-1
signature.py
src/binwalk/modules/signature.py
+0
-2
No files found.
src/binwalk/core/common.py
View file @
cd8ca7a7
...
@@ -106,11 +106,11 @@ def file_size(filename):
...
@@ -106,11 +106,11 @@ def file_size(filename):
os
.
close
(
fd
)
os
.
close
(
fd
)
def
strip_quoted_strings
(
string
):
def
strip_quoted_strings
(
quoted_
string
):
'''
'''
Strips out data in between double quotes.
Strips out data in between double quotes.
@string - String to strip.
@
quoted_
string - String to strip.
Returns a sanitized string.
Returns a sanitized string.
'''
'''
...
@@ -120,14 +120,14 @@ def strip_quoted_strings(string):
...
@@ -120,14 +120,14 @@ def strip_quoted_strings(string):
# double quotes, and this function should ignore those. However, it also means that any
# double quotes, and this function should ignore those. However, it also means that any
# data between two quoted strings (ex: '"quote 1" you won't see me "quote
# data between two quoted strings (ex: '"quote 1" you won't see me "quote
# 2"') will also be stripped.
# 2"') will also be stripped.
return
re
.
sub
(
r'\"(.*)\"'
,
""
,
string
)
return
re
.
sub
(
r'\"(.*)\"'
,
""
,
quoted_
string
)
def
get_quoted_strings
(
string
):
def
get_quoted_strings
(
quoted_
string
):
'''
'''
Returns a string comprised of all data in between double quotes.
Returns a string comprised of all data in between double quotes.
@string - String to get quoted data from.
@
quoted_
string - String to get quoted data from.
Returns a string of quoted data on success.
Returns a string of quoted data on success.
Returns a blank string if no quoted data is present.
Returns a blank string if no quoted data is present.
...
@@ -139,7 +139,7 @@ def get_quoted_strings(string):
...
@@ -139,7 +139,7 @@ def get_quoted_strings(string):
# double quotes, and this function should ignore those. However, it also means that any
# double quotes, and this function should ignore those. However, it also means that any
# data between two quoted strings (ex: '"quote 1" non-quoted data
# data between two quoted strings (ex: '"quote 1" non-quoted data
# "quote 2"') will also be included.
# "quote 2"') will also be included.
return
re
.
findall
(
r'\"(.*)\"'
,
string
)[
0
]
return
re
.
findall
(
r'\"(.*)\"'
,
quoted_
string
)[
0
]
except
KeyboardInterrupt
as
e
:
except
KeyboardInterrupt
as
e
:
raise
e
raise
e
except
Exception
:
except
Exception
:
...
...
src/binwalk/core/magic.py
View file @
cd8ca7a7
...
@@ -278,17 +278,17 @@ class Signature(object):
...
@@ -278,17 +278,17 @@ class Signature(object):
Class to hold signature data and generate signature regular expressions.
Class to hold signature data and generate signature regular expressions.
'''
'''
def
__init__
(
self
,
id
,
first_line
):
def
__init__
(
self
,
s
id
,
first_line
):
'''
'''
Class constructor.
Class constructor.
@
id
- A ID value to uniquely identify this signature.
@
sid
- A ID value to uniquely identify this signature.
@first_line - The first SignatureLine of the signature (subsequent
@first_line - The first SignatureLine of the signature (subsequent
SignatureLines should be added via self.append).
SignatureLines should be added via self.append).
Returns None.
Returns None.
'''
'''
self
.
id
=
id
self
.
id
=
s
id
self
.
lines
=
[
first_line
]
self
.
lines
=
[
first_line
]
self
.
title
=
first_line
.
format
self
.
title
=
first_line
.
format
self
.
offset
=
first_line
.
offset
self
.
offset
=
first_line
.
offset
...
@@ -551,7 +551,6 @@ class Magic(object):
...
@@ -551,7 +551,6 @@ class Magic(object):
Returns a dictionary of tags parsed from the data.
Returns a dictionary of tags parsed from the data.
'''
'''
description
=
[]
description
=
[]
tag_strlen
=
None
max_line_level
=
0
max_line_level
=
0
previous_line_end
=
0
previous_line_end
=
0
tags
=
{
'id'
:
signature
.
id
,
'offset'
:
tags
=
{
'id'
:
signature
.
id
,
'offset'
:
...
...
src/binwalk/core/module.py
View file @
cd8ca7a7
...
@@ -16,7 +16,6 @@ import binwalk.core.statuserver
...
@@ -16,7 +16,6 @@ import binwalk.core.statuserver
import
binwalk.core.common
import
binwalk.core.common
import
binwalk.core.settings
import
binwalk.core.settings
import
binwalk.core.plugin
import
binwalk.core.plugin
from
threading
import
Thread
from
binwalk.core.compat
import
*
from
binwalk.core.compat
import
*
from
binwalk.core.exceptions
import
*
from
binwalk.core.exceptions
import
*
...
@@ -881,8 +880,6 @@ class Modules(object):
...
@@ -881,8 +880,6 @@ class Modules(object):
'''
'''
kwargs
=
{
'enabled'
:
False
}
kwargs
=
{
'enabled'
:
False
}
last_priority
=
{}
last_priority
=
{}
longs
=
[]
shorts
=
""
parser
=
argparse
.
ArgumentParser
(
add_help
=
False
)
parser
=
argparse
.
ArgumentParser
(
add_help
=
False
)
# Hack: This allows the ListActionParser class to correllate short options to long options.
# Hack: This allows the ListActionParser class to correllate short options to long options.
# There is probably a built-in way to do this in the
# There is probably a built-in way to do this in the
...
...
src/binwalk/core/plugin.py
View file @
cd8ca7a7
# Core code for supporting and managing plugins.
# Core code for supporting and managing plugins.
import
os
import
os
import
sys
import
imp
import
imp
import
inspect
import
inspect
import
binwalk.core.common
import
binwalk.core.common
...
...
src/binwalk/core/settings.py
View file @
cd8ca7a7
...
@@ -6,7 +6,7 @@ import binwalk.core.common as common
...
@@ -6,7 +6,7 @@ import binwalk.core.common as common
from
binwalk.core.compat
import
*
from
binwalk.core.compat
import
*
class
Settings
:
class
Settings
(
object
)
:
'''
'''
Binwalk settings class, used for accessing user and system file paths and general configuration settings.
Binwalk settings class, used for accessing user and system file paths and general configuration settings.
...
...
src/binwalk/core/statuserver.py
View file @
cd8ca7a7
# Provides scan status information via a TCP socket service.
# Provides scan status information via a TCP socket service.
# Currently only works for signature scans.
# Currently only works for signature scans.
import
sys
import
time
import
time
import
errno
import
errno
import
threading
import
threading
...
...
src/binwalk/modules/compression.py
View file @
cd8ca7a7
...
@@ -119,7 +119,6 @@ class LZMA(object):
...
@@ -119,7 +119,6 @@ class LZMA(object):
def
decompress
(
self
,
data
):
def
decompress
(
self
,
data
):
result
=
None
result
=
None
description
=
None
description
=
None
i
=
0
for
header
in
self
.
headers
:
for
header
in
self
.
headers
:
i
+=
1
i
+=
1
...
@@ -197,9 +196,6 @@ class Deflate(object):
...
@@ -197,9 +196,6 @@ class Deflate(object):
return
retval
return
retval
def
decompress
(
self
,
data
):
def
decompress
(
self
,
data
):
valid
=
True
description
=
None
# Looking for either a valid decompression, or an error indicating
# Looking for either a valid decompression, or an error indicating
# truncated input data
# truncated input data
try
:
try
:
...
...
src/binwalk/modules/extractor.py
View file @
cd8ca7a7
...
@@ -4,7 +4,6 @@
...
@@ -4,7 +4,6 @@
import
os
import
os
import
re
import
re
import
sys
import
stat
import
stat
import
shlex
import
shlex
import
tempfile
import
tempfile
...
...
src/binwalk/modules/hexdiff.py
View file @
cd8ca7a7
import
os
import
sys
import
sys
import
string
import
string
import
binwalk.core.common
as
common
import
binwalk.core.common
as
common
...
...
src/binwalk/modules/signature.py
View file @
cd8ca7a7
...
@@ -134,8 +134,6 @@ class Signature(Module):
...
@@ -134,8 +134,6 @@ class Signature(Module):
self
.
one_of_many
=
None
self
.
one_of_many
=
None
def
scan_file
(
self
,
fp
):
def
scan_file
(
self
,
fp
):
current_file_offset
=
0
while
True
:
while
True
:
(
data
,
dlen
)
=
fp
.
read_block
()
(
data
,
dlen
)
=
fp
.
read_block
()
if
dlen
<
1
:
if
dlen
<
1
:
...
...
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