Skip to content

Instantly share code, notes, and snippets.

View crater9893's full-sized avatar

crater9893

  • Provider of any and all entertainment and diversions
View GitHub Profile
@crater9893
crater9893 / get_windows_password.rb
Created January 30, 2018 08:41 — forked from chalfant/get_windows_password.rb
Ruby script to get and decrypt a Windows instance's Administrator password.
#!/usr/bin/env ruby
require 'optparse'
require 'ostruct'
require 'aws-sdk'
require 'base64'
require 'openssl'
class Passworder
def initialize(args)
parse_opts(args)
@crater9893
crater9893 / setup_monitoring.rb
Created January 30, 2018 08:39 — forked from chalfant/setup_monitoring.rb
Create monitoring metric filters and alarms for CIS Benchmarks for AWS
#!/usr/bin/env ruby
# Implement CIS Benchmarks for AWS Section 3.x
# Details on each benchmark from https://benchmarks.cisecurity.org/downloads/show-single/?file=awsfoundations.100
# name should be in camelcase since we'll use it for filter and alarm names
filters = [
{
benchmark: '3.1',
@crater9893
crater9893 / ec2metadata
Created January 11, 2018 06:16 — forked from coolflame87/ec2metadata
ec2metadata
#! /usr/bin/python
instdata_host = "169.254.169.254"
instdata_ver = "2009-04-04"
instdata_url = "http://%s/%s" % (instdata_host, instdata_ver)
__doc__ = """
Query and display EC2 metadata.
If no options are provided, all options will be displayed
#!/usr/bin/python
# Search for instances based on name tag
# Usage ./instance_search.py webserver
# Prints a hostfile style format
import boto.ec2
import sys
conn=boto.ec2.connect_to_region('ap-southeast-2')
reservations = conn.get_all_reservations(filters={'instance-state-name': 'running', 'tag-key': 'Name'})
for res in reservations:
for inst in res.instances:
@crater9893
crater9893 / ansible-summary.md
Created September 5, 2017 01:55 — forked from andreicristianpetcu/ansible-summary.md
This is an ANSIBLE Cheat Sheet from Jon Warbrick

An Ansible summary

Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)

Configuration file

intro_configuration.html

First one found from of

@crater9893
crater9893 / helpers.sh
Last active November 5, 2017 23:46 — forked from jimfdavies/helpers.sh
AWS CLI helpers
# Get a specific stack output where stack name contains
aws cloudformation --region ap-southeast-2 --profile myprofile describe-stacks --query 'Stacks[*]|[?contains(StackName, `myapp`) == `true`]|[].Outputs[?OutputKey==`DeploymentDns`].OutputValue' --output text
# Security groups that contain 0.0.0.0/0 rules
aws ec2 describe-security-groups --filters Name=ip-permission.cidr,Values=0.0.0.0/0 --output=text | grep SECURITYGROUPS
# Security groups for ElasticSearch
aws ec2 describe-security-groups --filters Name=ip-permission.from-port,Values=9200 --output=text | grep SECURITYGROUPS
wget http://stedolan.github.io/jq/download/linux64/jq
aws ec2 describe-instances --filters "Name=tag:Name,Values=$NAME" \
"Name=instance-state-name,Values=running" \
| jq -r \
".Reservations[] | .Instances[] | .InstanceId" \
aws ec2 describe-volumes --filters \
"Name=status,Values=available" \
| jq -r ".Volumes[] | .VolumeId" \
@crater9893
crater9893 / README.md
Last active November 9, 2017 10:16 — forked from hofmannsven/README.md
My simply Git Cheatsheet
@crater9893
crater9893 / manage-etc-hosts.sh
Created April 3, 2017 23:31 — forked from stvvt/manage-etc-hosts.sh
Bash Script to Manage /etc/hosts file for adding/removing hostnames.
#!/usr/bin/env bash
set -eu
# PATH TO YOUR HOSTS FILE
: ${ETC_HOSTS="/etc/hosts"}
# DEFAULT IP FOR HOSTNAME
DEFAULT_IP="127.0.0.1"
@crater9893
crater9893 / manage-etc-hosts.sh
Created April 3, 2017 23:29 — forked from irazasyed/manage-etc-hosts.sh
Bash Script to Manage /etc/hosts file for adding/removing hostnames.
#!/bin/sh
# PATH TO YOUR HOSTS FILE
ETC_HOSTS=/etc/hosts
# DEFAULT IP FOR HOSTNAME
IP="127.0.0.1"
# Hostname to add/remove.
HOSTNAME=$1