Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

solved issue with __plugname__ variable across modules #3

Merged
merged 1 commit into from
May 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions heap_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,40 +19,36 @@

#------------------------------------------------------------------------

from plugin_gui import HeapPluginForm

#------------------------------------------------------------------------
__version__ = "0.1"
__plugname__ = "HeapViewer"
from plugin_gui import HeapPluginForm, PLUGNAME

# -----------------------------------------------------------------------
class HeapViewPlugin(idaapi.plugin_t):
flags = 0
comment = ""
help = ""
wanted_name = __plugname__
wanted_name = PLUGNAME
wanted_hotkey = "Ctrl-H"

def init(self):
self.icon_id = 0
return PLUGIN_KEEP
return idaapi.PLUGIN_KEEP

def run(self, arg=0):
try:
if "ELF" not in get_file_type_name():
raise Exception("Executable must be ELF format")
if "ELF" not in idaapi.get_file_type_name():
raise Exception("Executable must be ELF fomat")

if not is_debugger_on() or not idaapi.dbg_can_query():
if not idaapi.is_debugger_on() or not idaapi.dbg_can_query():
raise Exception("The debugger must be active and suspended before using this plugin")

f = HeapPluginForm()
f.Show()

except Exception as e:
idaapi.warning("[%s] %s" % (__plugname__, e.message))
idaapi.warning("[%s] %s" % (PLUGNAME, e.message))

def term(self):
idaapi.msg("[%s] terminated" % (__plugname__))
idaapi.msg("[%s] terminated" % (PLUGNAME))

# -----------------------------------------------------------------------
def PLUGIN_ENTRY():
Expand Down
5 changes: 3 additions & 2 deletions heap_viewer/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
from collections import OrderedDict

# --------------------------------------------------------------------------
__plugname__ = 'HeapViewer'
PLUGVER = "0.1"
PLUGNAME = "HeapViewer"

PLUGIN_DIR = idadir(os.path.join("plugins", "heap_viewer"))
FILES_DIR = os.path.join(PLUGIN_DIR, "files")
Expand Down Expand Up @@ -48,7 +49,7 @@ def write_to_file(self, filename):

# --------------------------------------------------------------------------
def log(msg):
idaapi.msg("[%s] %s\n" % (__plugname__, msg))
idaapi.msg("[%s] %s\n" % (PLUGNAME, msg))

# --------------------------------------------------------------------------
def round_up(offset, alignment):
Expand Down
4 changes: 2 additions & 2 deletions heap_viewer/plugin_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def init_heap(self):

try:
current_libc_version = get_libc_version()
if self.config.libc_version == current_libc_version:
if self.config.libc_version == current_libc_version or current_libc_version == None:
self.heap = Heap(self.config)
self.btn_reload.setEnabled(True)
self.tabs.setTabEnabled(3, self.heap.tcache_enabled)
Expand Down Expand Up @@ -186,7 +186,7 @@ def show_chunk_info(self, address):
self.chunk_widget.show_chunk(address)

def Show(self):
return PluginForm.Show(self, __plugname__, options = (
return PluginForm.Show(self, PLUGNAME, options = (
PluginForm.FORM_TAB | PluginForm.FORM_CLOSE_LATER
))

Expand Down