about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCamille Mougey <camille.mougey@cea.fr>2015-02-18 14:47:01 +0100
committerCamille Mougey <camille.mougey@cea.fr>2015-02-18 20:42:54 +0100
commita2e461cc51a25ccc98e0de43ca87374edce412b4 (patch)
treec583f3d8d864b81abcfb56ceda173aa5c23c5718
parentd2cc082ba50397609e186d516b75226d638841d3 (diff)
downloadmiasm-a2e461cc51a25ccc98e0de43ca87374edce412b4.tar.gz
miasm-a2e461cc51a25ccc98e0de43ca87374edce412b4.zip
PyLint: Remove keyword redefinition, bad open mode
-rw-r--r--miasm2/arch/mips32/arch.py4
-rw-r--r--miasm2/core/bin_stream.py4
-rw-r--r--miasm2/core/utils.py4
-rw-r--r--miasm2/jitter/loader/pe.py8
-rw-r--r--miasm2/os_dep/linux_stdlib.py12
-rw-r--r--miasm2/os_dep/win_api_x86_32.py8
6 files changed, 20 insertions, 20 deletions
diff --git a/miasm2/arch/mips32/arch.py b/miasm2/arch/mips32/arch.py
index 00dc09ed..cbcd5e79 100644
--- a/miasm2/arch/mips32/arch.py
+++ b/miasm2/arch/mips32/arch.py
@@ -497,7 +497,7 @@ class bs_cond_name(bs_divert):
                '.LT', '.NGE', '.LE', '.NGT']
               ]
 
-    def divert(self, i, candidates):
+    def divert(self, index, candidates):
         out = []
         for candidate in candidates:
             cls, name, bases, dct, fields = candidate
@@ -511,7 +511,7 @@ class bs_cond_name(bs_divert):
                 args = dict(self.args)
                 args.update({'strbits': s})
                 f = bs(**args)
-                nfields[i] = f
+                nfields[index] = f
                 ndct = dict(dct)
                 ndct['name'] = name + new_name
                 out.append((cls, new_name, bases, ndct, nfields))
diff --git a/miasm2/core/bin_stream.py b/miasm2/core/bin_stream.py
index 19614661..6e158061 100644
--- a/miasm2/core/bin_stream.py
+++ b/miasm2/core/bin_stream.py
@@ -96,9 +96,9 @@ class bin_stream_str(bin_stream):
 
 class bin_stream_file(bin_stream):
 
-    def __init__(self, bin, offset=0L, shift=0):
+    def __init__(self, binary, offset=0L, shift=0):
         bin_stream.__init__(self)
-        self.bin = bin
+        self.bin = binary
         self.bin.seek(0, 2)
         self.shift = shift
         self.l = self.bin.tell()
diff --git a/miasm2/core/utils.py b/miasm2/core/utils.py
index 360deb8d..b2ddff2b 100644
--- a/miasm2/core/utils.py
+++ b/miasm2/core/utils.py
@@ -27,10 +27,10 @@ def hexdump(src, length=16):
     lines = []
     for c in xrange(0, len(src), length):
         chars = src[c:c + length]
-        hex = ' '.join(["%02x" % ord(x) for x in chars])
+        hexa = ' '.join(["%02x" % ord(x) for x in chars])
         printable = ''.join(
             ["%s" % ((ord(x) <= 127 and FILTER[ord(x)]) or '.') for x in chars])
-        lines.append("%04x  %-*s  %s\n" % (c, length * 3, hex, printable))
+        lines.append("%04x  %-*s  %s\n" % (c, length * 3, hexa, printable))
     print ''.join(lines)
 
 # stackoverflow.com/questions/2912231
diff --git a/miasm2/jitter/loader/pe.py b/miasm2/jitter/loader/pe.py
index f7e93c52..a3834d03 100644
--- a/miasm2/jitter/loader/pe.py
+++ b/miasm2/jitter/loader/pe.py
@@ -354,10 +354,10 @@ class libimp_pe(libimp):
                 self.fad2cname[ad] = c_name
                 self.fad2info[ad] = libad, imp_ord_or_name
 
-    def gen_new_lib(self, target_pe, filter=lambda _: True):
+    def gen_new_lib(self, target_pe, flt=lambda _: True):
         """Gen a new DirImport description
         @target_pe: PE instance
-        @filter: (boolean f(address)) restrict addresses to keep
+        @flt: (boolean f(address)) restrict addresses to keep
         """
 
         new_lib = []
@@ -369,8 +369,8 @@ class libimp_pe(libimp):
             for func_name, dst_addresses in self.lib_imp2dstad[ad].items():
                 out_ads.update({addr:func_name for addr in dst_addresses})
 
-            # Filter available addresses according to @filter
-            all_ads = [addr for addr in out_ads.keys() if filter(addr)]
+            # Filter available addresses according to @flt
+            all_ads = [addr for addr in out_ads.keys() if flt(addr)]
             log.debug('ads: %s' % map(hex, all_ads))
             if not all_ads:
                 continue
diff --git a/miasm2/os_dep/linux_stdlib.py b/miasm2/os_dep/linux_stdlib.py
index 9dbc6c60..57424995 100644
--- a/miasm2/os_dep/linux_stdlib.py
+++ b/miasm2/os_dep/linux_stdlib.py
@@ -54,18 +54,18 @@ def xxx_snprintf(jitter):
 
     writes to string str according to format format and at most size bytes.
     '''
-    ret_addr, (str, size, format) = jitter.func_args_stdcall(3)
+    ret_addr, (string, size, fmt) = jitter.func_args_stdcall(3)
     curarg, output = 3, ''
     while True:
-        c = jitter.vm.get_mem(format, 1)
-        format += 1
+        c = jitter.vm.get_mem(fmt, 1)
+        fmt += 1
         if c == '\x00':
             break
         if c == '%':
             token = '%'
             while True:
-                c = jitter.vm.get_mem(format, 1)
-                format += 1
+                c = jitter.vm.get_mem(fmt, 1)
+                fmt += 1
                 token += c
                 if c in '%cdfsux':
                     break
@@ -74,5 +74,5 @@ def xxx_snprintf(jitter):
         output += c
     output = output[:size - 1]
     ret = len(output)
-    jitter.vm.set_mem(str, output + '\x00')
+    jitter.vm.set_mem(string, output + '\x00')
     return jitter.func_ret_stdcall(ret_addr, ret)
diff --git a/miasm2/os_dep/win_api_x86_32.py b/miasm2/os_dep/win_api_x86_32.py
index e47c6024..cac03905 100644
--- a/miasm2/os_dep/win_api_x86_32.py
+++ b/miasm2/os_dep/win_api_x86_32.py
@@ -561,7 +561,7 @@ def kernel32_CreateFile(jitter, funcname, get_str):
                     if stat.S_ISDIR(s.st_mode):
                         ret = winobjs.handle_pool.add(f, 0x1337)
                     else:
-                        h = open(f, 'rb+')
+                        h = open(f, 'r+b')
                         ret = winobjs.handle_pool.add(f, h)
                 else:
                     log.warning("FILE %r DOES NOT EXIST!" % fname)
@@ -573,7 +573,7 @@ def kernel32_CreateFile(jitter, funcname, get_str):
                     winobjs.lastwin32error = 80
                 else:
                     open(f, 'w')
-                    h = open(f, 'rb+')
+                    h = open(f, 'r+b')
                     ret = winobjs.handle_pool.add(f, h)
             elif args.dwcreationdisposition == 4:
                 # open_always
@@ -582,7 +582,7 @@ def kernel32_CreateFile(jitter, funcname, get_str):
                     if stat.S_ISDIR(s.st_mode):
                         ret = winobjs.handle_pool.add(f, 0x1337)
                     else:
-                        h = open(f, 'rb+')
+                        h = open(f, 'r+b')
                         ret = winobjs.handle_pool.add(f, h)
                 else:
                     raise NotImplementedError("Untested case")
@@ -601,7 +601,7 @@ def kernel32_CreateFile(jitter, funcname, get_str):
                         # open dir
                         ret = winobjs.handle_pool.add(f, 0x1337)
                     else:
-                        h = open(f, 'rb+')
+                        h = open(f, 'r+b')
                         ret = winobjs.handle_pool.add(f, h)
                 else:
                     raise NotImplementedError("Untested case")  # to test