Skip to content

Instantly share code, notes, and snippets.

View BoeJaker's full-sized avatar
💭
Building Vera

Boe Jaker BoeJaker

💭
Building Vera
View GitHub Profile
@BoeJaker
BoeJaker / Sherlock.py
Created April 26, 2023 05:36
Sherlock Secret Finder
import os
import re
import subprocess
# List of regular expressions for detecting key and password patterns.
PATTERNS = [
r'AWS_ACCESS_KEY_ID=[^\s]+',
r'AWS_SECRET_ACCESS_KEY=[^\s]+',
r'AKIA[0-9A-Z]{16}',
r'secret_key=[^\s]+',
@BoeJaker
BoeJaker / quine.py
Created April 26, 2023 05:35
YAQuine
# This program uses the exec function to execute a string containing its own source code. The %r format specifier is used to represent the string a as a raw string literal, and % is used to substitute a into the string before executing it.
a='a=%r;exec(a%%a)';exec(a%a)
# This program outputs its own source code when executed. The %r format specifier is used to represent the string s as a raw string literal, which includes quotes and escape characters as necessary. The % operator then replaces %r with the raw string representation of s, resulting in a string containing the original source code.
# s='s=%r;print(s%%s)';print(s%s)
@BoeJaker
BoeJaker / pre-commit-docker-docs
Created April 25, 2023 04:54
Docker Docs Pre Commit
#!/bin/bash
# Check if Dockerfile has been modified
if git diff --name-only --cached | grep -q "Dockerfile|docker-compose"; then
# Generate documentation for Dockerfile
docker run --rm -v "$(pwd):/workdir" -w /workdir jessedusty/docker-generate-docs -f Dockerfile -o Dockerfile.md
# Add generated documentation to the commit
git add Dockerfile.md
import os
def create_dummy_env_file(env_path):
dummy_env_path = env_path + ".dummy"
with open(env_path, "r") as env_file, open(dummy_env_path, "w") as dummy_env_file:
for line in env_file:
if line.strip() == "":
dummy_env_file.write("\n")
else:
key, value = line.strip().split("=")
#!/bin/bash
# Run Sphinx to generate documentation
sphinx-build -b html docs/source docs/build
# Add the generated documentation to the commit
git add docs/build
# Print a message to the user
echo "Sphinx documentation generated."
@BoeJaker
BoeJaker / pre-commit
Created April 24, 2023 22:32
Watermark Pre-Commit
#!/bin/bash
# Add watermark to Python files
for file in $(git diff --name-only --cached | grep -E '\.py$'); do
# Add watermark to top of file
echo "# This script is property of [Your Company Name]" | cat - $file > temp && mv temp $file
done
@BoeJaker
BoeJaker / pre-commit_check-keys
Created April 24, 2023 22:31
Key Check Pre-Commit
# Check for encryption keys in any changed files
if git diff --cached --name-only | xargs grep -q "-----BEGIN\s+(RSA\s+)?PRIVATE\s+KEY-----\n?(?:[a-zA-Z0-9+/\n]{64})*[a-zA-Z0-9+/\n=]+\n?-----END\s+(RSA\s+)?PRIVATE\s+KEY-----"
then
echo "Warning: You are committing a file that contains an encryption key."
echo "Are you sure you want to commit this file? (y/n)"
read answer
if [ "$answer" != "${answer#[Yy]}" ]
then
exit 0
else
#!/usr/bin/env python3
from scapy.all import (
RadioTap, # Adds additional metadata to an 802.11 frame
Dot11, # For creating 802.11 frame
Dot11Deauth, # For creating deauth frame
sendp # for sending packets
)
from argparse import ArgumentParser as AP
from sys import exit
def deauth(iface: str, count: int, bssid: str, target_mac: str):
@BoeJaker
BoeJaker / tls_server.py
Created April 24, 2023 12:03
TLS_server.py
import socket
import ssl
from Crypto.Util.number import getPrime
from Crypto.Random import get_random_bytes
# Choose two prime numbers
p = getPrime(2048)
g = 2
# Generate a secret key
@BoeJaker
BoeJaker / tls_client.py
Created April 24, 2023 12:03
TLS Client
import socket
import ssl
from Crypto.Util.number import getPrime
from Crypto.Random import get_random_bytes
# Choose two prime numbers
p = getPrime(2048)
g = 2
# Generate a secret key