欢迎来到好人卡资源网,专注网络技术资源收集,我们不仅是网络资源的搬运工,也生产原创资源。寻找资源请留言或关注公众号:烈日下的男人

wget/curl 命令使用代理

linux sky995 3年前 (2021-01-16) 798次浏览 0个评论

本文及资源最后更新时间 2021-01-16 by sky995

国内机器跑分的时候,有些脚本下载不下来,这时候可以通过使用代理来下载

设置环境变量:

不带口令

代码:

  1. export http_proxy=http://your-ip-address:port
  2. export https_proxy=https://your-ip-address:port

带口令

代码:

  1. export http_proxy=http://user:password@your-proxy-ip-address:port
  2. export https_proxy=https://user:password@your-proxy-ip-address:port

取消代理

代码:

  1. unset http_proxy
  2. unset https_proxy

curl 使用命令行参数:[]内可选部分

代码:

  1. protocol: http https socks5
  2. curl -x ‘<[protocol://][user:password@]proxyhost[:port]>’ url

wget 使用命令行参数:

代码:

  1. wget –proxy=on –proxy-user “username” –proxy-password “password” url

wget 使用~/.wgetrc 优先级高于环境变量:

代码:

  1. use_proxy = on
  2. proxy_user=username
  3. proxy_password=password
  4. http_proxy =  http://proxy.server.address:port/
  5. https_proxy =  http://proxy.server.address:port/

或者

代码:

  1. use_proxy = on
  2. http_proxy =  http://username:password@proxy.server.address:port/
  3. https_proxy =  http://username:password@proxy.server.address:port/

wget 不使用代理命令行参数:

代码:

  1. wget –no-proxy FILE_URL

使用 Dante Server 创建 Socks 服务器

代码:

  1. apt install –assume-yes –no-install-recommends dante-server
  2. cat << “EOF” > /etc/danted.conf
  3. logoutput: /var/log/socks.log
  4. internal: eth0 port = 1080
  5. external: eth0
  6. clientmethod: none
  7. socksmethod: none
  8. user.privileged: root
  9. user.notprivileged: nobody
  10. client pass {
  11.   from: 0.0.0.0/0 to: 0.0.0.0/0
  12.   log: error connect disconnect
  13. }
  14. client block {
  15.   from: 0.0.0.0/0 to: 0.0.0.0/0
  16.   log: connect error
  17. }
  18. socks pass {
  19.   from: 0.0.0.0/0 to: 0.0.0.0/0
  20.   log: error connect disconnect
  21. }
  22. socks block {
  23.   from: 0.0.0.0/0 to: 0.0.0.0/0
  24.   log: connect error
  25. }
  26. EOF
  27. systemctl restart danted

 

代码:

  1. curl -x socks5://dante_server_ip:1080 ifconfig.co

好人卡资源网 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:wget/curl 命令使用代理
喜欢 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址