Skip to content

Instantly share code, notes, and snippets.

View dillera's full-sized avatar

Andrew Diller dillera

View GitHub Profile
@dillera
dillera / gist:7192d884929aac1b9905ab478342dc28
Last active September 15, 2024 13:00
Apple II Disk Type Detection
Apple 2 disk help
1. Format and Size Detection:
• is_woz_format: Checks if the disk image starts with the WOZ signature.
• get_image_size_kb: Retrieves the size of the disk image in kilobytes.
2. Filesystem Detection:
• detect_filesystem: Utilizes the existing autodetection to identify the filesystem and sector order.
3. Recommendation Logic:
• recommend_mounting: Implements the mounting recommendation rules based on image format, size, and filesystem.
@dillera
dillera / openfw.ps1
Created August 10, 2024 13:38
wsl2 Firewall Open Example
# Start SSH Service.
wsl sudo service ssh start
# WSL2 network port forwarding script v1
# for enable script, 'Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser' in Powershell,
# for delete exist rules and ports use 'delete' as parameter, for show ports use 'list' as parameter.
# written by Daehyuk Ahn, Aug-1-2020
# Display all portproxy information
If ($Args[0] -eq "list") {
import sys
from PIL import Image
import struct
# Define the Apple II HRG palette
palette = [
(0, 0, 0), # Black
(114, 38, 64), # Deep Red
(64, 51, 127), # Dark Blue
(255, 0, 255), # Purple
@dillera
dillera / setup-systemd.bash
Last active June 12, 2024 02:53
BASH commands to save a systemd service file to start the udp_firewall.js script on boot.
cat <<'EOF' > /etc/systemd/system/udp-firewall.service
[Unit]
Description=UDP Firewall Service
After=network.target
[Service]
ExecStart=/usr/bin/node /usr/local/bin/udp_firewall.js
Restart=always
User=root
@dillera
dillera / udp_firewall.js
Created June 12, 2024 02:00
BASH command to save a node script that will listen on port 6677 for IP address from a SubText BBS
cat <<'EOF' > /usr/local/bin/udp_firewall.js
const dgram = require('dgram');
const { exec } = require('child_process');
const PORT = 6677;
const server = dgram.createSocket('udp4');
server.on('listening', () => {
@dillera
dillera / set_iptable_rules.bash
Created June 12, 2024 01:59
A set of commands to setup iptables for the firewall host
cat <<EOF | sudo bash
# Flush existing rules and set default policies
iptables -F
iptables -t nat -F
iptables -t mangle -F
iptables -t raw -F
iptables -X
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
@dillera
dillera / udp_capture.py
Created June 7, 2024 14:41
Small Python script to capture UDP traffic and display the payload
import pyshark
import logging
# Set up logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
def packet_handler(pkt):
try:
if 'UDP' in pkt:
src_addr = pkt.ip.src
@dillera
dillera / index.html
Created May 22, 2024 02:00
FujiNet Flasher Auto Manifest
cat <<'EOF' > index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ESP Web Tools with Dynamic Manifest</title>
<style>
#spinner {
display: none;
@dillera
dillera / HTTP.cpp
Created May 11, 2024 01:06
refactored http.cpp
NetworkProtocolHTTP::~NetworkProtocolHTTP()
{
for (int i = 0; i < collect_headers_count; i++)
if (collect_headers[i] != nullptr)
{
free(collect_headers[i]);
collect_headers[i] = nullptr;
}
}
@dillera
dillera / create-startup.bash
Created November 22, 2023 20:46
A bash script that will create a systemd startup file using local env vars for security
#!/bin/bash
#
# create flask startup scripts for flask apps.
# a typical path: /home/ubuntu/yourProject
# with a venv at: /home/ubuntu/yourProject/venv
#
# adiller oct 2023
#
#################################################################
# Function to display usage notes