MainActivity.java 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667
  1. package de.tudarmstadt.informatik.hostage.ui;
  2. import java.util.ArrayList;
  3. import java.util.HashMap;
  4. import android.app.Activity;
  5. import android.app.ActivityManager;
  6. import android.app.ActivityManager.RunningServiceInfo;
  7. import android.content.BroadcastReceiver;
  8. import android.content.ComponentName;
  9. import android.content.Context;
  10. import android.content.Intent;
  11. import android.content.IntentFilter;
  12. import android.content.ServiceConnection;
  13. import android.content.SharedPreferences;
  14. import android.content.SharedPreferences.Editor;
  15. import android.net.ConnectivityManager;
  16. import android.os.Bundle;
  17. import android.os.IBinder;
  18. import android.support.v4.content.LocalBroadcastManager;
  19. import android.view.GestureDetector;
  20. import android.view.GestureDetector.SimpleOnGestureListener;
  21. import android.view.Menu;
  22. import android.view.MenuItem;
  23. import android.view.MotionEvent;
  24. import android.view.View;
  25. import android.view.View.OnTouchListener;
  26. import android.view.animation.Animation;
  27. import android.view.animation.AnimationUtils;
  28. import android.widget.AdapterView;
  29. import android.widget.AdapterView.OnItemClickListener;
  30. import android.widget.CheckBox;
  31. import android.widget.ImageView;
  32. import android.widget.ListView;
  33. import android.widget.TextView;
  34. import android.widget.Toast;
  35. import android.widget.ToggleButton;
  36. import android.widget.ViewAnimator;
  37. import de.tudarmstadt.informatik.hostage.HoneyService;
  38. import de.tudarmstadt.informatik.hostage.HoneyService.LocalBinder;
  39. import de.tudarmstadt.informatik.hostage.R;
  40. import de.tudarmstadt.informatik.hostage.commons.HelperUtils;
  41. import de.tudarmstadt.informatik.hostage.logging.DatabaseHandler;
  42. import de.tudarmstadt.informatik.hostage.logging.Logger;
  43. import de.tudarmstadt.informatik.hostage.logging.SQLLogger;
  44. /**
  45. * MainActivity is the central activity for the GUI of the application.
  46. * MainActivity is launched when the application is first started.
  47. * It shows the user: <br>
  48. * - information about the network<br>
  49. * - light indicators for recorded attacks on each protocol<br>
  50. * - amount of attacks on each protocols<br>
  51. * The user can start and stop services.
  52. * @author Mihai Plasoianu
  53. * @author Lars Pandikow
  54. *
  55. */
  56. public class MainActivity extends Activity {
  57. // String constants for whole application
  58. /**
  59. * Used for Broadcast between service and GUI. String: "de.tudarmstadt.informatik.hostage.BROADCAST"
  60. */
  61. public static final String BROADCAST = "de.tudarmstadt.informatik.hostage.BROADCAST";
  62. /**
  63. * Used to store session related data in a SharedPrefereces. String: "de.tudarmstadt.informatik.hostage.SESSION_DATA"
  64. */
  65. public static final String SESSION_DATA = "de.tudarmstadt.informatik.hostage.SESSION_DATA";
  66. public static final String LISTENER = "_LISTENER";
  67. public static final String HANDLER_COUNT = "_HANDLER_COUNT";
  68. public static final String SSID = "SSID";
  69. public static final String BSSID = "BSSID";
  70. public static final String INTERNAL_IP = "INTERNAL_IP";
  71. public static final String EXTERNAL_IP = "EXTERNAL_IP";
  72. /**
  73. * Integer representing a grey light.
  74. */
  75. public static final int LIGHT_GREY = 0x01;
  76. /**
  77. * Integer representing a green light.
  78. */
  79. public static final int LIGHT_GREEN = 0x02;
  80. /**
  81. * Integer representing a red light.
  82. */
  83. public static final int LIGHT_RED = 0x03;
  84. /**
  85. * Integer representing a yellow light.
  86. */
  87. public static final int LIGHT_YELLOW = 0x04;
  88. private HoneyService mService;
  89. private boolean serviceBound;
  90. private SharedPreferences pref;
  91. private Editor editor;
  92. private Logger logger;
  93. // variables for the swipe animation
  94. private ViewAnimator viewAnimator;
  95. private GestureDetector gestureDetector;
  96. private Animation animFlipInLR;
  97. private Animation animFlipOutLR;
  98. private Animation animFlipInRL;
  99. private Animation animFlipOutRL;
  100. private ListView listView;
  101. private ListViewAdapter adapter;
  102. private String protocolClicked;
  103. @Override
  104. protected void onCreate(Bundle savedInstanceState) {
  105. super.onCreate(savedInstanceState);
  106. setContentView(R.layout.activity_main);
  107. // Create dynamic view elements
  108. initViewAnimator();
  109. initListView();
  110. // Initialize Class variables
  111. pref = getSharedPreferences(MainActivity.SESSION_DATA, Context.MODE_PRIVATE);
  112. logger = new SQLLogger(this);
  113. editor = pref.edit();
  114. }
  115. @Override
  116. public boolean onCreateOptionsMenu(Menu menu) {
  117. getMenuInflater().inflate(R.menu.main, menu);
  118. return true;
  119. }
  120. @Override
  121. public boolean onOptionsItemSelected(MenuItem item) {
  122. // Handle item selection
  123. switch (item.getItemId()) {
  124. case R.id.action_settings:
  125. startActivity(new Intent(this, SettingsActivity.class));
  126. break;
  127. case R.id.action_about:
  128. startActivity(new Intent(this, AboutActivity.class));
  129. break;
  130. default:
  131. }
  132. return super.onOptionsItemSelected(item);
  133. }
  134. @Override
  135. protected void onStart() {
  136. super.onStart();
  137. //Register Broadcast Receiver
  138. registerReceiver();
  139. registerNetReceiver();
  140. // Bind service if running, else check for connection change and delete sessionData
  141. if (isServiceRunning()) {
  142. bindService(getServiceIntent(), mConnection, BIND_AUTO_CREATE);
  143. } else {
  144. String bssid_old = pref.getString(MainActivity.BSSID, "");
  145. String bssid_new = HelperUtils.getBSSID(this);
  146. if(bssid_new == null || !bssid_new.equals(bssid_old)){
  147. deleteSessionData();
  148. }
  149. }
  150. // Update UI
  151. updateUI();
  152. updateConnectionInfo();
  153. }
  154. @Override
  155. protected void onStop() {
  156. //Unbind running service
  157. if (isServiceRunning()) {
  158. unbindService(mConnection);
  159. }
  160. // Unregister Broadcast Receiver
  161. unregisterNetReceiver();
  162. unregisterReceiver();
  163. super.onStop();
  164. }
  165. @Override
  166. protected void onDestroy(){
  167. super.onDestroy();
  168. // If service not running delete session data
  169. if(!isServiceRunning()){
  170. deleteSessionData();
  171. }
  172. }
  173. /**
  174. * Called when User presses on/off button
  175. * @param view
  176. */
  177. public void buttonOnOffClick(View view) {
  178. if (((ToggleButton) view).isChecked()) {
  179. if (isParanoid()) {
  180. protocolClicked = "PANIC";
  181. } else {
  182. protocolClicked = "SMB";
  183. }
  184. startAndBind();
  185. } else {
  186. mService.stopListeners();
  187. stopAndUnbind();
  188. }
  189. }
  190. /**
  191. * Starts the ViewLog activity, when the Button is pressed
  192. * @see ViewLog
  193. * @param view View elements which triggers the method call.
  194. */
  195. public void showLog(View view){
  196. startActivity(new Intent(this, ViewLog.class));
  197. }
  198. /**
  199. * If mobile phone is connected to a wireless network starts the background service ands binds itself to it.
  200. * Else notifies the user that service could not be started.
  201. */
  202. private void startAndBind() {
  203. if(HelperUtils.getBSSID(this) != null){
  204. startService(getServiceIntent());
  205. bindService();
  206. } else{
  207. ToggleButton button = (ToggleButton) findViewById(R.id.toggleButtonOnOff);
  208. button.setChecked(false);
  209. Toast.makeText(getApplicationContext(), "To start a service, first connect to a wireless network.", Toast.LENGTH_SHORT).show();
  210. }
  211. }
  212. /**
  213. * Binds service to Activity
  214. * @see HoneyService
  215. */
  216. private void bindService(){
  217. bindService(getServiceIntent(), mConnection, BIND_AUTO_CREATE);
  218. serviceBound = true;
  219. }
  220. /**
  221. * Stops service and unbinds it.
  222. * @see HoneyService
  223. */
  224. private void stopAndUnbind() {
  225. unbindService();
  226. stopService(getServiceIntent());
  227. }
  228. /**
  229. * Unbinds service.
  230. * @see HoneyService
  231. */
  232. private void unbindService(){
  233. unbindService(mConnection);
  234. serviceBound = false;
  235. }
  236. /**
  237. * Connection to bind the background service
  238. * @see HoneyService
  239. */
  240. private ServiceConnection mConnection = new ServiceConnection() {
  241. /**
  242. * After the service is bound, check which has been clicked and start it.
  243. * @see android.content.ServiceConnection#onServiceConnected(android.content.ComponentName)
  244. */
  245. @Override
  246. public void onServiceConnected(ComponentName name, IBinder service) {
  247. mService = ((LocalBinder) service).getService();
  248. if(protocolClicked != null && protocolClicked.equals("PANIC")){
  249. mService.startListeners();
  250. }else if (protocolClicked != null){
  251. mService.toggleListener(protocolClicked);
  252. }
  253. protocolClicked = null;
  254. }
  255. /**
  256. * After the service is unbound, delete reference.
  257. * @see android.content.ServiceConnection#onServiceDisconnected(android.content.ComponentName)
  258. */
  259. @Override
  260. public void onServiceDisconnected(ComponentName name) {
  261. mService = null;
  262. }
  263. };
  264. /**
  265. * Returns an intent to start HoneyService.
  266. * @return An Intent to start HoneyService
  267. */
  268. private Intent getServiceIntent() {
  269. return new Intent(this, HoneyService.class);
  270. }
  271. /**
  272. * Checks if user selected paranoid mode.
  273. * @return True when paranoid mode is selected, else returns false.
  274. */
  275. private boolean isParanoid() {
  276. return ((CheckBox) findViewById(R.id.checkBoxParanoid)).isChecked();
  277. }
  278. /**
  279. * Initializes the ListView. Creating its contents dynamic from protocol protocols.xml
  280. * @see /res/values/protocols.xml
  281. */
  282. private void initListView() {
  283. ArrayList<HashMap<String, String>> data = new ArrayList<HashMap<String, String>>();
  284. for (String protocol : getResources().getStringArray(R.array.protocols)) {
  285. HashMap<String, String> d = new HashMap<String, String>();
  286. d.put("light", String.valueOf(R.drawable.light_grey));
  287. d.put("protocol", protocol);
  288. d.put("connections", "-");
  289. data.add(d);
  290. }
  291. listView = (ListView) findViewById(R.id.listViewProtocols);
  292. adapter = new ListViewAdapter(getLayoutInflater(), data);
  293. listView.setAdapter(adapter);
  294. listView.setOnTouchListener(new OnTouchListener() {
  295. @Override
  296. public boolean onTouch(View v, MotionEvent event) {
  297. return gestureDetector.onTouchEvent(event);
  298. }
  299. });
  300. listView.setOnItemClickListener(new OnItemClickListener() {
  301. @Override
  302. public void onItemClick(AdapterView<?> parent, View view,
  303. int position, long id) {
  304. String protocolName = (String) ((HashMap<?, ?>) adapter
  305. .getItem(position)).get("protocol");
  306. if (isServiceRunning()) {
  307. mService.toggleListener(protocolName);
  308. if(!mService.hasRunningListeners()){
  309. stopAndUnbind();
  310. }
  311. }else{
  312. protocolClicked = protocolName;
  313. startAndBind();
  314. }
  315. }
  316. });
  317. }
  318. /**
  319. * Checks if a HoneService instance is running.
  320. * @return True if HonerService is running, else false.
  321. * @see HonerService
  322. */
  323. private boolean isServiceRunning() {
  324. ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
  325. for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
  326. if (service.service.getClassName().equals(HoneyService.class.getName())) {
  327. return true;
  328. }
  329. }
  330. return false;
  331. }
  332. /**
  333. * Deletes all session related Data.
  334. */
  335. private void deleteSessionData(){
  336. editor.clear();
  337. editor.commit();
  338. }
  339. /**
  340. * Register broadcast receiver for custom broadcast.
  341. * @see MainActivity#BROADCAST
  342. */
  343. private void registerReceiver() {
  344. LocalBroadcastManager.getInstance(this).registerReceiver(mReceiver,
  345. new IntentFilter(BROADCAST));
  346. }
  347. /**
  348. * Unregisters broadcast receiver for custom broadcast.
  349. * @see MainActivity#BROADCAST
  350. */
  351. private void unregisterReceiver() {
  352. LocalBroadcastManager.getInstance(this).unregisterReceiver(mReceiver);
  353. }
  354. /**
  355. * Receiver for custom broadcast.
  356. * @see MainActivity#BROADCAST
  357. */
  358. private BroadcastReceiver mReceiver = new BroadcastReceiver() {
  359. @Override
  360. public void onReceive(Context context, Intent intent) {
  361. // Update user interface.
  362. updateUI();
  363. }
  364. };
  365. /**
  366. * Register broadcast receiver for network state changes.
  367. * @see ConnectivityManager#CONNECTIVITY_ACTION
  368. */
  369. private void registerNetReceiver() {
  370. IntentFilter intent = new IntentFilter();
  371. intent.addAction(ConnectivityManager.CONNECTIVITY_ACTION); //"android.net.conn.CONNECTIVITY_CHANGE"
  372. registerReceiver(netReceiver, intent);
  373. }
  374. /**
  375. * Unregister broadcast receiver for network state changes.
  376. */
  377. private void unregisterNetReceiver() {
  378. unregisterReceiver(netReceiver);
  379. }
  380. /**
  381. * Receiver for network state change events.
  382. */
  383. private BroadcastReceiver netReceiver = new BroadcastReceiver() {
  384. @Override
  385. public void onReceive(Context context, Intent intent) {
  386. String bssid_old = pref.getString(BSSID, "");
  387. String bssid_new = HelperUtils.getBSSID(context);
  388. if ((bssid_new == null || !bssid_new.equals(bssid_old)) && serviceBound) {
  389. Toast.makeText(getApplicationContext(),"Connection changed! Services stopped!", Toast.LENGTH_LONG).show();
  390. unbindService();
  391. }
  392. updateConnectionInfo();
  393. }
  394. };
  395. /**
  396. * Updates Information shown by the GUI.
  397. */
  398. private void updateUI() {
  399. boolean activeListeners = false;
  400. boolean activeHandlers = false;
  401. boolean yellowLight = false;
  402. //Check for all protocols if listeners are active and attacks have been recorded
  403. //Update protocol lights and connection information.
  404. for(String protocol : getResources().getStringArray(R.array.protocols)){
  405. //Check if protocol is active
  406. if(pref.getBoolean(protocol + LISTENER, false)){
  407. activeListeners = true;
  408. int handlerCount = pref.getInt(protocol + HANDLER_COUNT, 0);
  409. //Check if attacks have been recorded in this session.
  410. if(handlerCount > 0){
  411. activeHandlers = true;
  412. updateProtocolLight(LIGHT_RED, protocol);
  413. updateProtocolConnections(handlerCount, protocol);
  414. } else{
  415. //Check if the bssid of the wireless network has already been recorded as infected.
  416. if(logger.bssidSeen(protocol, HelperUtils.getBSSID(getApplicationContext()))){
  417. updateProtocolLight(LIGHT_YELLOW, protocol);
  418. yellowLight = true;
  419. } else{
  420. updateProtocolLight(LIGHT_GREEN, protocol);
  421. }
  422. updateProtocolConnections(0, protocol);
  423. }
  424. }else{
  425. updateProtocolLight(LIGHT_GREY, protocol);
  426. }
  427. }
  428. //Update the big attack indicator.
  429. if (activeListeners) {
  430. if (activeHandlers) {
  431. updateStatusLight(LIGHT_RED);
  432. } else {
  433. if(yellowLight){
  434. updateStatusLight(LIGHT_YELLOW);
  435. } else {
  436. updateStatusLight(LIGHT_GREEN);
  437. }
  438. }
  439. ((ToggleButton) findViewById(R.id.toggleButtonOnOff))
  440. .setChecked(true);
  441. findViewById(R.id.checkBoxParanoid).setEnabled(false);
  442. } else {
  443. updateStatusLight(LIGHT_GREY);
  444. ((ToggleButton) findViewById(R.id.toggleButtonOnOff))
  445. .setChecked(false);
  446. findViewById(R.id.checkBoxParanoid).setEnabled(true);
  447. }
  448. }
  449. /**
  450. * Sets the big light indicator.
  451. * @param light Integer code to set the light color.
  452. * @see MainActivity#LIGHT_GREY
  453. * @see MainActivity#LIGHT_GREEN
  454. * @see MainActivity#LIGHT_RED
  455. * @see MainActivity#LIGHT_YELLOW
  456. */
  457. private void updateStatusLight(int light) {
  458. switch (light) {
  459. case LIGHT_GREY:
  460. ((ImageView) findViewById(R.id.imageViewLight))
  461. .setImageResource(R.drawable.light_grey_large);
  462. break;
  463. case LIGHT_GREEN:
  464. ((ImageView) findViewById(R.id.imageViewLight))
  465. .setImageResource(R.drawable.light_green_large);
  466. break;
  467. case LIGHT_RED:
  468. ((ImageView) findViewById(R.id.imageViewLight))
  469. .setImageResource(R.drawable.light_red_large);
  470. break;
  471. case LIGHT_YELLOW:
  472. ((ImageView) findViewById(R.id.imageViewLight))
  473. .setImageResource(R.drawable.light_yellow_large);
  474. break;
  475. }
  476. }
  477. /**
  478. * Sets the light indicator for a given protocol.
  479. * @param light Integer code to set the light color.
  480. * @param protocolName Name of the protocol which should be updated.
  481. */
  482. private void updateProtocolLight(int light, String protocolName) {
  483. for (int i = 0; i < adapter.getCount(); ++i) {
  484. HashMap<String, String> d = (HashMap<String, String>) adapter
  485. .getItem(i);
  486. if (d.get("protocol").equals(protocolName)) {
  487. switch (light) {
  488. case LIGHT_GREY:
  489. d.put("light", String.valueOf(R.drawable.light_grey));
  490. d.put("connections", "-");
  491. break;
  492. case LIGHT_GREEN:
  493. d.put("light", String.valueOf(R.drawable.light_green));
  494. break;
  495. case LIGHT_RED:
  496. d.put("light", String.valueOf(R.drawable.light_red));
  497. break;
  498. case LIGHT_YELLOW:
  499. d.put("light", String.valueOf(R.drawable.light_yellow));
  500. break;
  501. }
  502. }
  503. }
  504. adapter.notifyDataSetChanged();
  505. }
  506. /**
  507. * Sets the connections count for a given protocol
  508. * @param connections New value for recorded connections.
  509. * @param protocolName Name of the protocol which should be updated.
  510. */
  511. private void updateProtocolConnections(int connections, String protocolName) {
  512. for (int i = 0; i < adapter.getCount(); ++i) {
  513. HashMap<String, String> d = ((HashMap<String, String>) adapter
  514. .getItem(i));
  515. if (d.get("protocol").equals(protocolName)) {
  516. d.put("connections", String.valueOf(connections));
  517. }
  518. }
  519. adapter.notifyDataSetChanged();
  520. }
  521. /**
  522. * Gets Information about connection state and updates the GUI.
  523. */
  524. private void updateConnectionInfo() {
  525. //Get text fields
  526. TextView ssidView = (TextView) findViewById(R.id.textViewSSIDValue);
  527. TextView bssidView = (TextView) findViewById(R.id.textViewBSSIDValue);
  528. TextView internalIPView = (TextView) findViewById(R.id.textViewInternalIPValue);
  529. TextView externalIPView = (TextView) findViewById(R.id.textViewExternalIPValue);
  530. //Update the connection information
  531. HelperUtils.updateConnectionInfo(this);
  532. //Get connection information
  533. String ssid = pref.getString(SSID, "-");
  534. String bssid = pref.getString(BSSID, "-");
  535. String internalIP = pref.getString(INTERNAL_IP, "-");
  536. String externalIP = pref.getString(EXTERNAL_IP, "-");
  537. //Set text fields
  538. if (ssid != null)
  539. ssidView.setText(ssid);
  540. else
  541. ssidView.setText("-");
  542. if (bssid != null)
  543. bssidView.setText(bssid);
  544. else
  545. bssidView.setText("-");
  546. if (internalIP != null)
  547. internalIPView.setText(internalIP);
  548. else
  549. internalIPView.setText("-");
  550. if (externalIP != null)
  551. externalIPView.setText(externalIP);
  552. else
  553. externalIPView.setText("-");
  554. }
  555. /*############# Help functions for animation ##################*/
  556. @Override
  557. public boolean onTouchEvent(MotionEvent event) {
  558. return gestureDetector.onTouchEvent(event);
  559. }
  560. /**
  561. * Initializes variables for screen animation
  562. */
  563. private void initViewAnimator() {
  564. viewAnimator = (ViewAnimator) findViewById(R.id.viewAnimator);
  565. gestureDetector = new GestureDetector(this, simpleOnGestureListener);
  566. animFlipInLR = AnimationUtils.loadAnimation(this,
  567. R.anim.in_left_to_right);
  568. animFlipOutLR = AnimationUtils.loadAnimation(this,
  569. R.anim.out_left_to_right);
  570. animFlipInRL = AnimationUtils.loadAnimation(this,
  571. R.anim.in_right_to_left);
  572. animFlipOutRL = AnimationUtils.loadAnimation(this,
  573. R.anim.out_right_to_left);
  574. }
  575. /**
  576. * Called when a swipe to the Left is registered.
  577. */
  578. private void swipeRightToLeft() {
  579. if (viewAnimator.getDisplayedChild() == 0) {
  580. viewAnimator.setInAnimation(animFlipInRL);
  581. viewAnimator.setOutAnimation(animFlipOutRL);
  582. viewAnimator.setDisplayedChild(1);
  583. }
  584. }
  585. /**
  586. * Called when a swipe to the Right is registered.
  587. */
  588. private void swipeLeftToRight() {
  589. if (viewAnimator.getDisplayedChild() == 1) {
  590. viewAnimator.setInAnimation(animFlipInLR);
  591. viewAnimator.setOutAnimation(animFlipOutLR);
  592. viewAnimator.setDisplayedChild(0);
  593. }
  594. }
  595. SimpleOnGestureListener simpleOnGestureListener = new SimpleOnGestureListener() {
  596. @Override
  597. public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
  598. float velocityY) {
  599. float sensitvity = 50;
  600. if ((e1.getX() - e2.getX()) > sensitvity) {
  601. swipeRightToLeft();
  602. } else if ((e2.getX() - e1.getX()) > sensitvity) {
  603. swipeLeftToRight();
  604. }
  605. return true;
  606. }
  607. };
  608. }