function string.fromhex(str)
return (str:gsub(‘..’, function (cc)
return string.char(tonumber(cc, 16))
end))
end
function WriteWXdat(_data)
local bin=string.fromhex(_data);
os.execute(“mkdir -p ” .. appDataPath(“com.tencent.xin”).. ‘/Library/WechatPrivate/’)
path=appDataPath(“com.tencent.xin”)..”/Library/WechatPrivate/wx.dat”;
local out = io.open(path,”a”);
out:write(bin)
out:close();
os.execute(“chown -R mobile:mobile ” ..appDataPath(“com.tencent.xin”).. ‘/Library/WechatPrivate/wx.dat’)
os.execute(“chmod 644 ” ..appDataPath(“com.tencent.xin”).. ‘/Library/WechatPrivate/wx.dat’)
end
–调用方法
WriteWXdat(“62·························”)