Skip to content

Instantly share code, notes, and snippets.

View bandrel's full-sized avatar

Justin Bollinger bandrel

View GitHub Profile
#!/usr/bin/env python3
import re
import sys
def convert_hex_base64(input):
from base64 import b64encode, b64decode
# hex -> base64
b64 = b64encode(bytes.fromhex(input)).decode()
# base64 -> hex
s2 = b64decode(b64.encode()).hex()
#!/usr/bin/env python3
import os
import caracara
import sys
hosts = caracara.HostsToolbox(key=os.environ["FALCON_CLIENT_ID"],secret=os.environ["FALCON_CLIENT_SECRET"],verbose=True)
with open(sys.argv[1]) as doc:
for _hostname in doc.readlines():
target_aid = hosts.host.find_host_aid(hostname=_hostname.strip())
#!/usr/bin/env python3
import argparse
import binascii
parser = argparse.ArgumentParser(description='Encoding and Decoding F5 URL Rewrites')
parser.add_argument('mode', type=str, help='text to encode or decode')
parser.add_argument('input_text', type=str, help='text to encode or decode')
parser.add_argument('--host', type=str, help='original F5 baseurl')
#!/usr/bin/env python3
'''
Script to expand CIDR notation to a list of IP addresses.
'''
import ipaddress
import sys
hosts = set()
subnets = str(sys.argv[1]).split(',')
@bandrel
bandrel / check_hashes.py
Last active February 2, 2023 15:55
To check for and reveal AD user accounts that share passwords using a hashdump from a Domain Controller
#!/usr/bin/env python3
#Purpose: To check for and reveal AD user accounts that share passwords using a hashdump from a Domain Controller
#Script requires a command line argument of a file containing usernames/hashes in the format of user:sid:LMHASH:NTLMHASH:::
# ./check_hashes.py <hash_dump>
import argparse
import re
parser = argparse.ArgumentParser(description="Check user hashes against each other to find users that share passwords")
#!/usr/bin/env python3
from __future__ import print_function
import socket
import argparse
import requests
import re
parser = argparse.ArgumentParser(description='Enumerate subdomains via certificate transparency logs')
parser.add_argument('domain', type=str, help='Target domain name')
#!/usr/bin/env python3
from __future__ import print_function
import socket
import argparse
import requests
import re
parser = argparse.ArgumentParser(description='Enumerate subdomains via certificate transparency logs')
parser.add_argument('domain', type=str, help='Target domain name')
#!/usr/bin/env python
import requests
import sys
import re
domain = sys.argv[1]
r = requests.get('https://crt.sh/?q=%.'+domain)
hostnames = re.findall(r'<TD>(\S+\.'+domain+r')',r.text)
#!/usr/bin/env python3
import ipaddress
import sys
subnets = str(sys.argv[1]).split(',')
for network in subnets:
for host in ipaddress.IPv4Network(network).hosts():
print(host)
@bandrel
bandrel / gist:b9dcc64628fc9dff8fd1c9d476bf0506
Created January 27, 2017 20:50
eem script for updating port description using CDP
event manager applet update-port-description
event neighbor-discovery interface regexp GigabitEthernet0/.* cdp add
action 1.0 cli command "enable"
action 2.0 cli command "config t"
action 3.0 cli command "interface $_nd_local_intf_name"
action 4.0 cli command "description $_nd_cdp_entry_name:$_nd_port_id"