Skip to content

Commit

Permalink
Script for checking
Browse files Browse the repository at this point in the history
  • Loading branch information
Anon-Exploiter committed Sep 26, 2019
1 parent 6c06d72 commit f57ec5b
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions VPC/vpcFlowLogs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/python3

from jmespath import search as queryJson
import botocore
import boto3
import json

def parseJson(query, jsonObj):
return(queryJson(query, jsonObj))

def vpcFlowLogs(clientApiCall):
fetchVPCS = clientApiCall.describe_vpcs()
vpcsID = parseJson('Vpcs[*].VpcId', fetchVPCS)

print("[$] VPC ID\t~ LogDestination\t~ FlowLogId")

for ids in vpcsID:
checkFlowLogs = clientApiCall.describe_flow_logs(Filters=[{'Name': 'resource-id', 'Values': [ids]}])
LogDestination = parseJson('FlowLogs[*].LogDestination', checkFlowLogs)
flowLogId = parseJson('FlowLogs[*].FlowLogId', checkFlowLogs)

if len(checkFlowLogs['FlowLogs']) != 0:
print(f"[#] {ids}\t~ {LogDestination}\t~ {flowLogId}")

else:
print(f"[!] {ids}\t~ Not Enabled\t~ Not Enabled")

def main():
clientCall = boto3.client("ec2")
vpcFlowLogs(clientCall)

if __name__ == '__main__':
main()

0 comments on commit f57ec5b

Please sign in to comment.