简体   繁体   English

错误:“NameError:未定义名称‘pwn’”

[英]Error: "NameError: name 'pwn' is not defined"

After using the following command to download pwn tools使用以下命令下载pwn工具后

python3 -m pip install --upgrade pwntools

I created a python file called exp.py and in the top of the file I import the pwn tools like this我创建了一个名为 exp.py 的 python 文件,并在文件顶部导入了 pwn 工具,如下所示

import pwn

I also used this method我也用过这个方法

from pwn import *

but am running the program and am getting the following msg但正在运行该程序并收到以下消息

File "exp.py", line 5, in <module>
    pwn.context.log_level = 'critical'
NameError: name 'pwn' is not defined

After looking on the code the problem was that i was writing the function from pwn like this查看代码后,问题是我正在像这样从 pwn 编写 function

pwn.function()

So i was getting the error of pwn.context.log_level = 'critical', if i remvoed the pwn and keep it like this context.log_level = 'critical' the error did not appear所以我得到了 pwn.context.log_level = 'critical' 的错误,如果我删除了 pwn 并保持它像这样 context.log_level = 'critical' 错误就不会出现

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM