Skip to content

Instantly share code, notes, and snippets.

View sktt's full-sized avatar

Johannes Wikner sktt

View GitHub Profile
@sktt
sktt / xxd
Last active March 6, 2019 14:10
jnes:src/ (9c8138f7b0✗) $ xxd -s0x1fafde147e00 -g1 -e -len 64 /proc/`pidof d8`/mem
de147e00: 48 8d 1d f9 ff ff ff 48 3b d9 74 18 48 ba 00 00 H......H;.t.H...
de147e10: 00 00 36 00 00 00 49 ba 40 22 c4 b5 31 7f 00 00 ..6...I.@"..1...
de147e20: 41 ff d2 cc 48 8b 59 e0 f6 43 0f 01 0f 85 ae 31 A...H.Y..C.....1
de147e30: f4 ff 55 48 89 e5 56 57 48 83 ec 30 48 89 75 e0 ..UH..VWH..0H.u.
Instructions (size = 868)
0x1fafde147e00 0 cc int3l
0x1fafde147e01 1 8d1df9ffffff leal rbx,[rip+0xfffffff9]
0x1fafde147e07 7 483bd9 REX.W cmpq rbx,rcx
0x1fafde147e0a a 7418 jz 0x1fafde147e24 <+0x24>
0x1fafde147e0c c 48ba0000000036000000 REX.W movq rdx,0x3600000000
0x1fafde147e16 16 cc int3l
0x1fafde147e17 17 ba4022c4b5 movl rdx,0xb5c42240 ;; off heap target
0x1fafde147e1c 1c 317f00 xorl [rdi+0x0],rdi
0x1fafde147e1f 1f 0041ff addb [rcx-0x1],al
(gdb) b *0x1fafde147e00
Breakpoint 2 at 0x1fafde147e00
(gdb) cont
Continuing.
Thread 1 "d8" hit Breakpoint 2, 0x00001fafde147e00 in LazyCompile:*myfunc test.js:144 ()
=> 0x00001fafde147e00 <LazyCompile:*myfunc test.js:144+0>: 48 8d 1d f9 ff ff ff lea -0x7(%rip),%rbx # 0x1fafde147e00 <LazyCompile:*myfunc test.js:144>
(gdb) i r rbx rcx
rbx 0x5 5
rcx 0x1fafde147e00 34840205622784
@sktt
sktt / android.sh
Last active September 13, 2018 13:21
all the stuff without any android-studio!
# make sure to not have conflicts..
sudo apt remove android-sdk{,-platform-tools,-build-tools} adb
sudo apt autoremove
mkdir ~/GREEN_LAB
cd ~/GREEN_LAB
# https://developer.android.com/studio/#command-tools
wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip -O android-sdk-tools.zip
sudo apt-get update
sudo apt-get install build-essential curl libz3-dev z3 libboost-dev libcapstone-dev libpython-dev cmake python-z3
curl -L http://software.intel.com/sites/landingpage/pintool/downloads/pin-2.14-71313-gcc.4.4.7-linux.tar.gz| tar xzf -
cd pin-2.14-71313-gcc.4.4.7-linux/source/tools/
curl -L https://github.com/JonathanSalwan/Triton/archive/v0.4.tar.gz | tar xzf -
cd Triton-0.4/
mkdir build
cd build
cmake -DPINTOOL=on -DKERNEL4=on ..
make -j4
@sktt
sktt / list.c
Created May 11, 2018 16:27
1337 lists... kernel style
#include <stdio.h>
/* 1337 linked list, kernel style */
#define MEMBER_OFFSET(type, member) \
(unsigned long)(&(((type *)0)->member))
#define LIST_ENTRY(ptr, type, member) \
((type *)(((char *)(ptr)) - MEMBER_OFFSET(type, member)))
#define LIST_INIT(list) \
(list).next = &(list);\
@sktt
sktt / websocket.js
Last active October 12, 2017 22:25
Skeleton code for setting up a websocket server, with a route for piping stdin to the websocket. So you could for instance do `ping google.com | node websocket.js` and maybe plot the results in the browser.... :D
const URL = require('url')
const Rx = require('rxjs/Rx')
const WebSocketServer = require('ws').Server
/** pipe stdin out on websocket */
function pipe (conn) {
process.stdin.setEncoding('utf8')
return Rx.Observable.create(obs => {
process.stdin.on('data', obs.next.bind(obs))
@sktt
sktt / newmac
Last active September 4, 2017 01:12
Generates a new mac address. You know why it's useful :)
#!/bin/sh
set -e
IF=$1
if [ -z "$IF" ] ; then
echo "Usage: $0 <interface>"
exit 1
fi
ifconfig $IF > /dev/null # stop execution if the interface doesn't exist
@sktt
sktt / 130717 redux_rxjs.md
Last active September 30, 2017 18:40
Simple state mgmt using rxjs for redux fans
date title descr
Thu 13 Jul 2017 10:41:19 AM CEST
Roll your own redux
Simple state mgmt using rxjs for redux fans

Roll your own redux

using rxjs

@sktt
sktt / keystone_hacks.js
Last active September 4, 2017 01:17
How to add support for pre updateItem hook for keystone.List.
// Naturally this has to be done before creating List instances!!
// monkey patching List constructor to add hooks support
(function () {
var grappling = require('grappling-hook');
var List = keystone.List;
keystone.List = function (name, options) {
List.apply(this, arguments);