Skip to content

Instantly share code, notes, and snippets.

View re2c_test.c
// re2c $INPUT -o $OUTPUT
#include <assert.h>
#include <stdint.h>
#include <unistd.h>
static const uint64_t ERROR = ~0lu;
struct match {
size_t so, eo;
rofl0r / gist:64fb5affb083ac8bcf0ebfaf6c5905e6
Created Apr 18, 2019
how to produce glibc's odd static linking warning about getaddrinfo
View gist:64fb5affb083ac8bcf0ebfaf6c5905e6
$ cat link_warning.c
#define __sec_comment "\n\t#"
#define __make_section_unallocated(section_string) \
asm (".section " section_string "\n\t.previous");
#define link_warning(symbol, msg) \
__make_section_unallocated (".gnu.warning." #symbol) \
static const char __evoke_link_warning_##symbol[] \
__attribute__ ((used, section (".gnu.warning." #symbol __sec_comment))) \
= msg;
#define static_link_warning(name) static_link_warning1(name)
rofl0r /
Created Apr 10, 2019
replaces all occurences of a specified mac address in a pcap file with a random new one
import sys, os
def usage():
print "usage: %s file.pcap AA:BB:CC:DD:EE:FF"%sys.argv[0]
print "where AA:BB:CC:DD:EE:FF is the mac address you want replaced"
if len(sys.argv) < 3: usage()
file_arg = sys.argv[1]
rofl0r / c99.l
Created Jan 1, 2018 — forked from codebrainz/c99.l
C99 Lex/Flex & YACC/Bison Grammars
View c99.l
D [0-9]
L [a-zA-Z_]
H [a-fA-F0-9]
E ([Ee][+-]?{D}+)
P ([Pp][+-]?{D}+)
FS (f|F|l|L)
IS ((u|U)|(u|U)?(l|L|ll|LL)|(l|L|ll|LL)(u|U))
#include <stdio.h>
rofl0r / af_packet_rx_ring.c
Created Oct 19, 2017 — forked from pavel-odintsov/af_packet_rx_ring.c
View af_packet_rx_ring.c
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <unistd.h>
#include <boost/thread.hpp>
#include <sys/mman.h>
#include <poll.h>
#include <arpa/inet.h>
rofl0r / seccomp_x32_bypass.c
Created Jul 9, 2017 — forked from thejh/seccomp_x32_bypass.c
PoC for bypassing sloppy seccomp blacklists on X86-64 using X32 syscalls
View seccomp_x32_bypass.c
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <signal.h>
#include <errno.h>
#include <fcntl.h>
#include <stddef.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <sys/stat.h>
rofl0r / python3_fixes_with_bs4_support.patch
Created Jun 8, 2017 — forked from kevinhendricks/python3_fixes_with_bs4_support.patch
google/gumbo-parser patch to allow to work with both python 2 and 3 and add BeautifulSoup4 support for both
View python3_fixes_with_bs4_support.patch
diff --git a/python/gumbo/ b/python/gumbo/
new file mode 100644
index 0000000..5a8d273
--- /dev/null
+++ b/python/gumbo/
@@ -0,0 +1,183 @@
+# -*- coding: utf-8 -*-
+# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
+from __future__ import unicode_literals, print_function
rofl0r /
Created May 3, 2017 — forked from disconnect3d/
Solution for sorcerery crackme2000 task from DefCon Quals CTF
Solution from Disconnect3d [playing in Just Hit the Core]
import os
import angr
import pwn
import subprocess
View 256_color_rgb_terminal.c
* gcc console.c -lncurses
* then run after export TERM=xterm-256color
* (C) 2010, 2017 rofl0r
* displays a nice 256color picture on the terminal, if the terminal
* supports it.
View 0001-OpenRISC-support-for-GCC-5.3.0.patch
From 44eac78981c07cf2f73a338d3e34eed685f6309d Mon Sep 17 00:00:00 2001
From: Siarhei Siamashka <>
Date: Mon, 25 Jul 2016 17:42:19 +0300
Subject: [PATCH] OpenRISC support for GCC 5.3.0
This is the difference between dfad8a2635433704c74c70db28c3559867c2e362
from and vanilla GCC 5.3.0
ChangeLog.or1k | 8 +
config/picflag.m4 | 3 +
You can’t perform that action at this time.