Skip to content

Instantly share code, notes, and snippets.

View kryptek's full-sized avatar

Alfred Moreno kryptek

  • Amazon Web Services
  • Seattle, WA
View GitHub Profile

Creating a dynamic site-to-site VPN with OpenSwan on Ubuntu 10.04 on EC2

Wes Winham winhamwr@gmail.com

There are many tutorials floating around the web that almost get you a dynamic VPN in EC2. The goal of this tutorial is to be a one-stop-shop for this specific setup.

@kryptek
kryptek / elb-describe.py
Created December 11, 2013 17:14
Retrieve an EC2 Load Balancers instances and their health status using python
import boto
import sys
ec2 = boto.connect_ec2()
elb = boto.connect_elb()
load_balancer = elb.get_all_load_balancers(load_balancer_names=[sys.argv[1]])[0]
health = load_balancer.get_instance_health()
instances = ec2.get_only_instances(instance_ids=[instance.id for instance in load_balancer.instances])
@kryptek
kryptek / bootstrap.sh
Created October 7, 2017 15:55 — forked from shostakovich/bootstrap.sh
Chef Solo on Mac OS X - examples
#!/bin/sh
USERNAME=shostakovich
mkdir ~/tmp
cd ~/tmp
# Install GCC + Git
curl https://github.com/downloads/kennethreitz/osx-gcc-installer/GCC-10.7-v2.pkg > GCC-10.7-v2.pkg
sudo installer -pkg GCC-10.7-v2.pkg -target /
@kryptek
kryptek / ssh-agent-forward.md
Created August 18, 2017 17:42 — forked from toejough/ssh-agent-forward.md
SSH Agent Forwarding in Python: Paramiko's undocumented API

What

A how-to for ssh-agent forwarding via Paramiko. Specifically, I used Paramiko v1.15.2 in this example.

Why

Paramiko's docs do not document the API required to do ssh-agent forwarding. I ended up finding out how by reading pull requests for ssh-agent forwarding features in frameworks that use Paramiko under the covers, like fabric and ansible.

Update:

Besides attempting to document this process here, I've opened a bug with Paramiko to document this API in their official docs.

How

@kryptek
kryptek / install_mosh_locally.sh
Created October 3, 2016 18:11 — forked from xiaom/install_mosh_locally.sh
install mosh locally
#!/bin/sh
# this script does absolutely ZERO error checking. however, it worked
# for me on a RHEL 6.3 machine on 2012-08-08. clearly, the version numbers
# and/or URLs should be made variables. cheers, zmil...@cs.wisc.edu
mkdir mosh
cd mosh
@kryptek
kryptek / rails_omakase.rb
Created April 8, 2016 18:01 — forked from postmodern/rails_omakase.rb
Proof-of-Concept exploit for the new Rails Remote Code Execution vulnerability (CVE-2013-0333)
#!/usr/bin/env ruby
#
# Proof-of-Concept exploit for Rails Remote Code Execution (CVE-2013-0333)
#
# ## Advisory
#
# https://groups.google.com/forum/?fromgroups=#!topic/rubyonrails-security/1h2DR63ViGo
#
# ## Caveats
#
@kryptek
kryptek / Kai32.bas
Created February 16, 2016 20:55 — forked from derv82/Kai32.bas
VB6 module for "interacting" with America Online (AOL). Developed between 1998-2000 when I was 15.
Attribute VB_Name = "Kai32"
'-=====================================================-
' -= +------------------------------------------------+ =-
' -= | |\ =-
' -= | |¯¯|\ |¯¯|\ |¯¯|\ |¯¯¯¯¯¯|\ |¯¯¯¯¯¯|\ |\\ =-
' -= | | |\/ /\| |__|\||__|| |\||___ |\| |\\| =-
' -= | | |/ /\/ |¯¯¯¯¯|\ \\\\| \\|¯ |\| /¯¯___/\| |\\| =-
' -= | | /\/ | |\||¯¯|\ |¯¯|| |\|| ¯¯¯|\ |\\| =-
' -= | | \/ | | |\|| |\||______|\||______|\| |\\| =-
' -= | | |\ \ | |\|| |\| \\\\\\\\| \\\\\\\\| |\\| =-
require "cgi"
class AkamaiTokenConfig
attr_accessor :window, :session_id, :data, :salt, :field_delimiter, :early_url_encoding, :ip
attr_reader :start_time, :hash_strategy, :acl, :url
def initialize(config={})
@ip = ''
self.start_time = Time.now.to_i
self.acl = '/*'
@kryptek
kryptek / gist:5460348
Last active December 16, 2015 15:59 — forked from bkimble/gist:1365005
#!/usr/bin/env ruby
require 'net/telnet'
require 'terminal-table'
tbl = Terminal::Table.new headings: %w(id expires cache_key bytes)
localhost = Net::Telnet::new("Host" => "localhost", "Port" => 11211, "Timeout" => 3)
matches = localhost.cmd("String" => "stats items", "Match" => /^END/).scan(/STAT items:(\d+):number (\d+)/)
slabs = matches.inject([]) { |items, item| items << Hash[*['id','items'].zip(item).flatten]; items }
@kryptek
kryptek / EXAMPLE-socket.py
Created November 19, 2015 22:07 — forked from mtearle/EXAMPLE-socket.py
npyscreen EXAMPLE of a socket connection updating widgets
#!/usr/bin/env python
import npyscreen, curses
# Incorporates code
# from http://www.binarytides.com/python-socket-server-code-example/
# Socket server in python using select function
import socket, select
class MyTestApp(npyscreen.NPSAppManaged):
# socket code