您的位置:首页 > 运维架构 > Linux

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

2014-04-04 13:00 387 查看
构造报文的方法应该很多,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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: