嗅探 iPhone 和 Mac 之间的 bonjour 流量
我的最终结果是尝试查看在我的 iphone 和 iphone 之间发送的 plist。我的 mac(我知道它是一个 plist,因为我可以在十六进制转储中看到 bplist00
)。
我有一个应用程序通过 bonjour 服务在我的 iPhone 和我的 Mac 之间发送数据。
我使用 tcpdump 捕获流量,并尝试将有效负载 hexdump 转换为二进制文件,然后将其转换为 plist 文本文件。
以下是我的步骤:
- 确保 iphone 和 mac 已连接,准备好发送命令
- 运行 tcp dump: sudo tcpdump -vSs 0 -A -i en1 -w Dump.pcap 'tcp port 57097' 在我的无线网络上(我使用 Bonjour 浏览器 查找服务注册的端口上),然后点击手机上的发送命令。
- 将pcap文件转换为文本文件: tshark -V -r Dump.pcap > Dump.txt(最终结果是这样的)
- 从文本文件中手动删除标题和其他信息这样我就只剩下有效负载了(我们现在在文件中有这个)
- 进行反向十六进制转储来转换文件转换为二进制文件:
xxd -r Dump.txt Dump1.txt
- 将二进制 plist 转换为文本文件:
plutil -convert xml1 Dump1.txt
但是,在第 6 步,事情发生了失败:Dump1.txt:属性列表错误:字符串转换失败。该字符串为空。 / JSON 错误:JSON 文本未以数组或对象开头,并且未设置允许片段的选项。
(尽管这可能是前面步骤中的错误)。我不确定为什么当我要求进行 XML 转换时它会报告 JSON 错误?
这种低级网络捕获不是我通常喜欢的东西(我通常在 fiddler 或 charles 中处于较高的位置,但考虑到这不是通过 HTTP,我需要进入堆栈的较低位置)。
有人可以告诉我我所做的是否正确,或者是否有更简单的方法来做到这一点?
我怎样才能捕获发送到我的 Mac 的 plist?
My end result is to try and see the plist being sent between my iphone & my mac (I know its a plist because I can see bplist00
in the hexdump).
I have an app sending data between my iphone to my mac via a bonjour service.
I use tcpdump to capture the traffic and try and transform the payload hexdump into binary to then convert it into a plist text file.
Here are my steps:
- Make sure the iphone and mac are connected, have the command ready to send
- Run tcp dump:
sudo tcpdump -vSs 0 -A -i en1 -w Dump.pcap 'tcp port 57097'
on my wireless network (I used Bonjour Browser to find what port the service is registered on), then hit the send command on the phone. - Convert the pcap file to a text file:
tshark -V -r Dump.pcap > Dump.txt
(the end result is this) - Manually remove the headers and other info from the text file so that I am just left with the payload (we now have this in the file)
- Do a reverse hex dump to convert the file into binary:
xxd -r Dump.txt Dump1.txt
- Convert the binary plist to a text file:
plutil -convert xml1 Dump1.txt
However, at step 6 is where things fail: Dump1.txt: Property List error: Conversion of string failed. The string is empty. / JSON error: JSON text did not start with array or object and option to allow fragments not set.
(although it could have been a mistake from an earlier step). And I'm not sure why it reports errors on JSON when I have asked for an XML conversion?
This low level network capturing is not something I am normally akin to (I'm normally higher up with fiddler or charles, but considering this isn't via HTTP I need to go lower down the stack).
Can someone please tell me if what I am doing is correct, or whether there is an easier way to do this?
How can I go about capturing the plist being sent to my mac?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的猜测是您的问题出在第 4 步附近,您手动编辑请求。我只是尝试类似的方法,使用 Charles 而不是 tcpdump,并且在我知道包含 plist 的有效负载中得到了完全相同的错误。不知道为什么我们收到 JSON 错误消息。
我能够通过直接将二进制编码的 plist 请求正文从 Charles 保存到文件(Charles 有一个“保存请求”菜单选项),然后运行 plutil -convert xml1 FILENAME -o - 来解决此问题就这样,效果很好。
My guess is your issue is somewhere around step 4, where you manually edit the request. I was just trying something similar, using Charles rather than tcpdump, and got the exact same error with a payload that I knew contained a plist. Not sure why we got the JSON error message.
I was able to resolve it by directly saving the binary-encoded plist request body from Charles to a file (Charles has a "Save Request" menu option), then run
plutil -convert xml1 FILENAME -o -
on it, and it worked just fine.