Skip to content

Instantly share code, notes, and snippets.

View VariableExp0rt's full-sized avatar

Liam VariableExp0rt

View GitHub Profile

Keybase proof

I hereby claim:

  • I am variableexp0rt on github.
  • I am thehappypeasant (https://keybase.io/thehappypeasant) on keybase.
  • I have a public key ASBi14O3Nf1jQmpc-L5peCbK-7z4fTultRG8zXJoxY5ulwo

To claim this, I am signing this object:

@VariableExp0rt
VariableExp0rt / guardduty_findings_csv.py
Created November 30, 2020 20:00
A Python script to automate exporting GD findings to CSV format.
import json
import botocore
import boto3
import pandas
from datetime import datetime, timezone, timedelta
# https://github.com/boto/boto/issues/
# https://austincloud.guru/excluding-disabled-regions/
@VariableExp0rt
VariableExp0rt / new_mfa_session.py
Created December 6, 2020 18:44
Quick script to export AWS credentials that are MFA authenticated
import boto3
import sys
import os
import json
import argparse
#if you need to change the default profile export the profile to the env var AWS_PROFILE before running this script OR
# change like so boto3.setup_default_session(profile_name='<profile name>')
parser = argparse.ArgumentParser(description='Process flags.')
@VariableExp0rt
VariableExp0rt / asynchronous_guardduty_findings_processing.py
Created December 6, 2020 21:05
A first delve into Coroutines with asyncio for grabbing GuardDuty findings from all regions concurrently
import asyncio
import boto3
import boto3.session
import threading
import time
from pprint import pprint
from botocore import exceptions
from datetime import timedelta, timezone, datetime
def getAvailableRegions(service):
@VariableExp0rt
VariableExp0rt / concurrency_test.py
Last active December 10, 2020 08:22
concurrency_test.py
import boto3
import boto3.session
import threading
import time
import concurrent.futures
from pprint import pprint
from botocore import exceptions
from datetime import timedelta, timezone, datetime
def getAvailableRegions(service):
import boto3
from pathlib import Path
from botocore.exceptions import ClientError
client = boto.client('iam')
def disable_key(username):
try:
res1 = client.list_access_keys(UserName=username)
@VariableExp0rt
VariableExp0rt / cfn-stackset-waiter.go
Last active January 16, 2021 18:31
A quick program to create a template from code, marshal to JSON using goformation and implement a waiter for each stackset instance
package main
import (
"fmt"
"os"
"sync"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/endpoints"
@VariableExp0rt
VariableExp0rt / download-filter-files.py
Created January 19, 2021 17:06
Quick script to download files from S3 based on their last modified date, useful for pulling CloudTrail files concurrently - change bucket (33) and prefix (28) before running
import boto3
from boto3.s3.transfer import S3Transfer
from boto3.s3.transfer import TransferConfig
from concurrent.futures import ThreadPoolExecutor
from concurrent import futures
import logging
from datetime import datetime, timedelta
boto3.set_stream_logger('boto3.resources', logging.INFO)
import boto3
import botocore
from botocore.exceptions import ClientError
ACCOUNT = ''
## Check security groups for any egress or ingress rules that have a CIDR range of 0.0.0.0/0 for any protocol
## Have included all protocols, as filter match is logical OR and wouldn't filter all
import boto3
import botocore
import argparse
import sys
###############################################################
# Usage: change IdentityStoreId to suit your use case #
# change the Attribute Value to a list of all users #
# change InstanceArn to suit your usecase #