Skip to content

Instantly share code, notes, and snippets.

@kylemanna
kylemanna / dnsmasq.sh
Created March 15, 2017 02:35
Simple tftp server using dnsmasq
$ sudo dnsmasq -kd -p 0 -C /dev/null -u nobody --enable-tftp --tftp-root=/srv/ftp
@cslarsen
cslarsen / sendeth.py
Created April 27, 2014 07:14
One way of sending raw Ethernet packets in Python
"""Demonstrates how to construct and send raw Ethernet packets on the
network.
You probably need root privs to be able to bind to the network interface,
e.g.:
$ sudo python sendeth.py
"""
from socket import *
@JanKoppe
JanKoppe / mactab
Created October 12, 2016 20:14
Persistent network device naming with Alpine Linux
#/etc/mactab
---
lan0 00:11:22:33:44:01
wan0 00:11:22:33:44:02
@sweenzor
sweenzor / subprocessdemote.py
Created January 26, 2012 23:08
Run python subprocess(es) as another user
#!/usr/bin/env python
import os
import subprocess
# > python subprocessdemote.py
# > sudo python subprocessdemote.py
def check_username():
c: command
cc: commandContext
v: version
P: payload
N: bulkedPayload
fP: fanoutPayload
aP: additionalPayload
Pm: payloadMetadata
i: messageId
U: messageUUID
@Cypheriel
Cypheriel / _srp.py
Last active June 23, 2024 10:51
Limited RFC 5054-compatibile client-side implementation of the Secure Remote Password protocol. Designed to work with Apple's GrandSlam Authentication API.
"""Copyright (c) 2024 Cypheriel.
Secure Remote Password protocol implementation.
This module provides an implementation of the Secure Remote Password protocol, as defined in RFC 5054.
For now, only the client-side implementation is provided.
This implementation is designed to be compatible with the Apple SRP implementation, as used in the GrandSlam framework.
See:
- https://datatracker.ietf.org/doc/html/rfc5054
@Cypheriel
Cypheriel / $mitmproxy for macOS internal services.md
Last active December 6, 2024 09:24
Guide for installing and setting up both mitmproxy and Frida mainly for use with sniffing HTTP(S) traffic internal to macOS.

Install mitmproxy

  1. Follow the instructions to install mitmproxy and launch either mitmproxy or mitmweb. If you plan on sniffing traffic from a macOS VM, it is probably preferable to install mitmproxy on the host OS.
  2. Change your proxy settings in macOS to use your local IPv4 address with port 8080 (by default).
    • System SettingsNetworkAdvancedHTTP and HTTPS proxies
  3. Install the mitmproxy certificate by navigating to http://mitm.it/
  4. Disable SSL verification.
    • On mitmweb, this is toggled in OptionsDon't verify server certificates

Install Frida

@Lauszus
Lauszus / crc.py
Last active December 12, 2024 21:06
Generic CRC-8, CRC-16 and CRC-32 calculations in Python
#!/usr/bin/env python
# Inspired by: https://www.youtube.com/watch?v=izG7qT0EpBw
# The CRC values are verified using: https://crccalc.com/
def reflect_data(x, width):
# See: https://stackoverflow.com/a/20918545
if width == 8:
x = ((x & 0x55) << 1) | ((x & 0xAA) >> 1)
x = ((x & 0x33) << 2) | ((x & 0xCC) >> 2)
x = ((x & 0x0F) << 4) | ((x & 0xF0) >> 4)
#include "Crypto.h"
#include "clock.h"
#include "global_config.h"
#include "log.h"
#include "string.h"
#include "PhysicalLayer.h"
#include "Zigbee.h"
#include "OSAL.h"
@hdoverobinson
hdoverobinson / ubxconfig.sh
Last active February 11, 2025 20:34
Configure u-blox GPS/GNSS modules with Bash
#!/bin/bash
###AUTHOR###
#Harry Dove-Robinson 5/8/2017
#harry@doverobinson.me
#https://gist.github.com/hdoverobinson
#https://github.com/hdoverobinson
###USAGE###
#This is a script used to configure u-blox GPS/GNSS modules from a text file generated by u-center.