|
@@ -3,14 +3,17 @@ import json
|
|
|
import sys
|
|
|
cmd='aws cloudtrail lookup-events --lookup-attributes AttributeKey=EventName,AttributeValue=RunInstances --max-results 20 --region us-east-1'
|
|
|
cmds=cmd.split(' ')
|
|
|
-cl=subprocess.run(cmds,text=True)
|
|
|
+cl=subprocess.run(cmds,text=True, capture_output=True)
|
|
|
|
|
|
clstr=str(cl)
|
|
|
lines=clstr.split('\n')
|
|
|
lst=[]
|
|
|
for l in lines:
|
|
|
- print(l)
|
|
|
- if '"EventName": ' in l:
|
|
|
+# print(l)
|
|
|
+ if '"AccessKeyId":' in l:
|
|
|
+ lst.append(l)
|
|
|
+
|
|
|
+ if '"EventName":' in l:
|
|
|
lst.append(l)
|
|
|
|
|
|
print(lst)
|