Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
S
SandHook
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
SandHook
Commits
b5dec3cb
Commit
b5dec3cb
authored
Feb 14, 2019
by
swift_gan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tweak loadModule
parent
60f3ddbc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
11 deletions
+11
-11
XposedCompat.java
...in/java/com/swift/sandhook/xposedcompat/XposedCompat.java
+2
-2
XposedInit.java
...mpat/src/main/java/de/robv/android/xposed/XposedInit.java
+9
-9
No files found.
xposedcompat/src/main/java/com/swift/sandhook/xposedcompat/XposedCompat.java
View file @
b5dec3cb
...
@@ -25,8 +25,8 @@ public class XposedCompat {
...
@@ -25,8 +25,8 @@ public class XposedCompat {
private
static
ClassLoader
sandHookXposedClassLoader
;
private
static
ClassLoader
sandHookXposedClassLoader
;
public
static
void
loadModule
(
String
apkPath
,
ClassLoader
classLoader
)
{
public
static
void
loadModule
(
String
modulePath
,
String
moduleOdexDir
,
String
moduleSoPath
,
ClassLoader
classLoader
)
{
XposedInit
.
loadModule
(
apk
Path
,
classLoader
);
XposedInit
.
loadModule
(
modulePath
,
moduleOdexDir
,
moduleSo
Path
,
classLoader
);
}
}
...
...
xposedcompat/src/main/java/de/robv/android/xposed/XposedInit.java
View file @
b5dec3cb
...
@@ -14,8 +14,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
...
@@ -14,8 +14,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipFile
;
import
java.util.zip.ZipFile
;
import
dalvik.system.DexClassLoader
;
import
dalvik.system.DexFile
;
import
dalvik.system.DexFile
;
import
dalvik.system.PathClassLoader
;
import
de.robv.android.xposed.services.BaseService
;
import
de.robv.android.xposed.services.BaseService
;
import
static
de
.
robv
.
android
.
xposed
.
XposedHelpers
.
closeSilently
;
import
static
de
.
robv
.
android
.
xposed
.
XposedHelpers
.
closeSilently
;
...
@@ -102,7 +102,7 @@ public final class XposedInit {
...
@@ -102,7 +102,7 @@ public final class XposedInit {
BufferedReader
apks
=
new
BufferedReader
(
new
InputStreamReader
(
stream
));
BufferedReader
apks
=
new
BufferedReader
(
new
InputStreamReader
(
stream
));
String
apk
;
String
apk
;
while
((
apk
=
apks
.
readLine
())
!=
null
)
{
while
((
apk
=
apks
.
readLine
())
!=
null
)
{
loadModule
(
apk
,
topClassLoader
);
loadModule
(
apk
,
null
,
null
,
topClassLoader
);
}
}
apks
.
close
();
apks
.
close
();
}
}
...
@@ -112,16 +112,16 @@ public final class XposedInit {
...
@@ -112,16 +112,16 @@ public final class XposedInit {
* Load a module from an APK by calling the init(String) method for all classes defined
* Load a module from an APK by calling the init(String) method for all classes defined
* in <code>assets/xposed_init</code>.
* in <code>assets/xposed_init</code>.
*/
*/
public
static
void
loadModule
(
String
apk
,
ClassLoader
topClassLoader
)
{
public
static
void
loadModule
(
String
modulePath
,
String
moduleOdexDir
,
String
moduleSoPath
,
ClassLoader
topClassLoader
)
{
if
(!
new
File
(
apk
).
exists
())
{
if
(!
new
File
(
modulePath
).
exists
())
{
Log
.
e
(
TAG
,
" File does not exist"
);
Log
.
e
(
TAG
,
" File does not exist"
);
return
;
return
;
}
}
DexFile
dexFile
;
DexFile
dexFile
;
try
{
try
{
dexFile
=
new
DexFile
(
apk
);
dexFile
=
new
DexFile
(
modulePath
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
Log
.
e
(
TAG
,
" Cannot load module"
,
e
);
Log
.
e
(
TAG
,
" Cannot load module"
,
e
);
return
;
return
;
...
@@ -147,7 +147,7 @@ public final class XposedInit {
...
@@ -147,7 +147,7 @@ public final class XposedInit {
ZipFile
zipFile
=
null
;
ZipFile
zipFile
=
null
;
InputStream
is
;
InputStream
is
;
try
{
try
{
zipFile
=
new
ZipFile
(
apk
);
zipFile
=
new
ZipFile
(
modulePath
);
ZipEntry
zipEntry
=
zipFile
.
getEntry
(
"assets/xposed_init"
);
ZipEntry
zipEntry
=
zipFile
.
getEntry
(
"assets/xposed_init"
);
if
(
zipEntry
==
null
)
{
if
(
zipEntry
==
null
)
{
Log
.
e
(
TAG
,
" assets/xposed_init not found in the APK"
);
Log
.
e
(
TAG
,
" assets/xposed_init not found in the APK"
);
...
@@ -161,7 +161,7 @@ public final class XposedInit {
...
@@ -161,7 +161,7 @@ public final class XposedInit {
return
;
return
;
}
}
ClassLoader
mcl
=
new
PathClassLoader
(
apk
,
XposedInit
.
class
.
getClassLoader
()
);
ClassLoader
mcl
=
new
DexClassLoader
(
modulePath
,
moduleOdexDir
,
moduleSoPath
,
topClassLoader
);
BufferedReader
moduleClassesReader
=
new
BufferedReader
(
new
InputStreamReader
(
is
));
BufferedReader
moduleClassesReader
=
new
BufferedReader
(
new
InputStreamReader
(
is
));
try
{
try
{
String
moduleClassName
;
String
moduleClassName
;
...
@@ -189,7 +189,7 @@ public final class XposedInit {
...
@@ -189,7 +189,7 @@ public final class XposedInit {
//fake
//fake
if
(
moduleInstance
instanceof
IXposedHookZygoteInit
)
{
if
(
moduleInstance
instanceof
IXposedHookZygoteInit
)
{
IXposedHookZygoteInit
.
StartupParam
param
=
new
IXposedHookZygoteInit
.
StartupParam
();
IXposedHookZygoteInit
.
StartupParam
param
=
new
IXposedHookZygoteInit
.
StartupParam
();
param
.
modulePath
=
apk
;
param
.
modulePath
=
modulePath
;
param
.
startsSystemServer
=
false
;
param
.
startsSystemServer
=
false
;
((
IXposedHookZygoteInit
)
moduleInstance
).
initZygote
(
param
);
((
IXposedHookZygoteInit
)
moduleInstance
).
initZygote
(
param
);
}
}
...
@@ -219,7 +219,7 @@ public final class XposedInit {
...
@@ -219,7 +219,7 @@ public final class XposedInit {
}
}
}
}
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
Log
.
e
(
TAG
,
" Failed to load module from "
+
apk
,
e
);
Log
.
e
(
TAG
,
" Failed to load module from "
+
modulePath
,
e
);
}
finally
{
}
finally
{
closeSilently
(
is
);
closeSilently
(
is
);
closeSilently
(
zipFile
);
closeSilently
(
zipFile
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment