我正在从 Python 中的远程终端连接检索简单的分配命令,并希望执行它们。格式将类似于b = 3156
,我想使用exec()
. 我的代码:
def execbin(cmd):
exec(cmd.decode('ascii')) # decode() because recvline() gets a binary string
conn = remote(url, port) # this is from the library pwntools
execbin(conn.recvline(keepends=False)) # get the line and run it
但是,对变量的赋值没有发生:
我怎样才能成功地执行这个任务?