awk - 如何在tshark功能tshark管道后添加管道

标签 awk sed pipe tshark

我想用tshark找到不是我的目标或源 IP。为此,我使用( ip-ifconfigifconfig 给出我的 ip)

# tshark -T fields -e ip.addr -E aggregator=" " | sed "s/$(ip-ifconfig)//"
tshark: Lua: Error during loading:
 [string "/usr/share/wireshark/init.lua"]:44: dofile has been disabled due to running Wireshark as superuser. See https://wiki.wireshark.org/CaptureSetup/CapturePrivileges for help in running Wireshark as an unprivileged user.
Capturing on 'wlp3s0'
**5500** 

我得到捕获的数据包的数量。我想要IP。

可能必须使用 awk 来操作输出.

此命令的输出没有带 sed 的管道是一个 IP 列表

最佳答案

我在找 tshark -l .

 -l        Flush the standard output after the information for each packet is printed.  (This is not, strictly speaking, line-buffered if -V was specified; however, it is the same as line-
           buffered if -V wasn't specified, as only one line is printed for each packet, and, as -l is normally used when piping a live capture to a program or script, so that output for a
           packet shows up as soon as the packet is seen and dissected, it should work just as well as true line-buffering.  We do this as a workaround for a deficiency in the Microsoft
           Visual C++ C library.)

           This may be useful when piping the output of TShark to another program, as it means that the program to which the output is piped will see the dissected data for a packet as soon
           as TShark sees the packet and generates that output, rather than seeing it only when the standard output buffer containing that data fills up.

关于awk - 如何在tshark功能tshark管道后添加管道,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39900145/

相关文章:

python - 比较两个文件的两个字段,如果不匹配则打印

sed - 如果找到,如何根据模式获取特定行

bash - sed-style 用随机字母替换字母,用随机数替换数字

shell - 如何在关键字搜索匹配后的行前添加注释 (#)

c++ - 如何以正确的格式沿第二条管道发回数据?

bash - 使用管道时修改文件的最佳方法?

shell - 命令来验证管道中的输入然后将其传递?

linux - 如何使用 sed 删除从第一行开始到遇到模式 '[ERROR] -17-12-2015' 之前的行?

linux - 使用 sed、awk 和 xargs 切片 3TB 日志文件?

bash - 将连续的两行合并为一行(寻求一种也适用于 Windows 文件的解决方案)