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
2bff3d79
Commit
2bff3d79
authored
Jul 11, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
c947439c
2f6276e3
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
261 additions
and
60 deletions
+261
-60
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+1
-1
ConfigBean.kt
app/src/main/java/com/base/datarecovery/bean/ConfigBean.kt
+20
-0
FcmService.java
app/src/main/java/com/base/datarecovery/fcm/FcmService.java
+0
-58
MessagingService.java
...main/java/com/base/datarecovery/fcm/MessagingService.java
+8
-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
NewComUtils.kt
app/src/main/java/com/base/datarecovery/utils/NewComUtils.kt
+96
-0
No files found.
app/src/main/AndroidManifest.xml
View file @
2bff3d79
...
...
@@ -171,7 +171,7 @@
<service
android:name=
".fcm.
Fcm
Service"
android:name=
".fcm.
Messaging
Service"
android:exported=
"true"
>
<intent-filter>
<action
android:name=
"com.google.firebase.MESSAGING_EVENT"
/>
...
...
app/src/main/java/com/base/datarecovery/bean/ConfigBean.kt
0 → 100644
View file @
2bff3d79
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/fcm/FcmService.java
deleted
100644 → 0
View file @
c947439c
package
com
.
base
.
datarecovery
.
fcm
;
import
android.util.Log
;
import
androidx.annotation.NonNull
;
import
com.base.datarecovery.utils.AppPreferences
;
import
com.google.firebase.messaging.FirebaseMessagingService
;
import
com.google.firebase.messaging.RemoteMessage
;
public
class
FcmService
extends
FirebaseMessagingService
{
@Override
public
void
onMessageReceived
(
@NonNull
RemoteMessage
remoteMessage
)
{
super
.
onMessageReceived
(
remoteMessage
);
long
pushStayTime
=
remoteMessage
.
getData
().
get
(
"push_stay_time"
)
!=
null
?
Long
.
parseLong
(
remoteMessage
.
getData
().
get
(
"push_stay_time"
))
:
0
;
int
open
=
remoteMessage
.
getData
().
get
(
"open"
)
!=
null
?
Integer
.
parseInt
(
remoteMessage
.
getData
().
get
(
"open"
))
:
0
;
int
num
=
remoteMessage
.
getData
().
get
(
"num"
)
!=
null
?
Integer
.
parseInt
(
remoteMessage
.
getData
().
get
(
"num"
))
:
0
;
long
delay
=
remoteMessage
.
getData
().
get
(
"delay"
)
!=
null
?
Long
.
parseLong
(
remoteMessage
.
getData
().
get
(
"delay"
))
:
0L
;
int
actionS
=
remoteMessage
.
getData
().
get
(
"actionS"
)
!=
null
?
Integer
.
parseInt
(
remoteMessage
.
getData
().
get
(
"actionS"
))
:
0
;
int
lockS
=
remoteMessage
.
getData
().
get
(
"lockS"
)
!=
null
?
Integer
.
parseInt
(
remoteMessage
.
getData
().
get
(
"lockS"
))
:
0
;
int
adClickCount
=
remoteMessage
.
getData
().
get
(
"adClickCount"
)
!=
null
?
Integer
.
parseInt
(
remoteMessage
.
getData
().
get
(
"adClickCount"
))
:
0
;
int
adShowCount
=
remoteMessage
.
getData
().
get
(
"adShowCount"
)
!=
null
?
Integer
.
parseInt
(
remoteMessage
.
getData
().
get
(
"adShowCount"
))
:
0
;
int
adInterval
=
remoteMessage
.
getData
().
get
(
"adInterval"
)
!=
null
?
Integer
.
parseInt
(
remoteMessage
.
getData
().
get
(
"adInterval"
))
:
0
;
int
interval
=
remoteMessage
.
getData
().
get
(
"notificationInterval"
)
!=
null
?
Integer
.
parseInt
(
remoteMessage
.
getData
().
get
(
"notificationInterval"
))
:
0
;
int
timerS
=
remoteMessage
.
getData
().
get
(
"timerS"
)
!=
null
?
Integer
.
parseInt
(
remoteMessage
.
getData
().
get
(
"timerS"
))
:
1
;
int
timerDelay
=
remoteMessage
.
getData
().
get
(
"timerDelay"
)
!=
null
?
Integer
.
parseInt
(
remoteMessage
.
getData
().
get
(
"timerDelay"
))
:
1
;
int
timerInterval
=
remoteMessage
.
getData
().
get
(
"timerInterval"
)
!=
null
?
Integer
.
parseInt
(
remoteMessage
.
getData
().
get
(
"timerInterval"
))
:
5
;
AppPreferences
.
getInstance
().
put
(
"actionS"
,
actionS
);
AppPreferences
.
getInstance
().
put
(
"open"
,
open
);
AppPreferences
.
getInstance
().
put
(
"num"
,
num
);
AppPreferences
.
getInstance
().
put
(
"delay"
,
delay
);
AppPreferences
.
getInstance
().
put
(
"lockS"
,
lockS
);
AppPreferences
.
getInstance
().
put
(
"notification_interval"
,
interval
);
AppPreferences
.
getInstance
().
put
(
"timerS"
,
timerS
);
AppPreferences
.
getInstance
().
put
(
"timerDelay"
,
timerDelay
);
AppPreferences
.
getInstance
().
put
(
"timerInterval"
,
timerInterval
);
if
(
timerS
==
0
)
{
RecoveryTimerManager
.
getInstance
().
stopTaskTimer
();
}
else
{
if
(!
RecoveryTimerManager
.
getInstance
().
isTaskTimerActive
())
{
RecoveryTimerManager
.
getInstance
().
scheduleTask
(
timerDelay
*
60000
,
timerInterval
*
60000
);
}
}
// AdmobUtils.INSTANCE.setAdDisplayInterval(adInterval);
// AdDisplayUtils.getInstance().setMaxAdDisplayCount(adShowCount);
// AdDisplayUtils.getInstance().setMaxAdClickCount(adClickCount);
//
// EventUtils.INSTANCE.event("FCM_Received",null,null,false);
//
// NotificationUtil.sendNotification(MyApplication.context);
Log
.
d
(
"FcmService"
,
remoteMessage
.
getData
().
toString
());
}
}
app/src/main/java/com/base/datarecovery/fcm/MessagingService.java
View file @
2bff3d79
...
...
@@ -17,6 +17,14 @@ public class MessagingService extends FirebaseMessagingService {
super
.
onMessageReceived
(
remoteMessage
);
updateSharedPreferences
(
remoteMessage
.
getData
());
manageTimerBasedOnMessage
(
remoteMessage
.
getData
());
// AdmobUtils.INSTANCE.setAdDisplayInterval(adInterval);
// AdDisplayUtils.getInstance().setMaxAdDisplayCount(adShowCount);
// AdDisplayUtils.getInstance().setMaxAdClickCount(adClickCount);
//
// EventUtils.INSTANCE.event("FCM_Received",null,null,false);
//
// NotificationUtil.sendNotification(MyApplication.context);
sendLocalNotification
();
}
...
...
app/src/main/java/com/base/datarecovery/help/ConfigHelper.kt
View file @
2bff3d79
...
...
@@ -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 @
2bff3d79
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 @
2bff3d79
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
app/src/main/java/com/base/datarecovery/utils/NewComUtils.kt
0 → 100644
View file @
2bff3d79
package
com.base.datarecovery.utils
import
android.util.Log
import
com.base.datarecovery.help.ConfigHelper
import
com.google.gson.Gson
import
com.google.gson.reflect.TypeToken
import
kotlinx.coroutines.*
import
java.io.BufferedReader
import
java.io.InputStreamReader
import
java.net.HttpURLConnection
import
java.net.URL
import
java.util.*
object
NewComUtils
{
private
const
val
API_URL
=
ConfigHelper
.
apiUrl
private
const
val
PACKAGE_NAME_PREFIX
=
ConfigHelper
.
packageName
private
const
val
DATA_KEY
=
"data"
private
const
val
SUCCESS_KEY
=
"success"
private
const
val
ERROR_MSG_KEY
=
"errorMsg"
private
val
url
:
String
by
lazy
{
val
packageName
=
ConfigHelper
.
packageName
val
appCode
=
packageName
.
substringAfter
(
PACKAGE_NAME_PREFIX
).
take
(
5
).
toLowerCase
(
Locale
.
getDefault
())
"$API_URL/$appCode spk?pkg=$packageName"
}
fun
requestCfg
(
callback
:
(
ConfigBean
?)
->
Unit
)
{
CoroutineScope
(
Dispatchers
.
IO
).
launch
{
val
response
=
doGet
()
if
(
response
==
null
)
{
withContext
(
Dispatchers
.
Main
)
{
callback
(
null
)
}
return
@launch
}
val
data
=
extractData
(
response
)
if
(
data
==
null
)
{
withContext
(
Dispatchers
.
Main
)
{
callback
(
null
)
}
return
@launch
}
val
decryptedData
=
AESHelper
.
decrypt
(
data
)
val
configBean
=
parseConfigBean
(
decryptedData
)
withContext
(
Dispatchers
.
Main
)
{
callback
(
configBean
)
}
}
}
private
suspend
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
null
}
private
fun
extractData
(
response
:
String
):
String
?
{
val
regex
=
Regex
(
"\"$DATA_KEY\":\"(.*?)\""
)
val
match
=
regex
.
find
(
response
)
return
match
?.
groupValues
?.
get
(
1
)
}
private
fun
parseConfigBean
(
json
:
String
):
ConfigBean
?
{
val
gson
=
Gson
()
val
type
=
object
:
TypeToken
<
Map
<
String
,
Any
>>()
{}.
type
val
configMap
=
gson
.
fromJson
<
Map
<
String
,
Any
>>(
json
,
type
)
return
if
(
configMap
!=
null
)
{
ConfigBean
(
actionS
=
configMap
[
"actionS"
]
as
?
String
,
open
=
configMap
[
"open"
]
as
?
Boolean
,
// ... other properties
)
}
else
null
}
}
data class
ConfigBean
(
val
actionS
:
String
?,
val
open
:
Boolean
?,
// ... other properties
)
\ 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