Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
E
Easy Cleaner Junk
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wanglei
Easy Cleaner Junk
Commits
312256a1
Commit
312256a1
authored
Jun 28, 2024
by
maxiaoliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改上报
parent
77039085
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
114 additions
and
0 deletions
+114
-0
AESHelper.kt
...ain/java/com/test/easy/easycleanerjunk/helps/AESHelper.kt
+60
-0
EventUtils.kt
...in/java/com/test/easy/easycleanerjunk/helps/EventUtils.kt
+53
-0
ReportUtils.java
...java/com/test/easy/easycleanerjunk/helps/ReportUtils.java
+1
-0
No files found.
app/src/main/java/com/test/easy/easycleanerjunk/helps/AESHelper.kt
0 → 100644
View file @
312256a1
package
com.test.easy.easycleanerjunk.helps
import
android.util.Base64
import
java.security.SecureRandom
import
javax.crypto.Cipher
import
javax.crypto.spec.GCMParameterSpec
import
javax.crypto.spec.SecretKeySpec
object
AESHelper
{
private
const
val
aesKey
=
"bt8n2r8wdqk30wcu"
private
val
cipher
by
lazy
{
Cipher
.
getInstance
(
"AES/GCM/NoPadding"
)
}
fun
encrypt
(
content
:
String
):
String
{
try
{
val
iv
=
ByteArray
(
12
).
apply
{
SecureRandom
().
nextBytes
(
this
)
}
val
contentBytes
=
content
.
toByteArray
(
Charsets
.
UTF_8
)
val
params
=
GCMParameterSpec
(
128
,
iv
)
cipher
.
init
(
Cipher
.
ENCRYPT_MODE
,
secretKey
,
params
)
val
encryptData
=
cipher
.
doFinal
(
contentBytes
)
assert
(
encryptData
.
size
==
contentBytes
.
size
+
16
)
val
message
=
ByteArray
(
12
+
contentBytes
.
size
+
16
)
System
.
arraycopy
(
iv
,
0
,
message
,
0
,
12
)
System
.
arraycopy
(
encryptData
,
0
,
message
,
12
,
encryptData
.
size
)
return
String
(
Base64
.
encode
(
message
,
Base64
.
NO_WRAP
),
Charsets
.
UTF_8
)
}
catch
(
_
:
Exception
)
{
}
return
content
}
@Synchronized
fun
decrypt
(
content
:
String
):
String
{
try
{
val
con
=
content
.
replace
(
" "
.
toRegex
(),
"+"
)
val
contentByte
=
Base64
.
decode
(
con
,
Base64
.
NO_WRAP
)
require
(
contentByte
.
size
>=
12
+
16
)
val
params
=
GCMParameterSpec
(
128
,
contentByte
,
0
,
12
)
cipher
.
init
(
Cipher
.
DECRYPT_MODE
,
secretKey
,
params
)
val
decryptData
=
cipher
.
doFinal
(
contentByte
,
12
,
contentByte
.
size
-
12
)
return
String
(
decryptData
,
Charsets
.
UTF_8
)
}
catch
(
_
:
Exception
)
{
}
return
content
}
private
val
secretKey
by
lazy
{
SecretKeySpec
(
aesKey
.
toByteArray
(),
"AES"
)
}
}
\ No newline at end of file
app/src/main/java/com/test/easy/easycleanerjunk/helps/EventUtils.kt
0 → 100644
View file @
312256a1
package
com.test.easy.easycleanerjunk.helps
import
com.test.easy.easycleanerjunk.BuildConfig
import
com.test.easy.easycleanerjunk.helps.ReportUtils.doPost
import
com.test.easy.easycleanerjunk.utils.SPUtils
import
org.json.JSONException
import
org.json.JSONObject
object
EventUtils
{
fun
event
(
key
:
String
,
value
:
String
?
=
null
,
ext
:
JSONObject
?
=
null
)
{
Thread
{
var
parmJson
:
String
?
=
""
try
{
val
pkg
=
ConfigHelper
.
packageName
val
s
=
JSONObject
()
.
put
(
"action"
,
key
)
.
put
(
"value"
,
value
)
.
put
(
"ext"
,
ext
)
val
s2
=
JSONObject
()
.
put
(
"${pkg}_3"
,
SPUtils
.
getInstance
().
getString
(
"Equipment"
))
.
put
(
"${pkg}_4"
,
SPUtils
.
getInstance
().
getString
(
"Manufacturer"
))
.
put
(
"${pkg}_5"
,
SPUtils
.
getInstance
().
getString
(
"svn"
))
.
put
(
"${pkg}_9"
,
SPUtils
.
getInstance
().
getString
(
"uuid"
))
.
put
(
"${pkg}_10"
,
SPUtils
.
getInstance
().
getString
(
"gid"
))
.
put
(
"${pkg}_13"
,
"android"
)
.
put
(
"${pkg}_15"
,
"google"
)
.
put
(
"${pkg}_14"
,
BuildConfig
.
VERSION_CODE
)
.
put
(
"${pkg}_8"
,
BuildConfig
.
VERSION_NAME
)
.
put
(
"${pkg}_24"
,
BuildConfig
.
BUILD_TYPE
)
val
data
=
JSONObject
()
.
put
(
"data"
,
s
)
.
put
(
"bp"
,
s2
)
.
toString
()
parmJson
=
AESHelper
.
encrypt
(
data
)
}
catch
(
e
:
JSONException
)
{
parmJson
=
""
}
doPost
(
ConfigHelper
.
eventUrl
,
HashMap
(),
parmJson
)
}.
start
()
}
}
\ No newline at end of file
app/src/main/java/com/test/easy/easycleanerjunk/helps/ReportUtils.java
View file @
312256a1
...
@@ -10,6 +10,7 @@ import java.net.URL;
...
@@ -10,6 +10,7 @@ import java.net.URL;
import
java.util.Map
;
import
java.util.Map
;
public
class
ReportUtils
{
public
class
ReportUtils
{
public
static
String
doPost
(
String
urlPath
,
Map
<
String
,
String
>
paramsMap
,
String
json
)
{
public
static
String
doPost
(
String
urlPath
,
Map
<
String
,
String
>
paramsMap
,
String
json
)
{
try
{
try
{
HttpURLConnection
conn
=
(
HttpURLConnection
)
new
URL
(
urlPath
).
openConnection
();
HttpURLConnection
conn
=
(
HttpURLConnection
)
new
URL
(
urlPath
).
openConnection
();
...
...
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