Skip to content

Instantly share code, notes, and snippets.

View brb's full-sized avatar

Martynas Pumputis brb

View GitHub Profile
#!/usr/bin/env bash
# Copyright (C) 2013 Tom Hendrikx <>. All Rights Reserved.
# This file is licensed under the GPLv2+. Please see COPYING for more information.
IFS=" " # tab character
cat "$export" | while read uuid group name login passwd notes; do
test "$uuid" = "# passwordsafe version 2.0 database" && continue
test "$uuid" = "uuid" && continue
brb /
Created February 10, 2017 16:29
Decrypt AES-GCM ESP (VXLAN) packets
set -eu
AWK_CMD='{print "\"IPv4\",\"" $2 "\",\"" substr($4, 1, length($4)-1) "\",\"" $8 "\",\"AES-GCM [RFC4106]\",\"" $19 "\",\"ANY 128 bit authentication [no checking]\",\"\""}'
ssh $HOST "sudo ip -o xfrm state" | awk "$AWK_CMD" >> $HOME/.config/wireshark/esp_sa
tshark -o esp.enable_encryption_decode:TRUE -d udp.port==6784,vxlan -nr $PCAP esp
brb / libbpf.diff
Created July 22, 2021 13:49
libbpf map pin race
View libbpf.diff
diff --git a/src/libbpf.c b/src/libbpf.c
index a97490c..4587950 100644
--- a/src/libbpf.c
+++ b/src/libbpf.c
@@ -4686,10 +4686,13 @@ bpf_object__create_maps(struct bpf_object *obj)
char *cp, errmsg[STRERR_BUFSIZE];
unsigned int i, j;
int err;
+ bool retried;
brb /
Last active November 23, 2020 14:35
area41 2014 challenge writeup


Being a cheapass student, I couldn't resist to try to win a free entrance to [Area41 Security Conference][3] (don't mix with Alcoholics Anonymous Area 41 in Nebraska) after spotting @gandro23 retweet about the conference and the challenge.

Level 01

The challenge starts after downloading and extracting a [binary][1]. A quick look

brb /
Created January 31, 2013 08:25
Build deb package from Erlang/OTP source
git svn clone svn:// debian-erlang
cd debian-erlang; git checkout 72f44f02d383d2858ed7480db7e5bbb662ea48d4
git clone git://
cd otp
git checkout OTP_R15B03
rm -rvf lib/*/doc/{archive,standard}/
ln -s ../debian-erlang/debian
./otp_build autoconf
dpkg-buildpackage -rfakeroot -uc -b
brb / dmesg
Last active March 8, 2019 20:00
vmalloc two failures
View dmesg
2019-03-08T19:36:39,224208+0000 tc: vmalloc: allocation failure, allocated 59392000 of 75501568 bytes, mode:0x6090c0(GFP_KERNEL|__GFP_NORETRY|__GFP_ZERO), nodemask=(null),cpuset=b389e318420d891300ad9658f8e056b59972fda9547dd566245a922c34bb9e42,mems_allowed=0
2019-03-08T19:36:39,224215+0000 CPU: 0 PID: 17378 Comm: tc Tainted: G C OE 5.0.0+ #1
2019-03-08T19:36:39,224216+0000 Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
2019-03-08T19:36:39,224217+0000 Call Trace:
2019-03-08T19:36:39,224233+0000 dump_stack+0x63/0x85
2019-03-08T19:36:39,224240+0000 warn_alloc+0x10b/0x190
2019-03-08T19:36:39,224242+0000 __vmalloc_node_range+0x173/0x270
2019-03-08T19:36:39,224244+0000 __vmalloc_node_flags_caller+0x47/0x50
2019-03-08T19:36:39,224246+0000 ? htab_map_alloc+0x2e4/0x4e0
2019-03-08T19:36:39,224247+0000 bpf_map_area_alloc+0x45/0x50
brb / proc-meminfo
Created March 8, 2019 11:06
vmalloc fails to alloc 75MB, Linux 5.0
View proc-meminfo
MemTotal: 4037048 kB
MemFree: 170752 kB
MemAvailable: 2848280 kB
Buffers: 238708 kB
Cached: 2553912 kB
SwapCached: 0 kB
Active: 1720420 kB
Inactive: 1682980 kB
Active(anon): 612384 kB
Inactive(anon): 844 kB
brb / ipvlan.patch
Created February 12, 2019 13:47
ipvlan-no-netfilter.patch applied to v4.15.18
View ipvlan.patch
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 0936da592..589d7f3a5 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -145,13 +145,15 @@ config MACVTAP
To compile this driver as a module, choose M here: the module
will be called macvtap.
+config IPVLAN_L3S
+ depends on NETFILTER
brb / main.c
Created January 31, 2019 08:33
View main.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
static inline unsigned int bpf_num_possible_cpus(void)
static const char *fcpu = "/tmp/foo";
unsigned int start, end, possible_cpus = 0;
char buff[128];
brb /
Created August 1, 2018 12:16

Keybase proof

I hereby claim:

  • I am brb on github.
  • I am martynasp ( on keybase.
  • I have a public key whose fingerprint is 26E3 A522 51B3 4AD1 C2CD E5CB 5385 B938 B74F 0D71

To claim this, I am signing this object: