Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
H
HookNotify
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
steve
HookNotify
Commits
437a6678
Commit
437a6678
authored
Mar 02, 2022
by
steve
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成-适配 android 11 储存空间
parent
204240a5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
55 additions
and
14 deletions
+55
-14
MainActivity.kt
app/src/main/java/com/go/hookNotify/MainActivity.kt
+7
-4
DateUnit.kt
app/src/main/java/com/go/hookNotify/units/DateUnit.kt
+14
-0
LogSaveUnit.kt
app/src/main/java/com/go/hookNotify/units/LogSaveUnit.kt
+0
-0
Hook.kt
app/src/main/java/com/go/hookNotify/xp/Hook.kt
+1
-2
HookGlobalNotify.java
...main/java/com/go/hookNotify/xp/code/HookGlobalNotify.java
+12
-3
HookSimBoxNotify.java
...main/java/com/go/hookNotify/xp/code/HookSimBoxNotify.java
+15
-5
strings.xml
app/src/main/res/values/strings.xml
+6
-0
No files found.
app/src/main/java/com/go/hookNotify/MainActivity.kt
View file @
437a6678
...
...
@@ -2,8 +2,10 @@ package com.go.hookNotify
import
android.os.Bundle
import
android.view.View
import
android.widget.Toast
import
androidx.appcompat.app.AppCompatActivity
import
com.go.hookNotify.databinding.ActivityMainBinding
import
com.go.hookNotify.units.HookTestUnit
class
MainActivity
:
AppCompatActivity
(),
View
.
OnClickListener
{
...
...
@@ -18,11 +20,12 @@ class MainActivity : AppCompatActivity(), View.OnClickListener {
override
fun
onClick
(
view
:
View
?)
{
when
(
view
)
{
mBinding
.
btnChange
->
{
mBinding
.
tvTitle
.
text
=
"OK2"
if
(
HookTestUnit
.
toMessage
())
Toast
.
makeText
(
this
,
getString
(
R
.
string
.
share_hook_suc
),
Toast
.
LENGTH_SHORT
).
show
()
else
Toast
.
makeText
(
this
,
getString
(
R
.
string
.
share_hook_failure
),
Toast
.
LENGTH_SHORT
).
show
()
mBinding
.
tvTitle
.
text
=
"OK"
}
}
}
...
...
app/src/main/java/com/go/hookNotify/units/DateUnit.kt
0 → 100644
View file @
437a6678
package
com.go.hookNotify.units
import
java.text.SimpleDateFormat
import
java.util.*
object
DateUnit
{
fun
getNowTime
(
sTimeFormat
:
String
=
"yyyy-MM-dd HH-mm-ss"
):
String
{
val
sdf
=
SimpleDateFormat
(
sTimeFormat
,
Locale
.
getDefault
())
val
calendar
=
Calendar
.
getInstance
()
val
data
=
calendar
.
time
return
sdf
.
format
(
data
)
}
}
\ No newline at end of file
app/src/main/java/com/go/hookNotify/units/LogSaveUnit.kt
View file @
437a6678
This diff is collapsed.
Click to expand it.
app/src/main/java/com/go/hookNotify/xp/Hook.kt
View file @
437a6678
...
...
@@ -4,7 +4,6 @@ import com.go.hookNotify.units.XPoseDebugUnit
import
com.go.hookNotify.xp.code.HookGlobalNotify
import
com.go.hookNotify.xp.code.HookSimBoxNotify
import
de.robv.android.xposed.IXposedHookLoadPackage
import
de.robv.android.xposed.XposedBridge
import
de.robv.android.xposed.callbacks.XC_LoadPackage
class
Hook
:
IXposedHookLoadPackage
{
...
...
@@ -17,7 +16,7 @@ class Hook : IXposedHookLoadPackage {
xPosedHook
(
packageName
,
lpparam
)
}
private
fun
androidSystemHook
(
loadPackageParam
:
XC_LoadPackage
.
LoadPackageParam
?){
private
fun
androidSystemHook
(
loadPackageParam
:
XC_LoadPackage
.
LoadPackageParam
?)
{
XPoseDebugUnit
.
xPoseLogDebug
(
"android system start"
)
HookGlobalNotify
().
handleLoadPackage
(
loadPackageParam
)
}
...
...
app/src/main/java/com/go/hookNotify/xp/code/HookGlobalNotify.java
View file @
437a6678
...
...
@@ -5,13 +5,18 @@ import android.app.Notification;
import
android.content.Context
;
import
android.os.Bundle
;
import
com.go.hookNotify.units.DateUnit
;
import
com.go.hookNotify.units.LogSaveUnit
;
import
com.go.hookNotify.units.XPoseDebugUnit
;
import
java.util.Objects
;
import
java.util.Set
;
import
de.robv.android.xposed.IXposedHookLoadPackage
;
import
de.robv.android.xposed.IXposedHookZygoteInit
;
import
de.robv.android.xposed.XC_MethodHook
;
import
de.robv.android.xposed.XSharedPreferences
;
import
de.robv.android.xposed.XposedBridge
;
import
de.robv.android.xposed.XposedHelpers
;
import
de.robv.android.xposed.callbacks.XC_LoadPackage
;
...
...
@@ -48,9 +53,10 @@ public class HookGlobalNotify implements IXposedHookLoadPackage {
Notification
notification
=
(
Notification
)
param
.
args
[
2
];
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
"\n"
).
append
(
"=============================================================================="
).
append
(
"\n"
);
sb
.
append
(
DateUnit
.
INSTANCE
.
getNowTime
(
"yyyy-MM-dd HH-mm-ss"
));
sb
.
append
(
"\n"
).
append
(
"object notification: "
).
append
(
notification
.
toString
()).
append
(
"\n"
);
sb
.
append
(
"object bundle:"
).
append
(
"\n"
);
Bundle
bundle
=
notification
.
extras
;
if
(
bundle
!=
null
)
{
Set
<
String
>
keys
=
bundle
.
keySet
();
...
...
@@ -63,8 +69,11 @@ public class HookGlobalNotify implements IXposedHookLoadPackage {
String
title
=
notification
.
extras
.
getString
(
"android.title"
,
"no Title"
);
// String content = notification.extras.getString("android.text", "");
String
documentName
=
"log/"
+
title
;
// LogSaveUnit.INSTANCE.saveLogFile(documentName, sb.toString());
String
documentPath
=
"logGlobal/"
+
title
;
String
fileName
=
"GlobalLog_"
+
DateUnit
.
INSTANCE
.
getNowTime
(
"yyyy-MM-dd HH-mm-ss"
)+
".txt"
;
LogSaveUnit
.
INSTANCE
.
saveLogFile
(
mContext
,
documentPath
,
fileName
,
sb
.
toString
());
}
});
}
...
...
app/src/main/java/com/go/hookNotify/xp/code/HookSimBoxNotify.java
View file @
437a6678
package
com
.
go
.
hookNotify
.
xp
.
code
;
import
android.app.AndroidAppHelper
;
import
android.app.Notification
;
import
android.content.ContentValues
;
import
android.content.Context
;
import
android.os.Bundle
;
import
com.go.hookNotify.units.DateUnit
;
import
com.go.hookNotify.units.LogSaveUnit
;
import
com.go.hookNotify.units.XPoseDebugUnit
;
import
com.go.hookNotify.xp.Constants
;
import
java.util.Map
;
import
java.util.Set
;
import
de.robv.android.xposed.IXposedHookLoadPackage
;
import
de.robv.android.xposed.XC_MethodHook
;
...
...
@@ -34,10 +39,11 @@ public class HookSimBoxNotify implements IXposedHookLoadPackage {
private
final
String
mCountryCode
=
"countryCode"
;
private
final
String
mNormalizedNumber
=
"normalizedNumber"
;
private
Context
mContext
=
null
;
@Override
public
void
handleLoadPackage
(
XC_LoadPackage
.
LoadPackageParam
lpparam
)
throws
Throwable
{
if
(!
lpparam
.
processName
.
equals
(
Constants
.
SIMBOX_NAME
))
return
;
XPoseDebugUnit
.
xPoseLogInfo
(
"simBox start init!!"
);
...
...
@@ -46,6 +52,9 @@ public class HookSimBoxNotify implements IXposedHookLoadPackage {
ContentValues
.
class
,
String
.
class
,
Map
.
class
,
String
.
class
,
boolean
.
class
,
boolean
.
class
,
boolean
.
class
,
new
XC_MethodHook
()
{
@Override
protected
void
beforeHookedMethod
(
MethodHookParam
param
)
throws
Throwable
{
mContext
=
AndroidAppHelper
.
currentApplication
();
XPoseDebugUnit
.
xPoseLogInfo
(
"Success Hook Method"
);
ContentValues
contentValues
=
(
ContentValues
)
param
.
args
[
0
];
...
...
@@ -79,12 +88,13 @@ public class HookSimBoxNotify implements IXposedHookLoadPackage {
mExt
+
": "
+
ext
+
"\n"
+
mCountryCode
+
": "
+
countryCode
+
"\n"
+
mNormalizedNumber
+
": "
+
normalizedNumber
+
"\n"
;
XPoseDebugUnit
.
xPoseLogInfo
(
sMsg
);
String
documentName
=
"log2/"
+
number
+
"-"
+
imsi
;
LogSaveUnit
.
INSTANCE
.
saveLogFile
(
documentName
,
sMsg
);
//存在手机的外部空间
super
.
beforeHookedMethod
(
param
);
String
documentPath
=
"logSimbox/"
+
number
+
"-"
+
imsi
;
String
fileName
=
"SimBoxLog_"
+
DateUnit
.
INSTANCE
.
getNowTime
(
"yyyy-MM-dd HH-mm-ss"
)
+
".txt"
;
LogSaveUnit
.
INSTANCE
.
saveLogFile
(
mContext
,
documentPath
,
fileName
,
sMsg
);
//存在手机外部空间
super
.
beforeHookedMethod
(
param
);
}
});
}
...
...
app/src/main/res/values/strings.xml
View file @
437a6678
<resources>
<string
name=
"app_name"
>
HookNotify
</string>
<!--share-->
<string
name=
"share_hook_test"
>
Hook 測試
</string>
<string
name=
"share_hook_suc"
>
Hook 成功
</string>
<string
name=
"share_hook_failure"
>
Hook 失敗
</string>
</resources>
\ No newline at end of file
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