Skip to content

Instantly share code, notes, and snippets.

@gcmurphy
gcmurphy / find_crypto.sh
Created February 10, 2015 22:41
Find python crypto usage in openstack
#!/bin/bash
search(){
echo ""
echo "Searching for $1 usage.."
echo ""
grep -nr --include \*.py --exclude test\*.py \
--exclude \*_test\*.py\
--exclude \*tempest\*\
--exclude \*site-packages\* \
-E $2 *
@gcmurphy
gcmurphy / wtft.c
Created March 12, 2015 19:20
WTF time is it in UTC
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <memory.h>
void display_current_time(const char *name, short tz){
time_t t;
struct tm *tdata;
time(&t);
@gcmurphy
gcmurphy / bcrypt_nullbyte.py
Created March 13, 2015 13:56
Example where things can go wrong using bcrypt in python..
# demo of what people 'may' do..
import bcrypt
from hashlib import sha1
salt = bcrypt.gensalt()
def hash_password(password):
# as per article various mechanisms may be employed
# to truncate the passwords length to 72 chars
return bcrypt.hashpw(sha1(password).digest(), salt)
@gcmurphy
gcmurphy / altchainfail.c
Created July 10, 2015 04:11
altchainfail.c
// original source - http://sourceforge.net/projects/mancha/files/sec/altchainfail.c/download
/*
* alt.chain.fail
* stand-alone vulnerability tester for: CVE-2015-1793
* by: mancha (@mancha140)
*
* based on test written by Matt Caswell for the OpenSSL project.
*
* gcc -o altchainfail altchainfail.c -lcrypto
@gcmurphy
gcmurphy / devops.sh
Last active August 29, 2015 14:25
ghetto devops
#!/bin/bash
for IP in `cat servers.txt`; do ssh $USER@$IP 'bash -s' < $@; done
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import paramiko
import itertools
import multiprocessing
to_csv = lambda x: ', '.join(x)
allowed = lambda x: x == 'publickey'
@gcmurphy
gcmurphy / .vimrc
Created January 16, 2012 05:28
vimrc
set et
set ts=4
set sw=4
set ai
set smarttab
set incsearch
set hlsearch
set wildmenu
set wildmode=list:longest,full
set backspace=2
@gcmurphy
gcmurphy / jt.c
Created April 24, 2012 04:36
Java classpath maker. I don't think this is needed in Java > 6 or if you have proper manifest.
#include <stdio.h>
#include <stdlib.h>
#include <talloc.h>
#include <dirent.h>
#include <regex.h>
int main(int argc, char *argv[])
{
int arg;
regex_t pattern;
@gcmurphy
gcmurphy / weekly.sh
Created May 9, 2012 05:44
Weekly Status Report - Status report using taskwarrior
#!/bin/bash
Recipient="user@example.com"
Subject="Status: $(date --date="7 days ago" +'%y-%m-%d')"
LastWeek=`task export status:completed end.after:$(date --date="7 days ago" "+%m/%d/%Y") |json_reformat | grep description | sed -e "s/\"description\"\: \"/\* /" -e "s/\",$//"`
ThisWeek=`task export status:pending |json_reformat | grep description | sed -e "s/\"description\"\: \"/\* /" -e "s/\",$//"`
Body=`echo -e "Last Week:\n\n${LastWeek}\n\nThis Week:\n\n${ThisWeek}\n\nGrant."`
thunderbird -compose "to='$Recipient',subject='$Subject',body='$Body'"
@gcmurphy
gcmurphy / align.c
Created June 4, 2012 01:49
alignment
#include <stdio.h>
int main()
{
void *p;
if (((unsigned long)p) & 15 == 0)
puts("16 bit aligned");
if (((unsigned long)p) & 23 == 0)
puts("24 bit aligned");
if (((unsigned long)p) & 31 == 0)
puts("32 bit aligned");