Skip to content

Instantly share code, notes, and snippets.

View cmbaughman's full-sized avatar
🎯
Focusing

Chris Baughman cmbaughman

🎯
Focusing
View GitHub Profile
@cmbaughman
cmbaughman / Reaper.bat
Last active April 20, 2023 14:20
Quick untested bat script to run reaper as admin
@echo off
set local
set runas=runas /user:Administrator
%runas% "c:\program files\reaper.exe"
%runas% explorer.exe
@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 / winshare.md
Created January 18, 2023 14:04
Mounting Windows Shares With CIFS

How To Use Windows Network Shares From Linux

This is the fastest way to set up Windows network (AD) shares with Linux using cifs-utils

Setup

  1. sudo apt update && sudo apt install cifs-utils -y
  2. sudo mkdir /mnt/win_share_name
  3. Create a credentials file: sudo nano /etc/win-credentials and enter the following contents:
@cmbaughman
cmbaughman / crowdsec-commands.md
Last active October 21, 2024 21:19
Crowdsec Commands

Useful Crowdsec Commands

Update

cscli hub update && cscli hub upgrade

Restart

systemctl restart crowdsec
@cmbaughman
cmbaughman / fail2ban.md
Created December 13, 2022 16:49
Set up fail2ban

Configure fail2ban

Install

sudo apt install fail2ban

Activate the service (so that after reboot it runs)

sudo systemctl enable fail2ban.service

Create

cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local

@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 / cloudflare.vpn.md
Last active August 3, 2022 12:17
Cloudflare VPN IPv4 Addresses to block

Keeping a list here of automated attack IPs that use the cloudflare VPN. These are used by automated vulnerability scaners. Fuck those assholes.

173.245.48.0/20 103.21.244.0/22 103.22.200.0/22 103.31.4.0/22 141.101.64.0/18 108.162.192.0/18 190.93.240.0/20

@cmbaughman
cmbaughman / shell-passwords.md
Created July 21, 2022 14:20
Encrypt and Store Passwords for Shell Scripts

Encrypt and Store Passwords for Shell Scripts

Here's a safe and secure method of storing passwords, encrypted, for use in shell scripts. This is in bash, but can easily be ported to other shells as the bulk of the work is handled by the openssl and sshpass apps.

  1. Install openssl and sshpass:
sudo apt update && sudo apt install openssl sshpass -y
@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.