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
39118ec8
Commit
39118ec8
authored
Apr 16, 2021
by
Fear1ess
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
4/8
parent
89da278b
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
147 additions
and
20 deletions
+147
-20
MainActivity.java
app/src/main/java/com/reyun/sdktestdemo/MainActivity.java
+2
-3
CMakeLists.txt
wandun/src/main/cpp/CMakeLists.txt
+6
-2
collect.c
wandun/src/main/cpp/collect.c
+68
-2
wd_syscall.h
wandun/src/main/cpp/include/wd_syscall.h
+16
-4
utils.c
wandun/src/main/cpp/utils.c
+3
-3
wd_syscall_aarch64.s
wandun/src/main/cpp/wd_syscall_aarch64.s
+3
-3
wd_syscall_arm.s
wandun/src/main/cpp/wd_syscall_arm.s
+3
-3
wd_syscall_x86.s
wandun/src/main/cpp/wd_syscall_x86.s
+46
-0
No files found.
app/src/main/java/com/reyun/sdktestdemo/MainActivity.java
View file @
39118ec8
...
@@ -57,6 +57,7 @@ import java.security.cert.CertificateException;
...
@@ -57,6 +57,7 @@ import java.security.cert.CertificateException;
import
java.security.cert.CertificateFactory
;
import
java.security.cert.CertificateFactory
;
import
java.util.Enumeration
;
import
java.util.Enumeration
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Properties
;
public
class
MainActivity
extends
AppCompatActivity
{
public
class
MainActivity
extends
AppCompatActivity
{
private
TextView
mText
;
private
TextView
mText
;
...
@@ -110,13 +111,12 @@ public class MainActivity extends AppCompatActivity {
...
@@ -110,13 +111,12 @@ public class MainActivity extends AppCompatActivity {
}
catch
(
CameraAccessException
e
)
{
}
catch
(
CameraAccessException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
}
}
@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
)
{
String
aa
=
System
.
getProperty
(
"http.agent"
);
//初始化sdk环境
//初始化sdk环境
WdMain
wm
=
WdMain
.
getInstance
();
WdMain
wm
=
WdMain
.
getInstance
();
wm
.
init
(
getApplicationContext
(),
"test-a341fsfr3123ddadfs"
);
wm
.
init
(
getApplicationContext
(),
"test-a341fsfr3123ddadfs"
);
...
@@ -138,7 +138,6 @@ public class MainActivity extends AppCompatActivity {
...
@@ -138,7 +138,6 @@ public class MainActivity extends AppCompatActivity {
Log.d(TAG, "onError: " + errorMsg);
Log.d(TAG, "onError: " + errorMsg);
}*/
}*/
});
});
}
}
}
}
}
}
...
...
wandun/src/main/cpp/CMakeLists.txt
View file @
39118ec8
...
@@ -6,11 +6,15 @@ include_directories(${CMAKE_SOURCE_DIR}/include)
...
@@ -6,11 +6,15 @@ include_directories(${CMAKE_SOURCE_DIR}/include)
if
(
${
CMAKE_ANDROID_ARCH_ABI
}
STREQUAL
"arm64-v8a"
)
if
(
${
CMAKE_ANDROID_ARCH_ABI
}
STREQUAL
"arm64-v8a"
)
set
(
ARCH_DEPENDED_SRC
set
(
ARCH_DEPENDED_SRC
wd_syscall64.s
)
wd_syscall
_aarch
64.s
)
elseif
(
${
CMAKE_ANDROID_ARCH_ABI
}
STREQUAL
"armeabi-v7a"
)
elseif
(
${
CMAKE_ANDROID_ARCH_ABI
}
STREQUAL
"armeabi-v7a"
)
set
(
ARCH_DEPENDED_SRC
set
(
ARCH_DEPENDED_SRC
wd_syscall32.s
)
wd_syscall_arm.s
)
elseif
(
${
CMAKE_ANDROID_ARCH_ABI
}
STREQUAL
"x86"
)
set
(
ARCH_DEPENDED_SRC
wd_syscall_x86.s
)
endif
()
endif
()
add_library
(
add_library
(
...
...
wandun/src/main/cpp/collect.c
View file @
39118ec8
...
@@ -386,11 +386,10 @@ void collect_env(JNIEnv *env, cJSON *json) {
...
@@ -386,11 +386,10 @@ void collect_env(JNIEnv *env, cJSON *json) {
void
collect_libs_info
(
JNIEnv
*
env
,
cJSON
*
json
)
{
void
collect_libs_info
(
JNIEnv
*
env
,
cJSON
*
json
)
{
cJSON
*
item
=
cJSON_CreateObject
();
cJSON
*
item
=
cJSON_CreateObject
();
const
char
*
lib_names
[]
=
{
"libwdun.so"
,
"libc.so"
};
const
char
*
lib_names
[]
=
{
"libwdun.so"
,
"libc.so"
};
int
pid
=
WDSYSCALL
(
SYS_getpid
);
for
(
int
j
=
0
;
j
<
sizeof
(
lib_names
)
/
sizeof
(
const
char
*
);
++
j
)
{
for
(
int
j
=
0
;
j
<
sizeof
(
lib_names
)
/
sizeof
(
const
char
*
);
++
j
)
{
char
cmd
[
64
]
=
{
0
};
char
cmd
[
64
]
=
{
0
};
char
line
[
1024
]
=
{
0
};
char
line
[
1024
]
=
{
0
};
snprintf
(
cmd
,
63
,
"cat /proc/
%d/maps | grep %s"
,
pid
,
lib_names
[
j
]);
snprintf
(
cmd
,
63
,
"cat /proc/
self/maps | grep %s"
,
lib_names
[
j
]);
FILE
*
fp
=
g_funcs
.
wd_popen
(
cmd
,
"r"
);
FILE
*
fp
=
g_funcs
.
wd_popen
(
cmd
,
"r"
);
if
(
fgets
(
line
,
1024
,
fp
))
{
if
(
fgets
(
line
,
1024
,
fp
))
{
int
pos
=
0
;
int
pos
=
0
;
...
@@ -589,6 +588,15 @@ void collect_user_agent(JNIEnv *env, cJSON *json) {
...
@@ -589,6 +588,15 @@ void collect_user_agent(JNIEnv *env, cJSON *json) {
addJniStringToJson
(
env
,
json
,
"user-agent"
,
ua_jstr
);
addJniStringToJson
(
env
,
json
,
"user-agent"
,
ua_jstr
);
(
*
env
)
->
DeleteLocalRef
(
env
,
ua_jstr
);
(
*
env
)
->
DeleteLocalRef
(
env
,
ua_jstr
);
jstring
key_jstr
=
(
*
env
)
->
NewStringUTF
(
env
,
"http.agent"
);
jobject
ua2_jstr
=
wdCallStaticObjectMethod
(
env
,
"java/lang/System"
,
"getProperty"
,
"(Ljava/lang/String;)Ljava/lang/String;"
,
key_jstr
);
addJniStringToJson
(
env
,
json
,
"user-agent2"
,
ua2_jstr
);
(
*
env
)
->
DeleteLocalRef
(
env
,
key_jstr
);
(
*
env
)
->
DeleteLocalRef
(
env
,
ua2_jstr
);
logd
(
WD_COLLECT
,
"%s"
,
"collect user agent finished..."
);
logd
(
WD_COLLECT
,
"%s"
,
"collect user agent finished..."
);
}
}
...
@@ -701,5 +709,63 @@ void collect_risk_info(JNIEnv *env, cJSON *json) {
...
@@ -701,5 +709,63 @@ void collect_risk_info(JNIEnv *env, cJSON *json) {
vpn
=
""
;
vpn
=
""
;
}
}
cJSON_AddStringToObject
(
json
,
"vpn"
,
vpn
);
cJSON_AddStringToObject
(
json
,
"vpn"
,
vpn
);
//emulator
const
char
*
emulator_files
[]
=
{
"/dev/socket/qemud"
,
"/dev/qemu_pipe"
,
"/goldfish"
,
"/system/lib/libc_malloc_debug_qemu.so"
,
"/sys/qemu_trace"
,
"/system/bin/microvirt-prop"
,
"/system/lib/libdroid4x.so"
,
"/system/bin/windroyed"
,
"/system/bin/microvirtd"
,
"/system/bin/nox-prop"
,
"/system/bin/ttVM-prop"
,
"/system/bin/droid4x-prop"
,
"/data/.bluestacks.prop"
,
"/data/app/com.bluestacks.appmart-1.apk"
,
"/data/app/com.bluestacks.home-1.apk"
,
"/data/app/com.bluestacks.searchapp-1.apk"
,
"/data/data/com.bluestacks.setup"
,
"/dev/vboxuser"
,
"/fstab.vbox86"
,
"/init.vbox86.rc"
,
"/init.svc.vbox86-setup"
,
"/sys/bus/pci/drivers/vboxguest/module"
,
"/sys/bus/pci/drivers/vboxguest/new_id"
,
"/sys/bus/pci/drivers/vboxguest/remove_id"
,
"/sys/bus/pci/drivers/vboxguest/uevent"
,
"/sys/bus/platform/drivers/qemu_pipe"
,
"/sys/bus/platform/drivers/qemu_trace"
,
"/init.svc.droid4x"
,
"/init.svc.noxd"
,
"/init.svc.microvirtd"
,
"/ro.kernel.android.qemud"
,
"/androVM.vbox_dpi"
,
"/androVM.vbox_graph_mode"
,
"/system/bin/qemu_props"
,
"/system/bin/androVM-prop"
,
"/system/lib/libaligl2.so"
,
"/system/lib/libalitag.so"
,
"/system/lib/libcloudletevent.so"
,
"/system/lib/libcloudletos.so"
,
"/system/lib/nemuguest.ko"
,
"/system/lib/nemusf.ko"
,
"/system/lib/nemuvideo.ko"
,
"/system/lib/vpipe.ko"
,
"/system/lib/vpipe_novt.ko"
,
"/system/lib/vboxguest.ko"
,
"/system/lib/vboxsf.ko"
,
};
cJSON
*
emulator
=
cJSON_CreateArray
();
for
(
int
i
=
0
;
i
<
sizeof
(
emulator_files
)
/
sizeof
(
const
char
*
);
++
i
)
{
if
(
is_file_exists
(
emulator_files
[
i
]))
{
cJSON_AddItemToArray
(
emulator
,
cJSON_CreateString
(
emulator_files
[
i
]));
}
}
cJSON_AddItemToObject
(
json
,
"emulator"
,
emulator
);
}
}
wandun/src/main/cpp/include/wd_syscall.h
View file @
39118ec8
...
@@ -10,18 +10,30 @@
...
@@ -10,18 +10,30 @@
#ifdef __arm__
#ifdef __arm__
#define WDSYSCALL(cmd, args...) wd_syscall
32
(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
#endif
#endif
#ifdef __aarch64__
#ifdef __aarch64__
#define WDSYSCALL(cmd, args...) wd_syscall64(WDNUM(cmd), ##args)
#define WDSYSCALL(cmd, args...) wd_syscall_aarch64(WDNUM(cmd), ##args)
#define WD_SYS_mmap SYS_mmap
#endif
#ifdef x86
#define WDSYSCALL(cmd, args...) wd_syscall_x86(WDNUM(cmd), ##args)
#define WD_SYS_mmap SYS_mmap
#endif
#ifdef x86_64
#define WDSYSCALL(cmd, args...) wd_syscall_x64(WDNUM(cmd), ##args)
#define WD_SYS_mmap SYS_mmap
#define WD_SYS_mmap SYS_mmap
#endif
#endif
#define IMPORTWDSYSCALL \
#define IMPORTWDSYSCALL \
__attribute__((visibility("hidden"))) extern long wd_syscall32(int cmd, ...);\
__attribute__((visibility("hidden"))) extern long wd_syscall_arm(int cmd, ...);\
__attribute__((visibility("hidden"))) extern long wd_syscall64(int cmd, ...);
__attribute__((visibility("hidden"))) extern long wd_syscall_aarch64(int cmd, ...);\
__attribute__((visibility("hidden"))) extern long wd_syscall_x86(int cmd, ...);\
__attribute__((visibility("hidden"))) extern long wd_syscall_x64(int cmd, ...);
long
wd_set_errno
(
int
n
);
long
wd_set_errno
(
int
n
);
...
...
wandun/src/main/cpp/utils.c
View file @
39118ec8
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
#include "syscall.h"
#include "syscall.h"
#include "fcntl.h"
#include "fcntl.h"
#include "errno.h"
#include "errno.h"
#include "unistd.h"
IMPORTWDSYSCALL
IMPORTWDSYSCALL
...
@@ -150,9 +151,8 @@ int read_file(const char *file_path, const char *mode, char *r_buf, size_t r_len
...
@@ -150,9 +151,8 @@ int read_file(const char *file_path, const char *mode, char *r_buf, size_t r_len
}
}
int
is_file_exists
(
const
char
*
file_path
)
{
int
is_file_exists
(
const
char
*
file_path
)
{
int
fd
=
WDSYSCALL
(
SYS_faccessat
,
AT_FDCWD
,
file_path
,
R
_OK
,
0
);
int
res
=
WDSYSCALL
(
SYS_faccessat
,
AT_FDCWD
,
file_path
,
F
_OK
,
0
);
int
err
=
errno
;
int
err
=
errno
;
if
(
fd
==
-
1
)
return
0
;
if
(
res
==
-
1
)
return
0
;
WDSYSCALL
(
SYS_close
,
fd
);
return
1
;
return
1
;
}
}
wandun/src/main/cpp/wd_syscall64.s
→
wandun/src/main/cpp/wd_syscall
_aarch
64.s
View file @
39118ec8
...
@@ -2,12 +2,12 @@
...
@@ -2,12 +2,12 @@
// Created by Fear1ess on 2021/3/31.
// Created by Fear1ess on 2021/3/31.
//
//
.global wd_syscall64
.global wd_syscall
_aarch
64
.extern wd_set_errno
.extern wd_set_errno
.type wd_syscall64, %function
.type wd_syscall
_aarch
64, %function
wd_syscall64:
wd_syscall
_aarch
64:
/* Move syscall No. from x0 to x8 */
/* Move syscall No. from x0 to x8 */
sub x0, x0, #0xcd
sub x0, x0, #0xcd
mov x8, x0
mov x8, x0
...
...
wandun/src/main/cpp/wd_syscall
32
.s
→
wandun/src/main/cpp/wd_syscall
_arm
.s
View file @
39118ec8
...
@@ -2,12 +2,12 @@
...
@@ -2,12 +2,12 @@
// Created by Fear1ess on 2021/3/31.
// Created by Fear1ess on 2021/3/31.
//
//
.global wd_syscall
32
.global wd_syscall
_arm
.extern wd_set_errno
.extern wd_set_errno
.type wd_syscall
32
, %function
.type wd_syscall
_arm
, %function
wd_syscall
32
:
wd_syscall
_arm
:
mov ip, sp
mov ip, sp
stmfd sp!, {r4, r5, r6, r7}
stmfd sp!, {r4, r5, r6, r7}
sub r0, r0, #0xcd
sub r0, r0, #0xcd
...
...
wandun/src/main/cpp/wd_syscall_x86.s
0 → 100644
View file @
39118ec8
.global wd_syscall_x86
.extern wd_set_errno
.type wd_syscall_x86, %function
wd_syscall_x86:
# Push the callee save registers.
push %ebx
push %esi
push %edi
push %ebp
# Get and save the system call entry address.
int $80
push %eax
# Load all the arguments from the calling frame.
# (Not all will be valid, depending on the syscall.)
mov 24(%esp),%eax
mov 28(%esp),%ebx
mov 32(%esp),%ecx
mov 36(%esp),%edx
mov 40(%esp),%esi
mov 44(%esp),%edi
mov 48(%esp),%ebp
# Make the system call.
call *(%esp)
addl $4, %esp
# Error?
cmpl $-4096, %eax
jb 1f
# Yes, so set errno.
negl %eax
pushl %eax
call wd_set_errno
addl $4, %esp
1:
# Restore the callee save registers.
pop %ebp
pop %edi
pop %esi
pop %ebx
ret
\ 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