Python and Shodan 2.0

 I referenced a shodan and terminal in a previous post.  In that post I gave a very basic python script.  In that same link there are instructions on how to obtain your Shodan API Key

I have added some useful functionality to that basic script.  Check out the video below for the code!

Primary Changes:

-Added functionality of displaying output on screen OR exporting output file.

-Script retrieves (IP/Hostname/OS) and appends the data of each asset to a list.  Which you can then choose to display on screen or export to file.

-output file has a delimiter of a single space, which you can then run the following commands to carve up the output file

# cat output.txt | cut -d " " -f 1 (display only IPs)

# cat output.txt | cut -d " " -f 2 (display only Hostnames)

# cat output.txt | cut -d " " -f 3 (display only OS')

# cat output.txt | cut -d " " -f 1,2 (display IPs and Hostnames only)



  1. > 8 million hits in 30 seconds.... that really surprised me! I appreciate the way you break down each piece of the code, and your explanations are easy to follow, like having a conversation. Looking forward to the next one!


Post a Comment

Popular Posts