Skip to content

Instantly share code, notes, and snippets.

View RoseSecurity's full-sized avatar

RoseSecurity

View GitHub Profile
@RoseSecurity
RoseSecurity / .pre-commit-config.yaml
Created March 22, 2024 14:40
Validate JSON, clean up markdown, eliminate trailing whitespace, detect secrets, and format Terraform with this Pre-Commit hook!
repos:
# pre-commit install --hook-type pre-push
- repo: https://github.com/pre-commit/pre-commit-hooks # Generic review/format
rev: v4.4.0
hooks:
- id: check-json
- id: detect-private-key
- id: end-of-file-fixer
- id: no-commit-to-branch
args: ["--branch", "master"]
@RoseSecurity
RoseSecurity / kubernetes-api-deprecation.yml
Created February 23, 2024 20:12
A GitLab CI Pipeline for discovering deprecated Kubernetes APIs inside of repository manifest files
kubernetes-api-deprecation:
image:
name: golang:1.22-bookworm
variables:
KUBERNETES_TARGET_VERSION: "1.27"
before_script:
- apt-get update && apt-get install -y git
script:
- git clone https://github.com/doitintl/kube-no-trouble.git
- cd kube-no-trouble/
@RoseSecurity
RoseSecurity / aws-phish.py
Created February 4, 2024 02:04
An AWS Flask phishing application for harvesting credentials from mobile and desktop device logins.
#!/usr/bin/env python3
from flask import Flask, render_template, request, redirect
import os
# AWS Flask phishing application for harvesting credentials from mobile and desktop device logins.
# For the application to work, place the index.html file the templates directory and the style.css file in the static directory
app = Flask(__name__)
@RoseSecurity
RoseSecurity / summarizer.py
Last active February 3, 2024 23:45
Don't have time to watch tutorials and technical videos? Need to quickly identify useful information? This script harnesses machine learning to summarize YouTube videos.
#!/usr/bin/env python3
import os
import argparse
import whisper
from pytube import YouTube
from transformers import pipeline
# Harness machine learning to summarize YouTube video transcriptions
@RoseSecurity
RoseSecurity / ercot_wind_production.py
Created January 5, 2024 14:12
A utility for visualizing ERCOT wind production across north, south, west, and system-wide resources.
#!/usr/bin/env python3
import urllib.request
from datetime import datetime, timedelta
import json
import matplotlib.pyplot as plt
from matplotlib.dates import DateFormatter
# Reference: https://apiexplorer.ercot.com/api-details#api=pubapi-apim-api&operation=getData_14
@RoseSecurity
RoseSecurity / ttfb.py
Last active December 19, 2023 18:38
Measure the Time To First Byte (TTFB) of a website by DNS lookup, TCP connection, SSL connection, and document HTTP request.
#!/usr/bin/env python3
import requests
import time
# Measure the Time To First Byte (TTFB) of a website by DNS lookup, TCP connection, SSL connection, and document HTTP
# request.
# Reference: https://www.debugbear.com/docs/metrics/time-to-first-byte
@RoseSecurity
RoseSecurity / find_pats.py
Created December 7, 2023 19:06
A down and dirty script for finding GitHub PATs in public repositories
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Run script from command line via python3 find_pats.py
import click
import datetime
import time
from github import Github
@RoseSecurity
RoseSecurity / packer_fmt.yml
Created November 19, 2023 04:29
A GitHub Action for establishing which HCL directories have been modified, setting up Packer, and running packer fmt against the templates
name: Packer Format
on:
pull_request:
types: [opened, synchronize]
paths:
- '**/*'
permissions:
contents: read
pull-requests: write
@RoseSecurity
RoseSecurity / elasticsearch-provider.tf
Last active December 7, 2023 19:06
A comprehensive way to interact with Elasticsearch's Terraform provider
terraform {
required_version = ">= 1.5.5"
required_providers {
elasticstack = {
source = "elastic/elasticstack"
version = ">= 0.9.0"
}
}
}
@RoseSecurity
RoseSecurity / Dockerfile
Last active November 16, 2023 20:06
This script creates a basic Flask web application that serves a fake HTML page at the root route /. It has additional routes for /healthz and /callback. The /healthz route returns a simple "Healthy" response for healthchecks. The main logic is in the /callback route. It checks the request User-Agent header and if it exactly matches a specific Ch…
FROM python:3.12-slim
WORKDIR /redirector_app
# Copy the current directory contents
ADD . /redirector_app
# Install flask
RUN pip install flask