用到shodan模块
话不多说,马上开始
pip3 install shodan
import shodan
SHODAN_API_KEY=" 你的shodankey"
api = shodan.Shodan(SHODAN_API_KEY)
try:
results=api.search("3389")
print ('Results found: %s' % results['total'])
for result in results['matches']:
print ('IP: %s' % result['ip_str'])
print (result['data'])
print ('')
except shodan.APIError as e:
print ('Error: %s' % e)