Skip to content

Instantly share code, notes, and snippets.

View cmbaughman's full-sized avatar
🎯
Focusing

Chris Baughman cmbaughman

🎯
Focusing
View GitHub Profile
@carrot-c4k3
carrot-c4k3 / gspoc.txt
Last active March 28, 2025 04:07
Game Script native code execution PoC
// native code exec PoC via Game Script - @carrot_c4k3 (exploits.forsale)
//
// sample shellcode: mov rax, 0x1337; ret;
// drop your own shellcode inplace here
let shellcode = [0x48,0xC7,0xC0,0x37,0x13,0x00,0x00,0xC3]
// hex printing helper functions
let i2c_map = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F']
let c2i_map = {'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9, 'A': 0xA, 'B': 0xB, 'C': 0xC, 'D': 0xD, 'E': 0xE, 'F': 0xF}
@cmbaughman
cmbaughman / mysql_replication.md
Created November 8, 2023 13:41
Setting Up MySQL Replication

Setting Up MySQL Replication

Overview

We’ll configure one MySQL instance as the source database and another as its replica. Replication allows data synchronization between these separate databases.

Step 1: Configure the source

  1. Obviously install MySQL on 2 servers.
@cmbaughman
cmbaughman / compromisejs-name.js
Last active January 29, 2023 23:07
Using Compromise.js to get name formats right.
const nlp = require("compromise");
const nameParser = require("name-parser");
// Function to determine the name format
function determineNameFormat(name) {
// Patterns to match different name formats
const firstLast = nlp(name).match("#Honorific #FirstName #LastName").out("array");
const lastFirst = nlp(name).match("#LastName, #FirstName #Honorific").out("array");
const middleName = nlp(name).match("#FirstName #MiddleName #LastName").out("array");
const middleInitial = nlp(name).match("#FirstName #MiddleInitial #LastName").out("array");
@cmbaughman
cmbaughman / README.md
Created January 29, 2023 02:31
The JavaScript feature, Generators

Here is an example of using JavaScript generators to handle multiple HTTP requests in a sequential manner:

const fetch = require("node-fetch");

function* fetchUsers() {
  const user1 = yield fetch("https://jsonplaceholder.typicode.com/users/1");
 const user2 = yield fetch("https://jsonplaceholder.typicode.com/users/2");
@cmbaughman
cmbaughman / container.js
Created September 22, 2022 23:10
Example of "inversion of control" or aspect oriented programming in JavaScript
const Container = {
_storage: {},
register(key, deps, func) {
this._storage[key] = { deps, func };
},
get(key) {
if (!this._storage[key]) throw new Error(`Missing ${key}`);
const { func, deps } = this._storage[key];
return (...args) => {
const resolvedDeps = deps.map((key) => this.get(key));
@cmbaughman
cmbaughman / RokuFun.md
Created June 8, 2022 23:49
Fun with Roku

Fun stuff with Roku

Enumerate Roku devices

sudo nmap -sV -O -n 192.168.X.X/24

Identify the device and other stuff using netcat on the SSDP multicast address, port 1900.

@cmbaughman
cmbaughman / linux_ad.sh
Created September 10, 2020 13:00
Ubuntu Active Directory
#!/bin/bash
sudo apt install sssd heimdal-clients msktutil
sudo mv /etc/krb5.conf /etc/krb5.conf.default
COMP=$HOSTNAME
read -p 'What is the domain name? (example: URLFINANCIAL without the .local) ' DOMAIN
LCASEDOMAIN=`echo "$DOMAIN" | tr '[:upper:]' '[:lower:]'`
@cmbaughman
cmbaughman / DockerFile
Created August 7, 2020 16:05 — forked from zhunhung/DockerFile
Selenium Linux DockerFile
FROM ubuntu:latest
RUN apt-get update \
&& apt-get install -y python3-pip python3-dev \
&& cd /usr/local/bin \
&& ln -s /usr/bin/python3 python \
&& pip3 install --upgrade pip
# INSTALL DEPENDENCIES
RUN apt-get install -y curl unzip openjdk-8-jre-headless xvfb libxi6 libgconf-2-4
@cmbaughman
cmbaughman / clean-empty-dir.sh
Created August 5, 2020 18:15
Clean up empty directories relative to the current directory
#!/bin/bash
find . -type d -empty -exec rm -i -R {} \;
@cmbaughman
cmbaughman / simple_server_setup_ubuntu.md
Last active August 4, 2020 18:47
Initial Base Ubuntu Server Setup

Simple Ubuntu Server Setup


Create a user

NOTE: You must use public key based authentication.

  1. Create user adduser testuser
  2. Grant sudo usermod -aG sudo testuser
  3. ufw enable/disable