AMG · API reference
AMG is controlled through a local HTTP API. Commands use the form /cmd?fun=command¶meters.
| Item | Value |
|---|---|
| HTTP base URL | http://127.0.0.1:8080 |
| Method | GET |
| Bundle ID | com.superdev.AMG |
| Result file | /var/mobile/amgResult.txt |
| Record folder | /var/mobile/AMG/ |
| Config file | /private/var/mobile/Library/Preferences/AMG/config.plist |
Before you call anything
- Download the official
ts.soplugin in TouchSprite (More → Plugins in the bottom-right corner). The parameter files are plists, so you need it to read and write them. - Before each call, make sure AMG is in the foreground. If it is not, run
runApp("com.superdev.AMG")and wait about 3 seconds.
Return values
After calling, poll /var/mobile/amgResult.txt:
| Value | Meaning |
|---|---|
1 | Success |
0 | Failure |
2 | Running — keep waiting |
How long to wait
Waiting time depends on how many apps you selected and how large the backups are. With smart airplane mode on, wait at least 15 seconds each time. When running scripts it is better to turn smart airplane mode off and check the IP inside the script instead.
Endpoint list
| Function | Command | Parameters |
|---|---|---|
| Original device | originRecord | — |
| Reset | newRecord | — |
| Next record | nextRecord | — |
| First record | firstRecord | — |
| Restore a specific record | setRecord | recordName |
| Get the current record name | getCurrentRecordName | — |
| Get every record name | getAllRecordNames | saveFilePath |
| Rename a record | setRecordName | oldName newName |
| Delete a specific record | deleteRecord | recordName |
| Delete every record | deleteAllRecords | — |
| Disable / enable a specific record | disableRecord · enableRecord | recordName |
| Disable / enable every record | disableAllRecord · enableAllRecord | — |
| Get the current record's parameters | getCurrentRecordParam | saveFilePath |
| Set the current record's parameters | setCurrentRecordParam | filePath |
| Get a specific record's parameters | getRecordParam | recordName saveFilePath |
| Set a specific record's parameters | setRecordParam | recordName filePath |
Endpoint details
Original device
GET http://127.0.0.1:8080/cmd?fun=originRecordTurns spoofing off and returns to the real device.
Reset
GET http://127.0.0.1:8080/cmd?fun=newRecordGenerates a new device from the current settings and creates a record.
Next record
GET http://127.0.0.1:8080/cmd?fun=nextRecordSwitches to the next record. Calling it again after the last one returns to the original device, so you can use Get the current record name to tell whether a full cycle has finished.
First record
GET http://127.0.0.1:8080/cmd?fun=firstRecordRestores the first record.
Restore a specific record
GET http://127.0.0.1:8080/cmd?fun=setRecord&recordName=A10086| Parameter | Required | Notes |
|---|---|---|
recordName | Yes | Record name. The record must exist |
Get the current record name
GET http://127.0.0.1:8080/cmd?fun=getCurrentRecordNameThe name comes back in the HTTP response body itself. When the result file reads 1, read the response body. On the original device it returns the name of the built-in original record.
Get every record name
GET http://127.0.0.1:8080/cmd?fun=getAllRecordNames&saveFilePath=/var/mobile/AMG_All_Record.plist| Parameter | Required | Notes |
|---|---|---|
saveFilePath | Yes | Where to save the list of names (a plist). Delete any old file before calling |
Rename a record
GET http://127.0.0.1:8080/cmd?fun=setRecordName&oldName=old-name&newName=new-name| Parameter | Required | Notes |
|---|---|---|
oldName | Yes | Current record name. You can get it with getCurrentRecordName first |
newName | Yes | New record name |
Delete a specific record
GET http://127.0.0.1:8080/cmd?fun=deleteRecord&recordName=2018-11-11-11-11-11-11| Parameter | Required | Notes |
|---|---|---|
recordName | Yes | Name of the record to delete |
Delete every record
GET http://127.0.0.1:8080/cmd?fun=deleteAllRecordsDeletes all records but keeps the one currently in use. To wipe everything, call originRecord first to return to the original device, then delete.
Disable / enable a specific record
GET http://127.0.0.1:8080/cmd?fun=disableRecord&recordName=record-name
GET http://127.0.0.1:8080/cmd?fun=enableRecord&recordName=record-name| Parameter | Required | Notes |
|---|---|---|
recordName | Yes | Record name |
Disable / enable every record
GET http://127.0.0.1:8080/cmd?fun=disableAllRecord
GET http://127.0.0.1:8080/cmd?fun=enableAllRecordWarning
These two commands are AllRecord (singular), not AllRecords.
Get the current record's parameters
GET http://127.0.0.1:8080/cmd?fun=getCurrentRecordParam&saveFilePath=/var/mobile/AMG_Param.plist| Parameter | Required | Notes |
|---|---|---|
saveFilePath | Yes | Where to save the parameters (a plist). Delete any old file before calling |
Set the current record's parameters
GET http://127.0.0.1:8080/cmd?fun=setCurrentRecordParam&filePath=/var/mobile/AMG_Param.plist| Parameter | Required | Notes |
|---|---|---|
filePath | Yes | Path to the edited parameter file |
Correct flow: getCurrentRecordParam to export → plist.read to load and edit the fields → plist.write to save → then call this endpoint.
Get a specific record's parameters
GET http://127.0.0.1:8080/cmd?fun=getRecordParam&recordName=record-name&saveFilePath=/var/mobile/AMG_Param.plist| Parameter | Required | Notes |
|---|---|---|
recordName | Yes | Record name |
saveFilePath | Yes | Where to save the parameters |
Set a specific record's parameters
GET http://127.0.0.1:8080/cmd?fun=setRecordParam&recordName=record-name&filePath=/var/mobile/AMG_Param.plist| Parameter | Required | Notes |
|---|---|---|
recordName | Yes | Record name |
filePath | Yes | Path to the edited parameter file |
Parameter file
Parameter files are plists, read and written with ts.plist. Common fields:
| Field | Notes |
|---|---|
DeviceToken | Push notification token |
Longitude | Longitude, e.g. 121.4997661114 |
Latitude | Latitude, e.g. 31.2394855667 |
Model | Device model, e.g. iPhone X |
SystemVer | iOS version, e.g. 12.1.2 |
The exported file is the authoritative list of fields.
Device model and iOS version switches
To change Model or SystemVer you must also turn on the matching switch in config.plist, otherwise nothing happens:
| Config key | Notes |
|---|---|
fakeDeviceModel | "1" enables the custom model, "0" restores it |
fakeSystemVer | "1" enables the custom iOS version, "0" restores it |
Available models: iPhone 4, 4s, 5c, 5, 6, 6 Plus, 6s, 6s Plus, 7, 7 Plus, 8, 8 Plus, X, Xr, Xs, Xs Max.
Lua example (TouchSprite)
Put the wrapper below at the top of your script, then call functions such as AMG.New() directly.
require "TSLib"
local sz = require("sz")
local http = require("szocket.http")
if isFileExist(userPath() .. "/plugin/ts.so") == false then
dialog("ts.so plugin missing: open TouchSprite, tap More in the bottom-right corner, open Plugins and download the official ts.so", 0)
lua_exit()
end
local ts = require("ts")
local plist = ts.plist
local BASE = "http://127.0.0.1:8080/cmd?fun="
-- Make sure AMG is in the foreground
function Check_AMG()
if isFrontApp("com.superdev.AMG") == 0 then
runApp("com.superdev.AMG")
mSleep(3000)
end
end
-- Poll the result: true = success / false = failure
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("in progress", 1)
goto get
end
end
end
-- Generic call: returns (success, response body)
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,
}
-- ===== Usage examples =====
-- Reset
if AMG.New() then toast("Reset complete", 3) end
-- Walk every record; coming back to the original device means a full cycle is done
AMG.First()
repeat
-- ... your own logic here ...
AMG.Next()
until AMG.Get_Name() == "Original device"
-- Change the current record's GPS position
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
-- Change the device model and iOS version (the config switches must be on too)
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)
endFor usage, see the AMG user guide.
The interface and supported systems may change with updates. Back up important data before cleaning, resetting or deleting anything.
