Skip to content

Instantly share code, notes, and snippets.

View RoseSecurity's full-sized avatar

RoseSecurity

View GitHub Profile
@RoseSecurity
RoseSecurity / jira-precommit.py
Created October 27, 2023 16:53
This Python code uses the Jira API to create a new issue from the last Git commit message. It can be used as a precommit hook to create Jira tickets from Git commit history.
#!/usr/bin/env python3
from jira import JIRA
import subprocess
# Set your Jira server URL, Email, and API token
email = ""
server_url = ""
api_token = ""
@RoseSecurity
RoseSecurity / reddit-feed.py
Created November 8, 2023 14:45
A simple Python utility that harnesses Reddit's API to create custom feeds for your Streamlit application.
#!/usr/bin/env python3
import streamlit as st
import praw
# Instantiate bot
reddit = praw.Reddit(client_id=st.secrets["CLIENTID"],
client_secret=st.secrets["CLIENTSECRET"],
user_agent='Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36',
username=st.secrets["USERNAME"],
@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
@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 / 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 / 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 / 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 / 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 / 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 / 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__)