Git Product home page Git Product logo

fuckcdn's Issues

The plain HTTP request was sent to HTTPS port

测试代码

使用该代码探测443端口,没有进行tls的处理

func tlsTest() {
	conn, err := net.Dial("tcp", "220.181.38.148:443")
	msg := "GET / HTTP/1.1\r\n"
	msg += "Host:" + "baidu.com" + "\r\n"
	msg += "DNT: 1\r\n"
	msg += "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.87 Safari/537.36\r\n"
	msg += "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3\r\n"
	// msg += "Accept-Encoding: gzip, deflate\r\n"
	msg += "Accept-Language: zh-CN,zh;q=0.9,en;q=0.8\r\n"
	msg += "Connection: close\r\n"
	msg += "\r\n\r\n"
	defer conn.Close()
	_, err = io.WriteString(conn, msg)
	if err != nil {
		fmt.Println(err.Error())
	}

	buf := make([]byte, 4096)
	count, err := conn.Read(buf)

	if err != nil {
		fmt.Println(err.Error())
	}
	fmt.Println(string(buf[0:count]))
}

返回400错误

HTTP/1.1 400 Bad Request
Server: bfe/1.0.8.18
Date: Wed, 05 Aug 2020 11:58:13 GMT
Content-Type: text/html
Content-Length: 673
Connection: close

<html>
<head><title>400 The plain HTTP request was sent to HTTPS port</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<center>The plain HTTP request was sent to HTTPS port</center>
<hr><center>bfe/1.0.8.18</center>
</body>
</html>

修复建议

可以查看 zgrab 的实现

https://github.com/zmap/zgrab2/blob/master/modules/http/scanner.go

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.