Skip to content

Commit c28b927

Browse files
committed
Merge branch 'develop' of git://github.com/fat-tire/android-1 into msf_notification
2 parents 35b585b + 8a0afc5 commit c28b927

5 files changed

Lines changed: 75 additions & 5 deletions

File tree

cSploit/res/values/colors.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,9 @@
1010
<color name="holo_blue_dark">#ff0d222f</color>
1111
<color name="selectable_blue">#ff36ccff</color>
1212
<color name="selectable_blue_dark">#ff144d5d</color>
13+
<color name="pink">#E91E63</color>
14+
<color name="red">#F44336</color>
15+
<color name="green">#4CAF50</color>
16+
<color name="purple">#3F51B5</color>
17+
<color name="orange">#FFC107</color>
1318
</resources>

cSploit/res/values/strings.xml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,15 +237,11 @@
237237
<string name="error_rpc">RPC error</string>
238238
<string name="error_rpcd_inval">bad settings</string>
239239
<string name="error_rpcd_shell">cannot execute shell</string>
240-
<string name="rpcd_starting">Starting MetaSploit RPCD&#8230;</string>
240+
<string name="rpcd_starting">Starting MetaSploit RPCD. Standby&#8230;</string>
241241
<string name="rpcd_started">MetaSploit RPCD started</string>
242242
<string name="rpcd_stopped">MetaSploit RPCD stopped</string>
243243
<string name="rpcd_running">MetaSploit RPCD is already running</string>
244244
<string name="rpcd_timedout">MetaSploit RPCD does not respond</string>
245-
<string name="error_rcpd_fatal">fatal error occurred, i\'m searching that bug for send it to my developers.
246-
if i won\'t exit please close me from preferences->applications,
247-
and ALERT MY DEVELOPERS.
248-
</string>
249245

250246
<!-- mitm modules -->
251247
<string name="mitm_simple_sniff">Simple Sniff</string>
@@ -400,6 +396,8 @@
400396
<string name="pref_folder">Folder</string>
401397
<string name="pref_msf_enable">Enable MSF</string>
402398
<string name="pref_msf_enable_desc">Enable the MetaSploit Framework</string>
399+
<string name="pref_msf_notifications">MSF status notifications</string>
400+
<string name="pref_msf_notifications_desc">View MSF RPC connection status</string>
403401
<string name="pref_msf_delete">Delete MSF</string>
404402
<string name="pref_msf_delete_desc">Delete the MetaSploit Framework from your device</string>
405403
<string name="pref_msfwipe_message">Do you really want to delete the MetaSploit Framework?</string>

cSploit/res/xml-v14/preferences.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,12 @@
163163
android:title="@string/pref_msf_enable"
164164
android:summary="@string/pref_msf_enable_desc" />
165165

166+
<SwitchPreference
167+
android:defaultValue="true"
168+
android:key="MSF_NOTIFICATIONS"
169+
android:title="@string/pref_msf_notifications"
170+
android:summary="@string/pref_msf_notifications_desc" />
171+
166172
<ListPreference
167173
android:key="MSF_BRANCH"
168174
android:summary="@string/pref_msf_branch_desc"

cSploit/res/xml/preferences.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,12 @@
163163
android:title="@string/pref_msf_enable"
164164
android:summary="@string/pref_msf_enable_desc" />
165165

166+
<CheckBoxPreference
167+
android:defaultValue="true"
168+
android:key="MSF_NOTIFICATIONS"
169+
android:title="@string/pref_msf_notifications"
170+
android:summary="@string/pref_msf_notifications_desc" />
171+
166172
<ListPreference
167173
android:key="MSF_BRANCH"
168174
android:summary="@string/pref_msf_branch_desc"

cSploit/src/org/csploit/android/services/receivers/MsfRpcdServiceReceiver.java

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
11
package org.csploit.android.services.receivers;
22

33
import android.app.Activity;
4+
import android.app.NotificationManager;
45
import android.content.Context;
56
import android.content.Intent;
67
import android.content.IntentFilter;
8+
import android.content.SharedPreferences;
9+
import android.support.v4.app.NotificationCompat;
10+
import android.support.v4.content.ContextCompat;
711
import android.widget.Toast;
812

913
import org.csploit.android.R;
1014
import org.csploit.android.core.ManagedReceiver;
15+
import org.csploit.android.core.System;
1116
import org.csploit.android.services.MsfRpcdService;
1217

1318
/**
1419
* Receive and manage intents from the MsfRpcd service
1520
*/
1621
public class MsfRpcdServiceReceiver extends ManagedReceiver {
1722

23+
final int MSF_NOTIFICATION = 1337;
1824
private final IntentFilter filter;
1925

2026
public MsfRpcdServiceReceiver() {
@@ -47,6 +53,12 @@ public void run() {
4753
} else {
4854
showToastForStatus(context, status);
4955
}
56+
57+
SharedPreferences myPrefs = System.getSettings();
58+
if (myPrefs.getBoolean("MSF_NOTIFICATIONS", true)) {
59+
updateNotificationForStatus(context, status);
60+
}
61+
5062
}
5163

5264
private void showToastForStatus(Context context, MsfRpcdService.Status status) {
@@ -74,4 +86,47 @@ private void showToastForStatus(Context context, MsfRpcdService.Status status) {
7486
break;
7587
}
7688
}
89+
90+
private void updateNotificationForStatus(Context context, MsfRpcdService.Status status) {
91+
NotificationCompat.Builder mBuilder =
92+
new NotificationCompat.Builder(context)
93+
.setSmallIcon(R.drawable.exploit_msf)
94+
.setContentTitle("MetaSploit RPCD Status");
95+
mBuilder.setProgress(0, 0, false);
96+
switch (status) {
97+
case STARTING:
98+
mBuilder.setContentText(context.getResources().getText(R.string.rpcd_starting));
99+
mBuilder.setProgress(0, 0, true);
100+
mBuilder.setColor(ContextCompat.getColor(context, R.color.selectable_blue));
101+
break;
102+
case CONNECTED:
103+
mBuilder.setContentText(context.getResources().getText(R.string.connected_msf));
104+
mBuilder.setColor(ContextCompat.getColor(context, R.color.green));
105+
break;
106+
case DISCONNECTED:
107+
mBuilder.setContentText(context.getResources().getText(R.string.msfrpc_disconnected));
108+
mBuilder.setColor(ContextCompat.getColor(context, R.color.purple));
109+
break;
110+
case STOPPED:
111+
mBuilder.setContentText(context.getResources().getText(R.string.rpcd_stopped));
112+
mBuilder.setColor(ContextCompat.getColor(context, R.color.purple));
113+
break;
114+
case KILLED:
115+
mBuilder.setContentText(context.getResources().getText(R.string.msfrpcd_killed));
116+
mBuilder.setColor(ContextCompat.getColor(context, R.color.purple));
117+
break;
118+
case START_FAILED:
119+
mBuilder.setContentText(context.getResources().getText(R.string.msfrcd_start_failed));
120+
mBuilder.setColor(ContextCompat.getColor(context, R.color.red));
121+
break;
122+
case CONNECTION_FAILED:
123+
mBuilder.setContentText(context.getResources().getText(R.string.msf_connection_failed));
124+
mBuilder.setColor(ContextCompat.getColor(context, R.color.red));
125+
break;
126+
}
127+
128+
NotificationManager mNotificationManager =
129+
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
130+
mNotificationManager.notify(MSF_NOTIFICATION, mBuilder.build());
131+
}
77132
}

0 commit comments

Comments
 (0)