Skip to content

Instantly share code, notes, and snippets.

@aayla-secura
aayla-secura / create_ssl_cert.sh
Created February 26, 2018 12:56
Create a CA ROOT X.509 self-signed certificate, then create and sign an X.509 subject certificate.
#!/bin/bash
# Defaults
CA_EXPIRY=7300 # in days
SUBJ_EXPIRY=730 # in days
KEYDIR="$HOME/.ssl/private"
CERTDIR="$HOME/.ssl/certs"
CA="localCA"
SUBJ="subj"
CA_KEYLEN=4096
@aayla-secura
aayla-secura / search_gmail.py
Last active November 30, 2020 07:41
Search for an email in gmail and extract regex from it
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
import pickle
import base64
import os.path
import sys
import re
import argparse
import logging
@aayla-secura
aayla-secura / jwt_bruteforce.py
Created January 19, 2021 00:18
Brute-force a JWT signed with a shared key
#!/usr/bin/env python3
#############################################################
# @AaylaSecura1138, github.com/aayla-secura
# Modify and distribute as you wish
#############################################################
import logging
import jwt
import sys
import argparse
@aayla-secura
aayla-secura / nasm_shell.sh
Last active March 10, 2021 21:19
Show disassembly of given opcodes or assembly instructions
#!/bin/bash
# See -h for help
INTERACTIVE=1
READ_ARGS=()
NASM_ARGS=()
OBJDUMP_ARGS=()
# Determine if interactive or stdin is redirected from file/heredoc/command
# output/etc
@aayla-secura
aayla-secura / hashcat_gen_username_rule.sh
Created April 23, 2021 01:11
Generate a hashcat rule file to prepend {username}: to every password
#!/bin/bash
usage() {
cat <<EOF
Takes a list of usernames a writes a rule file to prepend each of these to each password canditate.
${BASH_SOURCE[0]} <options> <username or file> [<username or file> ...]
Options:
-@ Also take the base username if full one is an email
@aayla-secura
aayla-secura / parse-nmap.sh
Last active May 24, 2021 22:40
Parse nmap output to print host port
#!/bin/bash
# TODO
# - Consolidate ports for the same host from different files
ONE_PER_LINE=0
AS_URLS=0
AS_IPS=0
NO_VERSION=0
SEP=" "
SUBSEP=","
@aayla-secura
aayla-secura / rbash_funcs.sh
Last active June 11, 2021 00:45
Functions to do useful stuff in a restricted bash shell; Uses only bash built-ins
#!/bin/bash
# Uses only bash built-ins allowed in restricted mode
# Also includes a few functions that require some external commands, see
# FUNCTIONS THAT REQUIRE SOME EXTERNAL COMMANDS at the end
# TODO check for # of arguments; or an argument parser
function _echoarray {
# print array elements one per line
local IFS=$'\n'
echo "$*"
#!/usr/bin/env python3
import logging
import math
import string
import sys
import argparse
from collections.abc import Mapping, MutableMapping
from collections import Counter
import re
@aayla-secura
aayla-secura / jwt_rs256_as_hs256.py
Last active March 20, 2022 12:15
JWT RS256 to HS256 re-signing attack
#!/usr/bin/env python2
#############################################################
# @AaylaSecura1138, github.com/aayla-secura
# Modify and distribute as you wish
#############################################################
# NO LONGER MAINTAINED: CURRENT CODE LIVES HERE:
# https://github.com/aurainfosec/jwt_resign_asym_to_sym
#############################################################
# Some JWT libraries are vulnerable to a known attack which changes
# the type of a JWT from an asymmetric (e.g. RS256) to a symmetric
@aayla-secura
aayla-secura / magicdict.py
Last active September 29, 2022 00:38
A magic dictionary which never raises KeyError, can set default values for keys based on regex and can filter based on regex
# EXAMPLE USAGE
# import json
#
# mdorder = MagicDict()
# mdorder.configure(
# defaults={'^price$': 0, '_address$': 'No such street, PO 000'})
# create a default order
# mdorder['price']
# mdorder['shipping_address']
# mdorder['billing_address']