nc工具使用

(在输入第二行之后,敲两次回车),这就打开了一个到主机www.chinaitlab.com的端口80的TCP连接,然后发送HTTP GET命令。你应该能看到包含着YESKY主页的基本HTML文件的应苔消息。如果你想只看到HTTP消息行而不接收该对象本身,那么就把上面的GET换 成HEAD。

 

 nc www.baidu.com 80
GET /index.html HTTP/1.1

HTTP/1.1 200 OK
Date: Wed, 29 Feb 2012 05:29:02 GMT
Server: BWS/1.0
Content-Length: 7701
Content-Type: text/html;charset=gb2312
Cache-Control: private
Expires: Wed, 29 Feb 2012 05:29:02 GMT
Set-Cookie: BAIDUID=7066A6768B94E9F7C3F0F023CCB23A64:FG=1; expires=Wed, 29-Feb-42 05:29:02 GMT; path=/; domain=.baidu.com
P3P: CP=" OTI DSP COR IVA OUR IND COM "
Connection: Keep-Alive

<!doctype html><html><head><meta http-equiv="Content-Type" content="text/html;charset=gb2312

.............................

.........

..... <!--d01a5ab4c0f73034-->

 

######################################

[ @localhost ~]$ nc www.baidu.com 80
HEAD /index.html HTTP/1.1

HTTP/1.1 200 OK
Date: Wed, 29 Feb 2012 05:31:19 GMT
Server: BWS/1.0
Content-Length: 7701
Content-Type: text/html;charset=gb2312
Cache-Control: private
Expires: Wed, 29 Feb 2012 05:31:19 GMT
Set-Cookie: BAIDUID=5A7858AE2C5F8C4A07D595B514A95E30:FG=1; expires=Wed, 29-Feb-42 05:31:19 GMT; path=/; domain=.baidu.com
P3P: CP=" OTI DSP COR IVA OUR IND COM "
Connection: Keep-Alive