Skip to content

Instantly share code, notes, and snippets.

@zeheater
zeheater / 01.sslgen.sh
Last active July 20, 2022 04:12
Generate Self Signed rootCA, server private key, server certificate with multiple wildcard domain + ip address
#!/bin/bash
ORG="ORGZ"
SERVER="project"
read -r -d '' CONFIG << EOM
[SAN]
subjectAltName=@alt_names
[alt_names]
@zeheater
zeheater / 00.sshd.sh
Last active May 10, 2022 07:47
Provisioning Ubuntu Server 20.04
#!/bin/bash
cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
cat << EOF > /etc/ssh/sshd_config
Include /etc/ssh/sshd_config.d/*.conf
Protocol 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
LogLevel INFO
PermitRootLogin no

Looking to create a Software RAID 1 setup for your 2-disk server on Ubuntu Server 20.04?

Screen Shot 2020-06-05 at 20 55 31

Let's start with the basics: the official guide by Ubuntu (https://ubuntu.com/server/docs/install/storage) is outdated/wrong. And as of March 2021 it's possible that there's a bug as well with how the bios_grub partitions are created when using multiple disks.

Now on to the solution:

  • Select "Custom storage layout" when you reach the storage configuration step of the installer.
  • If the disks have existing partitions, click on each disk under AVAILABLE DEVICES and then select REFORMAT. This will (temporarily) wipe out the partitions.
@zeheater
zeheater / old_excel_crack_macro.vbs
Last active March 6, 2022 06:10
Unlock Old Excel Protected Sheet Without Password
Option Explicit
Sub GetPass()
Const a = 65, b = 66, c = 32, d = 126
Dim i#, j#, k#, l#, m#, n#, o#, p#, q#, r#, s#, t#
With ActiveSheet
@zeheater
zeheater / send_bytes_bluetoothctl_spp.md
Created May 27, 2021 07:04
Sending raw bytes to SPP Mobile Printer with bluetoothctl bluez

Send Raw Bytes to Bluetooth SPP with bluetoothctl

bluetoothctl gatt.list-attributes
bluetoothctl gatt.select-attributes <spp - attributes>
bluetoothctl gatt.write "0xhh 0xhh ..."

Using interactive cli

@zeheater
zeheater / sixpair.c
Last active March 17, 2021 06:57
Set SixAxis Bluetooth Pair
/**
* Author: zeheater@gmail.com
* Credits:
* 1. https://help.ubuntu.com/community/Sixaxis?action=AttachFile&do=get&target=sixpair.c
* 2. https://github.com/kLeZ/SixPair
*
* Compile with:
* clang -Weverything -o sixpairng sixpairng.c -lusb-1.0
* OR
* gcc -o sixpairng sixpairng.c -lusb-1.0
@zeheater
zeheater / async_udp_server.py
Last active February 25, 2021 12:48
Python Async UDP Server
import sys
import asyncio
import concurrent.futures
from hexdump import hexdump
class DebugServer():
def connection_made(self, transport):
self.transport = transport

The basic concept of UN-ENCRYPTED VPN is to route all network packets to the client's TUN interface, where the VPN Client Sofware will read the packets from the TUN interface and write them into a buffer which then will be sent via TCP/UDP connection to the VPN Server. The VPN Server Software writes all data to the server's TUN interface so that it can go to the intended recipient. At this point there are important settings a server must be configured with.

# Server side configuration
sysctl -w net.ipv4.ip_forward=1
iptables -t filter -A FORWARD -j ACCEPT
iptables -t nat -A POSTROUTING -j MASQUERADE -s <TUN_IP/MASK>
@zeheater
zeheater / Step-by-Step GCC.md
Created October 2, 2020 16:01
A step-by-step breakdown of GCC compile and link process

Step-by-Step GCC

main.c

#include<stdio.h>

int main(int argc, char *argv[])
{
  printf("Hello, World !");
  return 0;
}
@zeheater
zeheater / JWT.md
Last active July 22, 2020 17:27
JWT Notes

JWT from Scratch

JWT Consist of 3 parts:

  • Header
  • Data
  • Verification
Sample:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c