linux中用telnet如何构造get、post请求头报文

来源:互联网 发布:淘宝网沙滩裙图片 编辑:程序博客网 时间:2024/05/17 07:19

构造报文的方法应该很多,telnet、pyhon脚本、写代码,应该都行,但个人感觉telnet还是最简单的,哈哈!

在命令行下输入telnet  172.18.1.179 80

然后输入如下的报文头,直接回车发送即可

(如果没有telnet客户端,可以直接 apt-get install telnet-ssl 安装一个客户端工具 就可以了)

 

例1:

GET /index.html HTTP/1.1
Accept: image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/msword, application/vnd.ms-powerpoint, application/vnd.ms-excel, */*
Accept-Language: zh-cn
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; InfoPath.2)
Accept-Encoding: gzip, deflate
Cookie: hidden=value; TestCookie=WAF_Cookie_Test; phpbot=hijklmn123; phpsessid=abcdefg
Host: 172.18.1.179
Connection: Keep-Alive

 

例2:

POST /index.html HTTP/1.1
Accept: image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/msword, application/vnd.ms-powerpoint, application/vnd.ms-excel, */*
Accept-Language: zh-cn
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; InfoPath.2)
Accept-Encoding: gzip, deflate
Host: 172.18.1.179
Content-Length:20

Connection: Keep-Alive
Cache-Control: no-cache

fname=0123456789012345678&lname=aa

 

报文的内容也可以通过抓包工具获取比如http watch

0 0
原创粉丝点击