错误一:
File "D:\Program Files\Python37\lib\site-packages\pwnlib\term\term.py", line 167
def goto((r, c)):
^
SyntaxError: invalid syntax
原因:
Tuple parameter unpacking is not supported in python3 (python3不再支持元组作为函数参数)。
解决方案:
打开term.py,修改部分代码,去除元组参数。
def goto(r, c): #改了这里
do('cup', r - scroll + height - 1, c)
def render_from(i, force = False, clear_after = False):
e = None
# `i` should always be a valid cell, but in case i f***ed up somewhere, I'll
# check it and just do nothing if something went wrong.
if i < 0 or i >= len(cells):
return
goto(cells[i].start[0],cells[i].start[1]) #改了这里
for c in cells[i:]:
if not force and c.start == e:
goto(cells[-1].end[0],cells[-1].end[1]) #改了这里
break
elif e:
c.start = e
render_cell(c, clear_after = clear_after)
e = c.end
if clear_after and (e[0] < scroll or e[1] < width - 1):
put('\x1b[J')
flush()
错误二:
import fcntl
ModuleNotFoundError: No module named 'fcntl'
原因:
windows中的python不自带fcntl而且这个模块
解决方案:
python路径下的Lib中新建一个fcntl.py文件,并写入:
def fcntl(fd, op, arg=0):
return 0
def ioctl(fd, op, arg=0, mutable_flag=True):
if mutable_flag:
return 0
else:
return ""
def flock(fd, op):
return
def lockf(fd, operation, length=0, start=0, whence=0):
return
待续。。。

在使用Python的pwn库时遇到了两个错误:一是因Python3不支持元组参数解包导致的SyntaxError,二是尝试导入fcntl模块时在Windows环境下找不到该模块。对于错误一,需要修改term.py中的元组参数;对于错误二,由于fcntl模块在Windows上缺失,可以创建一个空的fcntl.py文件来解决依赖问题。
2080





