Skip to content

Instantly share code, notes, and snippets.

@finnigja
finnigja / autonmap.sh
Created May 26, 2023 21:29
Simple nmap scanner / differ
#!/usr/local/bin/bash
SCAN_TARGETS="x.x.x.x/28 x.x.x.x/27 x.x.x.x"
EMAIL_RECIPIENTS="email@example.com.com"
WEB_URL="https://tools.example.com/scans/scan-$DATE.xml"
RUN_DIRECTORY="/usr/local/scans/data/"
NMAP="/usr/local/bin/nmap"
NDIFF="/usr/local/bin/ndiff"
# got a list of IPs you need to do lookups for?
# map them back to their ASes with Team Cymru's DNS-based IP-to-ASN lookup service...
$ for asn in $(
for ip in $(cat ips.txt); do
revip=$(echo $ip | awk -F. '{print $4"."$3"."$2"."$1}');
dig +short $revip.origin.asn.cymru.com TXT;
done | cut -d ' ' -f 1 | cut -c 2- | sort | uniq
);
do dig +short AS$asn.asn.cymru.com TXT;
done
@finnigja
finnigja / terraform_aws_cloudformation_stack_debug.log
Last active July 21, 2021 19:31
Debug log extract for aws_cloudformation_stack failure to update to parameters
2021-07-21T11:56:00.135-0700 [INFO] Starting apply for aws_cloudformation_stack.test-stack
2021-07-21T11:56:00.135-0700 [DEBUG] aws_cloudformation_stack.test-stack: applying the planned Update change
2021-07-21T11:56:00.136-0700 [INFO] provider.terraform-provider-aws_v3.50.0_x5: 2021/07/21 11:56:00 [DEBUG] Updating CloudFormation stack: {
Capabilities: ["CAPABILITY_IAM"],
ClientRequestToken: "terraform-20210721185600136300000001",
Parameters: [{
ParameterKey: "TestParameter",
ParameterValue: "new parameter value"
}],
StackName: "arn:aws:cloudformation:us-west-2:586122851592:stack/test-stack/9b81b940-ea52-11eb-835a-0a92558e38af",
#!/usr/bin/env python
from gevent import monkey, joinall, spawn
monkey.patch_all()
import base64
import gzip
import boto3
import sys
#!/usr/bin/env python3
#
# Use the GitHub API to mass-add all repos inside an org to a team.
# (Tweak the GH_PERM value to change the permissions that are granted.)
#
import json
import os
import requests
import sys
@finnigja
finnigja / [Last Week in AWS] Issue #92- Amazon DocumentDB for Pets.eml
Created January 14, 2019 18:00
[Last Week in AWS] Issue #92- Amazon DocumentDB for Pets.eml
Received: from BN6PR12MB1906.namprd12.prod.outlook.com (2603:10b6:600::20) by
CY4PR12MB1912.namprd12.prod.outlook.com with HTTPS via
CY1PR03CA0010.NAMPRD03.PROD.OUTLOOK.COM; Mon, 14 Jan 2019 15:31:00 +0000
Received: from MWHPR12CA0030.namprd12.prod.outlook.com (2603:10b6:301:2::16)
by BN6PR12MB1906.namprd12.prod.outlook.com (2603:10b6:404:108::12) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1516.15; Mon, 14 Jan
2019 15:30:57 +0000
Received: from BY2NAM01FT026.eop-nam01.prod.protection.outlook.com
(2a01:111:f400:7e42::203) by MWHPR12CA0030.outlook.office365.com
@finnigja
finnigja / get.py
Created November 8, 2018 18:19
Playing with gevent
#!/usr/bin/env python
from gevent import monkey, joinall, spawn
monkey.patch_all()
import requests
import sys
import time
REQUEST_COUNT = int(sys.argv[1:2][0]) or 20
@finnigja
finnigja / init.lua
Created November 7, 2018 00:35
Simple window tiling with Hammerspoon
-- http://www.hammerspoon.org/go/
-- basic key shortcuts for window tiling
hs.window.animationDuration = 0
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "M", function()
local win = hs.window.focusedWindow()
local f = win:frame()
local screen = win:screen()
#!/bin/sh
# https://aws.amazon.com/blogs/security/how-to-prepare-for-aws-move-to-its-own-certificate-authority/
declare -a arr=("https://good.sca1a.amazontrust.com/" "https://good.sca2a.amazontrust.com/" "https://good.sca3a.amazontrust.com/" "https://good.sca4a.amazontrust.com/" "https://good.sca0a.amazontrust.com/" "https://starfieldtech.com/" "https://aws.amazon.com")
for i in "${arr[@]}"
do
printf $i
curl -s -o /dev/null -w "\t%{http_code}\n" $i
#!/usr/bin/env python
# https://aws.amazon.com/blogs/security/how-to-prepare-for-aws-move-to-its-own-certificate-authority/
import requests
URLS = [
'https://good.sca1a.amazontrust.com/',
'https://good.sca2a.amazontrust.com/',
'https://good.sca3a.amazontrust.com/',