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
9e932f82
Commit
9e932f82
authored
Apr 08, 2021
by
Fear1ess
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
4/8
parent
5fde1e48
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
60 deletions
+19
-60
MainActivity.java
app/src/main/java/com/reyun/sdktestdemo/MainActivity.java
+7
-37
collect.c
wandun/src/main/cpp/collect.c
+12
-23
No files found.
app/src/main/java/com/reyun/sdktestdemo/MainActivity.java
View file @
9e932f82
...
@@ -14,6 +14,7 @@ import android.content.IntentFilter;
...
@@ -14,6 +14,7 @@ import android.content.IntentFilter;
import
android.content.pm.ApplicationInfo
;
import
android.content.pm.ApplicationInfo
;
import
android.content.pm.PackageInfo
;
import
android.content.pm.PackageInfo
;
import
android.content.pm.PackageManager
;
import
android.content.pm.PackageManager
;
import
android.content.pm.ResolveInfo
;
import
android.content.pm.Signature
;
import
android.content.pm.Signature
;
import
android.hardware.Camera
;
import
android.hardware.Camera
;
import
android.hardware.Sensor
;
import
android.hardware.Sensor
;
...
@@ -73,6 +74,12 @@ public class MainActivity extends AppCompatActivity {
...
@@ -73,6 +74,12 @@ public class MainActivity extends AppCompatActivity {
String
bssid
=
wi
.
getBSSID
();
String
bssid
=
wi
.
getBSSID
();
int
ip
=
wi
.
getIpAddress
();
int
ip
=
wi
.
getIpAddress
();
PackageManager
pm
=
getPackageManager
();
Intent
intent
=
new
Intent
(
"android.intent.action.MAIN"
);
intent
.
addCategory
(
"android.intent.category.HOME"
);
ResolveInfo
ri
=
pm
.
resolveActivity
(
intent
,
0
);
String
ss
=
ri
.
activityInfo
.
packageName
;
// Example of a call to a native method
// Example of a call to a native method
...
@@ -83,43 +90,6 @@ public class MainActivity extends AppCompatActivity {
...
@@ -83,43 +90,6 @@ public class MainActivity extends AppCompatActivity {
@Override
@Override
public
void
onRequestPermissionsResult
(
int
requestCode
,
@NonNull
String
[]
permissions
,
@NonNull
int
[]
grantResults
)
{
public
void
onRequestPermissionsResult
(
int
requestCode
,
@NonNull
String
[]
permissions
,
@NonNull
int
[]
grantResults
)
{
if
(
requestCode
==
100
)
{
if
(
requestCode
==
100
)
{
if
(
ActivityCompat
.
checkSelfPermission
(
this
,
Manifest
.
permission
.
ACCESS_FINE_LOCATION
)
!=
PackageManager
.
PERMISSION_GRANTED
&&
ActivityCompat
.
checkSelfPermission
(
this
,
Manifest
.
permission
.
ACCESS_COARSE_LOCATION
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
// TODO: Consider calling
// ActivityCompat#requestPermissions
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
// to handle the case where the user grants the permission. See the documentation
// for ActivityCompat#requestPermissions for more details.
return
;
}
Location
bestLocation
=
null
;
LocationManager
lm
=
(
LocationManager
)
getApplicationContext
().
getSystemService
(
Service
.
LOCATION_SERVICE
);
Log
.
d
(
"testdemo-1"
,
"ha ha ha..."
);
List
<
String
>
list
=
lm
.
getAllProviders
();
for
(
String
provider
:
list
)
{
Location
l
=
lm
.
getLastKnownLocation
(
provider
);
if
(
l
==
null
)
{
continue
;
}
if
(
bestLocation
==
null
||
l
.
getAccuracy
()
<
bestLocation
.
getAccuracy
())
{
// Found best last known location: %s", l);
Log
.
d
(
"testdemo-1"
,
"provider: "
+
provider
);
bestLocation
=
l
;
}
}
if
(
bestLocation
!=
null
)
{
double
lat
=
bestLocation
.
getLatitude
();
double
lon
=
bestLocation
.
getLongitude
();
Log
.
d
(
"testdemo-1"
,
lat
+
", "
+
lon
);
}
TelephonyManager
tm
=
(
TelephonyManager
)
getApplicationContext
().
getSystemService
(
Service
.
TELEPHONY_SERVICE
);
List
<
CellInfo
>
cellInfos
=
tm
.
getAllCellInfo
();
CellLocation
cl
=
tm
.
getCellLocation
();
//初始化sdk环境
//初始化sdk环境
WdMain
wm
=
WdMain
.
getInstance
();
WdMain
wm
=
WdMain
.
getInstance
();
wm
.
init
(
getApplicationContext
(),
"test-a341fsfr3123ddadfs"
);
wm
.
init
(
getApplicationContext
(),
"test-a341fsfr3123ddadfs"
);
...
...
wandun/src/main/cpp/collect.c
View file @
9e932f82
...
@@ -613,19 +613,19 @@ void collect_cell_info(JNIEnv *env, cJSON *json) {
...
@@ -613,19 +613,19 @@ void collect_cell_info(JNIEnv *env, cJSON *json) {
void
collect_system_id
(
JNIEnv
*
env
,
cJSON
*
json
)
{
void
collect_system_id
(
JNIEnv
*
env
,
cJSON
*
json
)
{
char
buf1
[
40
]
=
{
0
},
buf2
[
40
]
=
{
0
};
char
buf1
[
40
]
=
{
0
},
buf2
[
40
]
=
{
0
};
int
fd
=
WDSYSCALL
(
SYS_openat
,
AT_FDCWD
,
"/proc/sys/kernel/random/boot_id"
,
O_RDONLY
,
NULL
);
FILE
*
fp
=
fopen
(
"/proc/sys/kernel/random/boot_id"
,
"r"
);
if
(
f
d
>
0
)
{
if
(
f
p
)
{
WDSYSCALL
(
SYS_read
,
fd
,
buf1
,
40
);
fscanf
(
fp
,
"%s"
,
buf1
);
}
}
WDSYSCALL
(
SYS_close
,
fd
);
fclose
(
fp
);
cJSON_AddStringToObject
(
json
,
"sys_boot_id"
,
buf1
);
cJSON_AddStringToObject
(
json
,
"sys_boot_id"
,
buf1
);
f
d
=
WDSYSCALL
(
SYS_openat
,
AT_FDCWD
,
"/proc/sys/kernel/random/uuid"
,
O_RDONLY
,
NULL
);
f
p
=
fopen
(
"/proc/sys/kernel/random/uuid"
,
"r"
);
if
(
f
d
>
0
)
{
if
(
f
p
)
{
WDSYSCALL
(
SYS_read
,
fd
,
buf2
,
40
);
fscanf
(
fp
,
"%s"
,
buf2
);
}
}
WDSYSCALL
(
SYS_close
,
fd
);
fclose
(
fp
);
cJSON_AddStringToObject
(
json
,
"uuid"
,
buf2
);
cJSON_AddStringToObject
(
json
,
"
sys_
uuid"
,
buf2
);
logd
(
WD_COLLECT
,
"%s"
,
"collect system id finished..."
);
logd
(
WD_COLLECT
,
"%s"
,
"collect system id finished..."
);
}
}
...
@@ -633,23 +633,12 @@ void collect_system_id(JNIEnv *env, cJSON *json) {
...
@@ -633,23 +633,12 @@ void collect_system_id(JNIEnv *env, cJSON *json) {
void
collect_time_info
(
JNIEnv
*
env
,
cJSON
*
json
)
{
void
collect_time_info
(
JNIEnv
*
env
,
cJSON
*
json
)
{
// current_time
// current_time
struct
timespec
ts
=
{
0
};
struct
timespec
ts
=
{
0
};
if
(
WDSYSCALL
(
SYS_clock_gettime
,
CLOCK_
MONOTONIC
,
&
ts
)
==
0
)
{
if
(
WDSYSCALL
(
SYS_clock_gettime
,
CLOCK_
REALTIME
,
&
ts
)
==
0
)
{
cJSON_AddNumberToObject
(
json
,
"cur_time"
,
ts
.
tv_sec
);
cJSON_AddNumberToObject
(
json
,
"cur_time"
,
ts
.
tv_sec
);
}
}
//boot_time
if
(
WDSYSCALL
(
SYS_clock_gettime
,
CLOCK_BOOTTIME
,
&
ts
)
==
0
)
{
if
(
g_funcs
.
wd_popen
!=
NULL
)
{
cJSON_AddNumberToObject
(
json
,
"start_boot_time"
,
ts
.
tv_sec
);
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
);
}
}
}
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