LocationSpoofer README

The project's README from github.com/HuangZhuoRui/LocationSpoofer. As one markdown file: README.md.

LocationSpoofer

基于 KernelSU + LSPosed 的 Android 系统级虚拟定位与无线环境伪装框架

Android system-level location spoofing and wireless environment simulation framework based on KernelSU + LSPosed

License: GPL-3.0 Android Kotlin Compose KernelSU LSPosed Telegram

简体中文 | English


📢 加入我们的 Telegram 交流群 进行技术探讨、催更、吹牛逼、搞抽象。

📖 查看 LocationSpoofer 详细使用教程


项目简介

在现代 Android 系统的风控与反作弊环境中,传统的“模拟位置(Mock Location)”开发者选项已被商业 SDK(如高德风控、腾讯安全、百度定位、网易易盾、各类考勤及打卡风控系统)列为高风险特征。这类检测机制不仅验证 isFromMockProvider / isMock 标志位,还会主动采集并交叉比对设备所处的周围物理环境:

LocationSpoofer 是专为应对深度风控检测而设计的系统级虚拟定位与无线环境模拟方案。 项目基于 KernelSU / APatch / Magisk 获取底层 Root 权限,并利用 LSPosed (libxposed API 101+) 框架在 Zygote 阶段注入目标应用进程,以高物理契合度拦截并伪造所有与位置、卫星、基站、Wi-Fi、蓝牙、传感器相关的底层 API 响应,确保应用获取自洽且真实的虚假环境指纹。


功能特性

┌─────────────────────────────────────────────────────────────────────────┐
│                             LocationSpoofer                             │
│                    系统级虚拟定位与无线环境模拟                         │
└─────────────────────────────────────────────────────────────────────────┘
        │                            │                            │
        ▼                            ▼                            ▼
  【空间定位与物理仿真】       【无线电与传感器模拟】         【反检测套件】
  • 三地图引擎自由切换         • Wi-Fi 扫描与连接态伪装       • Xposed 堆栈调用帧清洗
  • WGS-84/GCJ-02/BD-09 自适应 • 2G-5G NR 蜂窝基站小区模拟   • ClassLoader 探测隔离
  • Ornstein-Uhlenbeck 抖动    • BLE 蓝牙信标扫描过滤         • isFromMockProvider 抹除
  • 步态横向摇摆与高斯噪声     • WiGLE / OpenCellID 云端导入  • AppOps OP_MOCK_LOCATION 隐藏
  • 真实路网拟合与红绿灯停候   • 空间反距离加权 (IDW) 插值    • Settings.Secure 开关覆写
  • 悬浮窗遥控阻尼摇杆         • 步频与计步传感器联动         • MultiDex 动态 Class 拦截

1. 多地图引擎与坐标系适配

2. GPS 物理抖动与步态模拟

真实 GPS 芯片输出的坐标因电离层延迟、多径效应及接收机热噪声,天然具有高斯分布的白噪声特征。

3. 反检测与 MultiDex 支持

4. Wi-Fi、基站与蓝牙环境模拟

5. 卫星矩阵与 NMEA 模拟

6. 传感器与步频模拟

7. 路线规划与红绿灯模拟

8. 用户界面


系统架构

本项目采用 MVVM + Clean Architecture,并按职责拆分为 6 个 Gradle 模块:

模块 类型 职责
app Android App 宿主壳工程:Application / MainActivity、签名与打包配置、聚合各模块的 Koin DI;仅把 xposed 模块的产物(LocationHooker 类与 META-INF/xposed/* 元数据)打进最终 APK 供 LSPosed 扫描加载,自身不直接调用其代码
app-ui Android Library 全部 Jetpack Compose UI:页面、弹窗、自研“液态玻璃”组件(ui/liquid)与 ViewModel 层
service Android Library 前台保活服务 SpoofingService、悬浮摇杆 FloatingJoystickService、开机自启广播等后台/服务层
xposed Android Library LSPosed / Xposed 注入模块本体:LocationHooker 入口 + hooks/、hooks/network/ 下的各类 Hook 实现
core-data Android Library app / app-ui / service 三端共用的数据与业务层:Room 数据库、各类 Repository,以及 ConfigManager、RootManager、EnvironmentScanner 等核心工具类
core-geo 纯 Kotlin/JVM 全项目唯一不依赖 Android 的模块:坐标系换算、路线几何与运动真实度引擎,以及 Hook 端与 App 共用的系统识别规则(vendor/)

两个变体统一通过 libxposed 的远程配置通道传递 JSON,Hook 从内存缓存读取:

┌─────────────────────────────────────────────────────────────────────────┐
│     LocationSpoofer 宿主进程(app / app-ui / service / core-data)      │
│  ┌─────────────────────────┐  ┌──────────────────────────────────────┐  │
│  │     Triple Map Engine   │  │          RouteStateMachine           │  │
│  │ (AMap / Baidu / Google) │  │     (IDLE / READY / RUN / PAUSE)     │  │
│  └────────────┬────────────┘  └──────────────────┬───────────────────┘  │
│               │                                  │                      │
│  ┌────────────▼──────────────────────────────────▼───────────────────┐  │
│  │                    ConfigManager(core-data)                     │  │
│  │     序列化配置与坐标系映射,通过框架发布完整配置快照     │  │
│  └──────────────────────────────────┬────────────────────────────────┘  │
│  ┌──────────────────────────────────▼────────────────────────────────┐  │
│  │                    SpoofingService(service)                     │  │
│  │           前台保活服务、悬浮摇杆控制器与路网 / 步态计算           │  │
│  └───────────────────────────────────────────────────────────────────┘  │
└─────────────────────────────────────┬───────────────────────────────────┘
                                      │ (ConfigManager 发布远程偏好 / 远程文件)
                                      ▼
               ┌─────────────────────────────────────────────┐
               │ 框架管理的远程偏好 / 配置文件 │
               └──────────────────────┬──────────────────────┘
                                      │ (框架通知 → 后台解码 → 原子更新内存缓存)
                                      ▼ LSPosed / libxposed (API 101+) 注入
┌─────────────────────────────────────────────────────────────────────────┐
│                              目标 App 进程                              │
│  ┌───────────────────────────────────────────────────────────────────┐  │
│  │                         LocationHooker                            │  │
│  │  • Location/GNSS:BaseLocationHooker、GnssStatusHooker 等         │  │
│  │  • 地图 SDK:AMapHooker / BaiduMapHooker / TencentMapHooker       │  │
│  │  • hooks/network/:Wifi* / Cellular* / Bluetooth*Hooker 等        │  │
│  │  • SensorStepHooker(计步)/ AntiDetectionHooker(反检测)        │  │
│  └───────────────────────────────────────────────────────────────────┘  │
└─────────────────────────────────────────────────────────────────────────┘

[!NOTE] 跨进程通信 (IPC) 设计: ConfigManager 使用 XposedService.getRemotePreferences() 发布完整 JSON 快照;UTF-8 配置超过 128 KiB 时先写入框架管理的独立远程文件,再原子发布文件指针,避免大配置占满 Binder 事务。全局与非全局版共用这一通道,无需修改 SELinux 策略或向公共临时目录写配置。 Hook 在模块加载时获取初始快照并注册配置变化监听,由后台线程解码、归一化后替换内存缓存;Hook 调用只读缓存。后台每秒检查框架偏好的内存快照以重试启动时的失败,路线派发和服务发现仍由独立定时器执行。 App 私有偏好保存最新期望状态,发布失败自动重试,框架重连后重新发布;停止或暂停请求不会被较早的活动配置覆盖。新通道发布成功后会清理旧配置、探针及脚本。框架仍负责配置持久化,此方案并非完全不落盘。 需要框架实现远程配置能力。升级后安装对应变体、启用模块并重启设备,再开始模拟;全局版可在“系统适配 → Hook 运行状态”检查配置来源为 libxposed:remote-preferences 或 libxposed:remote-file,并核对各进程的发布时间。此次通道迁移尚需真机复验。

系统适配(全局方案)

全局方案直接 Hook 系统服务,不同厂商 / 系统版本的内部实现不一样,需要逐个适配:


环境要求


使用指南

1. 编译与安装

# 1. 克隆代码仓库
git clone https://github.com/your-username/LocationSpoofer.git

# 2. 编译 Debug APK 并直接安装到设备
./gradlew installDebug

2. 权限与激活

  1. 打开 KernelSU / APatch / Magisk 管理器,授予 LocationSpoofer Root 权限。
  2. 打开 LSPosed 管理器,在模块列表中找到 LocationSpoofer 并启用。
  3. 在模块的作用域(Scope)中,勾选需要进行定位伪装的目标应用(如微信、企业微信、钉钉、超星学习通、百度地图、高德地图等)。
  4. 强行停止勾选的目标 App(或重启手机)以使其加载 Hook 逻辑。

3. 常见场景

定点模拟与环境锁定

  1. 启动 LocationSpoofer,在主页地图上拖动准星或搜索栏搜索目标位置。
  2. 在底部抽屉开启所需伪装开关:伪造 Wi-Fi、模拟基站、模拟蓝牙、模拟传感器计步、开启随机抖动。
  3. 点击“启动模拟”接管系统 GPS。
  4. 如需锁定使用具体的本地采集点,可在“管理数据”中点击对应采集点进行锁定绑定。

路线模拟

  1. 切换至“路线规划”标签页,在地图上依次标记多个路点。
  2. 设定移动模式(循环 / 往返 / 单程)以及速度档位(步行、跑步、骑行、自驾或自定义速度)。
  3. 开启 “使用真实路线规划”(系统将自动拉取真实道路轮廓并标记红绿灯等待节点)。
  4. 点击“开始模拟”。可随时开启“悬浮窗摇杆”在前台微调坐标与速度。

实地采集与数据自定义

  1. 开启“设置” -> “环境图谱与扫街” 模式,手机将在后台记录沿途的真实 Wi-Fi、基站与蓝牙信标。
  2. 进入“管理采集数据”页面,可查看列表、编辑备注,或手动指定/修改某条 Wi-Fi(如 SSID、BSSID、RSSI 等)或基站小区数据。
  3. 支持将采集到的无线电指纹一键导出为 JSON 文件,用于备份或共享导入。

独立应用坐标系配置


技术栈


免责声明

本程序仅供学习研究、技术交流以及个人合法合规测试(如开发者定位测试、设备兼容性调试)使用。 使用者请勿将本工具用于任何违法违规或违反相关平台服务协议的活动(包括但不限于虚假打卡、网络考试作弊、商业欺诈等)。 使用本模块造成的任何账号封禁、数据丢失、法律纠纷或其他直接/间接损失,均由使用者自行承担,作者不对此承担任何责任。


开源协议

本项目基于 GNU General Public License v3.0 协议开源。

Copyright (C) 2026 SuseOAA

LocationSpoofer (HuangZhuoRui/LocationSpoofer)

Searching Database…

What is this?LocationSpoofer is an Android system-level location spoofing and wireless-environment simulation framework built on KernelSU + LSPosed. It fakes GPS, Wi-Fi, cellular, Bluetooth and sensor data together so that apps cross-checking mock-location flags against real-world wireless signals get a consistent fake environment.
Is this an app I open, or something that hooks into other apps?It is an LSPosed/Xposed module: you enable it in your root manager and in LSPosed, pick the target apps in its 'Scope', and it injects into those apps at the Zygote stage to intercept location, satellite, Wi-Fi, cell and sensor APIs.
How do I get it running?Install the APK, grant it Root permission in your KernelSU/APatch/Magisk manager, enable it as a module in LSPosed, check the target apps in its Scope, then force-stop (or reboot) those apps so the hooks load.
Do I need root and a specific Xposed framework?Yes: Android 8.0 (API 26) or later, root via KernelSU/APatch/Magisk, and LSPosed (API 101+) or a compatible libxposed API 101+ framework.
Does it fake location system-wide for every app at once?No, this is not a global solution. You must add each target app individually in LSPosed's Scope, because the author chose not to maintain separate system-level adaptations for every phone vendor.
Who is this actually for?Developers and researchers doing legitimate location-testing and device-compatibility debugging; the README explicitly disclaims use for cheating attendance, exams or fraud.
How does it make the simulated GPS track look natural instead of a static point?It applies an Ornstein-Uhlenbeck mean-reverting random process for slow drift (hard-bounded to 4 meters) plus a Gaussian lateral 'gait jitter' during walking/running, mimicking the natural noise of a real GPS chip and human stride.
How does it avoid being detected as a hook/Xposed module?It scrubs stack traces of Xposed/LSPosed package names, blocks reflective detection of its classes via Class.forName/ClassLoader.loadClass, and permanently overwrites isFromMockProvider/isMock and related Settings/AppOps flags to false.
Can it simulate movement along an actual road, not just a straight line?Yes, the route-simulation mode fits real road geometry via map routing, auto-pauses 15 seconds at detected traffic lights, and offers a floating joystick for manual speed/heading adjustment during simulation.
Which map engines can I use to pick a location?AMap (Gaode) 3D Maps, Baidu Maps and Google Maps are all integrated; AMap is the default fallback everywhere since it needs no Google services, while Google Maps works if you supply your own API key.
Size
53.2 MB
Stars
2K
Age
5mo
Commits · 90 Days