mirror of
https://github.com/xweiba/location-spoofer.git
synced 2026-09-22 06:40:44 +08:00
feat: point third-party mode at upstream Yu9191 modules
- subscription URLs now resolve directly to upstream modules (gh-proxy mirror / raw), dropping project-owned module and script copies - remove Resources/ThirdPartyProxyModules and ThirdParty/WlocScripts, their pbxproj references, and the contract-test module checks - third-party save sends lon/lat/acc matching the upstream settings script; motion-state simulation is unavailable (upstream lacks it) - surface the iOS 27 beta 6 gs-loc MITM limitation in the app setup and README (zh/en)
This commit is contained in:
@@ -1,52 +0,0 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { readFile } from "node:fs/promises";
|
||||
import vm from "node:vm";
|
||||
|
||||
const bundles = [
|
||||
new URL("../dist/v1/wloc.js", import.meta.url),
|
||||
new URL("../dist/v1/wloc-settings.js", import.meta.url)
|
||||
];
|
||||
|
||||
test("generated bundles avoid newer JavaScriptCore runtime requirements", async () => {
|
||||
for (const bundle of bundles) {
|
||||
const source = await readFile(bundle, "utf8");
|
||||
for (const unsupported of [
|
||||
/\bBigInt\b/,
|
||||
/\bglobalThis\b/,
|
||||
/\bURLSearchParams\b/,
|
||||
/\bObject\.fromEntries\b/,
|
||||
/\?\./,
|
||||
/\?\?/
|
||||
]) {
|
||||
assert.equal(unsupported.test(source), false, `${bundle.pathname} contains ${unsupported}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
test("settings bundle runs without modern URL and text globals", async () => {
|
||||
const source = await readFile(bundles[1], "utf8");
|
||||
let result;
|
||||
const storage = new Map();
|
||||
vm.runInNewContext(source, {
|
||||
$rocket: {},
|
||||
$request: {
|
||||
url: "https://gs-loc.apple.com/wloc-settings/save?lon=121.1&lat=31.2&acc=25"
|
||||
},
|
||||
$persistentStore: {
|
||||
read: (key) => storage.get(key) || null,
|
||||
write: (value, key) => {
|
||||
storage.set(key, value);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
$done: (value) => { result = value; },
|
||||
JSON,
|
||||
Number,
|
||||
Object,
|
||||
String,
|
||||
decodeURIComponent
|
||||
});
|
||||
|
||||
assert.equal(JSON.parse(result.response.body).success, true);
|
||||
});
|
||||
-85
@@ -1,85 +0,0 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import {
|
||||
MOTION_ACTIVITY_CONFIDENCE, MOTION_ACTIVITY_TYPE, internals, parseFields, patchWlocBody
|
||||
} from "../src/core.js";
|
||||
|
||||
const { concat, writeVarint, writeTag, writeLengthDelimited } = internals;
|
||||
|
||||
function location(withMotion = false) {
|
||||
const fields = [
|
||||
concat(writeTag(1, 0), writeVarint(100)),
|
||||
concat(writeTag(2, 0), writeVarint(200)),
|
||||
concat(writeTag(3, 0), writeVarint(25))
|
||||
];
|
||||
if (withMotion) {
|
||||
fields.push(concat(writeTag(11, 0), writeVarint(7)));
|
||||
fields.push(concat(writeTag(12, 0), writeVarint(88)));
|
||||
}
|
||||
return concat(...fields);
|
||||
}
|
||||
|
||||
function wifiPayload(value = location()) {
|
||||
const device = concat(
|
||||
writeLengthDelimited(1, new TextEncoder().encode("aa:bb:cc:dd:ee:ff")),
|
||||
writeLengthDelimited(2, value)
|
||||
);
|
||||
return writeLengthDelimited(2, device);
|
||||
}
|
||||
|
||||
function frame(payload) {
|
||||
return concat(Uint8Array.from([0, 1, 0, 0, 0, 1, 0, 0]),
|
||||
Uint8Array.from([payload.length >> 8, payload.length & 0xff]), payload);
|
||||
}
|
||||
|
||||
const config = {
|
||||
latitude: 31.230416,
|
||||
longitude: 121.473701,
|
||||
accuracy: 50,
|
||||
motionSimulationEnabled: false
|
||||
};
|
||||
|
||||
test("patches synthetic Wi-Fi response", () => {
|
||||
const result = patchWlocBody(frame(wifiPayload()), config);
|
||||
assert.equal(result.stats.wifi, 1);
|
||||
assert.equal(result.stats.locations, 1);
|
||||
});
|
||||
|
||||
test("preserves motion fields while disabled", () => {
|
||||
const result = patchWlocBody(frame(wifiPayload(location(true))), config);
|
||||
const payload = result.data.slice(10);
|
||||
assert.ok(payload.includes(7));
|
||||
assert.ok(payload.includes(88));
|
||||
});
|
||||
|
||||
test("replaces motion fields while enabled", () => {
|
||||
const result = patchWlocBody(frame(wifiPayload(location(true))), {
|
||||
...config, motionSimulationEnabled: true
|
||||
});
|
||||
const root = parseFields(result.data.slice(10));
|
||||
const device = parseFields(root[0].value);
|
||||
const fields = parseFields(device.find((field) => field.number === 2).value);
|
||||
const motionType = fields.find((field) => field.number === 11);
|
||||
const motionConfidence = fields.find((field) => field.number === 12);
|
||||
assert.deepEqual(motionType.value, writeVarint(MOTION_ACTIVITY_TYPE));
|
||||
assert.deepEqual(motionConfidence.value, writeVarint(MOTION_ACTIVITY_CONFIDENCE));
|
||||
});
|
||||
|
||||
test("patches CellTower fields 22 and 24", () => {
|
||||
for (const number of [22, 24]) {
|
||||
const cell = writeLengthDelimited(5, location());
|
||||
const result = patchWlocBody(frame(writeLengthDelimited(number, cell)), config);
|
||||
assert.equal(result.stats.cell, 1);
|
||||
}
|
||||
});
|
||||
|
||||
test("encodes signed int64 coordinates without BigInt", () => {
|
||||
assert.deepEqual(
|
||||
Array.from(writeVarint(-18_000_000_000)),
|
||||
[128, 152, 247, 248, 188, 255, 255, 255, 255, 1]
|
||||
);
|
||||
assert.deepEqual(
|
||||
Array.from(writeVarint(18_000_000_000)),
|
||||
[128, 232, 136, 135, 67]
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user