Skip to content

Instantly share code, notes, and snippets.

View jmhale's full-sized avatar

James Hale jmhale

View GitHub Profile
@jmhale
jmhale / get-container-ports.sh
Created May 3, 2019 11:22
Gets listening ports inside of a Docker container
CONTAINER_PID=$(sudo docker inspect -f '{{.State.Pid}}' container_name; sudo nsenter -t $CONTAINER_PID -n netstat -ln | grep LISTEN

Keybase proof

I hereby claim:

  • I am jmhale on github.
  • I am jhale (https://keybase.io/jhale) on keybase.
  • I have a public key ASDHkIOQMIqIh7OYC9V4HqwpPaF2RZylhtjLlxoBfro4TAo

To claim this, I am signing this object:

@jmhale
jmhale / gist:5a27833565e5185a4838b2227765b690
Created September 28, 2018 13:12
Get all AMIs in use in AWS
aws ec2 describe-instances | jq -r '[.Reservations[].Instances[].ImageId] | unique[]'
## Temporary VPN for DEF CON
variable "dns_zone" {}
variable "dns_zone_id" {}
variable "ssh_key_id" {}
data "aws_iam_policy_document" "access-defcon-artifacts-policy-doc" {
statement {
actions = [
"s3:GetObject",
## Temporary VPC for DEF CON
variable "defcon_cidr_vpc" { default = "10.170.0.0/16" }
variable "defcon_cidr_private_east_1a" { default = "10.170.1.0/24"}
variable "defcon_cidr_private_east_1b" { default = "10.170.2.0/24"}
variable "defcon_cidr_private_east_1c" { default = "10.170.3.0/24"}
variable "defcon_cidr_public_east_1a" { default = "10.170.11.0/24"}
variable "defcon_cidr_public_east_1b" { default = "10.170.12.0/24"}
variable "defcon_cidr_public_east_1c" { default = "10.170.13.0/24"}
@jmhale
jmhale / aws-reinvent2017-security-talks.md
Last active December 6, 2017 11:46
Links to the AWS re:Invent 2017 Security (SID) sessions. Blatantly stolen from: https://gist.github.com/stevenringo/108922d042c4647f2e195a98e668108a, where you can find the full list of talks.

| Title | Description

@jmhale
jmhale / okta-session-token.py
Created November 16, 2017 11:00
Handles MFA auth to Okta and outputs session_token
""" Handles auth to Okta and return session_token """
#pylint: disable=C0325
import os
from ConfigParser import RawConfigParser
from getpass import getpass
import requests
class OktaAuth(object):
""" Handles auth to Okta and returns SAML assertion """
def __init__(self, okta_profile, verbose):