Skip to content

Instantly share code, notes, and snippets.

View spacemeowx2's full-sized avatar

imspace spacemeowx2

  • 16:41 (UTC +08:00)
View GitHub Profile
@digilist
digilist / delay.sh
Created June 2, 2015 14:29
Delaying network traffic to a specific IP
#!/bin/bash
interface=lo
ip=10.0.0.1
delay=100ms
tc qdisc add dev $interface root handle 1: prio
tc filter add dev $interface parent 1:0 protocol ip prio 1 u32 match ip dst $ip flowid 2:1
tc qdisc add dev $interface parent 1:1 handle 2: netem delay $delay
@gbaman
gbaman / HowToOTG.md
Last active March 26, 2025 10:11
Simple guide for setting up OTG modes on the Raspberry Pi Zero

Raspberry Pi Zero OTG Mode

Simple guide for setting up OTG modes on the Raspberry Pi Zero - By Andrew Mulholland (gbaman).

The Raspberry Pi Zero (and model A and A+) support USB On The Go, given the processor is connected directly to the USB port, unlike on the B, B+ or Pi 2 B, which goes via a USB hub.
Because of this, if setup to, the Pi can act as a USB slave instead, providing virtual serial (a terminal), virtual ethernet, virtual mass storage device (pendrive) or even other virtual devices like HID, MIDI, or act as a virtual webcam!
It is important to note that, although the model A and A+ can support being a USB slave, they are missing the ID pin (is tied to ground internally) so are unable to dynamically switch between USB master/slave mode. As such, they default to USB master mode. There is no easy way to change this right now.
It is also important to note, that a USB to UART serial adapter is not needed for any of these guides, as may be documented elsewhere across the int

@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@nrollr
nrollr / nginx.conf
Last active February 22, 2025 10:42
NGINX config for SSL with Let's Encrypt certs
# UPDATED 17 February 2019
# Redirect all HTTP traffic to HTTPS
server {
listen 80;
listen [::]:80;
server_name www.domain.com domain.com;
return 301 https://$host$request_uri;
}
# SSL configuration
@wongsyrone
wongsyrone / change.diff
Last active April 24, 2020 07:42
badvpn change to Lwip 1.4(.1 maybe)
diff --git a/src/core/ipv4/ip4.c b/src/core/ipv4/ip4.c
index 4b38999c..1acc2558 100644
--- a/src/core/ipv4/ip4.c
+++ b/src/core/ipv4/ip4.c
@@ -473,6 +473,12 @@ ip_input(struct pbuf *p, struct netif *inp)
}
}
+ /* if we're pretending we are everyone for TCP, assume the packet is for source interface if it
+ isn't for a local address */
@hellman
hellman / 1_prepare_mitm.py
Last active October 8, 2019 06:02
0CTF 2018 Quals - zer0TC (Crypto 916)
#-*- coding:utf-8 -*-
'''
In the challenge we have a "toy block cipher". It is an SPN cipher with:
- 5 rounds
- 8 8-bit S-Boxes (64-bit block)
- bit permutations as linear layer
We are given 8 random plaintext/ciphertext pairs.
Legend:
WRI: Sent packet
RCV: Received packet
MCU: Received x31 packet. The first 49 bytes are truncated.
WRI: subcmd x22 - Set MCU state (suspend/resume)
RCV: 21 eb800000006a6878bed87500 8022 00000000000000000000000000000000000000000000000000000000000000000000
WRI: subcmd x21 - Write MCU
RCV: 21 f4800000006c5878bec87500 a021 0100ff00030005060000000000000000000000000000000000000000000000000062
WRI: subcmd x03 - Change input report format
@tesnos6921
tesnos6921 / info.md
Last active January 5, 2019 16:58
patchnso.py + sample patches for SMO 1.2.0

patchnso.py: a simple script to patch the .text sections of nso files and reassemble them

Python 2.7, requires lz4 module to be installed

Usage Instructions:

  1. Using hactool, extract the exefs of your game
  2. Within the exefsdir, there should be "main" and "main.npdm" and possibly a few others
  3. "main" is the game's main nso, you can load it into IDA and create your own patches or go out and find some
  4. When you have your patches put them all in a file in this format: (all values should be in hex) location:codepatch Example:
###############################################
# TX SX OS unpacker - by hexkyz and naehrwert #
###############################################
from Crypto.Cipher import AES
from Crypto.Util import Counter
import os
import struct
"""
# The following is adapted from https://github.com/reswitched/loaders/blob/master/nxo64.py
#
# ===========================================================================================
#
# Copyright 2017 Reswitched Team
#
# Permission to use, copy, modify, and/or distribute this software for any purpose with or
# without fee is hereby granted, provided that the above copyright notice and this permission
# notice appear in all copies.
#