mirror of
https://github.com/cemu-project/idapython.git
synced 2024-11-24 10:09:20 +01:00
Tabs converted to 4 spaces in Python sources.
This commit is contained in:
parent
921d57098a
commit
398ffdae3a
@ -14,340 +14,340 @@ idautils.py - High level utility functions for IDA
|
||||
import idaapi
|
||||
|
||||
def refs(ea, funcfirst, funcnext):
|
||||
"""
|
||||
Generic reference collector - INTERNAL USE ONLY.
|
||||
"""
|
||||
reflist = []
|
||||
"""
|
||||
Generic reference collector - INTERNAL USE ONLY.
|
||||
"""
|
||||
reflist = []
|
||||
|
||||
ref = funcfirst(ea)
|
||||
ref = funcfirst(ea)
|
||||
|
||||
if ref != idaapi.BADADDR:
|
||||
reflist.append(ref)
|
||||
if ref != idaapi.BADADDR:
|
||||
reflist.append(ref)
|
||||
|
||||
while 1:
|
||||
ref = funcnext(ea, ref)
|
||||
while 1:
|
||||
ref = funcnext(ea, ref)
|
||||
|
||||
if ref == idaapi.BADADDR:
|
||||
break
|
||||
else:
|
||||
reflist.append(ref)
|
||||
|
||||
return reflist
|
||||
|
||||
if ref == idaapi.BADADDR:
|
||||
break
|
||||
else:
|
||||
reflist.append(ref)
|
||||
|
||||
return reflist
|
||||
|
||||
|
||||
def CodeRefsTo(ea, flow):
|
||||
"""
|
||||
Get a list of code references to 'ea'
|
||||
"""
|
||||
Get a list of code references to 'ea'
|
||||
|
||||
@param ea: Target address
|
||||
@param flow: Follow normal code flow or not
|
||||
@type flow: Boolean (0/1, False/True)
|
||||
@param ea: Target address
|
||||
@param flow: Follow normal code flow or not
|
||||
@type flow: Boolean (0/1, False/True)
|
||||
|
||||
@return: list of references (may be empty list)
|
||||
@return: list of references (may be empty list)
|
||||
|
||||
Example::
|
||||
|
||||
for ref in CodeRefsTo(ScreenEA(), 1):
|
||||
print ref
|
||||
"""
|
||||
if flow == 1:
|
||||
return refs(ea, idaapi.get_first_cref_to, idaapi.get_next_cref_to)
|
||||
else:
|
||||
return refs(ea, idaapi.get_first_fcref_to, idaapi.get_next_fcref_to)
|
||||
Example::
|
||||
|
||||
for ref in CodeRefsTo(ScreenEA(), 1):
|
||||
print ref
|
||||
"""
|
||||
if flow == 1:
|
||||
return refs(ea, idaapi.get_first_cref_to, idaapi.get_next_cref_to)
|
||||
else:
|
||||
return refs(ea, idaapi.get_first_fcref_to, idaapi.get_next_fcref_to)
|
||||
|
||||
|
||||
def CodeRefsFrom(ea, flow):
|
||||
"""
|
||||
Get a list of code references from 'ea'
|
||||
"""
|
||||
Get a list of code references from 'ea'
|
||||
|
||||
@param ea: Target address
|
||||
@param flow: Follow normal code flow or not
|
||||
@type flow: Boolean (0/1, False/True)
|
||||
@param ea: Target address
|
||||
@param flow: Follow normal code flow or not
|
||||
@type flow: Boolean (0/1, False/True)
|
||||
|
||||
@return: list of references (may be empty list)
|
||||
@return: list of references (may be empty list)
|
||||
|
||||
Example::
|
||||
|
||||
for ref in CodeRefsFrom(ScreenEA(), 1):
|
||||
print ref
|
||||
"""
|
||||
if flow == 1:
|
||||
return refs(ea, idaapi.get_first_cref_from, idaapi.get_next_cref_from)
|
||||
else:
|
||||
return refs(ea, idaapi.get_first_fcref_from, idaapi.get_next_fcref_from)
|
||||
Example::
|
||||
|
||||
for ref in CodeRefsFrom(ScreenEA(), 1):
|
||||
print ref
|
||||
"""
|
||||
if flow == 1:
|
||||
return refs(ea, idaapi.get_first_cref_from, idaapi.get_next_cref_from)
|
||||
else:
|
||||
return refs(ea, idaapi.get_first_fcref_from, idaapi.get_next_fcref_from)
|
||||
|
||||
|
||||
def DataRefsTo(ea):
|
||||
"""
|
||||
Get a list of data references to 'ea'
|
||||
"""
|
||||
Get a list of data references to 'ea'
|
||||
|
||||
@param ea: Target address
|
||||
@param ea: Target address
|
||||
|
||||
@return: list of references (may be empty list)
|
||||
@return: list of references (may be empty list)
|
||||
|
||||
Example::
|
||||
|
||||
for ref in DataRefsTo(ScreenEA(), 1):
|
||||
print ref
|
||||
"""
|
||||
return refs(ea, idaapi.get_first_dref_to, idaapi.get_next_dref_to)
|
||||
Example::
|
||||
|
||||
for ref in DataRefsTo(ScreenEA(), 1):
|
||||
print ref
|
||||
"""
|
||||
return refs(ea, idaapi.get_first_dref_to, idaapi.get_next_dref_to)
|
||||
|
||||
|
||||
def DataRefsFrom(ea):
|
||||
"""
|
||||
Get a list of data references from 'ea'
|
||||
"""
|
||||
Get a list of data references from 'ea'
|
||||
|
||||
@param ea: Target address
|
||||
@param ea: Target address
|
||||
|
||||
@return: list of references (may be empty list)
|
||||
@return: list of references (may be empty list)
|
||||
|
||||
Example::
|
||||
|
||||
for ref in DataRefsFrom(ScreenEA(), 1):
|
||||
print ref
|
||||
"""
|
||||
return refs(ea, idaapi.get_first_dref_from, idaapi.get_next_dref_from)
|
||||
Example::
|
||||
|
||||
for ref in DataRefsFrom(ScreenEA(), 1):
|
||||
print ref
|
||||
"""
|
||||
return refs(ea, idaapi.get_first_dref_from, idaapi.get_next_dref_from)
|
||||
|
||||
|
||||
def XrefTypeName(typecode):
|
||||
"""
|
||||
Convert cross-reference type codes to readable names
|
||||
"""
|
||||
Convert cross-reference type codes to readable names
|
||||
|
||||
@param typecode: cross-reference type code
|
||||
"""
|
||||
ref_types = {
|
||||
0 : 'Data_Unknown',
|
||||
1 : 'Data_Offset',
|
||||
2 : 'Data_Write',
|
||||
3 : 'Data_Read',
|
||||
4 : 'Data_Text',
|
||||
5 : 'Data_Informational',
|
||||
16 : 'Code_Far_Call',
|
||||
17 : 'Code_Near_Call',
|
||||
18 : 'Code_Far_Jump',
|
||||
19 : 'Code_Near_Jump',
|
||||
20 : 'Code_User',
|
||||
21 : 'Ordinary_Flow'
|
||||
}
|
||||
assert typecode in ref_types, "unknown reference type %d" % typecode
|
||||
return ref_types[typecode]
|
||||
@param typecode: cross-reference type code
|
||||
"""
|
||||
ref_types = {
|
||||
0 : 'Data_Unknown',
|
||||
1 : 'Data_Offset',
|
||||
2 : 'Data_Write',
|
||||
3 : 'Data_Read',
|
||||
4 : 'Data_Text',
|
||||
5 : 'Data_Informational',
|
||||
16 : 'Code_Far_Call',
|
||||
17 : 'Code_Near_Call',
|
||||
18 : 'Code_Far_Jump',
|
||||
19 : 'Code_Near_Jump',
|
||||
20 : 'Code_User',
|
||||
21 : 'Ordinary_Flow'
|
||||
}
|
||||
assert typecode in ref_types, "unknown reference type %d" % typecode
|
||||
return ref_types[typecode]
|
||||
|
||||
|
||||
def XrefsFrom(ea, flags=0):
|
||||
"""
|
||||
Return all references from address 'ea'
|
||||
"""
|
||||
Return all references from address 'ea'
|
||||
|
||||
@param ea: Reference address
|
||||
@param flags: any of idaapi.XREF_* flags
|
||||
@param ea: Reference address
|
||||
@param flags: any of idaapi.XREF_* flags
|
||||
|
||||
Example:
|
||||
for xref in XrefsFrom(here(), 0):
|
||||
print xref.type, XrefTypeName(xref.type), \
|
||||
Example:
|
||||
for xref in XrefsFrom(here(), 0):
|
||||
print xref.type, XrefTypeName(xref.type), \
|
||||
'from', hex(xref.frm), 'to', hex(xref.to)
|
||||
|
||||
"""
|
||||
xref = idaapi.xrefblk_t()
|
||||
if xref.first_from(ea, flags):
|
||||
yield xref
|
||||
while xref.next_from():
|
||||
yield xref
|
||||
"""
|
||||
xref = idaapi.xrefblk_t()
|
||||
if xref.first_from(ea, flags):
|
||||
yield xref
|
||||
while xref.next_from():
|
||||
yield xref
|
||||
|
||||
|
||||
def XrefsTo(ea, flags=0):
|
||||
"""
|
||||
Return all references to address 'ea'
|
||||
"""
|
||||
Return all references to address 'ea'
|
||||
|
||||
@param ea: Reference address
|
||||
@param flags: any of idaapi.XREF_* flags
|
||||
@param ea: Reference address
|
||||
@param flags: any of idaapi.XREF_* flags
|
||||
|
||||
Example:
|
||||
for xref in XrefsTo(here(), 0):
|
||||
print xref.type, XrefTypeName(xref.type), \
|
||||
Example:
|
||||
for xref in XrefsTo(here(), 0):
|
||||
print xref.type, XrefTypeName(xref.type), \
|
||||
'from', hex(xref.frm), 'to', hex(xref.to)
|
||||
"""
|
||||
xref = idaapi.xrefblk_t()
|
||||
if xref.first_to(ea, flags):
|
||||
yield xref
|
||||
while xref.next_to():
|
||||
yield xref
|
||||
"""
|
||||
xref = idaapi.xrefblk_t()
|
||||
if xref.first_to(ea, flags):
|
||||
yield xref
|
||||
while xref.next_to():
|
||||
yield xref
|
||||
|
||||
|
||||
def Heads(start, end):
|
||||
"""
|
||||
Get a list of heads (instructions or data)
|
||||
"""
|
||||
Get a list of heads (instructions or data)
|
||||
|
||||
@param start: start address (this one is always included)
|
||||
@param end: end address
|
||||
@param start: start address (this one is always included)
|
||||
@param end: end address
|
||||
|
||||
@return: list of heads between start and end
|
||||
"""
|
||||
headlist = []
|
||||
headlist.append(start)
|
||||
@return: list of heads between start and end
|
||||
"""
|
||||
headlist = []
|
||||
headlist.append(start)
|
||||
|
||||
ea = start
|
||||
ea = start
|
||||
|
||||
while 1:
|
||||
ea = idaapi.next_head(ea, end)
|
||||
while 1:
|
||||
ea = idaapi.next_head(ea, end)
|
||||
|
||||
if ea == idaapi.BADADDR:
|
||||
break
|
||||
else:
|
||||
headlist.append(ea)
|
||||
|
||||
return headlist
|
||||
|
||||
if ea == idaapi.BADADDR:
|
||||
break
|
||||
else:
|
||||
headlist.append(ea)
|
||||
|
||||
return headlist
|
||||
|
||||
|
||||
def Functions(start, end):
|
||||
"""
|
||||
Get a list of functions
|
||||
"""
|
||||
Get a list of functions
|
||||
|
||||
@param start: start address
|
||||
@param end: end address
|
||||
@param start: start address
|
||||
@param end: end address
|
||||
|
||||
@return: list of heads between start and end
|
||||
@return: list of heads between start and end
|
||||
|
||||
@note: The last function that starts before 'end' is included even
|
||||
if it extends beyond 'end'.
|
||||
"""
|
||||
startaddr = start
|
||||
endaddr = end
|
||||
@note: The last function that starts before 'end' is included even
|
||||
if it extends beyond 'end'.
|
||||
"""
|
||||
startaddr = start
|
||||
endaddr = end
|
||||
|
||||
funclist = []
|
||||
funclist = []
|
||||
|
||||
func = idaapi.get_func(start)
|
||||
func = idaapi.get_func(start)
|
||||
|
||||
if func:
|
||||
funclist.append(func.startEA)
|
||||
if func:
|
||||
funclist.append(func.startEA)
|
||||
|
||||
ea = start
|
||||
ea = start
|
||||
|
||||
while 1:
|
||||
func = idaapi.get_next_func(ea)
|
||||
while 1:
|
||||
func = idaapi.get_next_func(ea)
|
||||
|
||||
if not func: break
|
||||
if not func: break
|
||||
|
||||
if func.startEA < end:
|
||||
funclist.append(func.startEA)
|
||||
ea = func.startEA
|
||||
else:
|
||||
break
|
||||
if func.startEA < end:
|
||||
funclist.append(func.startEA)
|
||||
ea = func.startEA
|
||||
else:
|
||||
break
|
||||
|
||||
return funclist
|
||||
|
||||
return funclist
|
||||
|
||||
|
||||
def Chunks(start):
|
||||
"""
|
||||
Get a list of function chunks
|
||||
"""
|
||||
Get a list of function chunks
|
||||
|
||||
@param start: address of the function
|
||||
@param start: address of the function
|
||||
|
||||
@return: list of funcion chunks (tuples of the form (start_ea, end_ea))
|
||||
belonging to the function
|
||||
"""
|
||||
function_chunks = []
|
||||
@return: list of funcion chunks (tuples of the form (start_ea, end_ea))
|
||||
belonging to the function
|
||||
"""
|
||||
function_chunks = []
|
||||
|
||||
func_iter = idaapi.func_tail_iterator_t( idaapi.get_func( start ) )
|
||||
status = func_iter.main()
|
||||
func_iter = idaapi.func_tail_iterator_t( idaapi.get_func( start ) )
|
||||
status = func_iter.main()
|
||||
|
||||
while status:
|
||||
chunk = func_iter.chunk()
|
||||
function_chunks.append((chunk.startEA, chunk.endEA))
|
||||
status = func_iter.next()
|
||||
while status:
|
||||
chunk = func_iter.chunk()
|
||||
function_chunks.append((chunk.startEA, chunk.endEA))
|
||||
status = func_iter.next()
|
||||
|
||||
return function_chunks
|
||||
return function_chunks
|
||||
|
||||
|
||||
def Segments():
|
||||
"""
|
||||
Get list of segments (sections) in the binary image
|
||||
"""
|
||||
Get list of segments (sections) in the binary image
|
||||
|
||||
@return: List of segment start addresses.
|
||||
"""
|
||||
seglist = []
|
||||
@return: List of segment start addresses.
|
||||
"""
|
||||
seglist = []
|
||||
|
||||
for n in range(idaapi.get_segm_qty()):
|
||||
seg = idaapi.getnseg(n)
|
||||
for n in range(idaapi.get_segm_qty()):
|
||||
seg = idaapi.getnseg(n)
|
||||
|
||||
if not seg:
|
||||
break
|
||||
else:
|
||||
seglist.append(seg.startEA)
|
||||
|
||||
return seglist
|
||||
if not seg:
|
||||
break
|
||||
else:
|
||||
seglist.append(seg.startEA)
|
||||
|
||||
return seglist
|
||||
|
||||
|
||||
def GetDataList(ea, count, itemsize=1):
|
||||
"""
|
||||
Get data list - INTERNAL USE ONLY
|
||||
"""
|
||||
getdata = None
|
||||
"""
|
||||
Get data list - INTERNAL USE ONLY
|
||||
"""
|
||||
getdata = None
|
||||
|
||||
if itemsize == 1:
|
||||
getdata = idaapi.get_byte
|
||||
if itemsize == 2:
|
||||
getdata = idaapi.get_word
|
||||
if itemsize == 4:
|
||||
getdata = idaapi.get_dword
|
||||
if itemsize == 1:
|
||||
getdata = idaapi.get_byte
|
||||
if itemsize == 2:
|
||||
getdata = idaapi.get_word
|
||||
if itemsize == 4:
|
||||
getdata = idaapi.get_dword
|
||||
|
||||
if getdata == None:
|
||||
raise ValueError, "Invalid data size! Must be 1, 2 or 4"
|
||||
if getdata == None:
|
||||
raise ValueError, "Invalid data size! Must be 1, 2 or 4"
|
||||
|
||||
list = []
|
||||
list = []
|
||||
|
||||
for offs in range(count):
|
||||
list.append(getdata(ea))
|
||||
ea = ea + itemsize
|
||||
for offs in range(count):
|
||||
list.append(getdata(ea))
|
||||
ea = ea + itemsize
|
||||
|
||||
return list
|
||||
return list
|
||||
|
||||
|
||||
def PutDataList(ea, list, itemsize=1):
|
||||
"""
|
||||
Put data list - INTERNAL USE ONLY
|
||||
"""
|
||||
putdata = None
|
||||
"""
|
||||
Put data list - INTERNAL USE ONLY
|
||||
"""
|
||||
putdata = None
|
||||
|
||||
if itemsize == 1:
|
||||
putdata = idaapi.patch_byte
|
||||
if itemsize == 2:
|
||||
putdata = idaapi.patch_word
|
||||
if itemsize == 4:
|
||||
putdata = idaapi.patch_dword
|
||||
if itemsize == 1:
|
||||
putdata = idaapi.patch_byte
|
||||
if itemsize == 2:
|
||||
putdata = idaapi.patch_word
|
||||
if itemsize == 4:
|
||||
putdata = idaapi.patch_dword
|
||||
|
||||
if putdata == None:
|
||||
raise ValueError, "Invalid data size! Must be 1, 2 or 4"
|
||||
if putdata == None:
|
||||
raise ValueError, "Invalid data size! Must be 1, 2 or 4"
|
||||
|
||||
for val in list:
|
||||
putdata(ea, val)
|
||||
ea = ea + itemsize
|
||||
for val in list:
|
||||
putdata(ea, val)
|
||||
ea = ea + itemsize
|
||||
|
||||
|
||||
def MapDataList(ea, length, func, wordsize=1):
|
||||
"""
|
||||
Map through a list of data words in the database
|
||||
"""
|
||||
Map through a list of data words in the database
|
||||
|
||||
@param ea: start address
|
||||
@param length: number of words to map
|
||||
@param func: mapping function
|
||||
@param wordsize: size of words to map [default: 1 byte]
|
||||
@param ea: start address
|
||||
@param length: number of words to map
|
||||
@param func: mapping function
|
||||
@param wordsize: size of words to map [default: 1 byte]
|
||||
|
||||
@return: None
|
||||
"""
|
||||
PutDataList(ea, map(func, GetDataList(ea, length, wordsize)), wordsize)
|
||||
@return: None
|
||||
"""
|
||||
PutDataList(ea, map(func, GetDataList(ea, length, wordsize)), wordsize)
|
||||
|
||||
|
||||
def GetInputFileMD5():
|
||||
"""
|
||||
Return the MD5 hash of the input binary file
|
||||
"""
|
||||
Return the MD5 hash of the input binary file
|
||||
|
||||
@return: MD5 string or None on error
|
||||
"""
|
||||
ua=idaapi.ucharArray(16)
|
||||
if idaapi.retrieve_input_file_md5(ua.cast()):
|
||||
md5str=""
|
||||
for i in range(16):
|
||||
md5str += "%02x" % ua[i]
|
||||
return md5str
|
||||
else:
|
||||
return None
|
||||
@return: MD5 string or None on error
|
||||
"""
|
||||
ua=idaapi.ucharArray(16)
|
||||
if idaapi.retrieve_input_file_md5(ua.cast()):
|
||||
md5str=""
|
||||
for i in range(16):
|
||||
md5str += "%02x" % ua[i]
|
||||
return md5str
|
||||
else:
|
||||
return None
|
||||
|
||||
|
6794
python/idc.py
6794
python/idc.py
File diff suppressed because it is too large
Load Diff
118
python/init.py
118
python/init.py
@ -19,65 +19,65 @@ warnings.filterwarnings('ignore', category=FutureWarning)
|
||||
|
||||
|
||||
def addscriptpath(script):
|
||||
"""
|
||||
Add the path part of the scriptfile to the system path to
|
||||
allow modules to be loaded from the same place.
|
||||
"""
|
||||
Add the path part of the scriptfile to the system path to
|
||||
allow modules to be loaded from the same place.
|
||||
|
||||
Each path is added only once.
|
||||
"""
|
||||
pathfound = 0
|
||||
Each path is added only once.
|
||||
"""
|
||||
pathfound = 0
|
||||
|
||||
scriptpath = os.path.dirname(script)
|
||||
scriptpath = os.path.dirname(script)
|
||||
|
||||
for pathitem in sys.path:
|
||||
if pathitem == scriptpath:
|
||||
pathfound = 1
|
||||
break
|
||||
|
||||
if pathfound == 0:
|
||||
sys.path.append(scriptpath)
|
||||
for pathitem in sys.path:
|
||||
if pathitem == scriptpath:
|
||||
pathfound = 1
|
||||
break
|
||||
|
||||
if pathfound == 0:
|
||||
sys.path.append(scriptpath)
|
||||
|
||||
# Add the script to ScriptBox if it's not there yet
|
||||
if not script in ScriptBox_instance.list:
|
||||
ScriptBox_instance.list.insert(0, script)
|
||||
# Add the script to ScriptBox if it's not there yet
|
||||
if not script in ScriptBox_instance.list:
|
||||
ScriptBox_instance.list.insert(0, script)
|
||||
|
||||
|
||||
def runscript(script):
|
||||
"""
|
||||
Run the specified script after adding its directory path to
|
||||
system path.
|
||||
"""
|
||||
Run the specified script after adding its directory path to
|
||||
system path.
|
||||
|
||||
This function is used by the low-level plugin code.
|
||||
"""
|
||||
addscriptpath(script)
|
||||
argv = sys.argv
|
||||
sys.argv = [ script ]
|
||||
execfile(script, globals())
|
||||
sys.argv = argv
|
||||
This function is used by the low-level plugin code.
|
||||
"""
|
||||
addscriptpath(script)
|
||||
argv = sys.argv
|
||||
sys.argv = [ script ]
|
||||
execfile(script, globals())
|
||||
sys.argv = argv
|
||||
|
||||
def print_banner():
|
||||
version1 = "IDAPython version %d.%d.%d %s (serial %d) initialized" % IDAPYTHON_VERSION
|
||||
version2 = "Python interpreter version %d.%d.%d %s (serial %d)" % sys.version_info
|
||||
linelen = max(len(version1), len(version2))
|
||||
version1 = "IDAPython version %d.%d.%d %s (serial %d) initialized" % IDAPYTHON_VERSION
|
||||
version2 = "Python interpreter version %d.%d.%d %s (serial %d)" % sys.version_info
|
||||
linelen = max(len(version1), len(version2))
|
||||
|
||||
print '-' * linelen
|
||||
print version1
|
||||
print version2
|
||||
print '-' * linelen
|
||||
print '-' * linelen
|
||||
print version1
|
||||
print version2
|
||||
print '-' * linelen
|
||||
|
||||
|
||||
#-----------------------------------------------------------
|
||||
# Take over the standard text outputs
|
||||
#-----------------------------------------------------------
|
||||
class MyStdOut:
|
||||
"""
|
||||
Dummy file-like class that receives stout and stderr
|
||||
"""
|
||||
def write(self, text):
|
||||
_idaapi.msg(text.replace("%", "%%"))
|
||||
"""
|
||||
Dummy file-like class that receives stout and stderr
|
||||
"""
|
||||
def write(self, text):
|
||||
_idaapi.msg(text.replace("%", "%%"))
|
||||
|
||||
def flush(self):
|
||||
pass
|
||||
def flush(self):
|
||||
pass
|
||||
|
||||
|
||||
# Redirect stderr and stdout to the IDA message window
|
||||
@ -103,24 +103,24 @@ from idautils import *
|
||||
# Build up the ScriptBox tool
|
||||
#-----------------------------------------------------------
|
||||
class ScriptBox(Choose):
|
||||
def __init__(self, list=[]):
|
||||
Choose.__init__(self, list, "ScriptBox", 1)
|
||||
self.width = 50
|
||||
def __init__(self, list=[]):
|
||||
Choose.__init__(self, list, "ScriptBox", 1)
|
||||
self.width = 50
|
||||
|
||||
def run(self):
|
||||
if len(self.list) == 0:
|
||||
Warning("ScriptBox history is empty.\nRun some script with Alt-9 and try again.")
|
||||
return None
|
||||
def run(self):
|
||||
if len(self.list) == 0:
|
||||
Warning("ScriptBox history is empty.\nRun some script with Alt-9 and try again.")
|
||||
return None
|
||||
|
||||
n = self.choose()
|
||||
|
||||
if n > 0:
|
||||
return self.list[n-1]
|
||||
else:
|
||||
return None
|
||||
n = self.choose()
|
||||
|
||||
if n > 0:
|
||||
return self.list[n-1]
|
||||
else:
|
||||
return None
|
||||
|
||||
def addscript(self, scriptpath):
|
||||
self.list.append(scriptpath)
|
||||
def addscript(self, scriptpath):
|
||||
self.list.append(scriptpath)
|
||||
|
||||
ScriptBox_instance = ScriptBox([])
|
||||
|
||||
@ -128,9 +128,9 @@ ScriptBox_instance = ScriptBox([])
|
||||
userrc = get_user_idadir() + os.sep + "idapythonrc.py"
|
||||
|
||||
if os.path.exists(userrc):
|
||||
runscript(userrc)
|
||||
# Remove the user script from the history
|
||||
del ScriptBox_instance.list[0]
|
||||
runscript(userrc)
|
||||
# Remove the user script from the history
|
||||
del ScriptBox_instance.list[0]
|
||||
|
||||
|
||||
# All done, ready to rock.
|
||||
|
Loading…
Reference in New Issue
Block a user