【问题标题】:Unable to download an existing file with wget and python http server无法使用 wget 和 python http 服务器下载现有文件
【发布时间】:2020-09-10 03:35:46
【问题描述】:

所以我用python -m SimpleHTTPServer 安装了一个http 服务器,我得到了:

Serving HTTP on 0.0.0.0 port 8000 ... 但是当我尝试下载时

wget http://192.168.100.65:8000/tmp/postgres_default_pass.txt

我明白了:

    192.168.100.74 - - [09/Sep/2020 23:32:30] code 404, message File not found
192.168.100.74 - - [09/Sep/2020 23:32:30] "GET /tmp/postgres_default_pass.txt HTTP/1.1" 404 -

在 wget 机器中:

    Connecting to 192.168.100.65:8000... connected.
HTTP request sent, awaiting response... 404 File not found
2020-09-09 23:32:31 ERROR 404: File not found.

但是文件存在,做一个ls我可以找到文件。

 ls
hsperfdata_kali
postgres_default_pass.txt
sqlmaprgl22hl623598

【问题讨论】:

    标签: python wget simplehttpserver


    【解决方案1】:

    SimpleHTTPServer 相对于其当前目录提供服务。试试wget http://localhost:8000/postgres_default_pass.txt

    话虽如此,请注意在 python3 中它已作为 http.server 移入 http。官方不支持 python2.7,因此将任何系统迁移到 python3 可能是个好主意。

    【讨论】:

    • 谢谢你,这解决了我的问题,我会这样做的。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-06-13
    • 1970-01-01
    • 2022-06-11
    • 2011-06-03
    • 2019-09-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多