【lua教程】简单检查是否有XP框架
local function Table_exists(tables,value)
for index,content in pairs(tables) do
if content:find(value) then
return true
end
end
end
local function endsWith(sss,str)
if sss:match(".") then
if str==tostring(sss):match("%.(.+)") then
return true
else
return false
end
end
end
local function lastIndexOf(text,z)
a=历遍字符串位置(text,z)
return a[#a]
end
function 取所有应用包名()
a={}
installedPackages = activity.getPackageManager().getInstalledPackages(0);
for index,content in pairs(luajava.astable(installedPackages)) do
packageInfo = content.packageName;
table.insert(a,tostring(packageInfo))
end
return a
end
function isHookByPackageName()
import "android.content.pm.PackageManager"
isHook = false;
packageManager = activity.getPackageManager();
applicationInfoList = packageManager.getInstalledApplications(PackageManager.GET_META_DATA);
if (nil== applicationInfoList) then
return isHook;
end
if Table_exists(取所有应用包名(),"de.robv.android.xposed.installer") then
isHook=true
else
if Table_exists(取所有应用包名(),"com.saurik.substrate") then
isHook=true
else
end
end
return isHook;
end
function isHookByJar()
import"android.os.Process"
isHook = false;
libraries = {};
mapsFilename = "/proc/" .. Process.myPid() .. "/maps";
reader = BufferedReader(FileReader(mapsFilename));
while reader.readLine() ~= nil do
if endsWith(tostring(reader.readLine()),"jar") ||endsWith(tostring(reader.readLine()),"so")then
line=tostring(reader.readLine())
n= lastIndexOf(line," ");
lines=string.sub(line,n+1,#line)
--print(lines)
table.insert(libraries,tostring(lines))
end
end
library=0
while library~=#libraries do
library=library+1
if libraries:match("com.saurik.substrate") then
Log.wtf("HookDetection", "Substrate shared object found: " + library);
isHook = true;
end
if libraries:match("Xposed") then
Log.wtf("HookDetection", "Xposed JAR found: " + library);
isHook = true;
end
end
reader.close();
return isHook;
end
页:
[1]