This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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]+', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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("=") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |