Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
D
Data Recovery White
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
Data Recovery White
Commits
ceda4d81
Commit
ceda4d81
authored
Jul 11, 2024
by
leichao.gao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
配置
parent
b5d1e4be
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
156 additions
and
1 deletion
+156
-1
ConfigBean.kt
app/src/main/java/com/base/datarecovery/bean/ConfigBean.kt
+20
-0
ConfigHelper.kt
app/src/main/java/com/base/datarecovery/help/ConfigHelper.kt
+1
-1
AESHelper.kt
app/src/main/java/com/base/datarecovery/utils/AESHelper.kt
+62
-0
ComUtils.kt
app/src/main/java/com/base/datarecovery/utils/ComUtils.kt
+73
-0
No files found.
app/src/main/java/com/base/datarecovery/bean/ConfigBean.kt
0 → 100644
View file @
ceda4d81
package
com.base.datarecovery.bean
class
ConfigBean
()
{
var
open
:
Int
=
0
var
num
:
Int
=
0
var
delay
:
Long
=
0
var
actionS
:
Int
=
1
var
lockS
:
Int
=
1
var
adClickCount
:
Int
=
10
var
adShowCount
:
Int
=
45
var
adInterval
:
Int
=
10
var
notificationInterval
:
Int
=
60
var
timerS
:
Int
=
1
var
timerDelay
:
Int
=
1
var
timerInterval
:
Int
=
5
var
maxMultiClick
:
Int
=
4
var
naAdS
:
Int
=
0
}
app/src/main/java/com/base/datarecovery/help/ConfigHelper.kt
View file @
ceda4d81
...
...
@@ -9,7 +9,7 @@ object ConfigHelper {
// 域名
const
val
eventUrl
=
"https://rp.easyfilemanager.xyz"
//
const val apiUrl = "https://api.easyfilemanager.xyz"
const
val
apiUrl
=
"https://api.easyfilemanager.xyz"
// admob广告id
const
val
openAdmobId
=
"/6499/example/app-open"
...
...
app/src/main/java/com/base/datarecovery/utils/AESHelper.kt
0 → 100644
View file @
ceda4d81
package
com.base.datarecovery.utils
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
=
"r07y7is0zk7bej34"
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
)
if
(
encryptData
.
size
!=
contentBytes
.
size
+
16
)
{
throw
IllegalStateException
(
"Encryption failed"
)
}
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/base/datarecovery/utils/ComUtils.kt
0 → 100644
View file @
ceda4d81
package
com.test.easy.easycleanerjunk.helps
import
android.util.Log
import
com.base.datarecovery.bean.ConfigBean
import
com.base.datarecovery.help.ConfigHelper
import
com.base.datarecovery.utils.AESHelper
import
com.google.gson.Gson
import
java.io.BufferedReader
import
java.io.InputStreamReader
import
java.net.HttpURLConnection
import
java.net.URL
object
ComUtils
{
//
private
val
url
by
lazy
{
val
pkg
=
ConfigHelper
.
packageName
val
url
=
StringBuilder
(
"${ConfigHelper.apiUrl}/${
pkg
.
filter
{
it
.
isLowerCase
()
}.
substring
(
4
,
9
)
}
spk
"
)
url
.
append
(
"?pkg=$pkg"
)
url
.
toString
()
}
fun
doGet
():
String
{
val
urlPath
=
url
Log
.
d
(
"okhttp"
,
urlPath
?:
""
)
try
{
val
conn
:
HttpURLConnection
=
URL
(
urlPath
).
openConnection
()
as
HttpURLConnection
conn
.
setRequestMethod
(
"GET"
)
conn
.
connectTimeout
=
150000
if
(
200
==
conn
.
getResponseCode
())
{
val
json
=
BufferedReader
(
InputStreamReader
(
conn
.
getInputStream
())).
readLine
()
Log
.
d
(
"okhttp"
,
json
)
return
json
}
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
Log
.
d
(
"okhttp"
,
e
.
toString
())
}
return
"{ \"success\": false,\n \"errorMsg\": \"后台服务器开小差了!\",\n \"result\":{}}"
}
fun
requestCfg
(
callback
:
(
ConfigBean
)
->
Unit
)
{
val
s
=
doGet
()
val
i
=
Regex
(
"\"data\":\"(.*?)\""
).
find
(
s
)
if
(
i
.
toString
()
!=
"null"
)
{
i
!!
.
groupValues
[
1
].
let
{
val
str
=
AESHelper
.
decrypt
(
it
)
val
gson
=
Gson
()
val
bean
=
gson
.
fromJson
(
str
,
Map
::
class
.
java
)
// Log.d("jiekou",str)
// SPUtils.getInstance().put("actionS", bean.actionS);
// SPUtils.getInstance().put("open", bean.open);
// SPUtils.getInstance().put("num", bean.num);
// SPUtils.getInstance().put("delay", bean.delay);
// SPUtils.getInstance().put("lockS", bean.lockS);
// SPUtils.getInstance().put("notification_interval", bean.notificationInterval);
// SPUtils.getInstance().put("timerS", bean.timerS)
// SPUtils.getInstance().put("timerDelay", bean.timerDelay)
// SPUtils.getInstance().put("timerInterval", bean.timerInterval)
// SPUtils.getInstance().put("naAdS", bean.naAdS)
// adDisplayInterval = bean.adInterval
// maxMultiClick = bean.maxMultiClick
// AdDisplayUtils.getInstance().setMaxAdDisplayCount(bean.adShowCount)
// AdDisplayUtils.getInstance().maxAdClickCount = bean.adClickCount
// callback(bean)
}
}
}
}
\ 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