Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python2
"""
Author: takeshix <takeshix@adversec.com>
PoC code for CVE-2014-0160. Original PoC by Jared Stafford (jspenguin@jspenguin.org).
Supportes all versions of TLS and has STARTTLS support for SMTP,POP3,IMAP,FTP and XMPP.
"""
import sys,struct,socket
from argparse import ArgumentParser
@adampats
adampats / sample data
Last active August 29, 2015 14:15
rails hashes
@myvariable data:
[{"id"=>"00006-testing-test_00",
"key"=>"00006",
"value"=>
{"_id"=>"00006-testing-test_00",
"_rev"=>"1-217c469e142fab5adbd334540b0246da",
"ApplicationName"=>"testing",
"Environment"=>"test",
"EnvironmentDescription"=>"test",
@adampats
adampats / sorter.js
Created March 31, 2015 04:32
javascript sort array of objects
objs.sort(function(a, b){
return a.name == b.name ? 0 : +(a.name > b.name) || -1;
});
@adampats
adampats / nginx
Created April 15, 2015 22:47
NGINX config script
#!/bin/sh
. /etc/rc.d/init.d/functions
. /etc/sysconfig/network
[ "$NETWORKING" = "no" ] && exit 0
nginx="/opt/nginx/sbin/nginx"
prog=$(basename $nginx)
NGINX_CONF_FILE="/opt/nginx/conf/nginx.conf"
@adampats
adampats / database.yml
Created May 5, 2015 20:25
database.yml
development:
adapter: sqlserver
host: ms12060@domain.net
database: rtailtest
username: s-serviceaccount@domain.net
password: password
@adampats
adampats / trace.txt
Created May 5, 2015 21:04
strange time method error
rTAIL $ rake db:import_csv[TAIL.csv] --trace
** Invoke db:import_csv (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:import_csv
rake aborted!
NoMethodError: undefined method `usec' for 9:Fixnum
/Users/adpatter/.rvm/gems/ruby-2.1.4/gems/activerecord-sqlserver-adapter-4.2.4/lib/active_record/connection_adapters/sqlserver/type/time.rb:48:in `usec_to_seconds_frction'
/Users/adpatter/.rvm/gems/ruby-2.1.4/gems/activerecord-sqlserver-adapter-4.2.4/lib/active_record/connection_adapters/sqlserver/type/time.rb:52:in `quote_usec'
/Users/adpatter/.rvm/gems/ruby-2.1.4/gems/activerecord-sqlserver-adapter-4.2.4/lib/active_record/connection_adapters/sqlserver/type/time.rb:30:in `quote_ss'
#!/bin/bash
#
# Carries out a full mysqldump, calls percona-xtrabackup and then
# copies the sql dump, the percona backup and your mysql bin logs
# to S3 using s3cmd http://s3tools.org/s3cmd
#
# TODO: extract out the S3 backup stuff to make it optional, and so
# other s3 programs can replace the s3cmd call.
# TODO: the if [ $? == 0 ] alert blocks should be a function
# TODO: make the if [ $? == 0 ] if [ $? != 0 ] more consistent - test
@adampats
adampats / dump-nsx-sgs.sh
Created June 24, 2015 21:59
One liner: Dump NSX Security Groups JSON to file
read -p "Username: " user; read -s -p "Password: " pass; curl -k -X GET https://nsxmanager.domain/api/2.0/services/securitygroup/scope/globalroot-0 -H "Accept: application/json" -u $user:$pass | jq . > prod-nsx-sgs.json
@adampats
adampats / logging.sh
Created June 24, 2015 22:00
AWS User Data script logging
exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1
@adampats
adampats / pry.rb
Last active August 29, 2015 14:24
pry method issue
def get_metadata_value(text, key)
text[/#{Regexp.escape("#{value}: ")}(.*?)#{Regexp.escape("<br />")}/m, 1]
end
@servicelist = get_services
@servicelist.map do |svc|
h = {
id: svc['id'],
title: svc['title'],
body: svc['body']['storage']['value'].split('meta-data:').first,