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
deefe57d
Commit
deefe57d
authored
Apr 23, 2021
by
Fear1ess
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
4/23
parent
20242691
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
98 additions
and
35 deletions
+98
-35
MainActivity.java
app/src/main/java/com/reyun/sdktestdemo/MainActivity.java
+24
-8
collect.c
wandun/src/main/cpp/collect.c
+58
-25
utils.h
wandun/src/main/cpp/include/utils.h
+1
-0
wd_syscall.h
wandun/src/main/cpp/include/wd_syscall.h
+2
-0
utils.c
wandun/src/main/cpp/utils.c
+8
-2
wd_jni.c
wandun/src/main/cpp/wd_jni.c
+5
-0
No files found.
app/src/main/java/com/reyun/sdktestdemo/MainActivity.java
View file @
deefe57d
...
@@ -26,6 +26,7 @@ import android.location.Location;
...
@@ -26,6 +26,7 @@ import android.location.Location;
import
android.location.LocationListener
;
import
android.location.LocationListener
;
import
android.location.LocationManager
;
import
android.location.LocationManager
;
import
android.net.ConnectivityManager
;
import
android.net.ConnectivityManager
;
import
android.net.LinkProperties
;
import
android.net.Network
;
import
android.net.Network
;
import
android.net.NetworkCapabilities
;
import
android.net.NetworkCapabilities
;
import
android.net.NetworkInfo
;
import
android.net.NetworkInfo
;
...
@@ -51,6 +52,7 @@ import com.reyun.wandun.WdMain;
...
@@ -51,6 +52,7 @@ import com.reyun.wandun.WdMain;
import
java.io.ByteArrayInputStream
;
import
java.io.ByteArrayInputStream
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.net.InetAddress
;
import
java.net.NetworkInterface
;
import
java.net.NetworkInterface
;
import
java.net.SocketException
;
import
java.net.SocketException
;
import
java.security.cert.Certificate
;
import
java.security.cert.Certificate
;
...
@@ -107,14 +109,6 @@ public class MainActivity extends AppCompatActivity {
...
@@ -107,14 +109,6 @@ public class MainActivity extends AppCompatActivity {
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
CameraManager
camera
=
(
CameraManager
)
getSystemService
(
Service
.
CAMERA_SERVICE
);
try
{
String
[]
list
=
camera
.
getCameraIdList
();
CameraCharacteristics
cc
=
camera
.
getCameraCharacteristics
(
"0"
);
Log
.
d
(
"haha"
,
"onCreate: "
);
}
catch
(
CameraAccessException
e
)
{
e
.
printStackTrace
();
}
}
}
@Override
@Override
...
@@ -144,5 +138,27 @@ public class MainActivity extends AppCompatActivity {
...
@@ -144,5 +138,27 @@ public class MainActivity extends AppCompatActivity {
});
});
}
}
}
}
public
String
getDns
()
{
String
result
=
""
;
ConnectivityManager
cm
=
(
ConnectivityManager
)
getSystemService
(
Context
.
CONNECTIVITY_SERVICE
);
NetworkInfo
activeNetworkInfo
=
cm
.
getActiveNetworkInfo
();
for
(
Network
network
:
cm
.
getAllNetworks
())
{
NetworkInfo
networkInfo
=
cm
.
getNetworkInfo
(
network
);
if
(
networkInfo
.
getType
()
==
activeNetworkInfo
.
getType
())
{
LinkProperties
lp
=
cm
.
getLinkProperties
(
network
);
for
(
InetAddress
addr
:
lp
.
getDnsServers
())
{
// Get DNS IP address here:
result
+=
addr
.
getHostAddress
()
+
","
;
}
}
}
if
(
result
.
contains
(
","
)){
result
=
result
.
substring
(
0
,
result
.
length
()
-
1
);
}
result
=
"["
+
result
+
"]"
;
return
result
;
}
}
}
wandun/src/main/cpp/collect.c
View file @
deefe57d
This diff is collapsed.
Click to expand it.
wandun/src/main/cpp/include/utils.h
View file @
deefe57d
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
#include <jni.h>
#include <jni.h>
void
addJniStringToJson
(
JNIEnv
*
env
,
cJSON
*
json
,
const
char
*
key
,
jobject
jstr
);
void
addJniStringToJson
(
JNIEnv
*
env
,
cJSON
*
json
,
const
char
*
key
,
jobject
jstr
);
void
addJniStringToArray
(
JNIEnv
*
env
,
cJSON
*
json
,
jobject
jstr
);
void
getJniStringSha256
(
JNIEnv
*
env
,
jobject
jstr
,
char
*
sha256
);
void
getJniStringSha256
(
JNIEnv
*
env
,
jobject
jstr
,
char
*
sha256
);
void
bytes2Hex
(
const
unsigned
char
*
source
,
char
*
dest
,
int
sourceLen
,
int
mac_format
);
void
bytes2Hex
(
const
unsigned
char
*
source
,
char
*
dest
,
int
sourceLen
,
int
mac_format
);
void
hex2Bytes
(
const
char
*
source
,
unsigned
char
*
dest
,
int
sourceLen
);
void
hex2Bytes
(
const
char
*
source
,
unsigned
char
*
dest
,
int
sourceLen
);
...
...
wandun/src/main/cpp/include/wd_syscall.h
View file @
deefe57d
...
@@ -12,11 +12,13 @@
...
@@ -12,11 +12,13 @@
#ifdef __arm__
#ifdef __arm__
#define WDSYSCALL(cmd, args...) wd_syscall_arm(WDNUM(cmd), ##args)
#define WDSYSCALL(cmd, args...) wd_syscall_arm(WDNUM(cmd), ##args)
#define WD_SYS_mmap SYS_mmap2
#define WD_SYS_mmap SYS_mmap2
#define WD_SYS_fstatat SYS_fstatat64
#endif
#endif
#ifdef __aarch64__
#ifdef __aarch64__
#define WDSYSCALL(cmd, args...) wd_syscall_aarch64(WDNUM(cmd), ##args)
#define WDSYSCALL(cmd, args...) wd_syscall_aarch64(WDNUM(cmd), ##args)
#define WD_SYS_mmap SYS_mmap
#define WD_SYS_mmap SYS_mmap
#define WD_SYS_fstatat SYS_newfstatat
#endif
#endif
#ifdef x86
#ifdef x86
...
...
wandun/src/main/cpp/utils.c
View file @
deefe57d
...
@@ -76,13 +76,19 @@ void hex2Bytes(const char* source, unsigned char* dest, int sourceLen)
...
@@ -76,13 +76,19 @@ void hex2Bytes(const char* source, unsigned char* dest, int sourceLen)
return
;
return
;
}
}
void
addJniStringToArray
(
JNIEnv
*
env
,
cJSON
*
json
,
jobject
jstr
)
{
addJniStringToJson
(
env
,
json
,
NULL
,
jstr
);
}
void
addJniStringToJson
(
JNIEnv
*
env
,
cJSON
*
json
,
const
char
*
key
,
jobject
jstr
)
{
void
addJniStringToJson
(
JNIEnv
*
env
,
cJSON
*
json
,
const
char
*
key
,
jobject
jstr
)
{
if
(
jstr
==
NULL
)
{
if
(
jstr
==
NULL
)
{
cJSON_AddStringToObject
(
json
,
key
,
""
);
if
(
key
)
cJSON_AddStringToObject
(
json
,
key
,
""
);
else
cJSON_AddItemToArray
(
json
,
cJSON_CreateString
(
""
));
}
else
{
}
else
{
jboolean
bl
=
0
;
jboolean
bl
=
0
;
const
char
*
value
=
(
*
env
)
->
GetStringUTFChars
(
env
,
jstr
,
&
bl
);
const
char
*
value
=
(
*
env
)
->
GetStringUTFChars
(
env
,
jstr
,
&
bl
);
cJSON_AddStringToObject
(
json
,
key
,
value
);
if
(
key
)
cJSON_AddStringToObject
(
json
,
key
,
value
);
else
cJSON_AddItemToArray
(
json
,
cJSON_CreateString
(
value
));
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
jstr
,
value
);
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
jstr
,
value
);
}
}
}
}
...
...
wandun/src/main/cpp/wd_jni.c
View file @
deefe57d
...
@@ -251,6 +251,10 @@ jvalue wdCallStaticMethod(JNIEnv* env, const char* clsName, const char* methodNa
...
@@ -251,6 +251,10 @@ jvalue wdCallStaticMethod(JNIEnv* env, const char* clsName, const char* methodNa
jvalue
wdCallMethod
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
methodName
,
const
char
*
methodSig
,
va_list
args
)
{
jvalue
wdCallMethod
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
methodName
,
const
char
*
methodSig
,
va_list
args
)
{
jclass
cls
=
(
*
env
)
->
GetObjectClass
(
env
,
obj
);
jclass
cls
=
(
*
env
)
->
GetObjectClass
(
env
,
obj
);
jmethodID
methodId
=
(
*
env
)
->
GetMethodID
(
env
,
cls
,
methodName
,
methodSig
);
jmethodID
methodId
=
(
*
env
)
->
GetMethodID
(
env
,
cls
,
methodName
,
methodSig
);
if
(
methodId
==
NULL
)
{
logd
(
WD_JNI
,
"not find method %s%s"
,
methodName
,
methodSig
);
goto
return_label
;
}
jvalue
value
=
{
0
};
jvalue
value
=
{
0
};
switch
(
wdGetMethodRetType
(
methodSig
))
{
switch
(
wdGetMethodRetType
(
methodSig
))
{
case
'V'
:
case
'V'
:
...
@@ -287,6 +291,7 @@ jvalue wdCallMethod(JNIEnv* env, jobject obj, const char* methodName, const char
...
@@ -287,6 +291,7 @@ jvalue wdCallMethod(JNIEnv* env, jobject obj, const char* methodName, const char
default:
break
;
default:
break
;
}
}
wdCheckException
(
env
);
wdCheckException
(
env
);
return_label:
(
*
env
)
->
DeleteLocalRef
(
env
,
cls
);
(
*
env
)
->
DeleteLocalRef
(
env
,
cls
);
return
value
;
return
value
;
}
}
...
...
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