Skip to content

Instantly share code, notes, and snippets.

View leoluk's full-sized avatar

leoluk leoluk

View GitHub Profile
@leoluk
leoluk / nma.py
Created August 8, 2012 17:17
NotifyMyAndroid shell command result notification
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author: http://github.com/leoluk
# License: GPLv3
#
"""
This quick-and-dirty script notifies you once a long-running shell command finishes,
using NotifyMyAndroid.com.
@leoluk
leoluk / journal-reactor.py
Created October 3, 2018 22:19
Example code that demonstrates how to listen to journald using Python 3 + asyncio.
#!/usr/bin/python3 -u
import asyncio
import sh
from systemd import journal
from systemd.daemon import notify
GATEWAY_IP = "192.168.10.1"
@leoluk
leoluk / custom_middleware.py
Created January 24, 2019 19:46
Netbox OAuth Login
"""
Custom LOGIN_REQUIRED middleware which allows OAuth URLs.
"""
import utilities.middleware
from django.conf import settings
class CustomLoginRequiredMiddleware(utilities.middleware.LoginRequiredMiddleware):
def __call__(self, request):
@leoluk
leoluk / rmk-web.sh
Created February 23, 2019 11:40
Remarkable remote Web UI login
#!/bin/bash
sudo ip addr add 10.11.99.1/32 dev lo
ssh rmk true
ssh -O forward -L 10.11.99.1:8080:10.11.99.1:80 rmk
gnome-open http://10.11.99.1
sudo socat TCP-LISTEN:80,reuseaddr,fork,su=nobody TCP:10.11.99.1:8080
root@dragon:~/leo2# find . -ls
642686 4 drwxr-xr-x 3 root root 4096 Sep 22 00:21 .
642727 4 drwxr-xr-x 4 root root 4096 Sep 22 00:00 ./rootfs
662833 4 -rwxr-xr-x 1 root root 62 Sep 22 00:00 ./rootfs/exploit.sh
654011 4 drwxr-xr-x 3 root root 4096 Sep 21 23:43 ./rootfs/proc
662371 4 drwxr-xr-x 4 root root 4096 Sep 21 23:44 ./rootfs/proc/self
662372 4 drwxr-xr-x 2 root root 4096 Sep 21 23:43 ./rootfs/proc/self/attr
662375 0 -rw-r--r-- 1 root root 0 Sep 21 23:43 ./rootfs/proc/self/attr/exec
662419 0 -rw-r--r-- 1 root root 0 Sep 21 23:44 ./rootfs/proc/self/status
662416 4 drwxr-xr-x 2 root root 4096 Sep 21 23:48 ./rootfs/proc/self/fd
root@dragon:~/leo2# find . -ls
642686 4 drwxr-xr-x 3 root root 4096 Sep 22 00:21 .
642727 4 drwxr-xr-x 4 root root 4096 Sep 22 00:00 ./rootfs
662833 4 -rwxr-xr-x 1 root root 62 Sep 22 00:00 ./rootfs/exploit.sh
654011 4 drwxr-xr-x 3 root root 4096 Sep 21 23:43 ./rootfs/proc
662371 4 drwxr-xr-x 4 root root 4096 Sep 21 23:44 ./rootfs/proc/self
662372 4 drwxr-xr-x 2 root root 4096 Sep 21 23:43 ./rootfs/proc/self/attr
662375 0 -rw-r--r-- 1 root root 0 Sep 21 23:43 ./rootfs/proc/self/attr/exec
662419 0 -rw-r--r-- 1 root root 0 Sep 21 23:44 ./rootfs/proc/self/status
662416 4 drwxr-xr-x 2 root root 4096 Sep 21 23:48 ./rootfs/proc/self/fd
#!/usr/bin/stap
global root_ns;
probe begin
{
root_ns = mnt_ns();
printf("root ns: %d", root_ns);
printf("\n%20s %6s %16s %6s %16s %40s %s\n", "PP", "UID", "MNT_NS", "PID", "COMM", "FLAGS", "PATH");
}
# First container
cat <<EOF > Dockerfile.1
FROM busybox
ADD rootfs /
EOF
mkdir rootfs
ln -s evil/level1/level2 rootfs/proc
package main
import (
"bytes"
"encoding/hex"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/tendermint/tendermint/rpc/client"
"log"
"net/http"
#!/usr/bin/python3
# -*- coding: utf8 -*-
"""
Screen scrapes Allestörungen.de spark lines
"""
import sys
import requests
import lxml.html