登录  | 立即注册

游客您好!登录后享受更多精彩

查看: 1064|回复: 0

[lua教程] 【lua教程】简单检查是否有XP框架

[复制链接]

444

主题

509

帖子

2051

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
2051

荣誉管理论坛元老

发表于 2021-6-30 23:19:22 来自手机 | 显示全部楼层 |阅读模式 来自:
  1. 7 j, U2 h" M) i+ b% ]& k
  2. local function Table_exists(tables,value)
    # X, {& O6 R7 A% k: c) b' t3 v/ ~
  3.   for index,content in pairs(tables) do$ s. t: K- }8 F9 @% s/ z
  4.     if content:find(value) then4 _2 C$ K+ v2 Z9 [5 m
  5.       return true
    9 E$ z7 X* s$ Y$ z& I  ?' |# [% c- r
  6.     end
    6 D, V- z2 ]% b: ~1 b6 v6 J8 X
  7.   end; [; l5 S: B+ ?* \- q) r! N
  8. end) j' G. u! T" S3 d8 o" J2 H% b  ]% H, G6 y
  9. local function endsWith(sss,str)
    7 b0 t' d+ Y6 H- `4 {
  10.   if sss:match(".") then
    / u2 d+ w4 p! a3 S
  11.     if str==tostring(sss):match("%.(.+)") then
    ) z0 o  n  U+ F5 R4 r8 z6 |
  12.       return true
    3 ]! _8 G+ [# H
  13.      else" B* R  n' h. I  N
  14.       return false. Y2 V! U0 D6 Z+ }4 o
  15.     end0 ?: D! F- Z3 B. ~3 C
  16.   end
    * G- T1 ~( P5 P3 P& k4 P3 `! R7 }
  17. 3 y: w! j, M" J
  18. end0 Z: U" Y) ^1 W) }) J+ `

  19. 8 M0 ~# w( K2 W8 F4 v% J1 t
  20. local function lastIndexOf(text,z)* o- d3 A0 g, b
  21.   a=历遍字符串位置(text,z)
    3 e, e$ k8 l' S, c; e' z, ]1 ~) L
  22.   return a[#a]
    & f2 d& z, F( K1 {
  23. end1 k: m( I1 \; ]% `
  24. function 取所有应用包名(); `0 x, H+ A7 I$ p# ?/ z
  25.   a={}
    - b% q, m9 I, G: Y1 g2 J9 M& |
  26.   installedPackages = activity.getPackageManager().getInstalledPackages(0);
    ; m! ^) q, b* d6 h5 L7 W5 s, T
  27.   for index,content in pairs(luajava.astable(installedPackages)) do
    ! G2 `0 Z  ]$ g9 N( v+ K
  28.     packageInfo = content.packageName;* Z1 @0 }4 r( d/ w
  29.     table.insert(a,tostring(packageInfo))/ j1 g" Q% w- N3 U2 \* i! L& O
  30.   end
    & F( T9 P( W4 N4 a! M( ^* `
  31.   return a; ^# e+ f. d9 X& `- g1 u
  32. end
    " B5 n+ `* \! d2 O
  33. function isHookByPackageName()4 H7 y3 v  \7 j7 i* D4 P6 p4 k
  34.   import "android.content.pm.PackageManager"3 X4 ^+ e7 N* y" s/ U  I
  35.   isHook = false;0 T1 q1 V/ G1 w$ F8 ^; T
  36.   packageManager = activity.getPackageManager();. O* @& {4 {- Y) J9 c( n
  37.   applicationInfoList = packageManager.getInstalledApplications(PackageManager.GET_META_DATA);; `% T9 U8 l5 K
  38.   if (nil== applicationInfoList) then+ A- x1 u6 R" u$ O. s9 ]  D
  39.     return isHook;% _! K! a$ g7 [7 ^
  40.   end
    7 ]/ @: M- i+ {5 Y9 k$ s. R
  41. ! l3 j$ R# B" ?6 S
  42.   if Table_exists(取所有应用包名(),"de.robv.android.xposed.installer") then: M8 e; P+ g' F, b6 F+ |$ l& R( q
  43.     isHook=true
    + o. i! f8 D/ g# r
  44.    else. P3 U: b% J* p$ S
  45.   [8 d' {% L; c6 n0 F% X. N/ K
  46.     if Table_exists(取所有应用包名(),"com.saurik.substrate") then
    4 W3 O3 c. m7 o) Y6 |" O* A$ x1 A- W) ^
  47.       isHook=true7 ~2 c$ _. `7 t
  48.      else; R" y) [3 k/ [+ S( N( T
  49. ! ~8 `1 F# R; j9 s7 d$ w5 Q
  50.     end
    2 j: g# s1 c# D% M
  51.   end8 `* h8 X# `  l. _& y  V
  52.   return isHook;( V6 J* e& }0 c5 f7 u$ h9 w
  53. % w+ p( H' ?2 m
  54. end; Y4 _- N& w  j& c; u
  55. function isHookByJar()0 C3 o/ A0 B! u* w; s$ M2 L
  56.   import"android.os.Process"/ F! l3 C6 v% F0 ^
  57.   isHook = false;  b. h2 y. W* l8 M9 I
  58.   libraries = {};
    9 A5 g8 e- m/ p8 x) p/ \! g
  59.   mapsFilename = "/proc/" .. Process.myPid() .. "/maps";
    ! C2 d) s( m, x* @
  60.   reader = BufferedReader(FileReader(mapsFilename));
      f% q# t! S5 c& Z. R3 k
  61.   while reader.readLine() ~= nil do
    2 e) H9 @+ N. e3 i& h0 \
  62.     if endsWith(tostring(reader.readLine()),"jar") ||endsWith(tostring(reader.readLine()),"so")then' r' ~: G# I/ l$ t
  63.       line=tostring(reader.readLine())/ Y4 w# ~6 k" Q9 |4 @7 N  I+ x% T9 S
  64.       n= lastIndexOf(line," ");" @9 E4 ?2 E% W
  65.       lines=string.sub(line,n+1,#line)1 k8 s* J6 ?9 t6 W1 }: {
  66.       --print(lines)2 Z  c% _2 ~9 i" E, o6 ]3 |
  67.       table.insert(libraries,tostring(lines))
    # F  L6 Q- K/ D- }+ a: V8 h: A
  68.     end6 J* C# U- f" o* X5 @  }8 F
  69.   end
    # l- n1 z1 j( `4 {* e2 r% I' D

  70. ) q. t1 o* u# M! l1 U# q/ m! r
  71.   library=0( q' t# s2 ?( }/ e
  72.   while library~=#libraries do9 G$ D9 e0 j, X0 q0 W
  73.     library=library+1$ H4 ~* R( ?  W. Q* _% c
  74.     if libraries[library]:match("com.saurik.substrate") then( l) @4 h2 y& F
  75.       Log.wtf("HookDetection", "Substrate shared object found: " + library);
    4 F: `# w! }( s$ |3 S) F" N
  76.       isHook = true;
    # i' E0 s3 D! A; _5 ~; Y3 `
  77.     end
    3 H. S; H( C* y) [
  78.     if libraries[library]:match("Xposed") then1 R: Y: o  Q- O( {
  79.       Log.wtf("HookDetection", "Xposed JAR found: " + library);
    , J5 Y, y  m7 a" Y: R) r1 e9 n+ u  W
  80.       isHook = true;
    8 g4 s9 }& y3 ^4 f- ?. \* f" K5 \1 D
  81.     end
    , m, M8 H* o# e6 X0 F- k) P
  82.   end9 v- V5 q; ^, M
  83.   reader.close();
    * ^# z! B) X% b9 l" i9 U
  84. / \2 U' X& G; w5 i. E+ ?( I3 E% Y( ^
  85.   return isHook;& b  A. M7 {! h/ k( a' ]# S
  86. + `6 l" l& U# s! @7 c
  87. end
复制代码
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|星空社区 |网站地图

GMT+8, 2024-4-28 14:30 , Processed in 0.056873 second(s), 32 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表