Skip to content

Instantly share code, notes, and snippets.

View mzpqnxow's full-sized avatar
🙈
Look at all this free stuff!

AG mzpqnxow

🙈
Look at all this free stuff!
View GitHub Profile
## FOR UBUNTU
Dependencies install
1. apt-get install nginx-extras
2. apt-get install lua-zlib
lua file decompress request body
--------------------------------
see https://gist.github.com/iammehrabalam/30f5402bbcdad139c9eafd3a6f47ce6c
@mzpqnxow
mzpqnxow / ubuntu-xenial-armfh-qemu.md
Created September 25, 2020 05:48 — forked from takeshixx/ubuntu-xenial-armfh-qemu.md
Running Ubuntu 16.04.1 armhf on Qemu

Running Ubuntu 16.04.1 armhf on Qemu

This is a writeup about how to install Ubuntu 16.04.1 Xenial Xerus for the 32-bit hard-float ARMv7 (armhf) architecture on a Qemu VM via Ubuntu netboot.

The setup will create a Ubuntu VM with LPAE extensions (generic-lpae) enabled. However, this writeup should also work for non-LPAE (generic) kernels.

The performance of the resulting VM is quite good, and it allows VMs with >1G ram (compared to 256M on versatilepb and 1G on versatile-a9/versatile-a15). It also supports virtio disks whereas versatile-a9/versatile-a15 only support SD cards via the -sd argument.

Get netboot files

@mzpqnxow
mzpqnxow / config-aes-gcm.h
Created September 8, 2020 18:04
Configure mbedtls for aes-gcm ONLY as a static library
#ifndef MBEDTLS_CONFIG_H
// Build mbtedtls with this as your configuration file and you'll have only what you need
// for AES GCM. You'll find a pretty small statically linked exe, at least when compared
// with WolfSL, OpenSSL, etc, etc. which (to be fair) are really meant to always have some
// amount of SSL/TLS support enabled
#define MBEDTLS_CONFIG_H
#define MBEDTLS_AES_FEWER_TABLES
#define MBEDTLS_NO_UDBL_DIVISION
#define MBEDTLS_AES_C
#define MBEDTLS_CIPHER_C
@mzpqnxow
mzpqnxow / filternet.py
Created August 25, 2020 13:33
Filter out LAN/multicast/broadcast/reserved/special in-place in Python3
#!/usr/bin/env python3
from ipaddress import ip_network
from sys import argv
lines = open(argv[1], mode='r').read().splitlines()
with open(argv[1], mode='w') as outfd:
for line in lines:
net = ip_network(line)
skip_addr = (net.is_link_local, net.is_loopback, net.is_multicast, net.is_private, net.is_reserved, net.is_unspecified)
@mzpqnxow
mzpqnxow / DiscordSOCKS5.md
Created August 24, 2020 04:45
Use SOCKS5 proxy with Discord on Linux

Using SOCKS5 Proxy With Discord on Linux

You may only need the environment or the command-line parameter to force Discord to use a proxy. It doesn't hurt to use both

So if you're behind a firewall and need to go through, e.g. an SSH dynamic port forward (a SOCKS5 channel inside an SSH session) you can use the following:

$ nohup ssh -D1080 proxy_server &
$ http_proxy=socks5://127.0.0.1:1080 https_proxy=socks5://127.0.0.1:1080 /opt/Discord/Discord --proxy-server="socks5://127.0.0.1:1080"
@mzpqnxow
mzpqnxow / commands.config
Created August 8, 2020 13:58
Basic reduced attack surface EdgeRouter configuration commands (L2-only configuration)
#
# This doesn't cover all of the hardening required for setting up an EdgeRouter as
# a router/firewall. This is more suitable for an Edge-X configured as a VLAN aware
# switch. There's a lot more to do to harden an L3 configuration, I'm not including it
# here
#
# Bind the management services to a specific IP address on a management VLAN interface
set service gui listen-address x.x.x.x
set service gui older-ciphers disable
@mzpqnxow
mzpqnxow / golang_fork.md
Last active August 1, 2020 14:21
Working with golang forks

Working with golang forks

The import path must be fixed when working on golang project forks. Here are some notes. I am not a golang dev by any means so I don't recommend anyone follow this. It's primarily for self-documentation

Assume a checked out fork

In your cloned repository, use go mod edit to fix the imports to point to your repository. Otherwise it will attempt to reference the original project's repository which won't work when you build

$ rm -f go.mod
@mzpqnxow
mzpqnxow / memdump.sh
Created July 31, 2020 23:00
Dump all memcache data from a host
#!/bin/bash
declare -r TARGET=$1
declare -r TIMEOUT=3
declare -r PORT=11211
if [ $# -ne 1 ]; then
echo "Usage: $0 <host>"
exit 1
fi
sudo apt-get install -y libmemcached-tools
for key in $(memcdump --servers="${TARGET}:${PORT}"); do
@mzpqnxow
mzpqnxow / att2intel.sh
Last active July 7, 2020 14:34
Roughly convert GNU binutils x86 (ATT) syntax to nasm (Intel) syntax
#!/usr/bin/perl -w
#
# Convert ATT/GNU binutils/as syntax to nasm-compatible (Intel) syntax and make it a little
# more readable. Supports basic instructions plus MMX instructions
#
# YMMV - I didn't write this nor do I maintain it
# It can be found on StackOverflow somewhere, credit to the original author
#
# https://stackoverflow.com/questions/137038/how-do-you-get-assembler-output-from-c-c-source-in-gcc
#
@mzpqnxow
mzpqnxow / azure-pmd-failsafe.sh
Created June 25, 2020 15:33
Shell script for setting up DPDK fail-safe PMD on Azure
#!/bin/sh
# Copyright (c) 2017 6WIND S.A.
version=20171003
[ "$0" != "bash" ] && self=$(readlink -f "$0")
[ "$self" ] && _self=${self##*/}
netvsc_id="{f8615163-df3e-46c5-913f-f2d2f965ed0e}"