Initial commit

This commit is contained in:
Xuc Pan committed 2026-09-05 13:04:29 +08:00
commit 611383544b
91 files changed
+12958

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -euo pipefail
project_root=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd -P)
temporary=$(mktemp -d "${TMPDIR:-/tmp}/uur-check.XXXXXX")
trap 'rm -rf -- "$temporary"' EXIT
cargo fmt --manifest-path "$project_root/Cargo.toml" --check
cargo clippy --manifest-path "$project_root/Cargo.toml" \
--all-targets -- -D warnings
cargo test --manifest-path "$project_root/Cargo.toml" --all-targets
cc -std=c11 -O2 -Wall -Wextra -Werror \
"$project_root/tests/frame-protocol.c" -o "$temporary/frame-protocol"
"$temporary/frame-protocol"
"$project_root/hook/build.sh"
"$project_root/capture/build.sh"
+8
View File
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
# Print the dotted version inside an installer filename such as
# UURemote_Setup_4.39.1.1375_0902062520_gwqd.exe or uuyc_4.33.0.exe.
set -euo pipefail
[[ $# == 1 ]] || { printf 'usage: %s <filename>\n' "$0" >&2; exit 2; }
grep -oE '[0-9]+(\.[0-9]+)+' <<<"$1" | head -n 1
+45
View File
@@ -0,0 +1,45 @@
#!/usr/bin/env bash
# Install uur into ~/.local: binary, hook DLLs, icon and an application
# menu entry. Clicking "UU Remote" in the launcher then runs the whole
# stack; no PATH edits are needed (the desktop entry uses absolute paths).
set -euo pipefail
root=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd -P)
readonly root
prefix="${UUR_INSTALL_PREFIX:-$HOME/.local}"
[[ -x "$root/target/release/uur" ]] || {
printf 'missing %s — run: cargo build --release\n' \
"$root/target/release/uur" >&2
exit 1
}
[[ -f "$root/build/hook/wevtapi.dll" && -f "$root/build/hook/uur-hook.dll" ]] || {
printf 'missing hook DLLs — run: ./hook/build.sh\n' >&2
exit 1
}
[[ -f "$root/capture/uur-pw-capture" ]] || {
printf 'missing capture helper — run: ./capture/build.sh\n' >&2
exit 1
}
install -Dm0755 "$root/target/release/uur" "$prefix/bin/uur"
for helper in uur-pw-capture; do
install -Dm0755 "$root/capture/$helper" "$prefix/lib/uur/$helper"
done
for dll in wevtapi.dll uur-hook.dll winlogon.exe uur-terminal-proxy.exe; do
install -Dm0644 "$root/build/hook/$dll" "$prefix/lib/uur/hook/$dll"
done
# Menu entry: absolute Exec path so the user's PATH is irrelevant.
install -Dm0644 "$root/packaging/uur.desktop" \
"$prefix/share/applications/uur.desktop"
sed -i "s|^Exec=.*|Exec=$prefix/bin/uur run|; s|^TryExec=.*|TryExec=$prefix/bin/uur|" \
"$prefix/share/applications/uur.desktop"
if [[ -f "$root/packaging/uur-icon.png" ]]; then
install -Dm0644 "$root/packaging/uur-icon.png" \
"$prefix/share/icons/hicolor/256x256/apps/uur.png"
fi
printf 'installed:\n %s/bin/uur\n %s/lib/uur/\n %s/share/applications/uur.desktop\n' \
"$prefix" "$prefix" "$prefix"
UUR_COMMAND="$prefix/bin/uur" "$root/packaging/post-install-message"
+7
View File
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
# Resolve the official NetEase UU Remote installer URL (curl, redirects).
set -euo pipefail
readonly feed_url="https://api.nrd.nie.163.com/api/v1/release/dl/1?channel=gwqd"
curl -fsIL --max-time 20 -o /dev/null -w '%{url_effective}' "$feed_url"
+75
View File
@@ -0,0 +1,75 @@
#!/usr/bin/env bash
set -euo pipefail
input=${1:?usage: scripts/probe-upstream.sh INSTALLER_OR_CLIENT_TREE}
work=$(mktemp -d "${TMPDIR:-/tmp}/uur-probe.XXXXXX")
trap 'rm -rf -- "$work"' EXIT
for tool in 7z objdump find strings; do
command -v "$tool" >/dev/null 2>&1 || {
printf 'missing probe dependency: %s\n' "$tool" >&2
exit 2
}
done
scan_root=$input
if [[ -f $input ]] && command -v osslsigncode >/dev/null 2>&1; then
osslsigncode verify -in "$input" >"$work/signature.log" 2>&1 || {
printf 'the upstream installer has no valid Authenticode signature\n' >&2
exit 1
}
fi
if [[ -f $input ]]; then
7z x -y -o"$work/payload" "$input" >"$work/extract.log" || true
scan_root="$work/payload"
fi
mapfile -d '' pe_files < <(
find "$scan_root" -type f \( -iname '*.exe' -o -iname '*.dll' \) -print0
)
if ((${#pe_files[@]} == 0)) && [[ -f $input ]]; then
for tool in wine wineboot xvfb-run timeout; do
command -v "$tool" >/dev/null 2>&1 || {
printf 'installer extraction is opaque and %s is unavailable for the Wine probe\n' \
"$tool" >&2
exit 2
}
done
export WINEPREFIX="$work/wine"
export WINEDEBUG=-all
xvfb-run -a wineboot --init >"$work/wineboot.log" 2>&1
timeout 240s xvfb-run -a wine "$input" /S >"$work/install.log" 2>&1 || true
scan_root="$WINEPREFIX/drive_c"
mapfile -d '' pe_files < <(
find "$scan_root" -type f \( -iname '*.exe' -o -iname '*.dll' \) -print0
)
fi
((${#pe_files[@]} > 0)) || {
printf 'no PE payload was available after extraction and Wine installation\n' >&2
exit 1
}
imports="$work/imports.txt"
strings_file="$work/strings.txt"
for file in "${pe_files[@]}"; do
objdump -p "$file" >>"$imports" 2>/dev/null || true
strings -a "$file" >>"$strings_file" 2>/dev/null || true
done
require_symbol() {
local symbol=$1
if ! grep -Fqi "$symbol" "$imports" && ! grep -Fqi "$symbol" "$strings_file"; then
printf 'missing upstream API contract: %s\n' "$symbol" >&2
return 1
fi
}
require_symbol SendInput
require_symbol EvtOpenPublisherMetadata
if ! grep -Eqi 'BitBlt|StretchBlt|CreateDXGIFactory1|DuplicateOutput' \
"$imports" "$strings_file"; then
printf 'missing every supported desktop capture API contract\n' >&2
exit 1
fi
printf 'upstream static contracts passed (%d PE files)\n' "${#pe_files[@]}"