Commit 9eb51e30 by heffnercj

Fixed python2.6 file open bugs; fixed OSX library file extension bug.

parent d087d583
export CC=@CC@
export CFLAGS=@CFLAGS@
export SONAME=@SONAME@
export SOEXT=@SOEXT@
export prefix=@prefix@
export exec_prefix=@exec_prefix@
export LIBDIR=@libdir@
......
LIBNAME=libcompress42.so
LIBNAME=libcompress42.$(SOEXT)
all: clean $(LIBNAME)
......
......@@ -600,6 +600,7 @@ ac_includes_default="\
ac_subst_vars='LTLIBOBJS
INSTALL_OPTIONS
SOEXT
SONAME
LIBOBJS
EGREP
......@@ -3278,14 +3279,18 @@ CFLAGS="-Wall -fPIC $CFLAGS"
if test "$(uname)" == "Darwin"
then
SONAME="-install_name"
SOEXT="dylib"
INSTALL_OPTIONS="-m644"
else
SONAME="-soname"
SOEXT="so"
INSTALL_OPTIONS="-D -m644"
fi
SONAME=$SONAME
SOEXT=$SOEXT
INSTALL_OPTIONS=$INSTALL_OPTIONS
ac_config_files="$ac_config_files Makefile"
......
......@@ -12,13 +12,16 @@ CFLAGS="-Wall -fPIC $CFLAGS"
if test "$(uname)" == "Darwin"
then
SONAME="-install_name"
SOEXT="dylib"
INSTALL_OPTIONS="-m644"
else
SONAME="-soname"
SOEXT="so"
INSTALL_OPTIONS="-D -m644"
fi
AC_SUBST(SONAME, $SONAME)
AC_SUBST(SOEXT, $SOEXT)
AC_SUBST(INSTALL_OPTIONS, $INSTALL_OPTIONS)
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
LIBNAME=libtinfl.so
LIBNAME=libtinfl.$(SOEXT)
all: clean $(LIBNAME)
......
from binwalk.common import *
from binwalk.plugins import *
class Plugin:
......@@ -18,7 +19,7 @@ class Plugin:
def pre_scan(self, fd):
if self.enabled:
self.fd = open(fd.name, 'rb')
self.fd = BlockFile(fd.name, 'r')
def callback(self, results):
if self.fd:
......
import ctypes
import ctypes.util
from binwalk.common import *
from binwalk.plugins import *
class Plugin:
......@@ -28,7 +29,7 @@ class Plugin:
def pre_scan(self, fd):
try:
if self.comp:
self.fd = open(fd.name, 'rb')
self.fd = BlockFile(fd.name, 'r')
except:
pass
......
......@@ -13,7 +13,7 @@ class Plugin:
ENABLED = False
SIZE = 33*1024
# To prevent many false positives, only show data that decompressed to a reasonable size
MIN_DECOMP_SIZE = 16*1024
MIN_DECOMP_SIZE = 32*1024
DESCRIPTION = "Deflate compressed data stream"
def __init__(self, binwalk):
......
import ctypes
import ctypes.util
from binwalk.plugins import *
from binwalk.common import BlockFile
class Plugin:
'''
......@@ -15,14 +16,14 @@ class Plugin:
self.tinfl = None
if binwalk.scan_type == binwalk.BINWALK:
# Add the zlib file to the list of magic files
binwalk.magic_files.append(binwalk.config.find_magic_file('zlib'))
# Load libtinfl.so
self.tinfl = ctypes.cdll.LoadLibrary(ctypes.util.find_library('tinfl'))
# Add the zlib file to the list of magic files
binwalk.magic_files.append(binwalk.config.find_magic_file('zlib'))
def pre_scan(self, fd):
if self.tinfl:
self.fd = open(fd.name, 'rb')
self.fd = BlockFile(fd.name, 'r')
def callback(self, result):
......
......@@ -4,6 +4,7 @@ import hashlib
import csv as pycsv
from datetime import datetime
from binwalk.compat import *
from binwalk.common import BlockFile
class PrettyPrint:
'''
......@@ -133,7 +134,7 @@ class PrettyPrint:
'''
md5 = hashlib.md5()
with open(file_name, 'rb') as f:
with BlockFile(file_name, 'r') as f:
for chunk in iter(lambda: f.read(128*md5.block_size), b''):
md5.update(chunk)
......
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