0
from shodan import WebAPI

SHODAN_API_KEY = "MY API KEY"
api = WebAPI(SHODAN_API_KEY)

results = api.exploitdb.search('PHP')

print 'Results found: %s' % results['total']
for exploit in results['matches']:
        print '%s:' % (exploit['description'])

如何将搜索限制为仅打印前 5 个结果?

4

2 回答 2

5
for exploit in results['matches'][:5]:
        print '%s:' % (exploit['description'])
于 2011-04-12T07:40:13.440 回答
0

花点时间学习有关列表和“切片”的 Python 基础知识:

http://diveintopython.ep.io/native-datatypes.html

于 2011-04-12T07:44:25.317 回答