Skip to content

Instantly share code, notes, and snippets.

@MarkBaggett
MarkBaggett / workshop_setup.py
Created October 21, 2022 19:02
SEC673 Workshop Setup Checks
import sys
import subprocess
import webbrowser
import time
import urllib.request
import tempfile
import zipfile
import pathlib
from io import BytesIO
@MarkBaggett
MarkBaggett / gist:411427eb965e28a99df700adbc853aab
Created March 26, 2023 21:17
Calculate Stats on student lab completions
import numpy as np
import pandas as pd
def objective_to_day(ct):
ct = ct[10:]
return int(ct.split(".")[0])
def objective_to_question(ct):
ct = ct[10:]
return int(ct.split(".")[1])
@MarkBaggett
MarkBaggett / 1 - pythons_sinister_secrets.md
Last active April 16, 2023 21:37
Come To The Darkside - Pythons Sinister Secrets
@MarkBaggett
MarkBaggett / escape_room
Last active June 3, 2023 15:56
Notes on an escape room using home assistant.
As requested here is a walk through for the "Escape room" challenge I threw together for a party at my house. This was developeed in about 5 hours. It took guests about 45 minutes to complete. I have several things I would like to do to improve it over the next could iterations.
Notes to the reader:
- Requires Home Assistant https://www.home-assistant.io
- Requires App Daemon https://www.home-assistant.io/docs/ecosystem/appdaemon/
- My home includes Philips Hue lights, Ecobee thermostat, arlo cameras, some smart TV's and other devices used in the challenges.
- It is not shown in the code below but I also have printed puzzles and ammo boxes with combination locks throughout the house. Generally a printed puzzle leads players to physical activity that triggers a "smart home puzzle" which leads them to a combination to unlock the next ammo box containing the next printed puzzle. Lather, rince, repeat.
- Not all puzzles are published here but this is enough to get your creative juices flowing.
- Th
@MarkBaggett
MarkBaggett / pxpowershell.py
Created November 29, 2017 19:32
pxpowershell - A super simple interface to Powershell from Python
#!/usr/bin/env python
#Quick and Dirty Python Interface to Powershell from Python
#Requires pexpect module. Try "pip install pexpect"
import pexpect
from pexpect.popen_spawn import PopenSpawn
import re
import time
class pxpowershell(object):
def __init__(self, *args, **kwargs):
@MarkBaggett
MarkBaggett / custom_caesar.py
Last active July 16, 2023 14:57
Python - SQLMAP - Tamper Script for Custom Caesar Cypher
#!/usr/bin/env python
from lib.core.data import kb
from lib.core.enums import PRIORITY
import string
__priority__ = PRIORITY.NORMAL
def dependencies():
pass
@MarkBaggett
MarkBaggett / base_practice.py
Last active July 31, 2023 17:53
Base_practice.py allows you to practice converting between bases and binary logic operations. This script goes along with the video lecture that covers the basic concepts. https://youtu.be/qLtCuSTKk4g
import random
#This program will present you with challenges to convert numbers between bases and perform logical operations.
#This program goes along with the following youtube video. https://youtu.be/qLtCuSTKk4g
# Helper function to create conversion functions for different number bases.
def make_conversion_function(choose_from, prompt_text, input_conversion):
def convert_function():
the_number = random.choice(choose_from)
answer = input(eval(prompt_text))
@MarkBaggett
MarkBaggett / scapy_helper.py
Last active March 25, 2024 21:59
Python - SCAPY - Full Packet Session Reassembly
#From here https://pen-testing.sans.org/blog/2017/10/13/scapy-full-duplex-stream-reassembly
def full_duplex(p):
sess = "Other"
if 'Ether' in p:
if 'IP' in p:
if 'TCP' in p:
sess = str(sorted(["TCP", p[IP].src, p[TCP].sport, p[IP].dst, p[TCP].dport],key=str))
elif 'UDP' in p:
sess = str(sorted(["UDP", p[IP].src, p[UDP].sport, p[IP].dst, p[UDP].dport] ,key=str))