admin管理员组文章数量:1389777
we have 7 million of security hub findings and I'm trying to fetch these by using boto3 securityhub get_findings()
method but as the number of findings is huge it is taking lot of time.
import boto3
securityhub_client=boto3.client('securityhub')
def get_all_findings(securityhub_client):
nexttoken=""
inspector_findings=[]
while True:
try:
if nexttoken:
findings=securityhub_client.get_findings(
NextToken=nexttoken,
maxResults=100,
Filters={
'ProductName':[
{
'value':'Inspector',
'Comparison':'EQUALS'
},
],
}
)
inspector_findings.extend(findings['Findings'])
nexttoken=findings.get('NextToken')
if not nexttoken:
break
except Exception as e:
print('Some issue occurred',e)
break
return inspector_findings
all_findings=get_all_findings(securityhub_client)
print("all findings",all_findings)
here the code is executing successfully but it's taking a lot of time. what is the best way to get all the 7m findings?
I can't use any other filters other than ProductName as Inspector as I need all the securityhub findings of the inspector.
本文标签: pythonHow to get millions of security hub findings using boto3Stack Overflow
版权声明:本文标题:python - How to get millions of security hub findings using boto3 - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744684101a2619591.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论