| 12345678910111213141516171819202122232425262728293031 |
- #!/bin/bash
- # Regenerate verify.exe (verify-only sandbox binary) from a.exe.
- #
- # a.exe is the prebuilt harness from uunicorn/synaWudfBioUsb-sandbox whose flow
- # is hardcoded to enroll()+identify(). Two byte patches turn it into a
- # verify-only binary:
- # - 0x4048b8 call enroll -> NOP x5
- # - 0x4048e1 mov $0x2710,%ecx (10s) -> mov $0,%ecx
- # If a future upstream a.exe differs, this script fails loudly (signatures).
- set -eu
- SANDBOX=${1:-/home/nebulon/projects/fingerprint/work/synaWudfBioUsb-sandbox}
- cd "$SANDBOX"
- [ -f a.exe ] || { echo "a.exe not found in $SANDBOX" >&2; exit 1; }
- cp -f a.exe verify.exe
- python3 - <<'EOF'
- data = bytearray(open('verify.exe', 'rb').read())
- sigA = bytes.fromhex('b902000000e81fe4ffffe802d8ffff') # mov ecx,2; call setMode; call enroll
- sigB = bytes.fromhex('b910270000488b054b9c0100ffd0e816ceffff') # mov ecx,0x2710; ...; call identify
- i = data.find(sigA)
- assert i >= 0, "signature A not found - a.exe changed upstream?"
- data[i + 10:i + 15] = b'\x90' * 5
- j = data.find(sigB)
- assert j >= 0, "signature B not found - a.exe changed upstream?"
- data[j + 1:j + 3] = b'\x00\x00'
- open('verify.exe', 'wb').write(bytes(data))
- print("patched: call enroll -> NOP, Sleep(10000) -> Sleep(0)")
- EOF
- chmod +x verify.exe
- echo "verify.exe ready in $SANDBOX"
|