Skip to content

Latest commit

 

History

History
42 lines (34 loc) · 6.64 KB

README.md

File metadata and controls

42 lines (34 loc) · 6.64 KB

Misc-Scripts by oh2fih

Miscellaneous scripts for different purposes. Mostly unrelated to each other.

ShellCheck Python Code Quality)

Category Script & Language Purpose & Usage
Automation find-inactive-ssh-sessions.sh
Shell (bash)
Find inactive (idle) SSH sessions or kill (-k) them. Could be used as a workaround for OpenSSH < 9.2 that did not have the sshd_config(5) keywords ChannelTimeout & UnusedConnectionTimeout.
find-inactive-ssh-sessions.sh [-k] [-i seconds] [-s]
DNS
DANE
letsencrypt-tlsa.sh
Shell (bash)
Create TLSA records from the current & backup Let's Encrypt Intermediate CAs. Defaults to le-ca TLSA 2 1 1 with configurable selector (-f) & matching type (-m).
letsencrypt-tlsa.sh [-f] [-m N] [-l "label [TTL]"] [-h] [2>/dev/null]
Email mail-prepender.sh
Shell (bash)
Prepends (to stdin/stdout) email header strings given in as flags i, I, a, or A; after possible mbox From & Return-Path header lines. Intended as a limited formail replacement that ignores the nyanses of the flags and simply prepends the valid (RFC 5322, 2.2) non-empty headers keeping the other headers as is. Flags x & X are implemented. Any other flags are ignored.
Git git-find-commits-by-file-hash.sh
Shell (bash)
Search Git repository history for commits with SHA-256 checksum of a file. Answers the question "Has this version of this file ever been committed as the file on this path of this Git repository?" and shows a summary (git show --stat) of the matching commit(s). The path should be relative to the repository root.
git-find-commits-by-file-hash.sh sha256sum path
Infosec netcat-proxy.sh
Shell (sh)
Creates a simple persistent TCP proxy with netcat & named pipes.
netcat-proxy.sh listenport targethost targetport
Infosec follow-cvelist.py
Python 3.6+
Follow changes (commits) in CVEProject / cvelistV5. Requires git. Working directory must be the root of the cvelistV5 repository.
follow-cvelist.py [-haForu4] [-vvvv] [-i s] [-c N] [-w N]
Infosec partialpassword.sh
Shell (bash)
Creates a new wordlist from a wordlist by replacing all ambiguous characters with all their possible combinations.
partialpassword.sh input.txt output.txt O0 [Il1 ...]
Infosec duplicate-ssh-hostkeys.sh
Shell (bash)
Find duplicate SSH host keys in a CIDR range. Examine your network for shared host keys that could potentially be dangerous.
duplicate-ssh-hostkeys.sh CIDR [HostKeyAlgorithm ...]
Infosec
Automation
make-mac-prefixes.py
Python 3.6+
Processes registered MAC address prefixes from IEEE MA-L Assignments (CSV) (stdin) to Nmap's nmap-mac-prefixes (stdout) with a few additional unregistered OUIs.
curl https://standards-oui.ieee.org/oui/oui.csv | make-mac-prefixes.py > nmap-mac-prefixes
WordPress test-cache-enabler.py
Python 3.6+
Tests whether the Cache Enabler by KeyCDN (WordPress) is working properly on the URLs given as arguments.
test-cache-enabler.py https://example.com [...]
Web detect-modified-html-element.sh
Shell (bash)
Checks HTML element changes on a web page since last run. Configured via environment variables.
Recommended to be executed as a SystemD service.
Web http-dns-round-robin.sh
Shell (bash)
Print HTTP headers for every DNS round-robin IP (IPv4 + IPv6)
http-dns-round-robin.sh URL
Web product-pricelimiter.sh
Shell (bash)
Compare product price on a web page with a given maximum price. Use, e.g., developer tools on your browser to find the HTML element containing the price.
product-pricelimiter.sh -u URL -s Selector [-m MaxPrice] [-n N] [-d N]
Web koronarokotusaika.sh
Shell (bash)
This script has been removed as koronarokotusaika.fi (bookcovidvaccine.fi) has been shut down on April 28, 2023.
Web xxl-product-pricelimiter.sh
Shell (bash)
This script has been replaced by the generalized product-pricelimiter.sh as the HTML structure of XXL.fi has changed.

Scripts that require sudo privileges (sbin/)

Category Script & Language Purpose & Usage
Automation autoreboot-on-segfaults.sh
Shell (sh)
Temporary solution that automatically reboots the system if there has been more than MAX_SEGFAULTS segmentation faults on the current boot. Fix the system!
Recommended to be scheduled with a SystemD service & timer.
Automation backup-mysql-databases.sh
Shell (bash)
Backup all MySQL/MariaDB databases; dump & compress. Overwrites older backups matching the same date pattern.
Recommended to be scheduled with a SystemD service & timer.
Automation create-site.sh
Shell (bash)
Web hosting automation for Debian with Apache2, PHP-FPM & Let's Encrypt.
sudo create-site.sh username example.com [www.example.com ...]
Firewall list2bans.sh
Shell (bash)
Lists all Fail2Ban jail statuses or jails banning an IP.
sudo list2bans.sh [ip]
Firewall unfail2ban.sh
Shell (bash)
Unbans the given IPs from all Fail2Ban jails.
sudo unfail2ban.sh ip [ip ...]

Install & update

Interactive installer & updater install.sh and simple updater update.sh help putting the scripts in directories that are typically in your $PATH. While using these installers as root/sudo, you might need to add an exception for the repository with:

sudo git config --global --add safe.directory <path>