读取时的linux FIFO block

标签 linux fifo netcat mkfifo

我正在 https://exploit-exercises.com/protostar/ 上做 net0 练习.练习的内容是将请求的数字作为 little endian 32bit int 发送到服务器。我想到了以下命令行。

mkfifo /tmp/pipe  
cat /tmp/pipe | netcat 127.0.0.1 2999 |tee -a /tmp/log | cut -d ' ' -f 3 | xargs -I{} python -c "import struct; print struct.pack('I',int({}))" > /tmp/pipe

第二个命令行没有完成,我发现 cat/tmp/pipe 在使用 strace 进行调试时阻塞读取(而不是打开)。

最佳答案

我找到了原因。当输出不是终端时,cut 将缓冲输出。 python print 也需要刷新。 https://unix.stackexchange.com/a/226675/194577

关于读取时的linux FIFO block ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49848626/

相关文章:

linux - Netcat反向shell

java - Expectj - 获取在此 session 期间在 spawn 的标准输出上收到的所有内容

php - 使用 Lynx 在 CentOS 中运行 PHP 脚本

scala - Scala 中有 FIFO 流吗?

C程序从FIFO中读取数据

linux - ncat web服务器如何获取请求参数和客户端ip

shell - 通过 netcat session 的 vi

linux - 通过 SSH 在 CentOS5 上安装 TexLive

linux - Bash 中的进程池

delphi - 如何设计可变数据大小的 FIFO 队列?