Skip to content

Instantly share code, notes, and snippets.

@garrett
Last active August 29, 2015 14:15
Show Gist options
  • Save garrett/7952f9eb56ea837b9b00 to your computer and use it in GitHub Desktop.
Save garrett/7952f9eb56ea837b9b00 to your computer and use it in GitHub Desktop.
discover local jetdirect printer IP addresses
#!/bin/sh
#
# A short script to discover HP JetDirect-enabled printers on your local network
#
# Requires: nmap, route, awk, grep
#
# On Fedora/RHEL/CentOS, you can install dependencies with:
# sudo yum install -y nmap net-tools curl gawk
#
# (Most of these commands will most likely be already installed.)
nmap --open -n -p 9100 `route | grep default | awk -e '{print $2}'`/24 | grep "scan report" | awk -e '{print $5}'
@garrett
Copy link
Author

garrett commented Feb 12, 2015

To use this on Fedora/RHEL/CentOS, you'll want to make sure dependencies are installed, by running a command like so:

sudo yum install -y nmap net-tools curl gawk 

You most likely will have many of the commands already installed, except for nmap.

Other distributions should do something kinda similar, but with whatever applicable package management system (such as apt-get, pacman, brew, etc.).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment