Hi all. I noticed that there was some heavy discussion on local network scanning techniques using WebSockets. The ability to do these things exist from way before the WebSocket era though.
In the shared link you can find a demo that I made in 2011 that allows you to print directly to many local network printers. I tried it today, and it still work in both Firefox and Chrome. It uses an XMLHttpRequest to send a request to printers on port 9100. Most printers will receive the HTTP request and parse it as a raw print job. In normal cases, the printer will just print the HTTP headers, however I use some control characters to escape to the PJL (print job language) world, where I reset the page by drawing a blank box over the headers and move the cursor to the top left. Besides PJL, it is possible to send postscript data as well.
This is extremely scary, as most printers allow you to perform firmware updates and more over PJL. But, as the Chromium team told me in 2011, this WONTFIX as it is the fault of your printer for being insecure.
On today's edition of "Things You Shouldn't Be Able To Do From a Browser"...
Seriously though, sending PJL commands directly to printers on port 9100 is such a neat hack. Back when I was working help desk in college, much fun was had the day I discovered you could change the "READY" string on HP printer displays to anything you wanted. "INSERT COIN", "CHECK ENGINE", etc.
Haha that's actually how I got started with this project. We had some printers with character displays, and I was creating small C programs that opened a socket to the printer to update the display. Used it to play pranks on my sister. At some point I wondered if it was possible to do it with HTTP requests and a PJL payload in the body.
In the shared link you can find a demo that I made in 2011 that allows you to print directly to many local network printers. I tried it today, and it still work in both Firefox and Chrome. It uses an XMLHttpRequest to send a request to printers on port 9100. Most printers will receive the HTTP request and parse it as a raw print job. In normal cases, the printer will just print the HTTP headers, however I use some control characters to escape to the PJL (print job language) world, where I reset the page by drawing a blank box over the headers and move the cursor to the top left. Besides PJL, it is possible to send postscript data as well.
This is extremely scary, as most printers allow you to perform firmware updates and more over PJL. But, as the Chromium team told me in 2011, this WONTFIX as it is the fault of your printer for being insecure.