Skip to content

Instantly share code, notes, and snippets.

@dbrumley
dbrumley / rewrite_errno.py
Last active May 31, 2023 01:34
Solves undefined symbol: errno, version GLIBC_2.0
#!/usr/bin/env python3
import lief
binary = lief.parse('extract75')
stdin = next(filter(lambda e:e.name == "stdin", binary.symbols))
errno = next(filter(lambda e:e.name == "errno", binary.symbols))
errno.name = stdin.name
binary.write("extract75-hacked")
int main(void)
{
const unsigned char _v[16] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x5d};
long double v;
memcpy(&v, _v, sizeof(v));
/* Return the result so that gcc doesn't optimize everything away */
return sinl(v);
}
@dbrumley
dbrumley / merlin-init.sh
Created May 6, 2017 21:03 — forked from unhammer/merlin-init.sh
Create .merlin file for a project with all your ocamlfind packages and .opam sources in there
#!/bin/sh
if test -f .merlin; then
echo ".merlin already exists, bailing out ..." >&2
exit 1
else
# You could add your default EXT's and such to this list: