Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
ReyunSecureSdk
Project
Overview
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
zhanglei
ReyunSecureSdk
Commits
4ce0efb1
Commit
4ce0efb1
authored
Apr 07, 2021
by
Fear1ess
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
4/6
parent
d4c7b1b9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
4 deletions
+30
-4
build.gradle
app/build.gradle
+0
-1
MainActivity.java
app/src/main/java/com/reyun/sdktestdemo/MainActivity.java
+2
-0
build.gradle
wandun/build.gradle
+0
-1
collect.c
wandun/src/main/cpp/collect.c
+28
-2
No files found.
app/build.gradle
View file @
4ce0efb1
...
...
@@ -37,7 +37,6 @@ android {
path
file
(
'src/main/cpp/CMakeLists.txt'
)
}
}
ndkVersion
'22.0.7026061'
}
dependencies
{
...
...
app/src/main/java/com/reyun/sdktestdemo/MainActivity.java
View file @
4ce0efb1
...
...
@@ -32,6 +32,7 @@ import android.os.Bundle;
import
android.provider.Settings
;
import
android.provider.Telephony
;
import
android.telephony.CellInfo
;
import
android.telephony.CellLocation
;
import
android.telephony.NeighboringCellInfo
;
import
android.telephony.TelephonyManager
;
import
android.util.DisplayMetrics
;
...
...
@@ -115,6 +116,7 @@ public class MainActivity extends AppCompatActivity {
TelephonyManager
tm
=
(
TelephonyManager
)
getApplicationContext
().
getSystemService
(
Service
.
TELEPHONY_SERVICE
);
List
<
CellInfo
>
cellInfos
=
tm
.
getAllCellInfo
();
CellLocation
cl
=
tm
.
getCellLocation
();
...
...
wandun/build.gradle
View file @
4ce0efb1
...
...
@@ -35,7 +35,6 @@ android {
path
file
(
'src/main/cpp/CMakeLists.txt'
)
}
}
ndkVersion
'22.0.7026061'
}
dependencies
{
...
...
wandun/src/main/cpp/collect.c
View file @
4ce0efb1
...
...
@@ -18,6 +18,7 @@
#include "openssl/md5.h"
#include <arpa/inet.h>
#include <sys/syscall.h>
#include <linux/prctl.h>
#define WD_COLLECT "wd_collect"
...
...
@@ -60,7 +61,9 @@ void do_collect(JNIEnv* env) {
if
((
permissions
&
PERMISSION_ACCESS_FINE_LOCATION
)
&&
(
permissions
&
PERMISSION_ACCESS_COARSE_LOCATION
))
{
collect_location_info
(
env
,
json
);
}
if
((
permissions
&
PERMISSION_READ_PHONE_STATE
)
&&
(
permissions
&
PERMISSION_ACCESS_COARSE_LOCATION
))
{
collect_cell_info
(
env
,
json
);
}
if
(
WDSYSCALL
(
SYS_clock_gettime
,
CLOCK_MONOTONIC
,
&
ts
)
==
0
)
{
end_time
=
(
double
)
ts
.
tv_nsec
/
1000000
+
(
double
)
ts
.
tv_sec
*
1000ULL
;
...
...
@@ -146,7 +149,7 @@ int collect_permissions(JNIEnv* env, cJSON* json) {
for
(
int
i
=
0
;
i
<
sizeof
(
permissions
)
/
sizeof
(
const
char
*
);
++
i
)
{
jstring
str
=
(
*
env
)
->
NewStringUTF
(
env
,
permissions
[
i
]);
if
(
wdCallIntMethod
(
env
,
g_app_context
,
"checkSelfPermission"
,
"(Ljava/lang/String;)I"
,
str
)
==
0
)
{
value
|=
(
2
<<
i
);
value
|=
(
1
<<
i
);
}
(
*
env
)
->
DeleteLocalRef
(
env
,
str
);
}
...
...
@@ -581,5 +584,28 @@ void collect_location_info(JNIEnv *env, cJSON *json) {
void
collect_cell_info
(
JNIEnv
*
env
,
cJSON
*
json
)
{
//cell info need ACCESSS_COARSE_LOCATION permission
cJSON
*
item
=
cJSON_CreateObject
();
jstring
phone_jstr
=
(
*
env
)
->
NewStringUTF
(
env
,
"phone"
);
jobject
tm
=
wdCallObjectMethod
(
env
,
g_app_context
,
"getSystemService"
,
"(Ljava/lang/String;)Ljava/lang/Object;"
,
phone_jstr
);
jobject
cl
=
wdCallObjectMethod
(
env
,
tm
,
"getCellLocation"
,
"()Landroid/telephony/CellLocation;"
);
if
(
cl
==
NULL
)
goto
return_label
;
jclass
gsm_cls
=
(
*
env
)
->
FindClass
(
env
,
"android/telephony/gsm/GsmCellLocation"
);
if
((
*
env
)
->
IsInstanceOf
(
env
,
cl
,
gsm_cls
)
==
JNI_TRUE
)
{
jint
cid
=
wdCallIntMethod
(
env
,
cl
,
"getCid"
,
"()I"
);
jint
lac
=
wdCallIntMethod
(
env
,
cl
,
"getLac"
,
"()I"
);
jint
psc
=
wdCallIntMethod
(
env
,
cl
,
"getPsc"
,
"()I"
);
cJSON_AddNumberToObject
(
item
,
"cid"
,
cid
);
cJSON_AddNumberToObject
(
item
,
"lac"
,
lac
);
cJSON_AddNumberToObject
(
item
,
"psc"
,
psc
);
}
(
*
env
)
->
DeleteLocalRef
(
env
,
gsm_cls
);
return_label:
(
*
env
)
->
DeleteLocalRef
(
env
,
cl
);
(
*
env
)
->
DeleteLocalRef
(
env
,
tm
);
(
*
env
)
->
DeleteLocalRef
(
env
,
phone_jstr
);
cJSON_AddItemToObject
(
json
,
"cell"
,
item
);
logd
(
WD_COLLECT
,
"%s"
,
"collect cell info finished..."
);
}
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