Skip to content

Instantly share code, notes, and snippets.

View barreljan's full-sized avatar

Bartjan Hoogenbosch barreljan

View GitHub Profile
@barreljan
barreljan / affected.py
Last active January 16, 2025 11:05
Check affected ip-addresses versus your aggregates
#!/usr/bin/env python3
"""This checks over large text files if your ip address if on a list
particular handy with CVEs and leaked data.
syntax:
./affected.py iplistofleak.txt
Needs 2 files to start:
1: a text file named 'aggregates' of your AS-system with CIDR notation,
per line, no other data or empty lines. This could be /32 if needed
@barreljan
barreljan / dnstest.sh
Last active November 16, 2022 14:53
dns query test
#!/bin/env bash
# mass query tool, inputs needs further validation but he, it works.
if [[ $# -le 2 ]]; then
echo -e "
dnstest: Test a DNS server with queries
Usage: dnstest <server> <record> <limit>\t\tWhere server represents the ip address, the limit how many attempts"
exit 1
fi
@barreljan
barreljan / history.sh
Last active November 15, 2022 15:31
bash history
# Log all commands to the systems logger
if [[ $(ps | grep -oP 'su$') ]]; then
# User used su
# Get UID from parent process
_PPID="$(ps -o ppid= | head -n1)"
_USER_ID="$(ps -o user= -p $_PPID)"
# Get the username of the user id
@barreljan
barreljan / aidechk.sh
Created March 30, 2022 12:36
AIDE check/report & update
#!/usr/bin/env bash
#aide check on centos7
DATE=`date +%Y-%m-%d`
REPORT="/tmp/Aide-${DATE}.txt"
RECIPIENT="john.doe@somedomain.tld"
TF=$(mktemp)
/sbin/aide --check > $TF
@barreljan
barreljan / rkey.sh
Last active November 15, 2022 14:55
rkey: remove an ssh-key
# Simple script om een offending key te verwijderen
# Checks
if [[ $# -ne 1 ]]; then
echo -e "RemoveKEY: Remove an SSH-key\n\nUsage: rkey <int>\t\tWhere int represents the line number"
exit 1
fi
if ! [[ "$1" =~ ^[0-9]+$ ]]; then
echo "Sorry, not a valid number"
exit 1