File tree Expand file tree Collapse file tree 4 files changed +14
-13
lines changed
app/src/main/java/com/example/leo/monitor Expand file tree Collapse file tree 4 files changed +14
-13
lines changed Original file line number Diff line number Diff line change @@ -21,16 +21,16 @@ object SHA256 {
21
21
}
22
22
}
23
23
24
- return byte2Hex( digest.digest())
24
+ return digest.digest().toHEX( )
25
25
}
26
26
27
27
fun hash (input : String ): String {
28
28
val digest = digestProvider()
29
- return byte2Hex( digest.digest(input.toByteArray()))
29
+ return digest.digest(input.toByteArray()).toHEX( )
30
30
}
31
31
32
32
fun hash (input : ByteArray ): String {
33
33
val digest = digestProvider()
34
- return byte2Hex( digest.digest(input))
34
+ return digest.digest(input).toHEX( )
35
35
}
36
36
}
Original file line number Diff line number Diff line change @@ -10,15 +10,16 @@ import com.squareup.moshi.Moshi
10
10
import de.robv.android.xposed.XposedHelpers
11
11
import java.io.File
12
12
import java.util.concurrent.ConcurrentHashMap
13
+ import okio.ByteString
13
14
import okio.GzipSink
14
15
import okio.HashingSource
15
16
import okio.Okio
16
17
import org.json.JSONObject
17
18
18
19
inline fun <reified T > clazz () = T ::class .java
19
20
20
- fun ByteArray.toHEX () =
21
- this .joinToString( " " ) { String .format( " %02x " , it) }
21
+ fun ByteArray.toHEX (): String =
22
+ ByteString .of( this , 0 , this .size).hex()
22
23
23
24
fun ByteArray.contains (bytes : ByteArray ) =
24
25
this .indexOf(bytes) != - 1
@@ -53,14 +54,6 @@ fun currentApplicationHash(sourceApk: File = File(AndroidAppHelper.currentApplic
53
54
.apply { Okio .buffer(this ).use { it.readAll(Okio .blackhole()) } }
54
55
.hash().hex()
55
56
56
- fun byte2Hex (bytes : ByteArray ) = StringBuilder (bytes.size * 2 )
57
- .apply {
58
- for (byte in bytes) {
59
- append(" %02x" .format(byte))
60
- }
61
- }
62
- .toString()
63
-
64
57
fun gzip (input : File , output : File ) {
65
58
Okio .buffer(Okio .source(input)).use { source ->
66
59
Okio .buffer(GzipSink (Okio .sink(output))).use { sink -> sink.writeAll(source) }
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import java.io.FileOutputStream
17
17
import java.net.Socket
18
18
import javax.crypto.Cipher
19
19
import javax.crypto.Mac
20
+ import okio.ByteString
20
21
21
22
object ParseGenerator {
22
23
@@ -153,9 +154,14 @@ object ParseGenerator {
153
154
return " ${action} _${cipher.algorithm} "
154
155
}
155
156
157
+ private fun parseByteArray (obj : ByteArray ) =
158
+ if (obj.size > DEFAULT_BUFFER_SIZE ) obj.toString()
159
+ else ByteString .of(obj, 0 , obj.size).base64()
160
+
156
161
fun parseObject (obj : Any? ): Any = when (obj) {
157
162
is List <* > -> obj.map { parseObject(it) }
158
163
is Array <* > -> obj.map { parseObject(it) }
164
+ is ByteArray -> parseByteArray(obj)
159
165
else -> obj.toString()
160
166
}
161
167
}
Original file line number Diff line number Diff line change 1
1
#! /bin/sh
2
2
# place this file at /data/adb/service.d
3
3
# https://github.com/topjohnwu/Magisk/blob/master/docs/guides.md#boot-scripts
4
+ # adb push run.sh /data/local/tmp/run.sh && adb shell "su -c 'mv /data/local/tmp/run.sh /data/adb/service.d/run.sh && chmod +x /data/adb/service.d/run.sh'"
4
5
5
6
sleep 60
6
7
am start --user 19 com.example.leo.monitor
8
+ am start -a android.intent.action.MAIN -c android.intent.category.HOME
You can’t perform that action at this time.
0 commit comments