AZ
十年iOS隐私保护插件服务商
AZ TUTORIALS · 接口参考

AMG · API 文档

AMG 通过本地 HTTP 接口调用,所有指令格式都是 /cmd?fun=指令名&参数。

AZ 教程汇总站内阅读更新于 2026-11-01
项目值
HTTP 基址http://127.0.0.1:8080
请求方式GET
Bundle IDcom.superdev.AMG
结果文件/var/mobile/amgResult.txt
记录目录/var/mobile/AMG/
配置文件/private/var/mobile/Library/Preferences/AMG/config.plist

调用前准备

  1. 触动精灵中下载官方插件 ts.so(触动 → 右下角「更多」→「插件」)。参数文件是 plist 格式,需要用它读写。
  2. 每次调用前确认 AMG 在前台,不在就先 runApp("com.superdev.AMG") 并等待约 3 秒。

返回值

调用接口后轮询 /var/mobile/amgResult.txt:

值含义
1成功
0失败
2执行中,继续等待

等待时间

等待时间按所选 App 数量和备份大小调整。如果开了智能飞行模式,建议每次等待 15 秒以上;跑脚本时更推荐关闭智能飞行,直接在脚本里判断 IP。

接口一览

功能指令参数
原始机器originRecord—
一键新机newRecord—
下一条nextRecord—
第一条firstRecord—
还原指定记录setRecordrecordName
获取当前记录名getCurrentRecordName—
获取所有记录名getAllRecordNamessaveFilePath
重命名记录setRecordNameoldName newName
删除指定记录deleteRecordrecordName
删除所有记录deleteAllRecords—
禁用 / 启用指定记录disableRecord · enableRecordrecordName
禁用 / 启用所有记录disableAllRecord · enableAllRecord—
获取当前记录参数getCurrentRecordParamsaveFilePath
设置当前记录参数setCurrentRecordParamfilePath
获取指定记录参数getRecordParamrecordName saveFilePath
设置指定记录参数setRecordParamrecordName filePath

接口详情

原始机器

GET http://127.0.0.1:8080/cmd?fun=originRecord

关闭改机,恢复到原始设备。

一键新机

GET http://127.0.0.1:8080/cmd?fun=newRecord

按当前设置生成新机并新建一条记录。

下一条

GET http://127.0.0.1:8080/cmd?fun=nextRecord

切换到下一条记录。到最后一条后再调用会回到「原始机器」,可以用 获取当前记录名 判断是否跑完一轮。

第一条

GET http://127.0.0.1:8080/cmd?fun=firstRecord

还原到第一条记录。

还原指定记录

GET http://127.0.0.1:8080/cmd?fun=setRecord&recordName=A10086
参数必填说明
recordName是记录名,该记录必须存在

获取当前记录名

GET http://127.0.0.1:8080/cmd?fun=getCurrentRecordName

记录名直接在 HTTP 响应体 中返回。结果文件为 1 时读取响应内容即可。处于原始机器时返回「原始机器」。

获取所有记录名

GET http://127.0.0.1:8080/cmd?fun=getAllRecordNames&saveFilePath=/var/mobile/AMG_All_Record.plist
参数必填说明
saveFilePath是记录名列表保存路径(plist)。建议调用前先删除旧文件

重命名记录

GET http://127.0.0.1:8080/cmd?fun=setRecordName&oldName=旧名称&newName=新名称
参数必填说明
oldName是原记录名。可先用 getCurrentRecordName 取当前记录名
newName是新记录名

删除指定记录

GET http://127.0.0.1:8080/cmd?fun=deleteRecord&recordName=2018-11-11-11-11-11-11
参数必填说明
recordName是要删除的记录名

删除所有记录

GET http://127.0.0.1:8080/cmd?fun=deleteAllRecords

删除所有记录,但会保留当前正在使用的记录。想全部删掉,先调用 originRecord 回到原始机器再删。

禁用 / 启用指定记录

GET http://127.0.0.1:8080/cmd?fun=disableRecord&recordName=记录名
GET http://127.0.0.1:8080/cmd?fun=enableRecord&recordName=记录名
参数必填说明
recordName是记录名

禁用 / 启用所有记录

GET http://127.0.0.1:8080/cmd?fun=disableAllRecord
GET http://127.0.0.1:8080/cmd?fun=enableAllRecord

WARNING

注意这两个指令是 AllRecord(单数),不是 AllRecords。

获取当前记录参数

GET http://127.0.0.1:8080/cmd?fun=getCurrentRecordParam&saveFilePath=/var/mobile/AMG_Param.plist
参数必填说明
saveFilePath是参数保存路径(plist)。建议调用前先删除旧文件

设置当前记录参数

GET http://127.0.0.1:8080/cmd?fun=setCurrentRecordParam&filePath=/var/mobile/AMG_Param.plist
参数必填说明
filePath是修改后的参数文件路径

正确流程:先 getCurrentRecordParam 导出 → plist.read 读取并修改字段 → plist.write 写回 → 再调用本接口。

获取指定记录参数

GET http://127.0.0.1:8080/cmd?fun=getRecordParam&recordName=记录名&saveFilePath=/var/mobile/AMG_Param.plist
参数必填说明
recordName是记录名
saveFilePath是参数保存路径

设置指定记录参数

GET http://127.0.0.1:8080/cmd?fun=setRecordParam&recordName=记录名&filePath=/var/mobile/AMG_Param.plist
参数必填说明
recordName是记录名
filePath是修改后的参数文件路径

参数文件

参数文件是 plist 格式,用 ts.plist 读写。常用字段:

字段说明
DeviceToken设备推送 Token
Longitude经度,如 121.4997661114
Latitude纬度,如 31.2394855667
Model机型,如 iPhone X
SystemVer系统版本,如 12.1.2

完整字段以实际导出的文件为准。

机型与系统开关

修改 Model / SystemVer 时,还需要在配置文件 config.plist 中打开对应开关,否则不生效:

配置项说明
fakeDeviceModel"1" 启用自定义机型,"0" 还原
fakeSystemVer"1" 启用自定义系统版本,"0" 还原

可选机型:iPhone 4、4s、5c、5、6、6 Plus、6s、6s Plus、7、7 Plus、8、8 Plus、X、Xr、Xs、Xs Max。

Lua 示例(触动精灵)

把下面的封装放在脚本开头,之后直接调用 AMG.New() 等函数。

lua
require "TSLib"
local sz = require("sz")
local http = require("szocket.http")

if isFileExist(userPath() .. "/plugin/ts.so") == false then
    dialog("未下载 ts.so 插件:进入触动 → 右下角更多 → 插件,下载官方插件 ts.so", 0)
    lua_exit()
end
local ts = require("ts")
local plist = ts.plist

local BASE = "http://127.0.0.1:8080/cmd?fun="

-- 确保 AMG 在前台
function Check_AMG()
    if isFrontApp("com.superdev.AMG") == 0 then
        runApp("com.superdev.AMG")
        mSleep(3000)
    end
end

-- 轮询结果:true 成功 / false 失败
function Check_AMG_Result()
    ::get::
    mSleep(3000)
    local f = "/var/mobile/amgResult.txt"
    if isFileExist(f) then
        local r = readFileString(f)
        if r == "0" then return false end
        if r == "1" then return true end
        if r == "2" then
            toast("执行中", 1)
            goto get
        end
    end
end

-- 通用调用:返回 (是否成功, 响应体)
function AMG_Call(query)
    Check_AMG()
    local res, code = http.request(BASE .. query)
    if code == 200 then
        return Check_AMG_Result(), res
    end
    return false
end

local AMG = {
    Original    = function() return AMG_Call("originRecord") end,
    New         = function() return AMG_Call("newRecord") end,
    Next        = function() return AMG_Call("nextRecord") end,
    First       = function() return AMG_Call("firstRecord") end,
    Recover     = function(name) return AMG_Call("setRecord&recordName=" .. name) end,
    Rename      = function(old, new) return AMG_Call("setRecordName&oldName=" .. old .. "&newName=" .. new) end,
    Delete      = function(name) return AMG_Call("deleteRecord&recordName=" .. name) end,
    Delete_All  = function() return AMG_Call("deleteAllRecords") end,
    Disable     = function(name) return AMG_Call("disableRecord&recordName=" .. name) end,
    Enable      = function(name) return AMG_Call("enableRecord&recordName=" .. name) end,
    Disable_All = function() return AMG_Call("disableAllRecord") end,
    Enable_All  = function() return AMG_Call("enableAllRecord") end,

    Get_Name = function()
        local ok, res = AMG_Call("getCurrentRecordName")
        if ok then return res end
    end,

    Get_Param = function()
        local file = userPath() .. "/lua/AMG_Param.plist"
        if isFileExist(file) then delFile(file) end
        if AMG_Call("getCurrentRecordParam&saveFilePath=" .. file) then return file end
    end,

    Set_Param = function(file)
        return AMG_Call("setCurrentRecordParam&filePath=" .. file)
    end,

    Get_All_Record = function()
        local file = userPath() .. "/lua/AMG_All_Record.plist"
        if isFileExist(file) then delFile(file) end
        if AMG_Call("getAllRecordNames&saveFilePath=" .. file) then return file end
    end,
}

-- ===== 使用示例 =====

-- 一键新机
if AMG.New() then toast("一键新机完成", 3) end

-- 遍历所有记录,回到「原始机器」说明跑完一轮
AMG.First()
repeat
    -- ……执行业务……
    AMG.Next()
until AMG.Get_Name() == "原始机器"

-- 修改当前记录的 GPS
local file = AMG.Get_Param()
if file then
    local p = plist.read(file)
    p["Longitude"] = "121.4997661114"
    p["Latitude"]  = "31.2394855667"
    plist.write(file, p)
    AMG.Set_Param(file)
end

-- 修改机型和系统版本(需同时打开配置开关)
function Set_AMG_Config(key, value)
    local cfg_file = "/private/var/mobile/Library/Preferences/AMG/config.plist"
    local cfg = plist.read(cfg_file)
    cfg[key] = value
    plist.write(cfg_file, cfg)
end

Set_AMG_Config("fakeDeviceModel", "1")
Set_AMG_Config("fakeSystemVer", "1")
local file = AMG.Get_Param()
if file then
    local p = plist.read(file)
    p["Model"] = "iPhone X"
    p["SystemVer"] = "12.1.2"
    plist.write(file, p)
    AMG.Set_Param(file)
end

使用教程见 AMG 使用教程。

提示

软件界面和支持范围可能随版本更新。执行清理、重置或删除操作前,请先备份重要数据。