Skip to content

Instantly share code, notes, and snippets.

@siwtom
siwtom / redsocks.conf
Created October 28, 2023 01:51 — forked from afriza/redsocks.conf
Setup iptables for RedSocks in OpenWRT
base {
// debug: connection progress & client list on SIGUSR1
log_debug = on;
// info: start and end of client session
log_info = on;
/* possible `log' values are:
* stderr
* file:/path/to/file
# nov/02/2022 13:13:38 by RouterOS 7.6
# software id = HCC0-4FJR
#
/interface bridge
add dhcp-snooping=yes igmp-snooping=yes name=bridge1
/interface ethernet
set [ find default-name=ether8 ] disable-running-check=no mac-address=\
00:02:B6:45:34:F4 name=B
set [ find default-name=ether1 ] disable-running-check=no name=C
set [ find default-name=ether2 ] disable-running-check=no name=D
@siwtom
siwtom / 00_MIGRATE_KEY.md
Created August 22, 2023 15:30 — forked from ttimasdf/00_MIGRATE_KEY.md
Migrate your OTA key, step by step guide

Goal

Migrate from self-built (test-key or dev-key) or Official Release from https://download.lineageos.org/, to our self-signed builds, RETAINING DATA!!! and avoid the annoying error:

Can't install this package on top of incompatible data. Please try another package or run a factory reset

Usage

Apply the two patch accordingly, with command below. (Changed a little bit from 156047 and 162144

@siwtom
siwtom / apk_zipalign_resign.md
Created March 28, 2023 17:57 — forked from ctrl-freak/apk_zipalign_resign.md
Modifying Android APK and Resign on Windows
@siwtom
siwtom / lineage-signing-builds.md
Created March 22, 2023 05:00 — forked from A2L5E0X1/lineage-signing-builds.md
Signing LineageOS builds with your own dev-keys

Generating dev-keys for signing android builds

All you need is an android buildsystem (I would recommend you to use lineageos)

PART 1: GENERATING KEYS

  1. Export your infos (replace examples with your infos)
subject='/C=US/ST=California/L=Mountain View/O=Android/OU=Android/CN=Android/[email protected]'

C: Country shortform
ST: Country longform
L: Location (I used federal state)

@siwtom
siwtom / Device.java
Created November 25, 2022 03:38 — forked from hormesiel/Device.java
How to get an Android device's serial number, visible to the user in "Settings > About phone/tablet/device > Status > Serial number".
import android.os.Build;
import java.lang.reflect.Method;
public class Device {
/**
* @return The device's serial number, visible to the user in {@code Settings > About phone/tablet/device > Status
* > Serial number}, or {@code null} if the serial number couldn't be found
*/
public static String getSerialNumber() {
@siwtom
siwtom / emulator-install-using-avdmanager.md
Created January 18, 2022 14:23 — forked from mrk-han/emulator-install-using-avdmanager.md
Installing and creating Emulators with AVDMANAGER (For Continuous Integration Server or Local Use)

Install and Create Emulators using AVDMANAGER and SDKMANAGER

TL;DR

For generic skin emulator with default apis (without google apis):

  1. List All System Images Available for Download: sdkmanager --list | grep system-images

  2. Download Image: sdkmanager --install "system-images;android-29;default;x86"

@siwtom
siwtom / emulator-with-fake-webcam.sh
Created January 16, 2022 15:34 — forked from radium226/emulator-with-fake-webcam.sh
Run an Android emulator with a fake webcam
#!/bin/bash
export REAL_DEVICE="/dev/video0"
export FAKE_DEVICE="/dev/video1"
export DURATION="5"
export SIZE="320x240"
export AVD="Nexus_5X_API_25"
@siwtom
siwtom / selenium_xhr_requests_via_performance_logging.py
Created September 6, 2021 08:18 — forked from lorey/selenium_xhr_requests_via_performance_logging.py
Access Chrome's network tab (e.g. XHR requests) with Selenium
#
# This small example shows you how to access JS-based requests via Selenium
# Like this, one can access raw data for scraping,
# for example on many JS-intensive/React-based websites
#
from time import sleep
from selenium import webdriver
from selenium.webdriver import DesiredCapabilities
@siwtom
siwtom / DecryptEncrypt.cs
Created March 16, 2019 05:17 — forked from loufq/DecryptEncrypt.cs
C# aes-256-cbc DecryptEncrypt
/// <summary>
/// aes-256-cbc 解码
/// </summary>
/// <param name="cipherData"></param>
/// <param name="keyString"></param>
/// <param name="ivString"></param>
/// <returns></returns>
public static string Decrypt(string cipherData, string keyString, string ivString)
{
byte[] key = Encoding.UTF8.GetBytes(keyString);