A particular useful feature of Shodan is that we don't need to open a web browser to use it.
There is also a command line interface client that can be used to make requests using the Shodan
API. To install the Shodan client, we'll need to have a working Python installation which is available
on any modern Linux distribution.
Then, we’ll install the client using pip. If Pip is not installed on your Linux you install it by executing
apt install python3-pip
As root I’ll run: pip3 install shodan
And It’s installing the shodan CLI client. In my example it's already installed.
Note that you install the CLI client the same way on Windows or Mac.
Now we can see all available options by typing Shodan-hash
In order to use the client
we have to firstinitialize it using an API key. Each account has its own unique API key and you can
find it on the shodan website under my account.
Of course you need to be logged in with a free or paid account.
This is my API key.
I'm copying the key and then in the command line I'm executing
shodan init and I'm pasting the key
and it has successfully initialized.
Now we can properly use the client.
Let's see some examples!
shodan counts a search term like this: shodan count "Chromecast:"
Let's see how many Chromecast devices are on Shodan; so there are 76364
Chromecast devices on Shodan. By the way Chromcast is a streaming media adapter from Google
that allows users to play online content such as videos and the music on a TV.
Many smart TV devices have Chromcast built in. Let's search for Chromcast devices shodan search
"Chromecast:"
and these are all Chromcast devices found on Shodan; if we want to see just a few fields we use
this command shodansearch
--fields and the fields
I want to see IP_str, port, org and host names.
It will display only these 4 fields.
the IP, the por,t the organization and the hostname.
Unfortunately in order to use complex filters in the Shodan CLI a premium account is required. Let's
find more information about such a device, about this one. So shodan host and the IP address
and it displayed information about that Chromcast device.
You can also run shodan stats and search query.
It will display statistics.
You can see that the most Chromcast devices are in South Korea.
And shodan my IP prints out your own external IP address.
Then you can search for that IP address on Shodan to see if there is any vulnerable device that
is accessible at your IP address.
It also includes devices inside the LAN with port forwarding enabled.