Skip to content

Commit

Permalink
minimal fixes to reduces pylint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
trolldbois committed Nov 5, 2015
1 parent 54d8823 commit 2acdd5f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 18 deletions.
6 changes: 2 additions & 4 deletions haystack/allocators/heapwalker.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

log = logging.getLogger('heapwalker')

__author__ = "Loic Jaquemet loic.jaquemet+python@gmail.com"


class HeapWalker(interfaces.IHeapWalker):

Expand All @@ -36,6 +34,7 @@ def get_free_chunks(self):
""" returns all free chunks in the heap (addr,size) """
raise NotImplementedError('Please implement all methods')


class HeapFinder(interfaces.IHeapFinder):

def __init__(self, memory_handler):
Expand Down Expand Up @@ -179,5 +178,4 @@ def make_heap_finder(memory_handler):
from haystack.allocators.win32 import win7heapwalker
return win7heapwalker.Win7HeapFinder(memory_handler)
else:
raise NotImplementedError(
'Heap Walker not found for os %s', os_name)
raise NotImplementedError('Heap Walker not found for os %s', os_name)
12 changes: 7 additions & 5 deletions haystack/allocators/libc/libdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,17 @@
# Copyright (C) 2011 Loic Jaquemet loic.jaquemet+python@gmail.com
#

__author__ = "Loic Jaquemet loic.jaquemet+python@gmail.com"

import ctypes
import logging

import os
import pickle
import sys

from haystack.mappings.process import readProcessMappings

log = logging.getLogger('libdl')


class Dl_info(ctypes.Structure):
_fields_ = [
# Pathname of shared object that contains address
Expand All @@ -42,13 +41,16 @@ def getMappings():


def reverseLocalFonctionPointerNames(context):
''' reverse fn pointer names by trying to rebase the ptr value to a local ld_open.
"""
reverse fn pointer names by trying to rebase the ptr value to a local ld_open.
load local memdump
map all librairies
go through all pointers in librairies
try to dl_addr the pointers by rebasing.
'''
:param context:
:return:
"""
fsave = context.config.getCacheFilename(
context.config.CACHE_FUNCTION_NAMES,
context.dumpname)
Expand Down
3 changes: 3 additions & 0 deletions haystack/allocators/win32/winheapwalker.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ class WinHeapWalker(heapwalker.HeapWalker):
FTH allocation in Heap.LocalData[n].SegmentInfo.CachedItems
Virtual allocation
"""
# def __init__(self, memory_handler, heap_module, heap_mapping, heap_module_constraints):
# super(WinHeapWalker, self).__init__(memory_handler, heap_module, heap_mapping, heap_module_constraints)
# self._free_chunks = None

def get_user_allocations(self):
""" returns all User allocations (addr,size) and only the user writeable part.
Expand Down
18 changes: 9 additions & 9 deletions haystack/gui/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
import statushandler
from haystack import dump_loader
from haystack import argparse_utils
import signature
from haystack.reverse import searchers
from haystack.reverse.heuristics import signature
from PyQt4 import QtGui, QtCore
from haystack.gui import view
from haystack.gui import widgets
Expand Down Expand Up @@ -190,13 +191,12 @@ def loadMapping(self, mapping, mappings):

def searchValue(self, value):
''' value is what type ? '''
resultGroup = QtGui.QGraphicsItemGroup(
) # self.graphicsView.GetScene().createItemGroup(items)
log.debug(
'parsing %s mapping for value %s' %
(self.mapping_name, value))
# self.graphicsView.GetScene().createItemGroup(items)
resultGroup = QtGui.QGraphicsItemGroup()
log.debug('parsing %s mapping for value %s', self.mapping_name, value)
found = 0
for res in self.mapping.search(value):
offset, instance = res
found += 1
resultGroup.addToGroup(
widgets.Word(
Expand All @@ -214,7 +214,7 @@ def searchPointers(self):
log.info('search %s mapping for pointer' % (self.mapping_name))
found = 0
start = self.mapping.start
searcher = searcher.PointerSearcher(self.mapping)
searcher = searchers.PointerSearcher(self.mapping)
for vaddr in searcher:
# searcher should return [(offset, value)]
word = self.mapping.read_word(vaddr)
Expand All @@ -238,7 +238,7 @@ def searchNullWords(self):
found = 0
tmpnull = []
start = self.mapping.start
searcher = searcher.NullSearcher(self.mapping)
searcher = searchers.NullSearcher(self.mapping)
for vaddr in searcher:
offset = vaddr - start
tmpnull.append(offset / searcher.WORDSIZE)
Expand Down Expand Up @@ -279,7 +279,7 @@ def searchStructure(
# import sslsnoop #?
# self.mapping.unmmap()
# DEBUG stop at the first instance, lazy me
instances = api.searchIn(
instances = api.search_in(
structType,
mappings=self.mappings,
targetMappings=[
Expand Down

0 comments on commit 2acdd5f

Please sign in to comment.