Skip to content

Instantly share code, notes, and snippets.

@libcrack
libcrack / snppclient.py
Created May 29, 2016 02:52
Quick & dirty SNPP client based on snpplib
#!/usr/bin/env python2
# coding: utf-8
# pylint: disable=C0103
# pylint: disable=C0301
# pylint: disable=C0411
# pylint: disable=C0413
# pylint: disable=W0611
# pylint: disable=W0612
# pylint: disable=W0702
# pylint: disable=W0703
@libcrack
libcrack / foo.make
Created May 30, 2016 15:46
GNU/Linux Makefile base template
CC := gcc
BIN := pcap
LDLIBS := -lpcap
LDFLAGS :=
CFLAGS := -Wall -Wno-parentheses -fomit-frame-pointer
CPPFLAGS :=
DEBUG := $(CFLAGS) -O0 -ggdb -fvar-tracking-assignments -fvar-tracking -fno-builtin
all: $(BIN)
@libcrack
libcrack / pfctl-invalid-login.sh
Created June 2, 2016 23:21
Detects invalid auth attemps in /var/log/maillog and blacklist the src IPs using a bpf table
#!/usr/bin/env bash
# root[at]libcrack[dot]so
# Sat Jan 10 07:15:37 CET 2015
#
# Detects invalid auth attemps in /var/log/maillog
# and blacklist all matchs IPs using a bpf table
#
# Tested under: OpenBSD 5.8
#
@libcrack
libcrack / backup.sh
Created June 6, 2016 11:52
Quick backup script
#!/usr/bin/env bash
# root@libcrack.so
date=`date "+%d%m%Y_%H%M%S"`
tardir="/var/backups"
tarball="${tardir}/backup_${HOSTNAME}_${date}.tgz"
folders="/etc /home /root" # XXX changeme
subject="`hostname` backup $tarball $date"
recipient="__YOURMAIL__" # XXX changeme
@libcrack
libcrack / pfsense-filter.pl
Last active July 22, 2022 17:30
Script to parse pfSense's filter log
#!/usr/bin/env perl
# libcrack@users.noreply.github.com
# Thu Jun 9 23:03:10 CEST 2016
#
# :~$ ssh root@pfsense "clog -f /var/log/filter.log" | pfsense-filter.pl
use strict;
use warnings;
$|=1;
@libcrack
libcrack / android-app-data-pull.sh
Last active June 23, 2016 11:25
Pulls the application's data passed as first argument from the first connected Android device via ADB
#!/usr/bin/env bash
# mar jun 14 18:54:23 CEST 2016
appname="$1"
[[ -z "$appname" ]] && {
printf "\e[31mUsage:\e[0m $0 <android.bundle.name>\n"
exit 1
}
@libcrack
libcrack / frida-gadgets-download.sh
Created June 23, 2016 17:29
Frida.re binary gadgets download helper script
#!/usr/bin/env bash
urls="
https://build.frida.re/frida/mac/lib/FridaGadget.dylib
https://build.frida.re/frida/ios/lib/FridaGadget.dylib
https://build.frida.re/frida/android/arm/lib/frida-gadget.so
https://build.frida.re/frida/android/arm64/lib/frida-gadget.so
https://build.frida.re/frida/android/arm64/lib/frida-gadget.so
https://build.frida.re/frida/linux/i386/lib/frida-gadget.so
https://build.frida.re/frida/linux/x86_64/lib/frida-gadget.so
@libcrack
libcrack / disable_ipv6_debian.sh
Created June 30, 2016 14:14
Script to disable IPv6 in Debian systems
#!/bin/sh
# @libcrack.so
# jue nov 13 21:33:12 CET 2014
echo "Disabling IPv6"
echo net.ipv6.conf.all.disable_ipv6=1 > /etc/sysctl.d/disableipv6.conf
echo net.ipv6.conf.default.disable_ipv6=1 >> /etc/sysctl.d/disableipv6.conf
echo net.ipv6.conf.lo.disable_ipv6=1 >> /etc/sysctl.d/disableipv6.conf
echo net.ipv6.conf.eth0.disable_ipv6=1 >> /etc/sysctl.d/disableipv6.conf
@libcrack
libcrack / conntrack-watcher.sh
Last active July 4, 2016 21:33
Connection tracking state table watcher
#!/bin/bash
# libcrack.so
# dom ago 31 04:17:57 CEST 2014
[[ "$(whoami)" == "root" ]] || {
printf "\e[0;31mGot root?\e[0m\n"
exit 1
}
#maximun="$(sysctl -n net.ipv4.netfilter.ip_conntrack_max)"
@libcrack
libcrack / setsid_setpgrp.c
Last active July 1, 2016 06:04
Playing with POSIX Job control setsid()/setpgrp()
/**
* root@libcrack.so
* vie jul 1 09:59:17 CEST 2016
*
* pid_t setsid(void); - Create session and set process group ID
* int setpgid(pid_t pid, pid_t pgid); - Set process group ID for job control
*
* Forbidding setsid() in a process group leader is required by POSIX.
* The setsid() function shall create a new session, if the calling process
* is not a process group leader. It is required to ensure that all members