Skip to content

Instantly share code, notes, and snippets.

View rikka0w0's full-sized avatar

Rikka0_0小六花 rikka0w0

  • UNSW
  • Sydney
View GitHub Profile
@rikka0w0
rikka0w0 / ubuntu_live_custom.md
Last active October 28, 2022 02:41
Customize Ubuntu 18.04 Live CD
  • Without the bootloader, you only need these files in casper/ to boot into live ubuntu: filesystem.squashfs initrd vmlinuz
  • The casper boot script will mount anything named with ".squashfs" to the lower layer of the overlayfs during boot. In this case, I'm creating my own "myroot.squashfs" to add packages and files into the live ubuntu, without having to unpack the existing "filesystem.squash". This saves a lot of time.

1. Mount everything:

Mount the original squashfs as the base (lower2), then mount the overlayfs with our committed changes (lower1) into myroot. Changes will be recorded in upper.

mkdir lower1 lower2 upper work
sudo mount -t squashfs /cdrom/casper/filesystem.squashfs lower2
sudo mount -n -t overlay overlayfs:/overlay -o lowerdir=lower1:lower2,upperdir=upper,workdir=work,index=on,redirect_dir=nofollow myroot
@rikka0w0
rikka0w0 / linux_tgt_iscsi_target.md
Last active January 11, 2020 16:13
iSCSI target on

Install TGT iSCSI target

sudo apt install -y tgt
sudo nano /etc/tgt/conf.d/TecMint_iscsi.conf

Write the config file (can be any.conf)

<target qwq.cszombie.net:lun0>
     # Provided device as an iSCSI target
 #direct-store /dev/sdb1
@rikka0w0
rikka0w0 / pxe_win10_winpe.md
Last active November 23, 2024 07:52
Boot Windows 10 and WinPE from PXE (IPXE)

Pre-requests:

  1. TFTP server
  2. IPXE Make sure ipxe.lkrn is in the TFTP root.
  3. iSCSI target (Server) Assume we have an iSCSI target "1:net.cszombie.au:windows" that is ready to be connected. 1 is LUN id, "net.cszombie.au:windows" is the target name.
  4. HTTP server (To speed up loading boot.wim, http is faster than tftp, http is supported by IPXE, however this is optional)

1. Download wimboot to the root of the TFTP server

2. Create scripts:

@rikka0w0
rikka0w0 / ipxe_build.md
Last active July 26, 2025 11:58
Build IPXE

1. Install tools and config IPXE

# Install compiler and dependencies
sudo apt-get install -y git gcc make liblzma-dev

# Grab the source code
git clone https://github.com/ipxe/ipxe.git
cd ipxe/src

# Enable NFS support
@rikka0w0
rikka0w0 / ramos_windows7.md
Last active June 16, 2024 13:22
Win7 RamOS PXE

Prerequests:

  1. DHCP server serving PXE information
  2. TFTP server
  3. IPXE(undionly.kpxe and/or ipxe.efi)
  4. memdisk (From Syslinx, can be found on Ubuntu live /usr/lib/syslinux/memdisk) on TFTP root
  5. A Win7 installation ISO, I'm using 23572_ENTERPRISE-7-SP1_X64_ZH-CN_PIP.iso (Google or Baidu it!), it is a special minimal Chinese x64 version created by a Russian guy.
  6. Download this tool: VHD_W7_Compact and extract to VHD_W7C_88.

1. Install Win7 x64 on a virtual machine (vmware)

  1. Install Win7
@rikka0w0
rikka0w0 / iptables_forward_to_hostname.md
Created January 22, 2020 18:03
Add/Update iptable NAT port forward rule based on hostname instead of ip address
#!/bin/bash

HostName=
PortListen=
PortTarget=

IPv4=$(ping -c1 $HostName | grep "bytes of data" | cut -d "(" -f2 | cut -d ")" -f1)
echo $IPv4
@rikka0w0
rikka0w0 / Fr6ToolChainInfo.java
Last active February 12, 2020 16:37
Add "Stack Analyzer" and "Build Analyzer" from STM32CubeMxIDE to Eclipse AC6
package com.st.stm32cube.ide.mcu.toolchain;
import java.util.Map;
import java.util.function.Supplier;
import com.st.stm32cube.common.ecosystemintegration.core.CompilerEnum;
import com.st.stm32cube.ide.mcu.toolchain.IToolChainInfo;
public class Fr6ToolChainInfo implements IToolChainInfo{
@rikka0w0
rikka0w0 / tunnel_smb_windows.md
Created March 2, 2020 17:21
How to proxy smb on Windows 10 using ssh

short description with ssh n stuff for tunneling

  1. launch hdwwiz.exe
  2. network adapters -> Microsoft KM-TEST Loopback Adapter -> finish
  3. disable everything except ipv4 in that new network sink
  4. inside the ipv4 settings set up a ip, 255.255.255.255 as subnet mask and disable netbios
    • if you cannot decide on an ip simply use 192.0.2.123 since it's not a public ip and most likely will never be used in a LAN environment. (in case you care about vpn compatibility)
  5. elevated windows shell
    • run sc config lanmanserver start= delayed-auto
      this is sadly required since microsoft will bind it's smb bullshit to 0.0.0.0:445 thus making it impossible to listen to that port yourself.
@rikka0w0
rikka0w0 / uicc_ribbon_binary_format.md
Last active April 9, 2025 22:38
Binary format of the Win32 Ribbon resource file

Introduction

The UICC.exe produces a binary description file from the source XAML, this binary is embedded in the generated RC resource file. The format of the binary file is not documented. I will try to reverse-engineer its binary format.

Definitions:

  1. Byte, 8 bits
  2. WORD, 16 bits, little-endian
  3. DWORD, 32 bits, little-endian

File Structure

@rikka0w0
rikka0w0 / update_iptables.sh
Created May 21, 2020 16:12
Add/Update iptable forwading rule with hostnames
#!/bin/bash
# Usage:
# Add/Update: ./update_iptables.sh <port_listen> (tcp|udp) <hostname>:<port>
# Delete: ./update_iptables.sh <port_listen> (tcp|udp) :<port>
PortListen=$1
Protocol=$2
HostName=${3%:*}
PortTarget=${3#*:}