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
912f76cd
Commit
912f76cd
authored
Feb 16, 2019
by
swift_gan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix null dir
parent
5c250a7a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
11 deletions
+14
-11
DexMaker.java
xposedcompat/src/main/java/com/android/dx/DexMaker.java
+6
-0
DynamicBridge.java
.../swift/sandhook/xposedcompat/methodgen/DynamicBridge.java
+2
-0
HookerDexMaker.java
...swift/sandhook/xposedcompat/methodgen/HookerDexMaker.java
+6
-11
No files found.
xposedcompat/src/main/java/com/android/dx/DexMaker.java
View file @
912f76cd
...
...
@@ -546,6 +546,12 @@ public final class DexMaker {
*
* TODO: load the dex from memory where supported.
*/
File
parentDir
=
result
.
getParentFile
();
if
(!
parentDir
.
exists
())
{
parentDir
.
mkdirs
();
}
result
.
createNewFile
();
JarOutputStream
jarOut
=
new
JarOutputStream
(
new
FileOutputStream
(
result
));
JarEntry
entry
=
new
JarEntry
(
DexFormat
.
DEX_IN_JAR_NAME
);
...
...
xposedcompat/src/main/java/com/swift/sandhook/xposedcompat/methodgen/DynamicBridge.java
View file @
912f76cd
...
...
@@ -47,6 +47,8 @@ public final class DynamicBridge {
try
{
String
fixedAppDataDir
=
XposedCompat
.
cacheDir
.
getAbsolutePath
();
dexDir
=
new
File
(
fixedAppDataDir
,
"/sandxposed/"
);
if
(!
dexDir
.
exists
())
dexDir
.
mkdirs
();
}
catch
(
Throwable
throwable
)
{
DexLog
.
e
(
"error when init dex path"
,
throwable
);
}
...
...
xposedcompat/src/main/java/com/swift/sandhook/xposedcompat/methodgen/HookerDexMaker.java
View file @
912f76cd
...
...
@@ -20,7 +20,6 @@ import java.lang.reflect.Member;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Modifier
;
import
java.util.Map
;
import
java.util.concurrent.atomic.AtomicLong
;
import
de.robv.android.xposed.XC_MethodHook
;
import
de.robv.android.xposed.XposedBridge
;
...
...
@@ -30,7 +29,6 @@ import static com.swift.sandhook.xposedcompat.utils.DexMakerUtils.autoBoxIfNeces
import
static
com
.
swift
.
sandhook
.
xposedcompat
.
utils
.
DexMakerUtils
.
autoUnboxIfNecessary
;
import
static
com
.
swift
.
sandhook
.
xposedcompat
.
utils
.
DexMakerUtils
.
createResultLocals
;
import
static
com
.
swift
.
sandhook
.
xposedcompat
.
utils
.
DexMakerUtils
.
getObjTypeIdIfPrimitive
;
import
static
com
.
swift
.
sandhook
.
xposedcompat
.
utils
.
DexMakerUtils
.
moveException
;
public
class
HookerDexMaker
{
...
...
@@ -48,7 +46,6 @@ public class HookerDexMaker {
private
static
final
String
PARAMS_FIELD_NAME_ARGS
=
"args"
;
private
static
final
String
CALLBACK_METHOD_NAME_BEFORE
=
"callBeforeHookedMethod"
;
private
static
final
String
CALLBACK_METHOD_NAME_AFTER
=
"callAfterHookedMethod"
;
private
static
final
String
PARAMS_METHOD_NAME_IS_EARLY_RETURN
=
"isEarlyReturn"
;
private
static
final
TypeId
<
Throwable
>
throwableTypeId
=
TypeId
.
get
(
Throwable
.
class
);
private
static
final
TypeId
<
Member
>
memberTypeId
=
TypeId
.
get
(
Member
.
class
);
private
static
final
TypeId
<
XC_MethodHook
>
callbackTypeId
=
TypeId
.
get
(
XC_MethodHook
.
class
);
...
...
@@ -77,8 +74,6 @@ public class HookerDexMaker {
private
static
final
TypeId
<
XposedBridge
>
xposedBridgeTypeId
=
TypeId
.
get
(
XposedBridge
.
class
);
private
static
final
MethodId
<
XposedBridge
,
Void
>
logThrowableMethodId
=
xposedBridgeTypeId
.
getMethod
(
TypeId
.
VOID
,
"log"
,
throwableTypeId
);
private
static
final
MethodId
<
XposedBridge
,
Void
>
logStrMethodId
=
xposedBridgeTypeId
.
getMethod
(
TypeId
.
VOID
,
"log"
,
TypeId
.
STRING
);
private
FieldId
<?,
XposedBridge
.
AdditionalHookInfo
>
mHookInfoFieldId
;
private
FieldId
<?,
Member
>
mMethodFieldId
;
...
...
@@ -406,9 +401,9 @@ public class HookerDexMaker {
code
.
newInstance
(
param
,
paramTypeId
.
getConstructor
());
// set method, thisObject, args
code
.
sget
(
mMethodFieldId
,
method
);
code
.
iput
(
paramTypeId
.
getField
(
memberTypeId
,
"method"
),
param
,
method
);
code
.
iput
(
paramTypeId
.
getField
(
TypeId
.
OBJECT
,
"thisObject"
),
param
,
thisObject
);
code
.
iput
(
paramTypeId
.
getField
(
objArrayTypeId
,
"args"
),
param
,
args
);
code
.
iput
(
paramTypeId
.
getField
(
memberTypeId
,
PARAMS_FIELD_NAME_METHOD
),
param
,
method
);
code
.
iput
(
paramTypeId
.
getField
(
TypeId
.
OBJECT
,
PARAMS_FIELD_NAME_THIS_OBJECT
),
param
,
thisObject
);
code
.
iput
(
paramTypeId
.
getField
(
objArrayTypeId
,
PARAMS_FIELD_NAME_ARGS
),
param
,
args
);
// call beforeCallbacks
code
.
loadConstant
(
beforeIdx
,
0
);
...
...
@@ -427,7 +422,7 @@ public class HookerDexMaker {
// start of catch
code
.
mark
(
tryBeforeCatch
);
moveException
(
code
,
throwable
);
code
.
moveException
(
throwable
);
code
.
invokeStatic
(
logThrowableMethodId
,
null
,
throwable
);
code
.
invokeVirtual
(
setResultMethodId
,
null
,
param
,
nullObj
);
code
.
loadConstant
(
returnEarly
,
false
);
...
...
@@ -484,7 +479,7 @@ public class HookerDexMaker {
code
.
removeCatchClause
(
throwableTypeId
);
// catch
code
.
mark
(
tryOrigCatch
);
moveException
(
code
,
throwable
);
code
.
moveException
(
throwable
);
// exception occurred when calling backup, save throwable to param
code
.
invokeVirtual
(
setThrowableMethodId
,
null
,
param
,
throwable
);
...
...
@@ -507,7 +502,7 @@ public class HookerDexMaker {
code
.
removeCatchClause
(
throwableTypeId
);
// catch
code
.
mark
(
tryAfterCatch
);
moveException
(
code
,
throwable
);
code
.
moveException
(
throwable
);
code
.
invokeStatic
(
logThrowableMethodId
,
null
,
throwable
);
// if lastThrowable == null, go to recover lastResult
code
.
compareZ
(
Comparison
.
EQ
,
noBackupThrowable
,
lastThrowable
);
...
...
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