Hostage.java 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649
  1. package de.tudarmstadt.informatik.hostage;
  2. import java.util.ArrayList;
  3. import java.util.HashMap;
  4. import java.util.LinkedList;
  5. import java.util.List;
  6. import org.apache.http.HttpEntity;
  7. import org.apache.http.HttpResponse;
  8. import org.apache.http.client.HttpClient;
  9. import org.apache.http.client.methods.HttpGet;
  10. import org.apache.http.impl.client.DefaultHttpClient;
  11. import org.apache.http.util.EntityUtils;
  12. import org.json.JSONObject;
  13. import android.app.NotificationManager;
  14. import android.app.PendingIntent;
  15. import android.app.Service;
  16. import android.content.BroadcastReceiver;
  17. import android.content.Context;
  18. import android.content.Intent;
  19. import android.content.IntentFilter;
  20. import android.content.SharedPreferences;
  21. import android.content.SharedPreferences.Editor;
  22. import android.net.ConnectivityManager;
  23. import android.net.DhcpInfo;
  24. import android.net.NetworkInfo;
  25. import android.net.Uri;
  26. import android.net.wifi.WifiInfo;
  27. import android.net.wifi.WifiManager;
  28. import android.os.AsyncTask;
  29. import android.os.Binder;
  30. import android.os.IBinder;
  31. import android.preference.PreferenceManager;
  32. import android.support.v4.app.NotificationCompat;
  33. import android.support.v4.app.TaskStackBuilder;
  34. import android.support.v4.content.LocalBroadcastManager;
  35. import android.util.Log;
  36. import android.widget.Toast;
  37. import de.tudarmstadt.informatik.hostage.R;
  38. import de.tudarmstadt.informatik.hostage.location.MyLocationManager;
  39. import de.tudarmstadt.informatik.hostage.persistence.HostageDBOpenHelper;
  40. import de.tudarmstadt.informatik.hostage.protocol.Protocol;
  41. import de.tudarmstadt.informatik.hostage.ui.activity.MainActivity;
  42. import static de.tudarmstadt.informatik.hostage.commons.HelperUtils.*;
  43. /**
  44. * Background service running as long as at least one protocol is active.
  45. * Service controls start and stop of protocol listener. Notifies GUI about
  46. * events happening in the background. Creates Notifications to inform the user
  47. * what it happening.
  48. *
  49. * @author Mihai Plasoianu
  50. * @author Lars Pandikow
  51. * @author Wulf Pfeiffer
  52. */
  53. public class Hostage extends Service {
  54. private HashMap<String, Boolean> mProtocolActiveAttacks;
  55. public class LocalBinder extends Binder {
  56. public Hostage getService() {
  57. return Hostage.this;
  58. }
  59. }
  60. /**
  61. * Task to find out the external IP.
  62. *
  63. */
  64. private class SetExternalIPTask extends AsyncTask<String, Void, String> {
  65. @Override
  66. protected String doInBackground(String... url) {
  67. String ipAddress = null;
  68. try {
  69. HttpClient httpclient = new DefaultHttpClient();
  70. HttpGet httpget = new HttpGet(url[0]);
  71. HttpResponse response;
  72. response = httpclient.execute(httpget);
  73. HttpEntity entity = response.getEntity();
  74. entity.getContentLength();
  75. String str = EntityUtils.toString(entity);
  76. JSONObject json_data = new JSONObject(str);
  77. ipAddress = json_data.getString("ip");
  78. } catch (Exception e) {
  79. e.printStackTrace();
  80. }
  81. return ipAddress;
  82. }
  83. @Override
  84. protected void onPostExecute(String result) {
  85. connectionInfoEditor.putString(getString(R.string.connection_info_external_ip), result);
  86. connectionInfoEditor.commit();
  87. notifyUI(this.getClass().getName(), new String[] { getString(R.string.broadcast_connectivity) });
  88. }
  89. }
  90. private static Context context;
  91. /**
  92. * Returns the application context.
  93. *
  94. * @return context.
  95. */
  96. public static Context getContext() {
  97. return Hostage.context;
  98. }
  99. private LinkedList<Protocol> implementedProtocols;
  100. private ArrayList<Listener> listeners = new ArrayList<Listener>();
  101. private NotificationCompat.Builder builder;
  102. private SharedPreferences connectionInfo;
  103. private Editor connectionInfoEditor;
  104. private final IBinder mBinder = new LocalBinder();
  105. /**
  106. * Receiver for connectivity change broadcast.
  107. *
  108. * @see MainActivity#BROADCAST
  109. */
  110. private BroadcastReceiver netReceiver = new BroadcastReceiver() {
  111. @Override
  112. public void onReceive(Context context, Intent intent) {
  113. String bssid_old = connectionInfo.getString(getString(R.string.connection_info_bssid), "");
  114. String bssid_new = getBSSID(context);
  115. if (bssid_new == null || !bssid_new.equals(bssid_old)) {
  116. deleteConnectionData();
  117. updateConnectionInfo();
  118. getLocationData();
  119. notifyUI(this.getClass().getName(), new String[] { getString(R.string.broadcast_connectivity) });
  120. }
  121. }
  122. };
  123. public List<Listener> getListeners() {
  124. return listeners;
  125. }
  126. /**
  127. * Determines the number of active connections for a protocol running on its
  128. * default port.
  129. *
  130. * @param protocolName
  131. * The protocol name
  132. * @return Number of active connections
  133. */
  134. public int getNumberOfActiveConnections(String protocolName) {
  135. int port = getDefaultPort(protocolName);
  136. return getNumberOfActiveConnections(protocolName, port);
  137. }
  138. /**
  139. * Determines the number of active connections for a protocol running on the
  140. * given port.
  141. *
  142. * @param protocolName
  143. * The protocol name
  144. * @param port
  145. * Specific port
  146. * @return Number of active connections
  147. */
  148. public int getNumberOfActiveConnections(String protocolName, int port) {
  149. for (Listener listener : listeners) {
  150. if (listener.getProtocolName().equals(protocolName) && listener.getPort() == port) {
  151. return listener.getHandlerCount();
  152. }
  153. }
  154. return 0;
  155. }
  156. /**
  157. * Determines if there any listener is currently running.
  158. *
  159. * @return True if there is a running listener, else false.
  160. */
  161. public boolean hasRunningListeners() {
  162. for (Listener listener : listeners) {
  163. if (listener.isRunning())
  164. return true;
  165. }
  166. return false;
  167. }
  168. /**
  169. * Determines if a protocol with the given name is running on its default
  170. * port.
  171. *
  172. * @param protocolName
  173. * The protocol name
  174. * @return True if protocol is running, else false.
  175. */
  176. public boolean isRunning(String protocolName) {
  177. int port = getDefaultPort(protocolName);
  178. return isRunning(protocolName, port);
  179. }
  180. public boolean isRunningAnyPort(String protocolName){
  181. for(Listener listener: listeners){
  182. if(listener.getProtocolName().equals(protocolName)){
  183. if(listener.isRunning()) return true;
  184. }
  185. }
  186. return false;
  187. }
  188. /**
  189. * Determines if a protocol with the given name is running on the given
  190. * port.
  191. *
  192. * @param protocolName
  193. * The protocol name
  194. * @param port
  195. * Specific port
  196. * @return True if protocol is running, else false.
  197. */
  198. public boolean isRunning(String protocolName, int port) {
  199. for (Listener listener : listeners) {
  200. if (listener.getProtocolName().equals(protocolName) && listener.getPort() == port) {
  201. return listener.isRunning();
  202. }
  203. }
  204. return false;
  205. }
  206. /**
  207. * Notifies the GUI about a event.
  208. *
  209. * @param sender
  210. * Source where the event took place.
  211. * @param key
  212. * Detailed information about the event.
  213. */
  214. public void notifyUI(String sender, String[] values) {
  215. createNotification();
  216. // Send Notification
  217. if (sender.equals(Handler.class.getName()) && values[0].equals(getString(R.string.broadcast_started))) {
  218. this.mProtocolActiveAttacks.put(values[1], true);
  219. attackNotification();
  220. }
  221. // Inform UI of Preference Change
  222. Intent intent = new Intent(getString(R.string.broadcast));
  223. intent.putExtra("SENDER", sender);
  224. intent.putExtra("VALUES", values);
  225. Log.i("Sender", sender);
  226. LocalBroadcastManager.getInstance(this).sendBroadcast(intent);
  227. }
  228. @Override
  229. public IBinder onBind(Intent intent) {
  230. return mBinder;
  231. }
  232. @Override
  233. public void onCreate() {
  234. super.onCreate();
  235. Hostage.context = getApplicationContext();
  236. implementedProtocols = getImplementedProtocols();
  237. connectionInfo = getSharedPreferences(getString(R.string.connection_info), Context.MODE_PRIVATE);
  238. connectionInfoEditor = connectionInfo.edit();
  239. mProtocolActiveAttacks = new HashMap<String, Boolean>();
  240. createNotification();
  241. registerNetReceiver();
  242. updateConnectionInfo();
  243. getLocationData();
  244. }
  245. @Override
  246. public void onDestroy() {
  247. cancelNotification();
  248. unregisterNetReceiver();
  249. super.onDestroy();
  250. }
  251. @Override
  252. public int onStartCommand(Intent intent, int flags, int startId) {
  253. // We want this service to continue running until it is explicitly
  254. // stopped, so return sticky.
  255. return START_STICKY;
  256. }
  257. /**
  258. * Starts the listener for the specified protocol. Creates a new
  259. * HoneyService if no matching HoneyListener is found.
  260. *
  261. * @param protocolName
  262. * Name of the protocol that should be started.
  263. */
  264. public boolean startListener(String protocolName) {
  265. return startListener(protocolName, getDefaultPort(protocolName));
  266. }
  267. /**
  268. * Starts the listener for the specified protocol and port. Creates a new
  269. * HoneyService if no matching HoneyListener is found.
  270. *
  271. * @param protocolName
  272. * Name of the protocol that should be started.
  273. * @param port
  274. * The port number in which the listener should run.
  275. */
  276. public boolean startListener(String protocolName, int port) {
  277. for (Listener listener : listeners) {
  278. if (listener.getProtocolName().equals(protocolName) && listener.getPort() == port) {
  279. if (!listener.isRunning()) {
  280. if (listener.start()) {
  281. // Toast.makeText(getApplicationContext(), protocolName
  282. // + " SERVICE STARTED!", Toast.LENGTH_SHORT).show();
  283. return true;
  284. }
  285. Toast.makeText(getApplicationContext(), protocolName + " SERVICE COULD NOT BE STARTED!", Toast.LENGTH_SHORT).show();
  286. return false;
  287. }
  288. }
  289. }
  290. Listener listener = createListener(protocolName, port);
  291. if (listener != null) {
  292. if (listener.start()) {
  293. // Toast.makeText(getApplicationContext(), protocolName +
  294. // " SERVICE STARTED!", Toast.LENGTH_SHORT).show();
  295. return true;
  296. }
  297. }
  298. Toast.makeText(getApplicationContext(), protocolName + " SERVICE COULD NOT BE STARTED!", Toast.LENGTH_SHORT).show();
  299. return false;
  300. }
  301. /**
  302. * Starts all listeners which are not already running.
  303. */
  304. public void startListeners() {
  305. for (Listener listener : listeners) {
  306. if (!listener.isRunning()) {
  307. listener.start();
  308. }
  309. }
  310. // Toast.makeText(getApplicationContext(), "SERVICES STARTED!",
  311. // Toast.LENGTH_SHORT).show();
  312. }
  313. /**
  314. * Stops the listener for the specified protocol.
  315. *
  316. * @param protocolName
  317. * Name of the protocol that should be stopped.
  318. */
  319. public void stopListener(String protocolName) {
  320. stopListener(protocolName, getDefaultPort(protocolName));
  321. }
  322. /**
  323. * Stops the listener for the specified protocol.
  324. *
  325. * @param protocolName
  326. * Name of the protocol that should be stopped.
  327. * @param port
  328. * The port number in which the listener is running.
  329. */
  330. public void stopListener(String protocolName, int port) {
  331. for (Listener listener : listeners) {
  332. if (listener.getProtocolName().equals(protocolName) && listener.getPort() == port) {
  333. if (listener.isRunning()) {
  334. listener.stop();
  335. mProtocolActiveAttacks.remove(protocolName);
  336. }
  337. }
  338. }
  339. // Toast.makeText(getApplicationContext(), protocolName +
  340. // " SERVICE STOPPED!", Toast.LENGTH_SHORT).show();
  341. }
  342. public void stopListenerAllPorts(String protocolName){
  343. for(Listener listener: listeners){
  344. if(listener.getProtocolName().equals(protocolName)){
  345. if(listener.isRunning()){
  346. listener.stop();
  347. mProtocolActiveAttacks.remove(protocolName);
  348. }
  349. }
  350. }
  351. }
  352. /**
  353. * Stops all running listeners.
  354. */
  355. public void stopListeners() {
  356. for (Listener listener : listeners) {
  357. if (listener.isRunning()) {
  358. listener.stop();
  359. mProtocolActiveAttacks.remove(listener.getProtocolName());
  360. }
  361. }
  362. // Toast.makeText(getApplicationContext(), "SERVICES STOPPED!",
  363. // Toast.LENGTH_SHORT).show();
  364. }
  365. /**
  366. * Updates the notification when a attack is registered.
  367. */
  368. private void attackNotification() {
  369. SharedPreferences defaultPref = PreferenceManager.getDefaultSharedPreferences(this);
  370. String strRingtonePreference = defaultPref.getString("pref_notification_sound", "content://settings/system/notification_sound");
  371. builder = new NotificationCompat.Builder(this).setContentTitle(getString(R.string.app_name)).setTicker(getString(R.string.honeypot_live_threat))
  372. .setContentText(getString(R.string.honeypot_live_threat)).setSmallIcon(R.drawable.ic_service_red).setAutoCancel(true).setWhen(System.currentTimeMillis())
  373. .setSound(Uri.parse(strRingtonePreference));
  374. Intent launchIntent = new Intent(getApplicationContext(), MainActivity.class);
  375. TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
  376. stackBuilder.addParentStack(MainActivity.class);
  377. Intent intent = MainActivity.getInstance().getIntent();
  378. intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
  379. intent.setAction("SHOW_HOME");
  380. stackBuilder.addNextIntent(intent);
  381. PendingIntent resultPendingIntent = PendingIntent.getActivity(MainActivity.context, 0, intent, 0);
  382. builder.setContentIntent(resultPendingIntent);
  383. if (defaultPref.getBoolean("pref_vibration", false)) {
  384. builder.setVibrate(new long[] { 100, 200, 100, 200 });
  385. }
  386. NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
  387. mNotificationManager.notify(1, builder.build());
  388. }
  389. /**
  390. * Cancels the Notification
  391. */
  392. private void cancelNotification() {
  393. NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
  394. mNotificationManager.cancel(1);
  395. }
  396. /**
  397. * Creates a HoneyListener for a given protocol on a specific port. After
  398. * creation the HoneyListener is not started. Checks if the protocol is
  399. * implemented first.
  400. *
  401. * @param protocolName
  402. * Name of the protocol
  403. * @param port
  404. * Port on which to start the HoneyListener
  405. * @return Returns the created HoneyListener, if creation failed returns
  406. * null.
  407. */
  408. private Listener createListener(String protocolName, int port) {
  409. for (Protocol protocol : implementedProtocols) {
  410. if (protocolName.equals(protocol.toString())) {
  411. Listener listener = new Listener(this, protocol, port);
  412. listeners.add(listener);
  413. return listener;
  414. }
  415. }
  416. return null;
  417. }
  418. /**
  419. * Creates a Notification in the notification bar.
  420. */
  421. private void createNotification() {
  422. if (MainActivity.getInstance() == null) {
  423. return; // prevent NullPointerException
  424. }
  425. HostageDBOpenHelper dbh = new HostageDBOpenHelper(this);
  426. boolean activeHandlers = false;
  427. boolean bssidSeen = false;
  428. boolean listening = false;
  429. for (Listener listener : listeners) {
  430. if (listener.isRunning())
  431. listening = true;
  432. if (listener.getHandlerCount() > 0) {
  433. activeHandlers = true;
  434. }
  435. if (dbh.bssidSeen(listener.getProtocolName(), getBSSID(getApplicationContext()))) {
  436. bssidSeen = true;
  437. }
  438. }
  439. builder = new NotificationCompat.Builder(this).setContentTitle(getString(R.string.app_name)).setWhen(System.currentTimeMillis());
  440. if (!listening) {
  441. builder.setSmallIcon(R.drawable.ic_launcher);
  442. builder.setContentText(getString(R.string.hostage_not_monitoring));
  443. } else if (activeHandlers) {
  444. builder.setSmallIcon(R.drawable.ic_service_red);
  445. builder.setContentText(getString(R.string.hostage_live_threat));
  446. } else if (bssidSeen) {
  447. builder.setSmallIcon(R.drawable.ic_service_yellow);
  448. builder.setContentText(getString(R.string.hostage_past_threat));
  449. } else {
  450. builder.setSmallIcon(R.drawable.ic_service_green);
  451. builder.setContentText(getString(R.string.hostage_no_threat));
  452. }
  453. Intent launchIntent = new Intent(getApplicationContext(), MainActivity.class);
  454. TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
  455. stackBuilder.addParentStack(MainActivity.class);
  456. Intent intent = MainActivity.getInstance().getIntent();
  457. intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
  458. intent.setAction("SHOW_HOME");
  459. stackBuilder.addNextIntent(intent);
  460. PendingIntent resultPendingIntent = PendingIntent.getActivity(MainActivity.context, 0, intent, 0); //stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
  461. builder.setContentIntent(resultPendingIntent);
  462. builder.setOngoing(true);
  463. NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
  464. mNotificationManager.notify(1, builder.build());
  465. }
  466. /**
  467. * Deletes all session related data.
  468. */
  469. private void deleteConnectionData() {
  470. connectionInfoEditor.clear();
  471. connectionInfoEditor.commit();
  472. }
  473. /**
  474. * Returns the default port number, if the protocol is implemented.
  475. *
  476. * @param protocolName
  477. * The name of the protocol
  478. * @return Returns the default port number, if the protocol is implemented.
  479. * Else returns -1.
  480. */
  481. private int getDefaultPort(String protocolName) {
  482. for (Protocol protocol : implementedProtocols) {
  483. if (protocolName.equals(protocol.toString())) {
  484. return protocol.getPort();
  485. }
  486. }
  487. return -1;
  488. };
  489. /**
  490. * Returns an LinkedList<String> with the names of all implemented
  491. * protocols.
  492. *
  493. * @return ArrayList of
  494. * {@link de.tudarmstadt.informatik.hostage.protocol.Protocol
  495. * Protocol}
  496. */
  497. private LinkedList<Protocol> getImplementedProtocols() {
  498. String[] protocols = getResources().getStringArray(R.array.protocols);
  499. String packageName = Protocol.class.getPackage().getName();
  500. LinkedList<Protocol> implementedProtocols = new LinkedList<Protocol>();
  501. for (String protocol : protocols) {
  502. try {
  503. implementedProtocols.add((Protocol) Class.forName(String.format("%s.%s", packageName, protocol)).newInstance());
  504. } catch (Exception e) {
  505. e.printStackTrace();
  506. }
  507. }
  508. return implementedProtocols;
  509. }
  510. /**
  511. * Starts an Instance of MyLocationManager to set the location within this
  512. * class.
  513. */
  514. private void getLocationData() {
  515. MyLocationManager locationManager = new MyLocationManager(this);
  516. locationManager.getUpdates(60 * 1000, 3);
  517. };
  518. // Notifications
  519. /**
  520. * Register broadcast receiver for connectivity changes
  521. */
  522. private void registerNetReceiver() {
  523. // register BroadcastReceiver on network state changes
  524. IntentFilter intent = new IntentFilter();
  525. intent.addAction(ConnectivityManager.CONNECTIVITY_ACTION); // "android.net.conn.CONNECTIVITY_CHANGE"
  526. registerReceiver(netReceiver, intent);
  527. }
  528. /**
  529. * Unregister broadcast receiver for connectivity changes
  530. */
  531. private void unregisterNetReceiver() {
  532. unregisterReceiver(netReceiver);
  533. }
  534. public boolean hasProtocolActiveAttacks(String protocol){
  535. if(!mProtocolActiveAttacks.containsKey(protocol)) return false;
  536. return mProtocolActiveAttacks.get(protocol);
  537. }
  538. public boolean hasActiveAttacks(){
  539. for(boolean b: mProtocolActiveAttacks.values()){
  540. if(b) return true;
  541. }
  542. return false;
  543. }
  544. /**
  545. * Updates the connection info and saves them in the the SharedPreferences
  546. * for session data.
  547. *
  548. * @param context
  549. * Needs a context to get system resources.
  550. * @see MainActivity#CONNECTION_INFO
  551. */
  552. private void updateConnectionInfo() {
  553. ConnectivityManager connManager = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
  554. NetworkInfo networkInfo = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
  555. if (networkInfo == null || !networkInfo.isConnected()) {
  556. return; // no connection
  557. }
  558. final WifiManager wifiManager = (WifiManager)context.getSystemService(Context.WIFI_SERVICE);
  559. final WifiInfo connectionInfo = wifiManager.getConnectionInfo();
  560. if (connectionInfo == null) {
  561. return; // no wifi connection
  562. }
  563. final DhcpInfo dhcpInfo = wifiManager.getDhcpInfo();
  564. if (dhcpInfo == null) {
  565. return;
  566. }
  567. String ssid = connectionInfo.getSSID();
  568. if (ssid.startsWith("\"") && ssid.endsWith("\"")) { // trim those quotes
  569. ssid = ssid.substring(1, ssid.length() - 1);
  570. }
  571. SharedPreferences pref = context.getSharedPreferences(getString(R.string.connection_info), Context.MODE_PRIVATE);
  572. Editor editor = pref.edit();
  573. editor.putString(getString(R.string.connection_info_ssid), ssid);
  574. editor.putString(getString(R.string.connection_info_bssid), connectionInfo.getBSSID());
  575. editor.putInt(getString(R.string.connection_info_internal_ip), dhcpInfo.ipAddress);
  576. editor.putInt(getString(R.string.connection_info_subnet_mask), dhcpInfo.netmask);
  577. editor.commit();
  578. SetExternalIPTask async = new SetExternalIPTask();
  579. async.execute(new String[] { "http://ip2country.sourceforge.net/ip2c.php?format=JSON" });
  580. this.mProtocolActiveAttacks.clear();
  581. }
  582. }