local function json2true(str,from,to) return true, from+3 end local function json2false(str,from,to) return false, from+4 end local function json2null(str, from, to) return nil, from+3 end local function json2nan(str, from, to) return nul, from+2 end local numberchars = {['-'] = true,['+'] = true,['.'] = true,['0'] = true,['1'] = true,['2'] = true,['3'] = true,['4'] = true,['5'] = true,['6'] = true,['7'] = true,['8'] = true,['9'] = true} local function json2number(str,from,to) local i = from+1 while(i<=to) do local char = string.sub(str, i, i) if not numberchars[char] then break end i = i + 1 end local num = tonumber(string.sub(str, from, i-1)) if not num then error(_format('json格式错误，不正确的数字, 错误位置:{from}', from)) end return num, i-1 end local function json2string(str,from,to) local ignor = false for i = from+1, to do local char = string.sub(str, i, i) if not ignor then if char == '\"' then return string.sub(str, from+1, i-1), i elseif char == '\\' then ignor = true end else ignor = false end end error(_format('json格式错误，字符串没有找到结尾, 错误位置:{from}', from)) end local function json2array(str,from,to)    local result = {}    from = from or 1    local pos = from+1    local to = to or string.len(str)    while(pos<=to) do        local char = string.sub(str, pos, pos)        if char == '\"' then            result[#result+1], pos = json2string(str,pos,to)        elseif char == '[' then            result[#result+1], pos = json2array(str,pos,to)        elseif char == '{' then            result[#result+1], pos = json2table(str,pos,to)        elseif char == ']' then            return result, pos        elseif (char=='f' or char=='F') then            result[#result+1], pos = json2false(str,pos,to)        elseif (char=='t' or char=='T') then            result[#result+1], pos = json2true(str,pos,to)        elseif (char=='n') then            result[#result+1], pos = json2null(str,pos,to)        elseif (char=='N') then            result[#result+1], pos = json2nan(str,pos,to)        elseif numberchars[char] then            result[#result+1], pos = json2number(str,pos,to)        end        pos = pos + 1    end    error(_format('json格式错误，表没有找到结尾, 错误位置:{from}', from)) end function _G.json2table(str,from,to)    local result = {}    from = from or 1    local pos = from+1    local to = to or string.len(str)    local key    while(pos<=to) do        local char = string.sub(str, pos, pos)        if char == '\"' then            if not key then                key, pos = json2string(str,pos,to)            else                result[key], pos = json2string(str,pos,to)                key = nil            end        elseif char == '[' then            if not key then                key, pos = json2array(str,pos,to)            else                result[key], pos = json2array(str,pos,to)                key = nil            end        elseif char == '{' then            if not key then                key, pos = json2table(str,pos,to)            else                result[key], pos = json2table(str,pos,to)                key = nil            end        elseif char == '}' then            return result, pos        elseif (char=='f' or char=='F') then            result[key], pos = json2false(str,pos,to)            key = nil        elseif (char=='t' or char=='T') then            result[key], pos = json2true(str,pos,to)            key = nil        elseif (char=='n') then            result[key], pos = json2null(str,pos,to)            key = nil        elseif (char=='N') then            result[key], pos = json2nan(str,pos,to)            key = nil        elseif numberchars[char] then            if not key then                key, pos = json2number(str,pos,to)            else                result[key], pos = json2number(str,pos,to)                key = nil            end        end        pos = pos + 1    end    error(_format('格式错误，表没有找到结尾, 错误位置:{from}', from)) end local jsonfuncs={['\"']=json2string,['[']=json2array,['{']=json2table,['f']=json2false,['F']=json2false,['t']=json2true,['T']=json2true} function json2lua(str) if str==nil then gg.alert('错误json') else local char = string.sub(str, 1, 1) local func=jsonfuncs[char] if func then return func(str, 1, string.len(str)) end if numberchars[char] then return json2number(str, 1, string.len(str)) end end end

ZZRc4 = {}
ZZMathBit = {}
function ZZMathBit.__xorBit(left, right) return (left + right) == 1 and 1 or 0 end function ZZMathBit.__base(left, right, op) if left < right then left, right = right, left end local res = 0 local shift = 1 while left ~= 0 do local ra = left % 2 local rb = right % 2 res = shift * op(ra,rb) + res shift = shift * 2 left = math.modf( left / 2) right = math.modf( right / 2) end return res end function ZZMathBit.xorOp(left, right) return ZZMathBit.__base(left, right, ZZMathBit.__xorBit) end function RC4(text,key,kasi)
  if kasi==false then str = text str=str:gsub("[%s%p]",""):upper() local index=1 local ret="" for index=1,str:len(),2 do ret=ret..string.char(tonumber(str:sub(index,index+1),16)) end text=ret end local function KSA(key) local keyLen = string.len(key) local schedule = {} local keyByte = {} for i = 0, 255 do schedule[i] = i end for i = 1, keyLen do keyByte[i - 1] = string.byte(key, i, i) end local j = 0 for i = 0, 255 do j = (j + schedule[i] + keyByte[ i % keyLen]) % 256 schedule[i], schedule[j] = schedule[j], schedule[i] end return schedule end local function PRGA(schedule, textLen) local i = 0 local j = 0 local k = {} for n = 1, textLen do i = (i + 1) % 256 j = (j + schedule[i]) % 256 schedule[i], schedule[j] = schedule[j], schedule[i] k[n] = schedule[(schedule[i] + schedule[j]) % 256] end return k end local function output(schedule, text) local len = string.len(text) local c = nil local res = {} for i = 1, len do c = string.byte(text, i,i) res[i] = string.char(ZZMathBit.xorOp(schedule[i], c)) end return table.concat(res) end local textLen = string.len(text) local schedule = KSA(key) local k = PRGA(schedule, textLen) str=output(k, text) if kasi==true then str = tostring(str) local index=1 local ret="" for index=1,str:len() do ret=ret..string.format("%02X",str:sub(index):byte()) end return string.lower(ret) else return str end end
--极简云RC42加密和解密配置     RC4("加密内容","密码",false=解密_true=加密)

function ultra(get,post) local c=gg.makeRequest(get,nil,post).content  if c==nil then gg.alert("网络错误了，请检查你的网络") os.exit() end return c  end
--请求

b=os.exit
function os.exit() b() end


---[=[上面不要乱动]=]-------------------------------------------------------------------------------------------------------------------

local xxxxxxx="https://cute521.cn"
--官网

local xxxxxxx_to_configure=xxxxxxx.."/api.php?api=ini"
--接口名称[应用配置]

local xxxxxxx_file=xxxxxxx.."/api.php?api=getfile"
--接口名称[获取文件外链]

---[=[  上面是对接  ]=]-------------------------------------------------------------------------------------------------------------------

local xxxxxxx_APPID='10199'
--APPID

local xxxxxxx_APPKEY='wA77OHqitu5YHX7Z'
--APPKEY

local xxxxxxx_RC4_key='5XZQ7yKZDnD10199'
--是否 RC4 加密[key 密钥]


local xxxxxxx_RC4=true
--是否 RC4 加密[false=关 true=开]
--选择 RC4加密-2 否则会乱码
--打开 签名放DATA里:打开

----------------------------------------------------------------------------------------------------------------------
--获取脚本RC4解密开关

local load_RC4=true
--是否 RC4 解密远程获取到都云脚本[false=关 true=开] 

local load_RC4key='yixi666'
--自定义密钥 用于解密放在云端的脚本

--加密软件:https://wwi.lanzoui.com/b0b8xu8cd

----------------------------------------------------------------------------------------------------------------------

if xxxxxxx_APPID=="" or  xxxxxxx_APPKEY=="" then
  gg.alert("对接数据,空...")--对话框
  os.exit()
end


---[=[   ]=]-------------------------------------------------------------------------------------------------------------------
file=ultra(xxxxxxx_to_configure.."&app="..xxxxxxx_APPID,"")
if xxxxxxx_RC4 == true then
  file=RC4(file,xxxxxxx_RC4_key,false)
  gg.setVisible(false)
end
if json2lua(file).code ~= 200 then
gg.alert("应用配置接口："..json2lua(file).msg)--错误提示
os.exit()
else

api_total=json2lua(file).msg.api_total
--调用几次接口[ 判断使用人数 ]

app_update_must=json2lua(file).msg.app_update_must
--是否强行更新 y是 n否

app_update_show=json2lua(file).msg.app_update_show
--更新内容

app_update_url=json2lua(file).msg.app_update_url
--更新地址

version=json2lua(file).msg.version
--版本号

version_info=json2lua(file).msg.version_info
--应用版本信息
end


function MAIN()

---[=[ 外链接获取内容 ]=]-------------------------------------------------------------------------------------------------------------------
file=ultra(xxxxxxx_file.."&app="..xxxxxxx_APPID,"")

if xxxxxxx_RC4==true then
  file=RC4(file,xxxxxxx_RC4_key,false)
end

if json2lua(file).code ~= 200 then
gg.alert("外链接接口："..json2lua(file).msg)--错误提示
os.exit()
else
msg=json2lua(file).msg--获取信息
end

---[=[   ]=]-------------------------------------------------------------------------------------------------------------------
M_note={}
M_file_url={}
kiosk=""

for i, v in ipairs(msg) do
gg.setVisible(false)
if v.file_url~=nil then
if v.note~=nil then
gg.toast("搜索到  "..i.."  个脚本")--提示
gg.sleep(100)--延迟


M_note[i]=v.note.."\n"..v.date--功能名字

kiosk=kiosk.."if kl== "..i.." then" .." load_jb([["..v.file_url.."]])".." end "
--获取

end
end
end


function load_jb(html)
uy=gg.makeRequest(html).content

if load_RC4==true then
  uy=RC4(uy,load_RC4key,false)
end

print(uy)--打印
os.exit()

UH_T=load(uy)
if UH_T==nil then
gg.alert("云端脚本存在问题无法启动")--对话框
else

load(uy)()
end end


Notice=[[
全网启动 👉 ]]..api_total..[[次 👈]]
--公告提示----------------------------------------------------------------------------------------------------------------------

M_note[#M_note+1]="退出"
kl=gg.choice(M_note,{},Notice)--多选界面功能

kiosk=kiosk.." if kl== "..(#M_note).." then " .."os.exit()".." end "


load(kiosk)()
end



while true do     
if gg.isVisible(true) then       
gg.setVisible(false)       
MAIN()
end
end