Skip to content

Instantly share code, notes, and snippets.

View jlamoree's full-sized avatar
💭
Really impressed with Microsoft® GitHub™

Joseph Lamoree jlamoree

💭
Really impressed with Microsoft® GitHub™
View GitHub Profile
@jlamoree
jlamoree / postfix-report.sh
Created December 31, 2022 23:07
pflogsumm report
#!/usr/bin/env bash
mailserver="mail.ec2.lamoree.net"
cd $(mktemp -d)
rsync --rsync-path="sudo rsync" -v -e ssh "${mailserver}:/var/log/maillog*" .
cat maillog* | docker run --rm -i -a stdin -a stdout docker.io/jlamoree/pflogsumm:latest > report.txt
subl report.txt
@jlamoree
jlamoree / rotate.sh
Created December 23, 2021 16:56
Perform password rotation on a collection of users in an AWS Directory
#!/usr/bin/env bash
profile="aws_cli_profile_name"
directory_id="d-1234567890"
username_pattern="user"
password_title="AWS Directory User"
for n in `seq -f "%02g" 1 5`; do
uuid=$(op create item Password --generate-password --title "$password_title $n" | jq -r .uuid)
password=$(op get item $uuid --fields password)
@jlamoree
jlamoree / export.sh
Last active November 5, 2021 11:47
Export Jenkins Configuration
#!/usr/bin/env bash -eu
project_root="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )"
lib_dir="${project_root}/lib"
source "${project_root}/scripts/vars.sh"
jenkins-cli() {
java -jar "${lib_dir}/jenkins-cli.jar" -webSocket $@
}
@jlamoree
jlamoree / policy.json
Created May 13, 2021 17:44
AWS IAM Policy for ACME User
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"route53:GetHostedZone",
"route53:ListHostedZones",
"route53:ListHostedZonesByName",
"route53:GetHostedZoneCount",
@jlamoree
jlamoree / PageReplacements.user.js
Last active February 15, 2021 19:20
A Tampermonkey® Userscript to correct page content.
// ==UserScript==
// @name PageReplacements
// @namespace https://lamoree.com/
// @version 0.2
// @description Correct the content of a web page.
// @author Joseph Lamoree
// @match https://*/*
// @grant none
// ==/UserScript==
@jlamoree
jlamoree / send-receipt-test.py
Created February 4, 2021 22:57
Send a test email using the Disposition-Notification-To header to verify whether a data leak exists.
#!/usr/bin/env python3
import smtplib
from email.message import EmailMessage
import email.utils
import ssl
server = {"hostname": "my.mailserver.tld", "port": 587}
auth = {"username": "username", "password": "password"}
sender = {"name":"The Sender", "address":"sender@domain.tld"}
@jlamoree
jlamoree / this-is-the-way.md
Created January 3, 2021 22:19
OpenCanary on Raspberry Pi

OpenCanary on Raspberry Pi

Parts

Raspberry Pi 4 https://www.amazon.com/gp/product/B07TC2BK1X Argon One Pi 4 V2 kit https://www.amazon.com/gp/product/B07WP9P8VW SanDisk Max Endurance 32 Gb microSD card https://www.amazon.com/gp/product/B084CJLNM4

OS

Download Ubuntu Server 20.04.1 LTS 64-bit from https://ubuntu.com/download/raspberry-pi and burn it to a microSD card with Raspberry Pi Imager 1.3 from https://www.raspberrypi.org/blog/raspberry-pi-imager-imaging-utility/ using the Select Custom option.

@jlamoree
jlamoree / update-aws-route53.sh
Last active September 8, 2020 13:26
Bash script to update a record on AWS Route53
#!/usr/bin/env bash
# This could be updated to receive the hostname and address as arguments, if needed.
profile=route53
zone_id=ZXXXXXXXXXX
fqdn=foo.aws.lamoree.net
ip=1.2.3.4
aws --profile $profile route53 change-resource-record-sets --hosted-zone-id $zone_id \
@jlamoree
jlamoree / randomize-character-case.py
Created August 12, 2020 13:38
Randomize character case
#!/usr/bin/env python
import random
import sys
o = ""
for c in sys.stdin.read():
if c.isalpha():
o += c.upper() if random.random() > 0.5 else c.lower()
else:
@jlamoree
jlamoree / cfmail-to-html.sh
Created March 12, 2019 14:55
Extract the message body (in HTML) from an Adobe ColdFusion saved mail file
#!/bin/bash
cfmailfile=${1:-_}
script_name="$( basename "${BASH_SOURCE[0]}" )"
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
usage() {
echo "Usage: $script_name cfmailfile"
exit 1