Skip to content

Instantly share code, notes, and snippets.

Avatar

Ryan Castellucci ryancdotorg

View GitHub Profile
@ryancdotorg
ryancdotorg / cryptroot.patch
Created Dec 25, 2011
patch to the cryptroot hook that comes with cryptsetup on debian/ubuntu
View cryptroot.patch
--- cryptroot.dist 2011-12-24 16:50:11.000000000 -0800
+++ cryptroot 2011-12-24 17:07:33.000000000 -0800
@@ -211,7 +211,7 @@
fi
# We have all the basic options, let's go trough them
- OPTIONS="target=$target,source=$source,key=$key"
+ OPTIONS="target=$target,source=$source"
local IFS=", "
unset HASH_FOUND
@ryancdotorg
ryancdotorg / batch_wrapper.sh
Created Mar 23, 2012
Command wrapper that allows multiple calls to a wrapped command
View batch_wrapper.sh
#!/bin/bash
# Configuration
COMMAND="/usr/bin/openssl"
PRE_ARGS=""
POST_ARGS="-passin env:PASSWD"
ECHO=1
# Add any needed execution environment setup code here
PASSWD=`get_passphrase.sh`
View screen_autostart.sh
# Add to the bottom of ~/.profile
# Check if this is being called from an interactive shell
case "$-" in
*i*)
# Great, it's an interactive shell. Is this shell being stated by sshd?
if [ `readlink /proc/$PPID/exe` = "/usr/sbin/sshd" ]
then
# exec screen. Attach to or create a new session called auto_ssh.
# -x allows multiple copies of screen to be attached to the same session.
exec screen -xR auto_ssh
@ryancdotorg
ryancdotorg / ext-fb.py
Created Oct 5, 2012
Extended FizzBuzz in Python
View ext-fb.py
#!/bin/env python
# Needs python 2.7 or later
from collections import OrderedDict
substitutions = OrderedDict([(3, 'Fizz'), (5, 'Buzz'), (7, 'Quxx')])
for i in xrange(1, 128):
line = ''
# This depends on the ordering of keys in the dict
@ryancdotorg
ryancdotorg / pre-ext-fb.py
Created Oct 5, 2012
Precomputed extended FizzBuzz in Python
View pre-ext-fb.py
#!/bin/env python
from collections import OrderedDict
substitutions = OrderedDict([(3, 'Fizz'), (5, 'Buzz'), (7, 'Quxx')])
max_i = 127
# Pre-compute all outputs - should be faster.
output_list = ['']*(max_i+1)
View wtcommit.sh
#!/bin/bash
# Save as 'wtcommit' somewhere in your path
# Usage: git commit -m "`wtcommit`"
curl -q http://whatthecommit.com/ 2>/dev/null | grep '<p>' | sed 's/<p>//'
@ryancdotorg
ryancdotorg / openssh_clearidentityfiles.patch
Last active Dec 14, 2015
Patch for OpenSSH that adds a ClearIdentityFiles option for use in ~/.ssh/config. Can be set to no - nothing happens, yes - all IdentityFile entries currently present are removed, never - any future attempts to use the option will be ignored, always - all all IdentityFile entries currently are removed and adding more is disabled. WARNING - this …
View openssh_clearidentityfiles.patch
diff --git a/readconf.c b/readconf.c
index 91dfa56..701c79a 100644
+ if (options->clear_identity_files > 0) {
+ intptr = &options->num_identity_files;
+ while (*intptr > 0) {
+ *intptr = *intptr - 1;
+ charptr = &options->identity_files[*intptr];
+ debug("removing identity %i (%p %p) %s",
+ *intptr, charptr, *charptr, *charptr);
+ if (charptr && *charptr) {
View ssh_config
# IdentityFile magic, should be placed at very end of file.
# Allows easier management of many ssh keys without having
# to repeatedly fiddle with ~/.ssh/config. If it's not clear
# you set up your keys as id_rsa_username@host.example.com
# substituting ANY for either the username or hostname if
# desired.
Host *
IdentityFile ~/.ssh/keys/id_ecdsa_%r@%h
IdentityFile ~/.ssh/keys/id_rsa_%r@%h
IdentityFile ~/.ssh/keys/id_dsa_%r@%h
View sudosudo.sh
#!/bin/bash
# PoC tty_tickets spoofing exploit by Ryan Castellucci
# Originally written October 2012, see CVE-2013-1776
# This does not implement using setsid to cause fallback
DUMMY=/does/not/exist/$RANDOM/$RANDOM/$RANDOM/$RANDOM
WAIT_LOOP=0
# Usage ./sudosudo.sh command [args]
@ryancdotorg
ryancdotorg / gist:6690445
Created Sep 24, 2013
Fixes to humblehacker/kspec to allow compile on ubuntu 12.04
View gist:6690445
diff --git a/main.cc b/main.cc
index 4bfc287..bb0ada7 100644
--- a/main.cc
+++ b/main.cc
@@ -180,7 +180,7 @@ generate_code(po::variables_map &options, hh::Keyboard::Ptr &kb)
{
try
{
- if (fs::is_regular_file(dir_itr->status()) && boost::iends_with(dir_itr->path().stem(), ".elu"))
+ if (fs::is_regular_file(dir_itr->status()) && boost::iends_with(dir_itr->path().stem().string(), ".elu"))
You can’t perform that action at this time.