Skip to content

Instantly share code, notes, and snippets.

@vcheckzen
vcheckzen / patch.sh
Last active August 27, 2024 13:30
Patch bins to write syslog to another place other than /dev/log
#!/bin/sh
# https://unix.stackexchange.com/questions/277202/use-a-different-socket-than-dev-log-system-wide
# https://blog.daveeddy.com/2018/09/26/logging-for-runit-on-void-linux-with-svlogger/
# Define the new and old log paths
NEW_LOG_PATH="/ved/log"
OLD_LOG_PATH="/dev/log"
# Function to patch binaries
@vcheckzen
vcheckzen / reverse.sh
Created August 13, 2024 16:49
Reverse lines
#!/bin/sh
reverse_all() {
input_file="$1"
# shellcheck disable=SC2016
sed '2,$G;h;$!d' "$input_file"
}
reverse_inner_group_by_prefix() {
input_file="$1"
@vcheckzen
vcheckzen / config.json
Created July 21, 2024 18:33
SingBox Http Client
{
"inbounds": [
{
"type": "mixed",
"listen": "::",
"listen_port": 10000
}
],
"outbounds": [
{
@vcheckzen
vcheckzen / override_ntp_cpd_server.sh
Created June 27, 2024 18:02
Android set NTP and CPD servers.
#!/bin/sh
# NTP
adb shell settings put global ntp_server ntp.aliyun.com
# CPD
adb shell settings put global captive_portal_http_url http://connect.rom.miui.com/generate_204
adb shell settings put global captive_portal_https_url https://connect.rom.miui.com/generate_204
adb shell settings put global captive_portal_use_https 1
adb shell settings put global captive_portal_detection_enabled 1
@vcheckzen
vcheckzen / find_ancestor_children.sh
Last active March 10, 2024 19:18
Find ancestor and descendant of a process on Linux.
#!/bin/sh
find_ancestors() {
pid=$1
while [ "$pid" -ne 0 ]; do
echo "$pid"
pid=$(awk '{print $4}' /proc/"$pid"/stat 2>/dev/null)
done
}
@vcheckzen
vcheckzen / restart-xray
Last active July 29, 2024 17:58
Run xray in tmp for mipsel_mips32
#!/bin/sh
BASEDIR="$(dirname "$0")"
(
cd "$BASEDIR" || exit 1
./kill-xray
sleep 3
./start-xray
)
@vcheckzen
vcheckzen / Instruction.md
Last active October 20, 2024 17:28
[Reproduce] Android 11+ Without Root Enable Adb WiFi On Boot Not Needing A Computer

简介

本教程是对 [1], [2], [3] 的复现,实现了 Android 11+ 开机解锁屏幕后自动开启 ADB WiFi 的 5555 端口,无需 ROOT 和电脑。如需无人值守,请将屏幕锁设置为 。本文不解释是什么,为什么,只介绍怎么做。

注意:本方法只适用于 WIFI 不会变化的场景,如果要在多个 WIFI 下使用,每个都要设置一次。

安装必要软件

  1. Termux
  2. Termux:Tasker
@vcheckzen
vcheckzen / ncsi.reg
Last active August 14, 2023 17:25
Windows Network Connectivity Status Indicator for China
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NlaSvc\Parameters\Internet]
"ActiveDnsProbeContent"="114.114.114.114"
"ActiveDnsProbeContentV6"="2409:8088:2000:2002::98"
"ActiveDnsProbeHost"="public1.114dns.com"
"ActiveDnsProbeHostV6"="dns.ipv6dns.com"
"ActiveWebProbeContent"="ok"
"ActiveWebProbeContentV6"="ok"
"ActiveWebProbeHost"="data.bilibili.com"
@vcheckzen
vcheckzen / port-scan.md
Created February 19, 2022 09:38
Network Port Open State Detection

Network Port Open State Detection

netcat

# tcp
nc -vzt google.com 443

# udp
nc -vzu dns.google 53
#!/usr/bin/env bash
jq() {
python3 -c "$(
cat <<EOF
import sys, json
json.dump($1$2, sys.stdout, separators=(',', ':'), ensure_ascii=False)
EOF
)"