//检测“/dev/socket/qemud”,“/dev/qemu\_pipe”这两个通道
public static boolean checkPipes(){
for(int i = 0; i < known\_pipes.length; i++){
String pipes = known\_pipes\[i\];
File qemu\_socket = new File(pipes);
if(qemu\_socket.exists()){
Log.v("Result:", "Find pipes!");
return true;
}
}
Log.i("Result:", "Not Find pipes!");
return false;
}
// 检测驱动文件内容
// 读取文件内容,然后检查已知QEmu的驱动程序的列表
public static Boolean checkQEmuDriverFile(){
File driver\_file = new File("/proc/tty/drivers");
if(driver\_file.exists() && driver\_file.canRead()){
byte\[\] data = new byte\[1024\]; //(int)driver\_file.length()
try {
InputStream inStream = new FileInputStream(driver\_file);
inStream.read(data);
inStream.close();
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
String driver\_data = new String(data);
for(String known\_qemu\_driver : AntiEmulator.known\_qemu\_drivers){
if(driver\_data.indexOf(known\_qemu\_driver) != -1){
Log.i("Result:", "Find know\_qemu\_drivers!");
return true;
}
}
}
Log.i("Result:", "Not Find known\_qemu\_drivers!");
return false;
}
//检测模拟器上特有的几个文件
public static Boolean CheckEmulatorFiles(){
for(int i = 0; i < known\_files.length; i++){
String file\_name = known\_files\[i\];
File qemu\_file = new File(file\_name);
if(qemu\_file.exists()){
Log.v("Result:", "Find Emulator Files!");
return true;
}
}
Log.v("Result:", "Not Find Emulator Files!");
return false;
}
// 检测模拟器默认的电话号码
public static Boolean CheckPhoneNumber(Context context) {
TelephonyManager telephonyManager = (TelephonyManager) context
.getSystemService(Context.TELEPHONY\_SERVICE);
String phonenumber = telephonyManager.getLine1Number();
for (String number : known\_numbers) {
if (number.equalsIgnoreCase(phonenumber)) {
Log.v("Result:", "Find PhoneNumber!");
return true;
}
}
Log.v("Result:", "Not Find PhoneNumber!");
return false;
}
//检测设备IDS 是不是 “000000000000000”
public static Boolean CheckDeviceIDS(Context context) {
TelephonyManager telephonyManager = (TelephonyManager) context
.getSystemService(Context.TELEPHONY\_SERVICE);
String device\_ids = telephonyManager.getDeviceId();
for (String know\_deviceid : known\_device\_ids) {
if (know\_deviceid.equalsIgnoreCase(device\_ids)) {
Log.v("Result:", "Find ids: 000000000000000!");
return true;
}
}
Log.v("Result:", "Not Find ids: 000000000000000!");
return false;
}
// 检测imsi id是不是“310260000000000”
public static Boolean CheckImsiIDS(Context context){
TelephonyManager telephonyManager = (TelephonyManager)
context.getSystemService(Context.TELEPHONY\_SERVICE);
String imsi\_ids = telephonyManager.getSubscriberId();
for (String know\_imsi : known\_imsi\_ids) {
if (know\_imsi.equalsIgnoreCase(imsi\_ids)) {
Log.v("Result:", "Find imsi ids: 310260000000000!");
return true;
}
}
Log.v("Result:", "Not Find imsi ids: 310260000000000!");
return false;
}
//检测手机上的一些硬件信息
public static Boolean CheckEmulatorBuild(Context context){
String BOARD = android.os.Build.BOARD;
String BOOTLOADER = android.os.Build.BOOTLOADER;
String BRAND = android.os.Build.BRAND;
String DEVICE = android.os.Build.DEVICE;
String HARDWARE = android.os.Build.HARDWARE;
String MODEL = android.os.Build.MODEL;
String PRODUCT = android.os.Build.PRODUCT;
if (BOARD == "unknown" || BOOTLOADER == "unknown"
|| BRAND == "generic" || DEVICE == "generic"
|| MODEL == "sdk" || PRODUCT == "sdk"
|| HARDWARE == "goldfish")
{
Log.v("Result:", "Find Emulator by EmulatorBuild!");
写在最后
在结束之际,我想重申的是,学习并非如攀登险峻高峰,而是如滴水穿石般的持久累积。尤其当我们步入工作岗位之后,持之以恒的学习变得愈发不易,如同在茫茫大海中独自划舟,稍有松懈便可能被巨浪吞噬。然而,对于我们程序员而言,学习是生存之本,是我们在激烈市场竞争中立于不败之地的关键。一旦停止学习,我们便如同逆水行舟,不进则退,终将被时代的洪流所淘汰。因此,不断汲取新知识,不仅是对自己的提升,更是对自己的一份珍贵投资。让我们不断磨砺自己,与时代共同进步,书写属于我们的辉煌篇章。
需要完整版PDF学习资源私我
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!