-
Notifications
You must be signed in to change notification settings - Fork 113
/
Copy pathemulator_detection_bypass.js
190 lines (168 loc) · 6.15 KB
/
emulator_detection_bypass.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
/************************************************************************
* Name: Anti Emulator Detection Bypass (aka BluePill)
* OS: Android
* Authors: @Areizen_
* Source: https://github.com/Areizen/Android-Malware-Sandbox/
* Info: uncomment the code to skip one or more bypasses
*************************************************************************/
Java.perform(function() {
console.log("--> Anti Emulator Detection Bypass (aka BluePill) - Script Loaded")
/***********************************************************
*** IMPORTANT ***
uncomment instructions below to skip one or more bypasses
/***********************************************************/
bypass_build_properties()
bypass_phonenumber()
bypass_deviceid()
bypass_imsi()
bypass_operator_name()
bypass_sim_operator_name()
bypass_has_file()
bypass_processbuilder()
bypass_system_properties()
});
function replaceFinaleField(object, fieldName, value){
var field = object.class.getDeclaredField(fieldName)
field.setAccessible(true)
field.set(null, value)
}
function bypass_build_properties()
{
console.log("Build Properties - Bypass Loaded")
// Class containing const that we want to modify
const Build = Java.use("android.os.Build")
// reflection class for changing const
const Field = Java.use('java.lang.reflect.Field')
const Class = Java.use('java.lang.Class')
// Replacing Build static fields
replaceFinaleField(Build, "FINGERPRINT", "abcd/C1505:4.1.1/11.3.A.2.13:user/release-keys")
replaceFinaleField(Build, "MODEL", "C1505")
replaceFinaleField(Build, "MANUFACTURER", "Sony")
replaceFinaleField(Build, "BRAND", "Xperia")
replaceFinaleField(Build, "BOARD", "7x27")
replaceFinaleField(Build, "ID", "11.3.A.2.13")
replaceFinaleField(Build, "SERIAL", "abcdef123")
replaceFinaleField(Build, "TAGS", "release-keys")
replaceFinaleField(Build, "USER", "administrator")
}
function bypass_phonenumber()
{
console.log("Phone Number - Bypass Loaded")
const TelephonyManager = Java.use('android.telephony.TelephonyManager')
TelephonyManager.getLine1Number.overload().implementation = function(){
console.log("Phone number - bypass done!")
return "060102030405"
}
}
function bypass_deviceid()
{
console.log("Device ID - Bypass Loaded")
const TelephonyManager = Java.use('android.telephony.TelephonyManager')
TelephonyManager.getDeviceId.overload().implementation = function(){
console.log("Device ID - bypass done!")
return "012343545456445"
}
}
function bypass_imsi()
{
console.log("IMSI - Bypass Loaded")
const TelephonyManager = Java.use('android.telephony.TelephonyManager')
TelephonyManager.getSubscriberId.overload().implementation = function(){
console.log("Device ID (getSubscriberId) - bypass done!")
return "310260000000111"
}
}
function bypass_operator_name()
{
console.log("Operator Name - Bypass Loaded")
const TelephonyManager = Java.use('android.telephony.TelephonyManager')
TelephonyManager.getNetworkOperatorName.overload().implementation = function(){
console.log("Operator Name - bypass done!")
return "not"
}
}
function bypass_sim_operator_name()
{
console.log("SIM Operator Name - Bypass Loaded")
const TelephonyManager = Java.use('android.telephony.TelephonyManager')
TelephonyManager.getSimOperatorName.overload().implementation = function(){
console.log("SIM Operator Name - bypass done!")
return "not"
}
}
function bypass_has_file(){
console.log("Emulator related files check - Bypass Loaded")
const File = Java.use("java.io.File")
const KnownFiles= [
"ueventd.android_x86.rc",
"x86.prop",
"ueventd.ttVM_x86.rc",
"init.ttVM_x86.rc",
"fstab.ttVM_x86",
"fstab.vbox86",
"init.vbox86.rc",
"ueventd.vbox86.rc",
"/dev/socket/qemud",
"/dev/qemu_pipe",
"/system/lib/libc_malloc_debug_qemu.so",
"/sys/qemu_trace",
"/system/bin/qemu-props",
"/dev/socket/genyd",
"/dev/socket/baseband_genyd",
"/proc/tty/drivers",
"/proc/cpuinfo"
]
File.exists.implementation = function () {
var x = this.getAbsolutePath();
for(var i=0; i<KnownFiles.length; i++){
if(KnownFiles[i] == x){
console.log("App was looking for "+x+" emulator file - bypass done!")
return false;
}
}
return this.exists();
};
}
function bypass_processbuilder(){
console.log("ProcessBuilder - Bypass Loaded")
var ProcessBuilder = Java.use('java.lang.ProcessBuilder');
ProcessBuilder.$init.overload('[Ljava.lang.String;').implementation = function(x){
console.log("ProcessBuilder - bypass done!")
return null
}
}
function bypass_system_properties() {
/*
* Function used to bypass common checks to
* Android OS properties
* Bypass the props checking from this git : https://github.com/strazzere/anti-emulator
*
*/
console.log("System Properties - Bypass Loaded")
const SystemProperties = Java.use('android.os.SystemProperties')
const String = Java.use('java.lang.String')
const Properties = {
"init.svc.qemud": null,
"init.svc.qemu-props": null,
"qemu.hw.mainkeys": null,
"qemu.sf.fake_camera": null,
"qemu.sf.lcd_density": null,
"ro.bootloader": "xxxxx",
"ro.bootmode": "xxxxxx",
"ro.hardware": "xxxxxx",
"ro.kernel.android.qemud": null,
"ro.kernel.qemu.gles": null,
"ro.kernel.qemu": "xxxxxx",
"ro.product.device": "xxxxx",
"ro.product.model": "xxxxxx",
"ro.product.name": "xxxxxx",
"ro.serialno": null
}
SystemProperties.get.overload('java.lang.String').implementation = function(x){
if (x in Properties){
console.log("App is looking for "+x+". Output replaced with "+Properties[x]+" - bypass done!")
return Properties[x]
}
return this.get(x)
}
}