Skip to content

Commit a79bdf8

Browse files
authored
Merge pull request #623 from learn-more/various_fixes
Various fixes
2 parents 5286c8f + 0b73e08 commit a79bdf8

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

qiling/core.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,14 @@ def __init__(
206206
# Add extra guard options when configured to do so
207207
self._init_stop_guard()
208208

209+
###############################
210+
# Properties configured later #
211+
###############################
212+
self.entry_point = None
213+
self.exit_point = None
214+
self.timeout = None
215+
self.count = None
216+
self._initial_sp = None
209217

210218
#####################
211219
# Qiling Components #

qiling/loader/pe.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,9 @@ def load_dll(self, dll_name, driver=False):
6767

6868
if self.libcache and os.path.exists(fcache) and \
6969
os.stat(fcache).st_mtime > os.stat(path).st_mtime: # pickle file cannot be outdated
70-
(data, cmdlines, self.import_symbols, self.import_address_table) = \
71-
pickle.load(open(fcache, "rb"))
70+
with open(fcache, "rb") as fcache_file:
71+
(data, cmdlines, self.import_symbols, self.import_address_table) = \
72+
pickle.load(fcache_file)
7273
for entry in cmdlines:
7374
self.set_cmdline(entry['name'], entry['address'], data)
7475
else:

qiling/os/utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,11 @@ def disassembler(self, ql, address, size):
256256
temp_str += ("%02x " % i)
257257
log_data += temp_str.ljust(30)
258258

259+
first = True
259260
for i in insn:
261+
if not first:
262+
log_data += '\n> '
263+
first = False
260264
log_data += "%s %s" % (i.mnemonic, i.op_str)
261265
logging.info(log_data)
262266

qiling/utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,11 @@ def debugger_convert_str(debugger_id):
254254
# Call `function_name` in `module_name`.
255255
# e.g. map_syscall in qiling.os.linux.map_syscall
256256
def ql_get_module_function(module_name, function_name = None):
257+
257258
try:
258259
imp_module = importlib.import_module(module_name)
259-
except:
260-
raise QlErrorModuleNotFound("[!] Unable to import module %s" % module_name)
260+
except Exception as ex:
261+
raise QlErrorModuleNotFound("[!] Unable to import module %s (%s)" % (module_name, ex))
261262

262263
try:
263264
module_function = getattr(imp_module, function_name)

0 commit comments

Comments
 (0)