How to: Shodan

Modified on: Mon, 3 Aug, 2020 at 11:28 PM

: Used by pentesters, researchers and data scientists everywhere to analyze information about computers on the Internet. From webcams to SCADA to looking at where various SSL information in certificates can tie organisations together. It is a common tool used by many different people.

TL;DR -- You can find the Shodan Transforms in the Transform Hub. To use all of the different Transform options (or you can stick with the free options), click on Settings in the Transform Hub after installing to add your API key. 

Numerous Transforms have been written for Shodan, however, upon studying the information provided by Shodan and examining how it could be integrated into the needs of Maltego users. Her is one example:

IP Information

Taking an IP address, users can identify various pieces of information for that IP address, these are broken down into the following:

  • Service - A service is an application running on a particular port and is represented as <port>:<banner> in a new maltego.Service entity. If the banner is unknown the text "<unknown>" is displayed.
  • Hostnames - Any hostnames enumerated by Shodan will be displayed. Most often this is the reverse DNS for the IP address.
  • Owner Details - This will return two phrases (unless they are the same), one for the ISP and one for the organisation identified by Shodan.
  • Location - If GPS and Location variables have been identified these will be returned as one or two different entities.
  • AS -  Returns the AS number for the IP address in question.

With this kind of information and the power of Maltego it means you can easily do link analysis across a large number of IP addresses (and later networks!) ... fantastically. Graphing information such as common services, owners or locations means that even if the machines you are investigating/targeting are on disparate networks you can find connection between them. It is of course still up to the analyst to identify if the connections are valid or not. 

An example of this could be something like looking at the infrastructure of the NSA (starting with and performing a simple footprint with Maltego ( Domain -> DNS -> IP Addresses). Once we have the IP addresses we can run the "To Shodan Details" Transform and see the following:

From here we can switch to 'bubble view' (replaced in M4) to get an idea of the most common nodes, and we see the usual suspects, Layer 3 communications (a T1 provider ), the AS used and a number of machines running what looks like webservers:

Above example shows the ability to correlate - however it may be even more interesting to look at machines that did not match the more common nodes. Looking at these you can quickly identify 'the odd one out':


The ability to send a netblock to Shodan and have it return IP Addresses it has found within a particular range is phenomenally useful. As such we have included this Transforms within the pack! What it gives you is the ability to take a large network space (think multiple Class A/B's) and have only a small subset of that returned. This is usually interesting as the results returned show only the populated space in the netblock -- Shodan does the pre-scanning for you!Keeping with our previous example of the NSA, if we take a handful of IP addresses within the 8.44.101.x network space found previously: - remoteoffice1.nsa.gov8.44.101.8   - smtp.nsa.gov8.44.101.9   - smtp.nsa.gov8.44.101.5   - -   - -

If we now run the Transform "To Netblock [Using natural boundaries]" to get the  class C those are in (or do it manually), which returns 

From here you can run to "toIPs [Shodan]" and you will see the following in the ouput window:

As you can see from this example we're using a free API key and our results are limited to 100 but you can use your own paid-for key to get all the results available! Even with just the first 100 results (of 198) it means we have already managed to narrow down our space further.

Now we can look at the results and perform tasks such as looking at the reverse DNS names (with the Transform "To DNS Name [Reverse DNS]") and already get new DNS names we previously did not find such as emvm-gh1-uea08.nsa.govand

Service/Port Splitting

One thing you might notice about the first example is that there is a service entity returned that contains the details in the format of <port> : <service> . There are two additional Transforms included in the Shodan Transform Hub item that will break these apart into the various ports and services. This allows you to quickly visualize which ports and applications are more commonly used.If we look at an example quickly mapping to DNS, then to IP addresses as we did above we see something like the following:

From here however it becomes more interesting as we can take each of the services to a port and banner and within bubble view examine the common infrastructure on a port and service level:

Typically you would see something like the graph above where there are a lot of port 80's running an HTTP of some kind, but it is interesting to see things like port 81,82,83 and 84 as well. In this case these all seem to be a standard webmail configuration. A graph like the one above however is filled with additional interesting artifacts.

Further Port Manipulation

From a port entity (either in your existing graph or dragging it in from the palette) you can also run Transforms that identify other IP addresses running services on that port. For example if we look at S7 devices (from we can see that they generally run on port 102.In Maltego we add the port to our graph and run the Transform to IPs From Port [via Shodan]. This gives us the option of adding additional terms in the query (that might be found in the response) as well as the country code as seen below:

From here we get a number of results back for IP addresses that have services running on port 102. We can then take each of these services to the details for those IP addresses and visualize the results to identify commonality between them. Here we can see that a lot of the machines running the Siemens S7 devices on port 80 also have VNC listening on port 5900.

Native Shodan Queries

In addition to the above queries we have also included the ability to search for your own custom terms or use a more guided version of the Transform.

The first is the advanced search - this Transform will send the terms you specify in a phrase entity directly and unmodified to Shodan. For example if you started with the phrase "National Security Agency" and wanted to see all results that contained that exact string you could run the "to IPs via Shodan [Advanced Search]" Transform. This would return the following:

You can also see in the detail view that the text Basic realm="National Security Agency" is seen within the IP address highlighted. You can view additional key terms used by exploring the Shodan API documentation at and viewing the keywords available under the  /Shodan/Host/Search heading.

If you would prefer to be guided through the four terms we use (ssl, hostname, org and isp) you can run the Transform "to IPs via Shodan [Basic]" which will allow you to specify the terms you want. You can use a space ( " " ) for terms you wish to exclude. 

Note: The free API will only allow you to use one term at a time. To use more terms you need your own API key.

Let's see how this works. If you used the phrase "NSA Search" (remember this can be anything as we are doing the basic search), and you filled in the terms as shown below when running the Transform "to IPs via Shodan [Basic]":

You would receive the following in your response:

Here you can now run the standard IP to Shodan details to get the details of each of these IP addresses, and as we were searching for any DNS Name containing we get the following out: 

...list truncated...

Keep in mind that Shodan returns *anything* that contains the word - so entries like are also returned!

Domain Queries

The last two Transforms are more an incorporation of the previous ones where we will use two specific Shodan keywords (namely 'ssl' and 'hostname') to search through any results found for additional DNS records that we might not have seen before using the other DNS transforms. These are very useful, especially with certificates (the SSL keyword) to find specific machines on the Internet.

If we run the two Transforms we get a nice subset of DNS names (that we had also seen before) with just two simple Transforms (To DNS Names [Via Shodan]and To DNS Names SSL [Via Shodan]) -- Abracadabra! 

Adding Shodan Transforms:
To add the Shodan Transforms it's as simple as going to the Transform Hub item and clicking on "Install":

API Keys: Shodan API keys are free with limitations for any user on the Shodan website and registration is completely free.

The limitations of the free API key are as follows:

  • Only the first 100 results per query
  • Advanced keywords can only be used one at a time (ie you cannot search for a DNS name within a particular country).

Registered users (a once off fee) do not have these limitations (apart from a certain number of lookups per month on a

registered key) and the project is really useful so we would encourage you to signup.

To add your API key click on Settings within the Transform Hub and enter your API key.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.