Commit cd8ca7a7 by devttys0

Minor code clean-up after lint testing.

parent a4945a93
......@@ -106,11 +106,11 @@ def file_size(filename):
os.close(fd)
def strip_quoted_strings(string):
def strip_quoted_strings(quoted_string):
'''
Strips out data in between double quotes.
@string - String to strip.
@quoted_string - String to strip.
Returns a sanitized string.
'''
......@@ -120,14 +120,14 @@ def strip_quoted_strings(string):
# 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
# 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.
@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 blank string if no quoted data is present.
......@@ -139,7 +139,7 @@ def get_quoted_strings(string):
# 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
# "quote 2"') will also be included.
return re.findall(r'\"(.*)\"', string)[0]
return re.findall(r'\"(.*)\"', quoted_string)[0]
except KeyboardInterrupt as e:
raise e
except Exception:
......
......@@ -278,17 +278,17 @@ class Signature(object):
Class to hold signature data and generate signature regular expressions.
'''
def __init__(self, id, first_line):
def __init__(self, sid, first_line):
'''
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
SignatureLines should be added via self.append).
Returns None.
'''
self.id = id
self.id = sid
self.lines = [first_line]
self.title = first_line.format
self.offset = first_line.offset
......@@ -551,7 +551,6 @@ class Magic(object):
Returns a dictionary of tags parsed from the data.
'''
description = []
tag_strlen = None
max_line_level = 0
previous_line_end = 0
tags = {'id': signature.id, 'offset':
......
......@@ -16,7 +16,6 @@ import binwalk.core.statuserver
import binwalk.core.common
import binwalk.core.settings
import binwalk.core.plugin
from threading import Thread
from binwalk.core.compat import *
from binwalk.core.exceptions import *
......@@ -881,8 +880,6 @@ class Modules(object):
'''
kwargs = {'enabled': False}
last_priority = {}
longs = []
shorts = ""
parser = argparse.ArgumentParser(add_help=False)
# 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
......
# Core code for supporting and managing plugins.
import os
import sys
import imp
import inspect
import binwalk.core.common
......
......@@ -6,7 +6,7 @@ import binwalk.core.common as common
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.
......
# Provides scan status information via a TCP socket service.
# Currently only works for signature scans.
import sys
import time
import errno
import threading
......
......@@ -119,7 +119,6 @@ class LZMA(object):
def decompress(self, data):
result = None
description = None
i = 0
for header in self.headers:
i += 1
......@@ -197,9 +196,6 @@ class Deflate(object):
return retval
def decompress(self, data):
valid = True
description = None
# Looking for either a valid decompression, or an error indicating
# truncated input data
try:
......
......@@ -4,7 +4,6 @@
import os
import re
import sys
import stat
import shlex
import tempfile
......
import os
import sys
import string
import binwalk.core.common as common
......
......@@ -134,8 +134,6 @@ class Signature(Module):
self.one_of_many = None
def scan_file(self, fp):
current_file_offset = 0
while True:
(data, dlen) = fp.read_block()
if dlen < 1:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment