Skip to content

Instantly share code, notes, and snippets.

@miekg
miekg / gist:921542
Created April 15, 2011 11:18
example client for async queries in Go DNS
package main
import (
"dns"
"fmt"
)
func HelloQuery(w dns.RequestWriter, req *dns.Msg, ) {
// client.Attemps = 3
@miekg
miekg / hash.go
Created June 11, 2012 11:43
Simple hashing and salting algo in Go
package main
import (
"crypto/sha1"
"fmt"
"io"
)
const ITER = 100000
@miekg
miekg / gist:3075199
Created July 9, 2012 08:49
check DS
package main
import (
"flag"
"fmt"
"github.com/miekg/dns"
"os"
"unbound"
)
@miekg
miekg / ztot.go
Created July 11, 2012 10:18
Create trace from zonefile
package main
import (
"github.com/miekg/dns"
"flag"
"github.com/miekg/pcap"
"os"
)
@miekg
miekg / query.go
Created October 19, 2012 09:18
try to query a domain
package main
import (
"fmt"
"github.com/miekg/dns"
"math/rand"
"os"
"time"
)
@miekg
miekg / getrfc
Created October 19, 2012 11:59
getrfc
#!/bin/zsh
# Retrieve RFC and/or drafts. By Miek Gieben (c) 2012, licensed under the GPL v2.
# RFC urls
# http://tools.ietf.org/pdf/rfc5737
# http://tools.ietf.org/rfc/rfc5737.txt
# Draft urls
# http://tools.ietf.org/id/draft-gieben-auth-denial-of-existence-dns-00.txt
# http://tools.ietf.org/pdf/draft-gieben-auth-denial-of-existence-dns-00.txt
@miekg
miekg / gist:4078673
Created November 15, 2012 13:29
% ./q nul\\000gap.test.globnix.net
% ./q nul\\000gap.test.globnix.net
;; opcode: QUERY, status: NOERROR, id: 4386
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 5, ADDITIONAL: 6
;; QUESTION SECTION:
;nul\000gap.test.globnix.net. IN A
;; ANSWER SECTION:
nul\000gap.test.globnix.net. 60 IN A 192.0.2.10
@miekg
miekg / gist:4466456
Created January 6, 2013 10:26
run go test, when the file end in _test.go otherwise go build. Use in vim: autocmd Filetype go set makeprg=gobuildtest\ %
#!/bin/zsh
filename=$1;shift
case $filename in
*_test.go) go test "$@";;
*) go build "$@";;
esac
package main
import (
"encoding/json"
"github.com/miekg/bitradix"
"log"
"net"
"os"
"reflect"
)
@miekg
miekg / x
Created February 6, 2013 09:21
tld-dnssec-check
for tld in $(awk ' { print $1 }' root-zone | egrep '^[a-z0-9-]+\.$' | sort -u); do
echo -n $tld:
if dig +dnssec DNSKEY $tld | grep -q RRSIG; then
echo -n DNSSEC:
else
echo -n dnssec:
fi
echo $(dig +noall +answer ${tld}cc.jpmens.net txt | awk ' { print $5" "$6" "$7" "$