我有这个片段,它可以在Linux中读取进程内存并搜索字符串,在某些发行版上可以正常运行,但在其他发行版上却遇到了此错误: 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)我应该声明为float吗?任何的想法?也尝试long()过相同的结果和错误。编辑:我忘了说的是我在“ x64”系统上得到的错误。
添加回答
举报
0/150
提交
取消