Impromptu capture of Command Line Session or parts thereof in OS X
I was checking out a great new app from the app store, airview by Clement Vasseur.
The basic concept is use of Apple airplay technology to display content from OS X computers or iDevices on other iDevices connected to the same local wireless network.
How cool would it be if when I have video on my macbook, iPad, Touch, or iPhone4 that I want to show somebody, they can view it right on their own iDevice?
If anyone is going to use this app, IT MUST BE SIMPLE, essentially zero config like the iDevice to AppleTV connection. Here is how it works:
- Your device notifies the network of availability, just like AppleTV
- I load a video on my Macbook or iDevice
- I click in the video controls to summon a list of push targets
- I click your device in the list
- The video appears on your device. <link to more on that >
It works very well.
I was curious how Clement implemented this at the tcp/ip level. That means a packet dump. I didn't have time for thorough investigation at that moment, so I needed to save the results.
The classic way is open a terminal window, sudo to an account with admin privileges, run tcpdump with a pipe out to a file, make a new airview connection, close the cli, make note of the file.
As I was already in the middle of an admin command line session, why start a new one from scratch? There is no need.
In OS X, I just ran the tcpdump in the current session, then did a cut and paste of the relevant information from the terminal window to a text file. From the Terminal window:
- Command-A to copy entire cli session to clipboard.
- Open textedit
- Command-V to paste the cli session into the textedit window
- Save the textedit file for later review of the specifics of the tcpdump
A relevant line from the packet dump --
-08:01:40.423780 IP6 (hlim 255, next-header UDP (17) payload length: 367) doug-brethowers-ipad.local.mdns > ff02::fb.mdns: [udp sum ok] 0*- [0q] 5/0/4 Doug BrethowerM-bM-^@M-^Ys iPad._airplay._tcp.local. (Cache flush) TXT "deviceid=D8:30:62:8E:56:BC" "features=0x7" "model=iPad1,1", _services._dns-sd._udp.local. PTR _airplay._tcp.local., _airplay._tcp.local. PTR Doug BrethowerM-bM-^@M-^Ys iPad._airplay._tcp.local., Doug BrethowerM-bM-^@M-^Ys iPad._device-info._tcp.local. TXT "model=K48AP", Doug BrethowerM-bM-^@M-^Ys iPad._airplay._tcp.local. (Cache flush) SRV Doug-Brethowers-iPad.local.:50726 0 0 ar: Doug-Brethowers-iPad.local. (Cache flush) AAAA fe80::da30:62ff:fe8e:56bc, Doug-Brethowers-iPad.local. (Cache flush) A 192.168.1.101, Doug-Brethowers-iPad.local. (Cache flush) NSEC, Doug BrethowerM-bM-^@M-^Ys iPad._airplay._tcp.local. (Cache flush) NSEC (359) --
If "by your command" sounds vaguely familiar, it was the oft recited mechanical communication of Cylon warriors to their imperious leader(s) in the Battlestar Galactica TV series.
