如何在wireshark中仅导出可打印文本(或任何其他数据包属性)
长话短说 - 我正在使用 Wireshark 将 SQL 从供应商工具捕获到 Oracle 数据库。它已经有 TNS 协议的解码器(这很棒),我可以通过以下方式访问 SQL 文本。
Right Click->Copy->Bytes(Printable Text Only).
问题是有大量数据包,右键单击每个数据包可能需要很长时间。我想知道是否有任何方法可以直接从 Wireshark 导出“仅可打印文本”。理想情况下,我想要一个包含语句的文本文件。
任何帮助将不胜感激。
Long story short - I'm capturing SQLs from vendor tool to Oracle database by using Wireshark. It already has decoder for TNS protocol (which is great) and I can access text of SQL by
Right Click->Copy->Bytes(Printable Text Only).
The problem is that there are tons of packets and doing right-click on each of them could take ages. I was wondering if there any way to export 'Printable Text Only' right from Wireshark. Ideally I want to have a text file with statements.
Any help will be highly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
终于找到办法做到这一点。首先,使用 tshark 捕获 tns 数据包:
然后您可以使用下面的 homebrew Ruby 脚本将字节转换为文本:
示例如下:
将仅从输入导出可打印文本到输出
将导出从输入到输出的所有文本
Finally found away to do this. First, use tshark capturing tns packets:
Then you could use home brew Ruby script below to transform from bytes to text:
Examples are:
will export printable text only from input to output
will export all text from input to output
查看对我有用的所有内容的一种简单方法就是右键单击 ->遵循 TCP 流。
注意:不可打印的字符显示为
.
。如果您想要提取的所有文本之间散布着一堆这样的内容(就像我一样),请将其切换为ASCII
,保存并在您最喜欢的文本编辑器(对我来说是 vim)中打开它),然后运行搜索并替换,类似于/\.//g
。An easy way of looking at them all that has worked for me is just
Right Click -> Follow TCP Stream
.A note: unprintable characters are displayed as
.
s. If there are a bunch of these interspersed between all the text you want to extract (as there was for me), switch it toASCII
, save it and open it in your favourite text editor (vim for me), then run a search and replace similar to/\.//g
.我不知道如何用 TNS 做到这一点。但是您可以使用 tshark 执行类似的操作,例如查看 http 请求。
tshark -T fields -e http.request.uri
因此,如果您可以查看 TNS 解码器中的选项,您应该能够获取该字段并将输出重定向到文件。
I don't know how to do it with TNS. but you can do something like this using tshark, for example to look at http requests.
tshark -T fields -e http.request.uri
So if you can look at the options in the TNS decoder, you should be able to grab that field and redirect the output to a file.