My wife has discovered just how much money she can save shopping for our groceries using all of the coupons she has found online. There are entire communities of people who follow and report on the deals you can find. The only problem for her has been that many of the coupons she has found require a special application by the coupon.com folks. The application is Windows/OS X only, and she runs Ubuntu.
Since I’m the one with the MacBook, it has become my duty to print the coupons that she forwards along to me. I was happy to see there was an OS X version of the app, and installed it, only to find out the following:

Well that’s sort of annoying. It just sends the job right off to the default printer, without asking about anything beforehand. What’s worse for me is that it won’t “print” to a “graphic format like a PDF”. A large percentage of my time, I’m not on a network with a printer, so I typically print things to postscript (.ps) files (bravo to Apple for building this into the OS and making it so easy). When I want the hardcopies, I just tar them up and send them to a shell account on a server where I do have access to a printer.
Since this app doesn’t give me the usual printing dialog box with the option to “print to .ps”, I just had to hack together something. I created a new printer in “System Preferences”->”Print & Fax”, with the following settings:

I then set this as my default printer. Next, I set up a netcat listener to listen on the JetDirect port (9100), wait for a print job, and dump the incoming postscript to a file:
nc -l 9100 > output.ps
Once netcat is running and listening, you can print to the printer that you set up, and the result is a postscript file that you can then view, convert, print, etc. It’s a pretty simple and painless procedure, if you’re dealing with an app that doesn’t play nicely with the printer dialog box.

I’m so glad you figured out how to do this! Thanks for printing my coupons, you’re the best hubby ever!
Nice technique. I can see this being useful in a penetration test as well. Disable the printer (turn it off, DoS it, etc..) then assume it’s IP address and sit with a NetCat listener on port 9100 and just gather up all the documents coming to the queue. The possibilities are endless… change the printer IP and do a MitM attack against printouts.
[...] trying to solve. However, as a commenter points out, what a great way to grab data in a pen test McGrew Security Blog >> Blog Archive >> Pretending to be a Printer with Netcat Tags: ( mitm printer netcat [...]
nice have to remember this when I need to print something
Wesley,
Great post! I will give that a try this weekend!
Ed