nc模拟浏览器请求http

发布时间:2020-10-06 02:24:03 作者:757781091
来源:网络 阅读:751

《渗 透测试完全初学者指南》的“6.5.1检测非标准端口”使用了nc手动发送http命令获取web的内容。依照这个例子是可以执行成功的,但按此例子的方法去apache发起请求则不能成功。如下:

nc 172.28.128.35 80
GET / HTTP/1.1
HTTP/1.1 400 Bad Request
Date: Fri, 27 Dec 2019 03:08:49 GMT
Server: Apache/2.4.6 (CentOS)
Content-Length: 226
Connection: close
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h2>Bad Request</h2>
<p>Your browser sent a request that this server could not understand.<br />
</p>
</body></html>

根据参考链接,需要使用下面的命令才能请求成功

printf "GET / HTTP/1.1\r\nHOST:z\r\n\r\n" | nc 172.28.128.35 80
HTTP/1.1 200 OK
Date: Fri, 27 Dec 2019 03:21:21 GMT
Server: Apache/2.4.6 (CentOS)
Last-Modified: Fri, 27 Dec 2019 02:59:06 GMT
ETag: "8-59aa6ad5747ae"
Accept-Ranges: bytes
Content-Length: 8
Content-Type: text/html; charset=UTF-8

dfafdas

参考链接中的文档解释了为什么需要这样的命令。
也可以通过将http命令保存在文本文件中重定向给nc,从print命令看,每一行是以\r\n结束的,因此保存的文本文档需要是windows格式的。

nc 172.28.128.35 80 < b.txt 
HTTP/1.1 200 OK
Date: Fri, 27 Dec 2019 03:28:08 GMT
Server: Apache/2.4.6 (CentOS)
Last-Modified: Fri, 27 Dec 2019 02:59:06 GMT
ETag: "8-59aa6ad5747ae"
Accept-Ranges: bytes
Content-Length: 8
Content-Type: text/html; charset=UTF-8

dfafdas
推荐阅读:
  1. nc模拟浏览器请求http的方法
  2. php模拟http请求的两种姿势

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

nc http

上一篇:在Create React App中使用CSS Modules的方法示例

下一篇:Bootstrap模态框使用详解

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》