Skip to content

Instantly share code, notes, and snippets.

View tmthrgd's full-sized avatar

Tom Thorogood tmthrgd

View GitHub Profile
@tmthrgd
tmthrgd / sort_file.go
Last active January 6, 2019 04:54
A small tool to sort all the funcs and global map keys in a golang source file.
// +build ignore
package main
import (
"bytes"
"fmt"
"go/parser"
"go/token"
"io/ioutil"
$ dnstrace -s 127.0.0.1:8053 -t TXT -n 1000 -c 500 miek.nl
Benchmarking 127.0.0.1:8053 via udp with 500 conncurrent requests
Total requests: 500000 of 500000 (100.0%)
Connection errors: 0
Read/Write errors: 367
DNS success codes: 499633
DNS response codes
$ dnstrace -s 127.0.0.1:8053 -t TXT -n 1000 -c 200 example.com
Benchmarking 127.0.0.1:8053 via udp with 200 conncurrent requests
Total requests: 200000 of 200000 (100.0%)
DNS success codes: 200000
DNS response codes
NOERROR: 200000
@tmthrgd
tmthrgd / dns-hold-open.go
Created August 16, 2018 09:07
CVE-2017-15133 PoCs affecting miekg/dns
// CVE-2017-15133 PoC by Tom Thorogood (https://tomthorogood.co.uk)
package main
import (
"context"
"flag"
"log"
"net"
"os"
"os/signal"
diff --git a/ssl/ngx_http_ether_ssl_module.c b/ssl/ngx_http_ether_ssl_module.c
index 99eb507..87d3f2e 100644
--- a/ssl/ngx_http_ether_ssl_module.c
+++ b/ssl/ngx_http_ether_ssl_module.c
@@ -25,15 +25,13 @@ static char *ngx_http_ether_ssl_merge_srv_conf(ngx_conf_t *cf, void *parent, voi
static char *ngx_http_ether_ssl_set_opt_env_str(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
-static ngx_inline const EVP_AEAD *ngx_http_ether_ssl_select_aead(const ngx_ether_key_st *key);
-
diff --git a/ngx_http_ether_module.c b/ngx_http_ether_module.c
index c065b40..82fa67a 100644
--- a/ngx_http_ether_module.c
+++ b/ngx_http_ether_module.c
@@ -106,6 +106,9 @@ typedef struct {
ngx_buf_t tmp_recv;
+ ngx_event_t get_ev;
+ ngx_queue_t sub_gets;
@tmthrgd
tmthrgd / link-sorter.go
Created January 2, 2017 11:17
Sorts a list of links into Instagram, Tumblr and Facebook links.
@tmthrgd
tmthrgd / template-slice.go
Created December 8, 2016 10:39
A slice function for Golang templates (text/template and html/template).
func slice(item interface{}, indices ...interface{}) (interface{}, error) {
v := reflect.ValueOf(item)
switch v.Kind() {
case reflect.Array, reflect.Slice, reflect.String:
case reflect.Invalid:
return nil, errors.New("index of untyped nil")
default:
return nil, fmt.Errorf("can't index item of type %s", v.Type())
}
<!doctype html>
<html lang=en>
<!--
(c) Tom Thorogood 2013
https://tomthorogood.co.uk
Copyright 2013 Tom Thorogood. All rights reserved.
Use of this source code is governed by a
Modified BSD License license that can be found in
the LICENSE file.
<!doctype html>
<html lang=en>
<!--
(c) Tom Thorogood 2012
https://tomthorogood.co.uk
Copyright 2012 Tom Thorogood. All rights reserved.
Use of this source code is governed by a
Modified BSD License license that can be found in
the LICENSE file.