Skip to content

Instantly share code, notes, and snippets.

View ryancdotorg's full-sized avatar

Ryan Castellucci ryancdotorg

View GitHub Profile
#!/bin/sh
PORT="$1"
FILE="$2"
SIZE=`/usr/bin/wc -c "$FILE" | /usr/bin/awk '{print$1}'`
(
/bin/cat <<EoF
HTTP/1.1 200 OK
Content-Type: application/octet-stream
superfish-tester.rya.nc xxx.xxx.xxx.xxx - - [19/Feb/2015:20:17:08 +0000] "GET /ca.js?cb=1424377029329 HTTP/1.1" 200 111 "https://rya.nc/superfish" "Mozilla/5.0 (Linux; Android 4.4.4; A0001 Build/KTU84Q) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.109 Mobile Safari/537.36"
@ryancdotorg
ryancdotorg / miner.sh
Created March 12, 2015 19:04
Stripe CTF 3 Gitcoin solution
#!/bin/bash
set -eu
if [ "$#" != 2 ]; then
echo >&2 "Usage: $0 <clone_url> <public_username>
A VERY SLOW mining implementation. This should give you an idea of
where to start, but it probably won't successfully mine you any
Gitcoins.
#!/usr/bin/env python
import re
import sys
import itertools
import collections
from struct import pack, pack_into, unpack, unpack_from, calcsize
from binascii import crc32, hexlify, unhexlify
from pprint import pprint
@ryancdotorg
ryancdotorg / set-dns-servers.sh
Created July 10, 2015 18:18
Set DNS servers for NetworkManager + dnsmasq
#!/bin/bash
# taken from https://gist.github.com/jjarmoc/1299906
function atoi
{
#Returns the integer representation of an IP arg, passed in ascii dotted-decimal notation (x.x.x.x)
IP=$1; IPNUM=0
for (( i=0 ; i<4 ; ++i )); do
((IPNUM+=${IP%%.*}*$((256**$((3-${i}))))))
IP=${IP#*.}
@ryancdotorg
ryancdotorg / rsa_gen.c
Last active September 4, 2015 08:42
OpenSSL's RSA keygen, annotated
/* crypto/rsa/rsa_gen.c */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
* by Eric Young (eay@cryptsoft.com).
* The implementation was written so as to conform with Netscapes SSL.
*
* This library is free for commercial and non-commercial use as long as
* the following conditions are aheared to. The following conditions
@ryancdotorg
ryancdotorg / ext-fb.py
Created October 5, 2012 18:08
Extended FizzBuzz in Python
#!/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 October 5, 2012 18:23
Precomputed extended FizzBuzz in Python
#!/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)
#define _LARGEFILE_SOURCE
#define _LARGEFILE64_SOURCE
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <stdio.h>
int main(int argc, char **argv) {
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <unistd.h>
#include <fcntl.h>
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>