|
@@ -187,8 +187,8 @@ public class HoneyService extends Service {
|
|
|
public void notifyUI(String sender, String[] values) {
|
|
|
createNotification();
|
|
|
|
|
|
- if (sender.equals(HoneyHandler.class.getName())) {
|
|
|
- updateNotification();
|
|
|
+ if (sender.equals(HoneyHandler.class.getName()) && values[0].equals(R.string.broadcast_started)) {
|
|
|
+ attackNotification();
|
|
|
}
|
|
|
|
|
|
Intent intent = new Intent(getString(R.string.broadcast));
|
|
@@ -533,19 +533,19 @@ public class HoneyService extends Service {
|
|
|
builder = new NotificationCompat.Builder(this).setContentTitle(
|
|
|
getString(R.string.app_name)).setWhen(
|
|
|
System.currentTimeMillis());
|
|
|
- if (activeHandlers) {
|
|
|
+ if(!listening){
|
|
|
+ builder.setSmallIcon(R.drawable.ic_launcher);
|
|
|
+ builder.setContentText("HosTaGe is not active.");
|
|
|
+ } else if (activeHandlers) {
|
|
|
builder.setSmallIcon(R.drawable.ic_service_red);
|
|
|
builder.setContentText("Network is infected!");
|
|
|
} else if (bssidSeen) {
|
|
|
builder.setSmallIcon(R.drawable.ic_service_yellow);
|
|
|
builder.setContentText("Network has been infected in previous session!");
|
|
|
- } else if(listening){
|
|
|
+ } else{
|
|
|
builder.setSmallIcon(R.drawable.ic_service_green);
|
|
|
builder.setContentText("Everything looks fine!");
|
|
|
- } else{
|
|
|
- builder.setSmallIcon(R.drawable.ic_launcher);
|
|
|
- builder.setContentText("HosTaGe is not active.");
|
|
|
- }
|
|
|
+ }
|
|
|
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
|
|
|
stackBuilder.addParentStack(MainActivity.class);
|
|
|
stackBuilder.addNextIntent(new Intent(this, MainActivity.class));
|
|
@@ -560,7 +560,7 @@ public class HoneyService extends Service {
|
|
|
|
|
|
* Updates the notification when a attack is registered.
|
|
|
*/
|
|
|
- private void updateNotification() {
|
|
|
+ private void attackNotification() {
|
|
|
SharedPreferences defaultPref = PreferenceManager
|
|
|
.getDefaultSharedPreferences(this);
|
|
|
String strRingtonePreference = defaultPref.getString(
|
|
@@ -569,7 +569,7 @@ public class HoneyService extends Service {
|
|
|
builder = new NotificationCompat.Builder(this)
|
|
|
.setContentTitle(getString(R.string.app_name))
|
|
|
.setTicker("Honeypot under attack!")
|
|
|
- .setContentText("Network is infected!")
|
|
|
+ .setContentText("Honeypot under attack!")
|
|
|
.setSmallIcon(R.drawable.ic_service_red).setAutoCancel(true)
|
|
|
.setWhen(System.currentTimeMillis())
|
|
|
.setSound(Uri.parse(strRingtonePreference));
|
|
@@ -584,7 +584,7 @@ public class HoneyService extends Service {
|
|
|
}
|
|
|
|
|
|
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
|
|
- mNotificationManager.notify(1, builder.build());
|
|
|
+ mNotificationManager.notify(2, builder.build());
|
|
|
}
|
|
|
|
|
|
|