Skip to content

Instantly share code, notes, and snippets.

View marceloalcocer's full-sized avatar

Marcelo Alcocer marceloalcocer

View GitHub Profile
@marceloalcocer
marceloalcocer / echo.py
Last active April 20, 2021 21:17
TCP echo server implemented using asyncio
#!/usr/bin/env python3
"""TCP echo server
Implemented using asyncio for concurrent client handling
"""
import asyncio
import argparse
import logging
@marceloalcocer
marceloalcocer / nat.sh
Created April 23, 2021 15:09
1:1 TCP NAT using nftables
#!/usr/bin/env bash
#
# 1:1 TCP NAT using nftables
#
# Implementation of 1:1 network address translation (NAT) between WAN/LAN
# on a Raspberry Pi 4B using nftables. NAT is performed;
#
# * for a single host on the LAN
# * for TCP traffic only
# * to specified ports on the LAN host
@marceloalcocer
marceloalcocer / wol.sh
Last active October 19, 2021 21:20
Wake on LAN magic packet dispatch implemented in bash
#!/usr/bin/env bash
#
# Wake on lan
#
# Send WoL magic packet over UDP
#
# Usage:
#
# wol MAC ADDRESS [PORT]
# wol FILE
@marceloalcocer
marceloalcocer / chromium-cookie.py
Created December 27, 2022 23:21
Chromium cookie extraction and decryption
@marceloalcocer
marceloalcocer / base64.c
Last active June 19, 2023 19:06
Lightweight base64 encoder, implemented in C
/* Base64 encoder *************************************************************
* *
* A lightweight base64 encoder, implemented in C. *
* *
* *
* Example usage; *
* *
* ``` *
* void main(void){ *
* unsigned char octets[] = { *
@marceloalcocer
marceloalcocer / pwnedpasswords.sh
Last active July 31, 2023 20:18
PwnedPasswords client implemented in bash
#!/usr/bin/env bash
#
# PwnedPasswords client implemented in bash
#
# Return the number of times a password has been seen in data breaches by
# querying the [PwnedPasword][hibp] service. Particularly useful for those
# who want to use the service, but are squeamish about typing their
# passwords into a web form…
#
# [hibp]: https://haveibeenpwned.com/Passwords