Skip to content

Instantly share code, notes, and snippets.

View kivikakk's full-sized avatar
🐰

Asherah Connor kivikakk

🐰
View GitHub Profile
@kivikakk
kivikakk / dns-over-tls.py
Created November 4, 2015 11:40
A hack using dnspython to perform DNS over TCP/TLS.
#!/usr/bin/env python
"""
dnspython3==1.12.0
mock==1.3.0
pbr==1.8.1
six==1.10.0
"""
import dns.message
use 5.018;
my %nodes = ();
open(my $fh, '<', 'input') or die "can't read input: $!";
while (my $line = <$fh>) {
if ($line =~ /^(\w+) to (\w+) = (\d+)$/) {
$nodes{$1}{$2} = $3;
$nodes{$2}{$1} = $3;
@kivikakk
kivikakk / ci-key-recover.py
Last active February 7, 2020 13:58
recover key from CodeIgniter homegrown crypto
#!/usr/bin/env python3
# CodeIgniter pre-2.2 non-mcrypt Encrypt reverser.
# Finds the key by partially-known plaintext attack.
# Written by Ashe Connor. Placed in the public domain.
import codecs
import re
import sys
import time
@kivikakk
kivikakk / find-line-no.py
Created June 30, 2016 16:14
find the file:line of the current ruby thread that crashed
m_pos = int(gdb.parse_and_eval("ruby_current_thread->cfp->pc - ruby_current_thread->cfp->iseq->iseq_encoded"))
if m_pos > 0:
m_pos -= 1
size = int(gdb.parse_and_eval("ruby_current_thread->cfp->iseq->line_info_size"))
if size == 0:
res = 0
elif size == 1:
res = int(gdb.parse_and_eval("ruby_current_thread->cfp->iseq->line_info_table[0].line_no"))
else:
@kivikakk
kivikakk / find-ci.py
Created June 30, 2016 16:51
find the method referred to by ci->mid
mid = int(gdb.parse_and_eval("ci->mid"))
bin_number = mid % int(gdb.parse_and_eval("global_symbols.id_str.num_bins"))
next_count = 0
while True:
key = int(gdb.parse_and_eval("global_symbols.id_str.as.big.bins[{}]{}.key".format(bin_number, ".next" * next_count)))
if key == mid:
break
next_count += 1

B: Yeah, the doctor said it would never grow back, but I mean, I've got a good few inches there now.
L: Well it still tastes the same to me, so …
B: Yeah, I've not been able to notice the difference either.
B: Do you like coffee?
L: I love coffee.
B: Oh, you like coffee, do you?
L: Big fan.
B: Tsk — you, you're a bit of a fan of coffee?
L: Coffee fan!
B: Are you a fan of coffee?

[alias]
# Note that that /w$/ variants tend to be those *without* -w. Same for
# /n$/ variants where appropriate.
s = status -sb
h = show -w
hs = show --stat
h1 = show -w HEAD~1
h2 = show -w HEAD~2
h3 = show -w HEAD~3
h4 = show -w HEAD~4
--- /Users/kivikakk/.emacs.d/core/templates/.spacemacs.template 2016-10-12 18:13:15.000000000 +1100
+++ .spacemacs 2016-10-16 18:50:32.000000000 +1100
@@ -36,11 +36,16 @@
;; Uncomment some layer names and press <SPC f e R> (Vim style) or
;; <M-m f e R> (Emacs style) to install them.
;; ----------------------------------------------------------------
- helm
- ;; auto-completion
- ;; better-defaults
+ auto-completion
Process 3647 stopped [21/4323]
* thread #1: tid = 0x5e96, 0x000000010011030a Emacs`assq_no_quit + 13, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
frame #0: 0x000000010011030a Emacs`assq_no_quit + 13
Emacs`assq_no_quit:
-> 0x10011030a <+13>: movq 0x5(%rsi), %rsi
0x10011030e <+17>: movl %esi, %ecx
0x100110310 <+19>: andl $0x7, %ecx
0x100110313 <+22>: movl $0x0, %eax
Executable module set to "/usr/local/Cellar/emacs-plus/25.1/Emacs.app/Contents/MacOS/Emacs".
Process 4788 stopped
* thread #1: tid = 0xe08a, 0x000000010020dceb Emacs`assq_no_quit(key=153323200, list=4332169555) + 107 at fns.c:1451, stop reason = sign
al SIGSTOP
frame #0: 0x000000010020dceb Emacs`assq_no_quit(key=153323200, list=4332169555) + 107 at fns.c:1451
1448 {
1449 while (CONSP (list)
1450 && (!CONSP (XCAR (list))
-> 1451 || !EQ (XCAR (XCAR (list)), key)))
1452 list = XCDR (list);
1453