{"id":237,"date":"2012-06-13T18:17:59","date_gmt":"2012-06-13T10:17:59","guid":{"rendered":"http:\/\/www.ipcpu.com\/?p=237"},"modified":"2012-06-13T18:17:59","modified_gmt":"2012-06-13T10:17:59","slug":"linux-telnet-more","status":"publish","type":"post","link":"https:\/\/c.ipcpu.com\/2012\/06\/linux-telnet-more\/","title":{"rendered":"\u5982\u4f55\u6279\u91cf\u68c0\u6d4b\u7aef\u53e3\u8fde\u901a\u6027\u3001\u7aef\u53e3\u662f\u5426\u5f00\u653e"},"content":{"rendered":"

\"telnet02\"<\/a>
\n
\u672c\u6587\u7684\u59ca\u59b9\u7bc7 \u5df2\u53d1\u5e03\u00a0 \u70b9\u51fb\u67e5\u770b\u00a0 \u5982\u4f55\u6279\u91cf\u68c0\u6d4b\u7aef\u53e3\u8fde\u901a\u6027\u3001\u7aef\u53e3\u662f\u5426\u5f00\u653e\uff08\u4e8c\uff09<\/span><\/a>
\n\u68c0\u6d4b\u7aef\u53e3\u8fd8\u5728\u7528telnet\uff1f\u592a\u843d\u4f0d\u628a
\n\u6709\u6ca1\u6709\u6279\u91cf\u68c0\u6d4b\u7684\u65b9\u6cd5\uff1f\u6709\u7684\u3002\u6211\u4eec\u7528nc\u5c31\u53ef\u4ee5\u5feb\u901f\u68c0\u6d4b\u7aef\u53e3\u7684\u5f00\u653e\u6027\u3002
\nnc\u68c0\u6d4b\u7aef\u53e3\u7684\u7528\u6cd5
\nnc -z -w 10 %IP %PORT<\/strong>
\n-z\u8868\u793a\u68c0\u6d4b\u6216\u8005\u626b\u63cf\u7aef\u53e3
\n-w\u8868\u793a\u8d85\u65f6\u65f6\u95f4
\n-u\u8868\u793a\u4f7f\u7528UDP\u534f\u8bae
\n\u4f8b\u5982\uff1a
\n[@s136.ipcpu.com ~]# nc -z -w 10 -u 8.8.8.8 53
\nConnection to 8.8.8.8 53 port [udp\/domain] succeeded!
\n[@s136.ipcpu.com ~]# nc -z -w 10 8.8.8.8 53
\nConnection to 8.8.8.8 53 port [tcp\/domain] succeeded!
\n[@s136.ipcpu.com ~]# echo $?
\n[@s136.ipcpu.com ~]# nc -z -w 10 8.8.8.7 53
\n[@s136.ipcpu.com ~]# echo $?
\n1
\n[@s136.ipcpu.com ~]#
\n\u7aef\u53e3\u6210\u529f\u8054\u901a\u8fd4\u56de\u503c\u662f0\uff0c\u63d0\u793asucceeded\uff1b\u5426\u5219\u8fd4\u56de1\uff0c\u4e0d\u63d0\u793a\u4efb\u4f55\u6570\u636e
\n\u5047\u5982\u6211\u4eec\u6709\u8fd9\u6837\u4e00\u5806IP\u548c\u7aef\u53e3\u3002
\n#cat ports
\n119.181.69.96 8080
\n119.181.118.38 8000
\n119.181.20.18 8080
\n119.181.69.37 8080
\n\u6211\u4eec\u53ef\u4ee5\u5199\u8fd9\u6837\u4e00\u4e2a\u811a\u672c\u6765\u6279\u91cf\u68c0\u6d4b\u7aef\u53e3\u662f\u5426\u5f00\u653e\uff1a
\ncat tetsport\u00a0\u00a0 |\u00a0 while read line
\ndo
\n#nc -z\u00a0 -w 10\u00a0 $line
\nnc -z -w 10 $line > \/dev\/null 2>&1
\nif [ $? -eq 0 ]
\nthen
\necho $line:ok
\nelse
\necho $line:fail
\nfi
\ndone
\n\u597d\u4e86\uff0c\u6211\u4eec\u7684\u8fd0\u884c\u7ed3\u679c\u5982\u4e0b\uff1a
\n119.181.69.96 8080:ok
\n119.181.118.38 8000:ok
\n119.181.20.18 8080:fail
\n119.181.69.37 8080:ok<\/p>\n

\u8f6c\u8f7d\u8bf7\u6ce8\u660e\uff1aIPCPU-\u7f51\u7edc\u4e4b\u8def<\/a> » \u5982\u4f55\u6279\u91cf\u68c0\u6d4b\u7aef\u53e3\u8fde\u901a\u6027\u3001\u7aef\u53e3\u662f\u5426\u5f00\u653e<\/a><\/p>","protected":false},"excerpt":{"rendered":"

\u672c\u6587\u7684\u59ca\u59b9\u7bc7 \u5df2\u53d1\u5e03\u00a0 \u70b9\u51fb\u67e5\u770b\u00a0 \u5982\u4f55\u6279\u91cf\u68c0\u6d4b\u7aef\u53e3\u8fde\u901a\u6027\u3001\u7aef\u53e3\u662f\u5426\u5f00\u653e\uff08\u4e8c\uff09 \u68c0\u6d4b\u7aef\u53e3\u8fd8\u5728\u7528telnet\uff1f\u592a\u843d\u4f0d\u628a \u6709\u6ca1\u6709\u6279\u91cf\u68c0\u6d4b\u7684\u65b9\u6cd5\uff1f\u6709\u7684\u3002\u6211\u4eec\u7528nc\u5c31\u53ef\u4ee5\u5feb\u901f\u68c0\u6d4b\u7aef\u53e3\u7684\u5f00\u653e\u6027\u3002 nc\u68c0\u6d4b\u7aef\u53e3\u7684\u7528\u6cd5 nc -z -w 10 %IP %PORT -z\u8868\u793a\u68c0\u6d4b\u6216\u8005\u626b\u63cf\u7aef\u53e3 -w\u8868\u793a\u8d85\u65f6\u65f6\u95f4 -u\u8868\u793a\u4f7f\u7528UDP\u534f\u8bae \u4f8b\u5982\uff1a [@s136.ipcpu.com ~]# nc -z -w 10 -u 8.8.8.8 53 Connection to 8.8.8.8 53 port [udp\/domain] succeeded! [@s136.ipcpu.com ~]# nc -z -w 10 8.8.8.8 53 Connection to 8.8.8.8 53 port [tcp\/domain] succeeded! [@s136.ipcpu.com ~]# echo $? [@s136.ipcpu.com ~]# nc […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[13],"tags":[17],"_links":{"self":[{"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/posts\/237"}],"collection":[{"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/comments?post=237"}],"version-history":[{"count":0,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/posts\/237\/revisions"}],"wp:attachment":[{"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/media?parent=237"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/categories?post=237"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/tags?post=237"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}