Skip to content

Instantly share code, notes, and snippets.

View nnsee's full-sized avatar

Rasmus Moorats nnsee

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nnsee
nnsee / dnsmasq.md
Last active January 18, 2022 11:14
Get dnsmasq to work properly with NetworkManager, VPNs, etc using openresolv

/etc/dnsmasq.conf:

listen-address=::1,127.0.0.1
interface=lo
conf-dir=/etc/dnsmasq.d
bind-interfaces

/etc/dnsmasq.d/openresolv.conf:

@nnsee
nnsee / setids.py
Last active September 17, 2021 11:47
Set UID/GID to EUID and spawn a shell
#!/usr/bin/env python
"""
Let's say you've been able to run a SUID binary and
dropped into a shell where your EUID is 0, but your
real UID/GID are still 1000. There's no C compiler
and you're not really keen on dropping files on disk.
bash drops EUID for security purposes and sudo still
asks for a password. But there's Python installed.
"""
@nnsee
nnsee / trig.sh
Last active December 30, 2021 13:16
Print caller
#!/bin/sh
_DATA="[$(date -uR)]
PID $$: $(tr '\0' ' ' < /proc/$$/cmdline)
PPID $PPID: $(tr '\0' ' ' < /proc/$PPID/cmdline)
UGID: $(id)
[-------------------------------]
"
echo "$_DATA" >> /tmp/trig
@nnsee
nnsee / chroot.sh
Last active May 16, 2021 23:32
OpenWRT chroot helper script
#!/bin/bash
# script to mount and chroot into a rootfs directory
# designed for openwrt systems, but should work for anything with minimal modifications
# unless you specify a different chroot dir,
# place script on the same level as the rootfs directory, should look something like so:
# /mnt/
# |- chroot.sh
# |- rootfs/