'how to writing a script in shodan (python)

I need help please write a script for Shodan. I have a lot of IP addresses on the monitor. I want to write a script that output from the API monitor: All the vulnerabilities and IP addresses that are vulnerable to the CSV file

Thanks



Solution 1:[1]

The easiest approach would be to use the Shodan CLI to download all information about your monitored IPs then either parse out the banners that you care about or convert it to a CSV. For example:

# Download all the data and store it in the file called "mydata.json.gz"
$ shodan alert download mydata.json.gz

# Convert the Shodan data file to CSV
# Note: the CSV will contain fewer properties than the JSON file
$ shodan convert mydata.json.gz csv

You can also look at the Python code for the above shodan alert download command to see how the Shodan CLI grabs the list of IPs. You could modify that code so it only downloads information about IPs that have vulnerabilities by checking if there is a vulns property on the banner.

Additional References

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 achillean