当前位置: 首页 > news >正文

足彩网站怎样做推广企业网站搜索引擎推广方法

足彩网站怎样做推广,企业网站搜索引擎推广方法,域名空间做网站,苏州信息造价网起因 抓取某个HTTPS网站的时候 开启charles代理能够抓取成功,关闭被风控 通过检测,怀疑可能是tls的时候有区别 尝试 golang的http中,Transport.TLSClientConfig是可以自定义设置的 但起初通过随意设置并不能绕过风控 困难 使用golang的http客户端,修改DialTLSContext函数的…

起因

抓取某个HTTPS网站的时候
开启charles代理能够抓取成功,关闭被风控
通过检测,怀疑可能是tls的时候有区别

尝试

golang的http中,Transport.TLSClientConfig是可以自定义设置的
但起初通过随意设置并不能绕过风控

困难

  1. 使用golang的http客户端,修改DialTLSContext函数的方式是可以实绕过风控,但使用proxy的时候,代码会使用pconn.addTLS(ctx, cm.tlsHost(), trace) 重新以普通方式进行握手,导致JA3修改失败
  2. 因为golang强关联,第三方库并不能完美的集成到现有代码中,都需要重构代码
  3. 某些网站会对于新建链接进行ClientSession检测,因此需要 KeepAlive+ClientSessionCache,这样通过复用连接减少风控概率

最终实现

  1. 只需要拿到合法的参数,并且配置到TLSClientConfig里即可
  2. 使用github.com/refraction-networking/utls中的UTLSIdToSpec拿到CipherSuites并传入
package main
import ("bytes""crypto/tls"tlsx "github.com/refraction-networking/utls""net/http"
)
func main() {c, _ := tlsx.UTLSIdToSpec(tlsx.HelloRandomized)a := &http.Client{Transport: &http.Transport{DisableKeepAlives: false,Proxy: proxy,TLSClientConfig: &tls.Config{InsecureSkipVerify: true,MinVersion:         c.TLSVersMin,MaxVersion:         c.TLSVersMax,CipherSuites:       c.CipherSuites,ClientSessionCache: tls.NewLRUClientSessionCache(32),},},}aw, bw := a.Get("https://tls.browserleaks.com/json")defer aw.Body.Close()var buf bytes.Bufferaw.Write(&buf)println(string(buf.String()), bw)
}

参考文章

  1. https://github.com/baixudong007/gospider
  2. https://juejin.cn/post/7073264626506399751 用Go构建你专属的JA3指纹
  3. https://blog.csdn.net/qq523176585/article/details/127116542 好库推荐|强烈推荐,支持Ja3指纹修改的golang请求库
  4. https://github.com/wangluozhe/requests
  5. https://github.com/refraction-networking/utls
  6. http://www.ctfiot.com/64337.html 如何绕过 JA3 指纹校验?
  7. https://www.coder.work/article/7192419 http - 发送请求时如何使用uTLS连接?
  8. https://segmentfault.com/a/1190000041699815/en Build your own JA3 fingerprint with Go
  9. https://zhuanlan.zhihu.com/p/601474166 curl_cffi: 支持原生模拟浏览器 TLS/JA3 指纹的 Python 库
  10. https://tools.scrapfly.io/api/fp/ja3

历史编写的代码

这些代码都不太好用

package mainimport ("context""fmt"tls "github.com/refraction-networking/utls"xtls "github.com/refraction-networking/utls""net""net/http"
)func GetTransport(helloID *xtls.ClientHelloID) *http.Transport {if helloID == nil {helloID = &xtls.HelloChrome_83}transport := http.DefaultTransport.(*http.Transport).Clone()transport.DialTLSContext = func(ctx context.Context, network, addr string) (_ net.Conn, err error) {dialer := net.Dialer{}con, err := dialer.DialContext(ctx, network, addr)if err != nil {return nil, err}// 根据地址获取host信息host, _, err := net.SplitHostPort(addr)if err != nil {return nil, err}c := transport.TLSClientConfig// 并且不验证host信息xtlsConf := &xtls.Config{ServerName: host,//Renegotiation:      xtls.RenegotiateNever,ClientSessionCache: xtls.NewLRUClientSessionCache(32),NextProtos:         []string{"h2", "http/1.1"},Rand: c.Rand,Time: c.Time,VerifyPeerCertificate: c.VerifyPeerCertificate,RootCAs: c.RootCAs,ClientCAs:                c.ClientCAs,InsecureSkipVerify:       c.InsecureSkipVerify,CipherSuites:             c.CipherSuites,PreferServerCipherSuites: c.PreferServerCipherSuites,SessionTicketsDisabled:   c.SessionTicketsDisabled,SessionTicketKey:         c.SessionTicketKey,MinVersion: c.MinVersion,MaxVersion: c.MaxVersion,DynamicRecordSizingDisabled: c.DynamicRecordSizingDisabled,KeyLogWriter: c.KeyLogWriter,}// 构建tls.UConnxtlsConn := xtls.UClient(con, xtlsConf, *helloID)// 握手err = xtlsConn.HandshakeContext(ctx)if err != nil {return nil, err}fmt.Println("当前请求使用协议:", xtlsConn.HandshakeState.ServerHello.AlpnProtocol)return xtlsConn, err}//transport.DialContext = transport.DialTLSContexttransport.DisableKeepAlives = truereturn transport
}
func CreateHTTPClient() *http.Transport {return &http.Transport{DialTLSContext: func(ctx context.Context, network, addr string) (net.Conn, error) {//initialize the tcp connectiontcpConn, err := (&net.Dialer{}).DialContext(ctx, network, addr)if err != nil {return nil, err}host, _, err := net.SplitHostPort(addr)if err != nil {return nil, err}//initialize the conifg for tlsconfig := tls.Config{ServerName:         host, //set the server name with the provided addrClientSessionCache: xtls.NewLRUClientSessionCache(0),}//initialize a tls connection with the underlying tcop connection and configtlsConn := tls.UClient(tcpConn, &config, tls.HelloRandomized)//start the tls handshake between serverserr = tlsConn.Handshake()if err != nil {return nil, fmt.Errorf("uTlsConn.Handshake() error: %w", err)}return tlsConn, nil},ForceAttemptHTTP2: false,}}
http://www.hkea.cn/news/678448/

相关文章:

  • 互联网行业pest分析福州百度快速优化排名
  • 做网站的接私活犯法吗如何对网站进行推广
  • 身高差效果图网站优化师和运营区别
  • 谷歌wordpress建站搜索引擎算法
  • .net 购物网站开发源代码发布信息的免费平台
  • 自己做一网站大学生网络营销策划书
  • 关于网站建设的文章百度域名收录提交入口
  • 国人在线做网站推广图片大全
  • 郑州网站建设七彩科技四年级说新闻2023
  • 在什么网站上做自媒体seo整站怎么优化
  • 网站开发要注意安全性公司优化是什么意思
  • 河北邢台做移动网站开通网站需要多少钱
  • 天河网站建设多少钱淘宝关键词优化
  • 中型网站 收益关键词排名查询官网
  • 网站的弹窗是怎么做的谈谈对seo的理解
  • 广州网站制作费用宁波seo外包哪个品牌好
  • 河南高端网站建设广州网站优化页面
  • 企业可以备案几个网站南昌seo实用技巧
  • 网站用什么布局专业网站建设公司
  • 公司网站怎么做分录it培训机构学费一般多少
  • 如何将自己做的网页做成网站绍兴seo
  • 河南省住房与城乡建设厅网站首页怎么做属于自己的网站
  • 移动端网站开发推广效果最好的平台
  • 用二级页面做网站的源代码自助建站系统破解版
  • 网站上怎么做动画广告推广策略包括哪些内容
  • 广州网站优化公司大亚湾发布
  • 广州网站开发招聘百度经验悬赏令
  • 吴江建设局网站郑州粒米seo外包
  • 建设工程合同纠纷与劳务合同纠纷seo培训教程视频
  • 找网站建设公司哪家最好沈阳市网站