代理设置

代理设置

一些常用的代理配置

终端代理设置

export {http,https,ftp}_proxy="http://user:pass@proxy:port/" export https_proxy=$http_proxy HTTP_PROXY=$http_proxy HTTPS_PROXY=$http_proxy NO_PROXY=$no_proxy # 临时socks5代理 export ALL_PROXY=socks5://ip:port 

wget设置代理

 wget代理配置 # 修改/etc/wgetrc或者~/.wgetrc # 临时代理 wget -Y on -e "http_proxy=http://proxy:port" "www.wo.com.cn" curl 设置代理 curl -x proxy:port www.wo.com.cn 

curl 使用sock5代理

# https://blog.emacsos.com/use-socks5-proxy-in-curl.html curl --socks5-hostname 127.0.0.1:1086 www.google.com curl --proxy socks5h://127.0.0.1:1086 www.google.com 

git 设置代理

git config --global http.proxy 'socks5://127.0.0.1:1080' git config --global https.proxy 'socks5://127.0.0.1:1080' #只对github.com git config --global http.https://github.com.proxy socks5://127.0.0.1:1080 #取消代理 git config --global --unset http.https://github.com.proxy) git config --global --unset http.proxy git config --global --unset https.proxy 

ssh 代理

ssh -o ProxyCommand="nc -X 5 -x proxy.net:1080 %h %p" [email protected] # ssh 代理配置 ~/.ssh/config Host * ProxyCommand nc -X 5 -x proxy.net:1080 %h %p #使用SSH端口转发之后,TCP 端口 A 与 B 之间现在并不直接通讯,而是转发到了 SSH 客户端及服务端来通讯,从而自动实现了数据加密并同时绕过了防火墙的限制 ssh -g -f -N -L forwardingPort:targetIP:targetPort user@sshServerIP ssh -f -N -R forwardingPort:targetIP:targetPort user@sshServerIP ssh -NTL 9001:localhost:80 workspace ssh -NTR 9001:localhost:8080 workspace 

nc命令

# https://linux.cn/article-9190-1.html # nc连接 nc -v 127.0.0.1 8080 # nc监听 nc -l 8080 # nc做代理 nc -l 8080 | nc 192.168.1.200 80 # 代理 双向管道接受返回 mkfifo 2way nc -l 8080 0<2way | nc 192.168.1.200 80 1>2way nc -l 9001 0<2way | tee cap.log | nc 127.0.0.1 8888 1>2way # 发送文件 nc -l 8080 > file.txt nc 192.168.1.100 8080 --send-only < data.txt # 端口转发 nc -u -l 80 -c 'nc -u -l 8080' # 客户端关闭,服务端继续 nc -l -k 8080 printf "GET / HTTP/1.0\r\n\r\n" | nc 127.0.0.1 8080 printf "GET / HTTP/1.1\r\nHost: z\r\n\r\n" | nc 127.0.0.1 8080 

网络工具

dig nslookup 抓包工具 charles Example http代理端口5000,转发至5100 export http_proxy=127.0.0.1:5000 mkfifo 2way nc -k -l 5000 0<2way | tee -a cap.log | nc 127.0.0.1 5100 1>2way golang反向代理转发请求至5200 package main import ( "log" "net/http" "net/http/httputil" "net/url" ) func init() { log.SetFlags(log.LstdFlags | log.Lshortfile) } type Proxy struct { p *httputil.ReverseProxy } func (p *Proxy) revert(w http.ResponseWriter, r *http.Request) { p.p.ServeHTTP(w, r) } ` ` func newReverseProxy(target *url.URL) *httputil.ReverseProxy { director := func(req *http.Request) { req.URL.Scheme = target.Scheme req.URL.Path = req.RequestURI req.URL.Host = target.Host } return &httputil.ReverseProxy{Director: director} } func main() { remote, _ := url.Parse("http://127.0.0.1:5200") proxy := newReverseProxy(remote) p := &Proxy{ p: proxy, } http.HandleFunc("/", p.revert) err := http.ListenAndServe(":5100", nil) if err != nil { log.Println(err) } } 

Read more

前端防范 XSS(跨站脚本攻击)

目录 一、防范措施 1.layui util  核心转义的特殊字符 示例 2.js-xss.js库 安装 1. Node.js 环境(npm/yarn) 2. 浏览器环境 核心 API 基础使用 1. 基础过滤(默认规则) 2. 自定义过滤规则 (1)允许特定标签 (2)允许特定属性 (3)自定义标签处理 (4)自定义属性处理 (5)转义特定字符 常见场景示例 1. 过滤用户输入的评论内容 2. 允许特定富文本标签(如富文本编辑器内容) 注意事项 更多配置 XSS(跨站脚本攻击)是一种常见的网络攻击手段,它允许攻击者将恶意脚本注入到其他用户的浏览器中。

详细教程:如何从前端查看调用接口、传参及返回结果(附带图片案例)

详细教程:如何从前端查看调用接口、传参及返回结果(附带图片案例)

目录 1. 打开浏览器开发者工具 2. 使用 Network 面板 3. 查看具体的API请求 a. Headers b. Payload c. Response d. Preview e. Timing 4. 实际操作步骤 5. 常见问题及解决方法 a. 无法看到API请求 b. 请求失败 c. 跨域问题(CORS) 作为一名后端工程师,理解前端如何调用接口、传递参数以及接收返回值是非常重要的。下面将详细介绍如何通过浏览器开发者工具(F12)查看和分析这些信息,并附带图片案例帮助你更好地理解。 1. 打开浏览器开发者工具 按下 F12 或右键点击页面选择“检查”可以打开浏览器的开发者工具。常用的浏览器如Chrome、Firefox等都内置了开发者工具。下面是我选择我的一篇文章,打开开发者工具进行演示。 2. 使用

Cursor+Codex隐藏技巧:用截图秒修前端Bug的保姆级教程(React/Chakra UI案例)

Cursor+Codex隐藏技巧:用截图秒修前端Bug的保姆级教程(React/Chakra UI案例) 前端开发中最令人头疼的莫过于那些难以定位的UI问题——元素错位、样式冲突、响应式失效...传统调试方式往往需要反复修改代码、刷新页面、检查元素。现在,通过Cursor编辑器集成的Codex功能,你可以直接用截图交互快速定位和修复这些问题。本文将带你从零开始,掌握这套革命性的调试工作流。 1. 环境准备与基础配置 在开始之前,确保你已经具备以下环境: * Cursor编辑器最新版(v2.5+) * Node.js 18.x及以上版本 * React 18项目(本文以Chakra UI 2.x为例) 首先在Cursor中安装Codex插件: 1. 点击左侧扩展图标 2. 搜索"Codex"并安装 3. 登录你的OpenAI账户(需要ChatGPT Plus订阅) 关键配置项: // 在项目根目录创建.