Skip to content

Instantly share code, notes, and snippets.

@TheArchivistsDomain
Created August 29, 2022 09:52
Show Gist options
  • Save TheArchivistsDomain/2b769ee6f20702ced7d29d2afa72cd99 to your computer and use it in GitHub Desktop.
Save TheArchivistsDomain/2b769ee6f20702ced7d29d2afa72cd99 to your computer and use it in GitHub Desktop.
Convert Shodan's json files to a txt list for feeding into other programs.
import json
from sys import argv
if len(argv) != 2:
print("Usage: python3 shodan2list.py <filename>")
exit(0)
with open(argv[1]) as f:
str_list = list(filter(None, f.read().split("\n")))
for host_json in str_list:
host = json.loads(host_json)
print(f'{host["ip_str"]}:{host["port"]}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment