Skip to content

Instantly share code, notes, and snippets.

View ssnover's full-sized avatar

Shane Snover ssnover

View GitHub Profile
@ssnover
ssnover / notes.md
Created April 4, 2024 19:12
Captive Portal debugging

TLDR

In short, I had a working connection on OZO SSID for multiple weeks following the introduction of the captive portal. Since Sunday, March 31, I've had problems at the DNS layer and above. Logging into the WiFi does not lead to a captive portal, but instead drops the request. Trying to trigger the captive portal from the browser or curl with an http site does not work. Attempting to ping Google's DNS server at 8.8.8.8 or Cloudflare's at 1.1.1.1 also does not go through. I believe Unifi management server's captive portal is based on pfsense which functions by capturing and modifying the DNS response with a 302. Attempting to login on my phone managed to reveal the server's IP address and the below is my attempt to explore what flow the server was attempting to serve to clients. It revealed TLS/SSL certificate issues (perhaps the gateway has been configured to attempt to MitM TLS encrypted packets), but also revealed the login page for the management server on the guest network at port 8443.

Final

@ssnover
ssnover / Cargo.toml
Created August 21, 2020 01:46
Example of discovering Hue bridge with ssdp-client crate
[package]
name = "test-something"
version = "0.1.0"
authors = ["ssnover95 <ssnover95@gmail.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
ssdp-client = "0.5.5"
@ssnover
ssnover / literal-type-check.cpp
Created March 17, 2018 19:14
A short example of showing volatile makes my_struct_t a non-literal type.
// Put this gist in Matt Godbolt's Compiler Explorer
// Compiler: ARM GCC 6.3
// Options: -std=c++14
#include <cstdint>
#include <type_traits>
typedef struct
{
volatile uint32_t variable1; // Remove volatile, and the condition passes
@ssnover
ssnover / mbed_test_output.txt
Created February 26, 2018 15:24
End of the Terminal Output after Running `mbed test`
Memory map breakdown for built projects (values in Bytes):
+-----------------------------------+---------------+-----------+------------+-------------+
| name | target | toolchain | static_ram | total_flash |
+-----------------------------------+---------------+-----------+------------+-------------+
| FileHandle | NUCLEO_F302R8 | GCC_ARM | 8628 | 47632 |
| MemoryPool | NUCLEO_F302R8 | GCC_ARM | 8876 | 42665 |
| SingletonPtr | NUCLEO_F302R8 | GCC_ARM | 8436 | 36937 |
| Transaction | NUCLEO_F302R8 | GCC_ARM | 8484 | 37573 |
| attributes | NUCLEO_F302R8 | GCC_ARM | 8620 | 36805 |
| basic | NUCLEO_F302R8 | GCC_ARM | 7924 | 29523 |
@ssnover
ssnover / main.cpp
Created February 24, 2018 04:34
Example whereby a fault occurs due to construction of mbed::CAN
/*
* file: main.cpp
* purpose: Entry point for the test of the CAN adapter.
*/
#include "mbed.h"
DigitalOut green_led(LED2);
CAN my_can_driver(PB_8, PB_9, 5000);
@ssnover
ssnover / arduino-evt-spi-testing.ino
Created November 29, 2017 02:09
Arduino SPI-to-Serial Slave
/*
* A short Arduino sketch which waits for a SPI character to be sent from a
* master device and then prints the received character over Serial.
*/
#include "Arduino.h"
#include <avr/io.h>
void setup()
{
@ssnover
ssnover / can-json-logger.py
Created September 18, 2017 23:50
Reads from a hard-coded serial port relying on a hard-coded message format.
import serial
LOG_FILE = 'can-message-log.txt'
def main():
"""
:return:
"""
my_serial_port = serial.Serial(port='COM6',
@ssnover
ssnover / arduino-can-rx.ino
Last active September 18, 2017 15:39
Arduino CAN-to-JSON Listener
#include <cstdio>
#include "Arduino.h"
#include "mcp_can.h"
#define NOP() asm("nop\n")
MCP_CAN my_can_controller(10);
const uint8_t CAN_INTERRUPT_PIN(2);
uint32_t messageId;