无法在目录中运行某些 python 文件



你好,我试着从目录中运行这个克隆的应用程序,但它不工作:

https://github.com/laramies/theHarvester

我在/opt/文件夹中克隆了这个应用程序,并将chmod -x添加到主题中,我尝试通过以下命令运行它们:

python3 /opt/theHarvester/theHarvester.py

给我这个错误:

File "/opt/theHarvester/theHarvester.py", line 5, in <module>
from theHarvester import __main__
File "/opt/theHarvester/theHarvester/__main__.py", line 4, in <module>
from theHarvester.discovery import dnssearch, takeover, shodansearch
File "/opt/theHarvester/theHarvester/discovery/takeover.py", line 1, in <module> 
from theHarvester.lib.core import *
File "/opt/theHarvester/theHarvester/lib/core.py", line 238, in <module>
class AsyncFetcher:
File "/opt/theHarvester/theHarvester/lib/core.py", line 239, in AsyncFetcher
proxy_list = Core.proxy_list()
File "/opt/theHarvester/theHarvester/lib/core.py", line 103, in proxy_list
with open('proxies.yaml', 'r') as proxy_file:
FileNotFoundError: [Errno 2] No such file or directory: 'proxies.yaml'`

但是当我使用这个命令时:

cd /opt/theHarvester/ python3 theHarvester.py

它工作得很好。

在python脚本的开头添加以下行:

script_directory = os.path.dirname(__file__)
os.chdir(script_directory)

这些行假装从包含脚本的目录(也包括proxies.yaml)运行脚本。

相关内容

  • 没有找到相关文章

最新更新