Commit cd8ca7a7 by devttys0

Minor code clean-up after lint testing.

parent a4945a93
...@@ -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:
......
...@@ -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, sid, 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 = sid
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':
......
...@@ -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
......
# 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
......
...@@ -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.
......
# 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
......
...@@ -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:
......
...@@ -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
......
import os
import sys import sys
import string import string
import binwalk.core.common as common import binwalk.core.common as common
......
...@@ -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:
......
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