Skip to content

Instantly share code, notes, and snippets.

View rossigee's full-sized avatar

Ross Golder rossigee

View GitHub Profile
@rossigee
rossigee / reportDynamicIPChanged.txt
Last active January 10, 2024 13:21
RouterOS raise HTTP event when dynamic IP address changes
:global previousIP 1.2.3.4
:global ipAddressCheckURL "http://ifconfig.me/ip"
# or... :global ipAddressCheckURL "http://icanhazip.com"
:global ipChangedEventURL "https://webhook.site/12345678-9610-4f57-9bfe-a3c5e2551d26"
/system/script/add name=reportDynamicIPChanged source={
:global ipAddressCheckURL
:global ipChangedEventURL
:local result [/tool fetch url=$ipAddressCheckURL mode=http as-value output=user];
:if ($result->"status" = "finished") do={
:local currentIP ($result->"data");
@rossigee
rossigee / wg-watch.sh
Created November 18, 2023 08:54
Bash script to manage Wireguard dynamic IP endpoint
#!/usr/bin/env bash
# Settings
WG_IFACE=wg0
WG_PEER=<peer_id>
WG_PORT=12345
HOSTNAME=yourhostname.dynamicip.example.com
# File to store the last IP
last_ip_file="/tmp/last_ip.txt"
@rossigee
rossigee / custom_parsers.conf
Created October 2, 2023 23:13
Custom fluent-bit parsers for Ubuntu 20.04+
[PARSER]
Name ubuntu-syslog-with-pid
Format regex
Regex /^(?<timestamp>\S+\s+\d{1,2}\s+\d{2}:\d{2}:\d{2})\s(?<hostname>\S+)\s(?<process>\S+)\[(?<pid>\d+)\]:\s(?<message>.*)$/
Time_Key time
Time_Format %b %d %H:%M:%S
Time_Keep On
[PARSER]
Name ubuntu-syslog-without-pid
@rossigee
rossigee / gist:05048dae301864d180773f3d31208c24
Created September 6, 2023 07:42
Fetch Windows Administrator password from EC2 using Terragrunt/Terraform state
#!/usr/bin/env bash
#
# Run this in the Terraform folder for the instance to reconstruct the Administator password.
#
# Example usage:
#
# get-windows-administrator-password
#
INSTANCE_ID=$1
@rossigee
rossigee / gist:052ff68cd59b32df7f78b3b7234b5c3b
Last active August 25, 2023 04:46
Some fluent-bit parsers for RFC3134 parsing of Mikrotik logs
[PARSER]
Name syslog-rfc3164-safe
Format regex
Regex /\<(?<pri>[0-9]+)\>(?<time>\w{3}\s+\d+\s\d{2}:\d{2}:\d{2})\s(?<host>[^ ]*)\s(?<ident>[a-zA-Z0-9_\/\.\-\+,]*)(\[(?<pid>\d+)\])*:?\s(?<message>.*)/
Time_Key time
Time_Format %b %d %H:%M:%S
Time_Keep On
[PARSER]
Name ssh_access_logs_mikrotik
@rossigee
rossigee / gist:7ce48ece0d0c2e28893235579bb48b68
Last active August 24, 2023 03:27
Lua hack for RFC3164 timestamps
-- Hack to workaround lack of precision in RFC3164 dates.
require "os"
function rfc3164_to_timestamp(rfc3164_log)
local month_names = {
Jan = "01", Feb = "02", Mar = "03", Apr = "04",
May = "05", Jun = "06", Jul = "07", Aug = "08",
Sep = "09", Oct = "10", Nov = "11", Dec = "12"
}
import os
import requests
def get_ipam_addresses(api_url, token, ca_cert):
headers = {
'Authorization': f'Token {token}',
'Content-Type': 'application/json'
}
# Fetch all IP addresses from NetBox
@rossigee
rossigee / main.go
Created November 13, 2021 01:56
OpenVPN AS XMLRPC client
package main
import (
"fmt"
"net"
"net/http"
"alexejk.io/go-xmlrpc"
)
@rossigee
rossigee / deploy-docker-and-compose.sh
Last active March 14, 2020 04:14
A quick curlable to deploy docker engine and docker-compose.
#!/bin/bash
export LC_ALL=C
export DEBIAN_FRONTEND=noninteractive
# Install Docker engine
echo "Installing docker engine..."
apt -q install --assume-yes \
apt-transport-https \
ca-certificates \
Verifying my Blockstack ID is secured with the address 16ukZMicPrZsMfXjqq3zq5LudRNK4vGexV https://explorer.blockstack.org/address/16ukZMicPrZsMfXjqq3zq5LudRNK4vGexV