LINUX.ORG.RU

netcat как получить ответ при использование пайпов


0

1

Если сделать так


test@test-desktop:~/$ nc google.com 80
test
HTTP/1.1 400 Bad Request ( The data is invalid.  )
Via: 1.1 NOV-GW01
Connection: close
Proxy-Connection: close
Pragma: no-cache
Cache-Control: no-cache
Content-Type: text/html
Content-Length: 4022  

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
То ответ приходит на stdout

А если так

echo test | nc google.com 80

То мы получим тишину, как при использование пайпов получить ответ. Спасибо.

★★★★★

taz@salvador ~ $ echo test | nc google.com 80
HTTP/1.0 400 Bad Request
Content-Type: text/html; charset=UTF-8
Content-Length: 925
Date: Thu, 31 May 2012 22:04:06 GMT
Server: GFE/2.0

<!DOCTYPE html>
<html lang=en>
  <meta charset=utf-8>
  <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
  <title>Error 400 (Bad Request)!!1</title>
  <style>
    *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}
  </style>
  <a href=//www.google.com/><img src=//www.google.com/images/errors/logo_sm.gif alt=Google></a>
  <p><b>400.</b> <ins>That’s an error.</ins>
  <p>Your client has issued a malformed or illegal request.  <ins>That’s all we know.</ins>
tazhate ★★★★★
()
Ответ на: комментарий от Dudraug

Отбой. Это в убунте глючный нэткат.

Опередил :)

tazhate ★★★★★
()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.