我有這個(gè)片段,它可以在Linux中讀取進(jìn)程內(nèi)存并搜索字符串,在某些發(fā)行版上可以正常運(yùn)行,但在其他發(fā)行版上卻遇到了此錯誤: maps_file = open("/proc/%s/maps"%pid, 'r') mem_file = open("/proc/%s/mem"%pid, 'r') for line in maps_file.readlines(): # for each mapped region m = re.match(r'([0-9A-Fa-f]+)', line) if m.group(3) == 'r': # if this is a readable region start = int(m.group(1), 16) end = int(m.group(2), 16) mem_file.seek(start) # seek to region start chunk = mem_file.read(end - start) # read region contents #print chunk, # dump contents to standard output mem_dump = open(working_dir+"/%s.bin"%pid, "ab") mem_dump.write(chunk,) mem_dump.close() maps_file.close() mem_file.close()錯誤:scan process: 491Traceback (most recent call last): File "./dump.py", line 106, in <module> MainDump(pid) File "./dump.py", line 79, in MainDump mem_file.seek(start) # seek to region startOverflowError: Python int too large to convert to C long問題行是:start = int(m.group(1), 16)和mem_file.seek(start)我應(yīng)該聲明為float嗎?任何的想法?也嘗試long()過相同的結(jié)果和錯誤。編輯:我忘了說的是我在“ x64”系統(tǒng)上得到的錯誤。
添加回答
舉報(bào)
0/150
提交
取消