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
daiwenjie
ReyunSecureSdk
Commits
5fde1e48
Commit
5fde1e48
authored
Apr 08, 2021
by
leiguo1029
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
\
parent
4ce0efb1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
6 deletions
+49
-6
build.gradle
wandun/build.gradle
+1
-4
collect.c
wandun/src/main/cpp/collect.c
+45
-1
collect.h
wandun/src/main/cpp/include/collect.h
+2
-0
WdMain.java
wandun/src/main/java/com/reyun/wandun/WdMain.java
+1
-1
No files found.
wandun/build.gradle
View file @
5fde1e48
...
...
@@ -26,10 +26,7 @@ android {
proguardFiles
getDefaultProguardFile
(
'proguard-android-optimize.txt'
),
'proguard-rules.pro'
}
}
compileOptions
{
sourceCompatibility
JavaVersion
.
VERSION_1_8
targetCompatibility
JavaVersion
.
VERSION_1_8
}
externalNativeBuild
{
cmake
{
path
file
(
'src/main/cpp/CMakeLists.txt'
)
...
...
wandun/src/main/cpp/collect.c
View file @
5fde1e48
...
...
@@ -25,7 +25,6 @@
extern
jobject
g_app_context
;
extern
struct
wd_funcs
g_funcs
;
IMPORTWDSYSCALL
cJSON
*
collect_init
()
{
...
...
@@ -64,6 +63,9 @@ void do_collect(JNIEnv* env) {
if
((
permissions
&
PERMISSION_READ_PHONE_STATE
)
&&
(
permissions
&
PERMISSION_ACCESS_COARSE_LOCATION
))
{
collect_cell_info
(
env
,
json
);
}
collect_system_id
(
env
,
json
);
collect_time_info
(
env
,
json
);
if
(
WDSYSCALL
(
SYS_clock_gettime
,
CLOCK_MONOTONIC
,
&
ts
)
==
0
)
{
end_time
=
(
double
)
ts
.
tv_nsec
/
1000000
+
(
double
)
ts
.
tv_sec
*
1000ULL
;
...
...
@@ -609,3 +611,45 @@ void collect_cell_info(JNIEnv *env, cJSON *json) {
logd
(
WD_COLLECT
,
"%s"
,
"collect cell info finished..."
);
}
void
collect_system_id
(
JNIEnv
*
env
,
cJSON
*
json
)
{
char
buf1
[
40
]
=
{
0
},
buf2
[
40
]
=
{
0
};
int
fd
=
WDSYSCALL
(
SYS_openat
,
AT_FDCWD
,
"/proc/sys/kernel/random/boot_id"
,
O_RDONLY
,
NULL
);
if
(
fd
>
0
)
{
WDSYSCALL
(
SYS_read
,
fd
,
buf1
,
40
);
}
WDSYSCALL
(
SYS_close
,
fd
);
cJSON_AddStringToObject
(
json
,
"sys_boot_id"
,
buf1
);
fd
=
WDSYSCALL
(
SYS_openat
,
AT_FDCWD
,
"/proc/sys/kernel/random/uuid"
,
O_RDONLY
,
NULL
);
if
(
fd
>
0
)
{
WDSYSCALL
(
SYS_read
,
fd
,
buf2
,
40
);
}
WDSYSCALL
(
SYS_close
,
fd
);
cJSON_AddStringToObject
(
json
,
"uuid"
,
buf2
);
logd
(
WD_COLLECT
,
"%s"
,
"collect system id finished..."
);
}
void
collect_time_info
(
JNIEnv
*
env
,
cJSON
*
json
)
{
// current_time
struct
timespec
ts
=
{
0
};
if
(
WDSYSCALL
(
SYS_clock_gettime
,
CLOCK_MONOTONIC
,
&
ts
)
==
0
)
{
cJSON_AddNumberToObject
(
json
,
"cur_time"
,
ts
.
tv_sec
);
}
//boot_time
if
(
g_funcs
.
wd_popen
!=
NULL
)
{
FILE
*
fp
=
g_funcs
.
wd_popen
(
"cat /proc/stat | grep btime"
,
"r"
);
if
(
fp
!=
NULL
)
{
char
buf
[
32
]
=
{
0
};
if
(
fgets
(
buf
,
31
,
fp
))
{
int
btime
;
sscanf
(
buf
,
"%*s %d"
,
&
btime
);
cJSON_AddNumberToObject
(
json
,
"boot_time"
,
btime
);
}
}
g_funcs
.
wd_pclose
(
fp
);
}
}
wandun/src/main/cpp/include/collect.h
View file @
5fde1e48
...
...
@@ -31,6 +31,8 @@ void collect_network_info(JNIEnv* env, cJSON* json);
void
collect_user_agent
(
JNIEnv
*
env
,
cJSON
*
json
);
void
collect_location_info
(
JNIEnv
*
env
,
cJSON
*
json
);
void
collect_cell_info
(
JNIEnv
*
env
,
cJSON
*
json
);
void
collect_system_id
(
JNIEnv
*
env
,
cJSON
*
json
);
void
collect_time_info
(
JNIEnv
*
env
,
cJSON
*
json
);
/** Network type is unknown */
#define NETWORK_TYPE_UNKNOWN 0
...
...
wandun/src/main/java/com/reyun/wandun/WdMain.java
View file @
5fde1e48
...
...
@@ -41,7 +41,7 @@ public class WdMain {
}
//获取wdId
public
void
getWdId
(
WdCallback
cb
)
{
public
void
getWdId
(
final
WdCallback
cb
)
{
ExecutorService
es
=
Executors
.
newSingleThreadExecutor
();
es
.
execute
(
new
Runnable
()
{
@Override
...
...
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