From ee44d4be9f7ec3c30d1a762d35585f997dc2fc4c Mon Sep 17 00:00:00 2001 From: Abdul Mannan Date: Sat, 12 Feb 2022 15:16:57 +0500 Subject: [PATCH] Bug Fixes Bug Fixes --- app/google-services.json | 2 +- app/proguard-rules.pro | 2 +- app/src/main/AndroidManifest.xml | 76 +- .../main/assets/Homepage/homepage-dark.html | 4 +- app/src/main/assets/Homepage/homepage.html | 6 +- .../assets/homepage/style/cs-font-awesome.css | 5 + .../dataManager/crawlerDataModel.java | 172 - .../appManager/activityContextManager.java | 18 +- .../appManager/activityStateManager.java | 6 +- .../appManager/activityThemeManager.java | 6 +- .../bookmarkHome/bookmarkAdapter.java | 12 +- .../bookmarkHome/bookmarkAdapterView.java | 6 +- .../bookmarkHome/bookmarkController.java | 50 +- .../bookmarkHome/bookmarkEnums.java | 2 +- .../bookmarkHome/bookmarkModel.java | 4 +- .../bookmarkHome/bookmarkViewController.java | 8 +- .../bookmarkSettingController.java | 398 +- .../bookmarkSettingEnums.java | 2 +- .../bookmarkSettingModelController.java | 172 +- .../bookmarkSettingViewController.java | 11 +- .../bridgeManager/bridgeController.java | 28 +- .../appManager/bridgeManager/bridgeEnums.java | 2 +- .../appManager/bridgeManager/bridgeModel.java | 24 +- .../bridgeManager/bridgeViewController.java | 8 +- .../externalShortcutController.java | 22 +- .../externalURLNavigationContoller.java | 18 +- .../helpManager/editViewController.java | 6 +- .../appManager/helpManager/helpAdapter.java | 4 +- .../helpManager/helpController.java | 522 +-- .../appManager/helpManager/helpDataModel.java | 2 +- .../appManager/helpManager/helpEnums.java | 2 +- .../appManager/helpManager/helpModel.java | 12 +- .../helpManager/helpViewController.java | 210 +- .../historyManager/historyAdapter.java | 15 +- .../historyManager/historyAdapterView.java | 6 +- .../historyManager/historyController.java | 38 +- .../historyManager/historyEnums.java | 2 +- .../historyManager/historyModel.java | 4 +- .../historyManager/historyViewController.java | 8 +- .../homeManager/FakeLauncherActivity.kt | 2 +- .../geckoManager/NestedGeckoView.java | 22 +- .../geckoManager/errorHandler.java | 6 +- .../geckoManager/extendedGeckoView.java | 7 +- .../geckoManager/geckoClients.java | 28 +- .../geckoManager/geckoDownloadManager.java | 11 +- .../geckoManager/geckoPromptView.java | 2 +- .../geckoManager/geckoSession.java | 48 +- .../geckoManager/selectionActionDelegate.java | 7 +- .../homeManager/hintManager/hintAdapter.java | 14 +- .../homeManager/hintManager/hintModel.java | 2 +- .../homeController/editTextManager.java | 6 +- .../homeController/homeController.java | 121 +- .../homeManager/homeController/homeModel.java | 6 +- .../homeController/homeViewController.java | 35 +- .../BrowserIconManager.kt | 2 +- .../kotlinHelperLibraries/defaultBrowser.kt | 2 +- .../languageManager/languageAdapter.java | 12 +- .../languageManager/languageController.java | 502 +-- .../languageManager/languageDataModel.java | 2 +- .../languageManager/languageEnums.java | 2 +- .../languageManager/languageModel.java | 4 +- .../languageViewController.java | 134 +- .../orbotLogManager/orbotLogAdapter.java | 19 +- .../orbotLogManager/orbotLogController.java | 44 +- .../orbotLogManager/orbotLogEnums.java | 2 +- .../orbotLogManager/orbotLogModel.java | 20 +- .../orbotLogManager/orbotLogStatus.java | 2 +- .../orbotLogViewController.java | 8 +- .../orbotManager/orbotController.java | 26 +- .../appManager/orbotManager/orbotEnums.java | 2 +- .../appManager/orbotManager/orbotModel.java | 22 +- .../orbotManager/orbotViewController.java | 4 +- .../proxyStatusController.java | 20 +- .../proxyStatusManager/proxyStatusEnums.java | 2 +- .../proxyStatusManager/proxyStatusModel.java | 4 +- .../proxyStatusViewController.java | 2 +- .../settingAccessibilityController.java | 26 +- .../settingAccessibilityEnums.java | 2 +- .../settingAccessibilityModel.java | 6 +- .../settingAccessibilityViewController.java | 8 +- .../settingAdvanceController.java | 29 +- .../advanceManager/settingAdvanceEnums.java | 2 +- .../advanceManager/settingAdvanceModel.java | 6 +- .../settingAdvanceViewController.java | 6 +- .../clearManager/settingClearController.java | 36 +- .../clearManager/settingClearEnums.java | 2 +- .../clearManager/settingClearModel.java | 4 +- .../settingClearViewController.java | 4 +- .../settingGeneralController.java | 30 +- .../generalManager/settingGeneralEnums.java | 2 +- .../generalManager/settingGeneralModel.java | 6 +- .../settingGeneralViewController.java | 12 +- .../logManager/settingLogController.java | 28 +- .../logManager/settingLogEnums.java | 2 +- .../logManager/settingLogModel.java | 6 +- .../logManager/settingLogViewController.java | 6 +- .../settingNotificationController.java | 26 +- .../settingNotificationEnums.java | 2 +- .../settingNotificationModel.java | 10 +- .../settingNotificationViewController.java | 6 +- .../settingPrivacyController.java | 28 +- .../privacyManager/settingPrivacyEnums.java | 2 +- .../privacyManager/settingPrivacyModel.java | 6 +- .../settingPrivacyViewController.java | 6 +- .../settingSearchController.java | 26 +- .../settingSearchEnums.java | 2 +- .../settingSearchModel.java | 6 +- .../settingSearchViewController.java | 8 +- .../settingHomeController.java | 50 +- .../settingHomeManager/settingHomeEnums.java | 2 +- .../settingHomeManager/settingHomeModel.java | 4 +- .../settingHomeViewController.java | 4 +- .../settingTrackingController.java | 26 +- .../trackingManager/settingTrackingEnums.java | 2 +- .../trackingManager/settingTrackingModel.java | 6 +- .../settingTrackingViewController.java | 6 +- .../appManager/tabManager/tabAdapter.java | 28 +- .../appManager/tabManager/tabController.java | 33 +- .../appManager/tabManager/tabEnums.java | 2 +- .../appManager/tabManager/tabModel.java | 8 +- .../tabManager/tabViewController.java | 16 +- .../constants/constants.java | 21 +- .../constants/enums.java | 7 +- .../constants/keys.java | 2 +- .../constants/messages.java | 2 +- .../constants/responses.java | 20 +- .../constants/sql.java | 2 +- .../constants/status.java | 7 +- .../constants/strings.java | 2 +- .../dataManager/bookmarkDataModel.java | 12 +- .../dataManager/bridgesDataModel.java | 10 +- .../dataManager/crawlerDataModel.java | 164 + .../dataManager/dataController.java | 24 +- .../dataManager/dataEnums.java | 2 +- .../dataManager/helpDataModel.java | 2 +- .../dataManager/historyDataModel.java | 12 +- .../dataManager/imageDataModel.java | 15 +- .../dataManager/models/bookmarkRowModel.java | 3 +- .../dataManager/models/crawlerRowModel.java | 54 +- .../dataManager/models/historyRowModel.java | 2 +- .../dataManager/models/imageRowModel.java | 2 +- .../dataManager/models/tabRowModel.java | 11 +- .../dataManager/preferenceDataModel.java | 2 +- .../referenceWebsiteDataModel.java | 8 +- .../dataManager/sqlCipherDataModel.java | 16 +- .../dataManager/suggestionDataModel.java | 12 +- .../dataManager/tabDataModel.java | 722 ++- .../eventObserver.java | 2 +- .../helperManager/helperMethod.java | 66 +- .../helperManager/sharedUIMethod.java | 10 +- .../libs/netcipher/NetCipher.java | 720 +-- .../client/SocksAwareClientConnOperator.java | 510 +-- .../client/SocksAwareProxyRoutePlanner.java | 142 +- .../libs/netcipher/client/StrongBuilder.java | 312 +- .../netcipher/client/StrongBuilderBase.java | 568 +-- .../client/StrongConnectionBuilder.java | 330 +- .../netcipher/client/StrongConstants.java | 88 +- .../netcipher/client/StrongHttpsClient.java | 330 +- .../client/StrongSSLSocketFactory.java | 404 +- .../client/TlsOnlySocketFactory.java | 1088 ++--- .../libs/netcipher/proxy/OrbotHelper.java | 1400 +++--- .../libs/netcipher/proxy/ProxyHelper.java | 148 +- .../libs/netcipher/proxy/ProxySelector.java | 118 +- .../libs/netcipher/proxy/PsiphonHelper.java | 354 +- .../libs/netcipher/proxy/SetFromMap.java | 174 +- .../libs/netcipher/proxy/SignatureUtils.java | 952 ++-- .../libs/netcipher/proxy/StatusCallback.java | 128 +- .../libs/netcipher/proxy/TorServiceUtils.java | 492 +- .../libs/netcipher/web/WebkitProxy.java | 1668 +++---- .../ClientAuthContentProviderGenesis.java | 206 +- .../libs/providers/ClientAuthDatabase.java | 60 +- .../libs/providers/CookieContentProvider.java | 263 +- .../libs/providers/HSContentProvider.java | 279 +- .../libs/providers/HSDatabase.java | 96 +- .../OnionServiceContentProvider.java | 218 +- .../libs/providers/OnionServiceDatabase.java | 82 +- .../libs/trueTime/trueTimeEncryption.java | 7 +- .../libs/views/ColorAnimator.java | 2 +- .../libs/views/KeyboardUtils.java | 2 +- .../libs/views/ThumbnailCrop.java | 2 +- .../adPluginManager/admobManager.java | 230 +- .../adPluginManager/facebookAdsManager.java | 174 +- .../adPluginManager/mopubManager.java | 236 +- .../analyticManager.java | 6 +- .../downloadPluginManager/blobDownloader.java | 154 +- .../downloadManager.java | 13 +- .../downloadReciever.java | 23 +- .../downloadService.java | 6 +- .../langPluginManager/langManager.java | 11 +- .../messagePluginManager/messageManager.java | 53 +- .../localEngagementManager.java | 8 +- .../notifictionManager.java | 10 +- .../orbotPluginManager/orbotLogManager.java | 98 +- .../orbotPluginManager/orbotManager.java | 22 +- .../orbotPluginManager/orbotPluginEnums.java | 24 +- .../pluginManager/pluginController.java | 66 +- .../pluginManager/pluginEnums.java | 2 +- .../downloadNotificationReciever.java | 8 +- .../Genesis/helperMethod/helperMethod.java | 7 - .../widgetManager/widgetController.java | 2 +- .../widgetManager/widgetModelController.java | 8 +- .../widgetManager/widgetViewController.java | 2 +- .../custom-xml/generic/xml-v25/shortcuts.xml | 84 +- .../bookmark/layout/bookmark_setting_view.xml | 394 +- .../layouts/bookmark/layout/bookmark_view.xml | 4 +- .../res/layouts/help/layout/help_view.xml | 4 +- .../layouts/history/layout/history_view.xml | 4 +- .../res/layouts/home/layout/home_view.xml | 14 +- .../layouts/home/layout/popup_search_view.xml | 14 +- .../layouts/language/layout/language_view.xml | 2 +- .../res/layouts/setting/layout/setting.xml | 2 +- .../layout/setting_accessibility_view.xml | 2 +- .../setting/layout/setting_advance_view.xml | 2 +- .../setting/layout/setting_clear_view.xml | 2 +- .../setting/layout/setting_general_view.xml | 2 +- .../setting/layout/setting_log_view.xml | 2 +- .../layout/setting_notification_view.xml | 2 +- .../setting/layout/setting_privacy_view.xml | 2 +- .../setting/layout/setting_search_view.xml | 2 +- .../setting/layout/setting_tracking_view.xml | 2 +- .../res/layouts/tab/layout/tab_grid_view.xml | 2 +- .../res/layouts/tab/layout/tab_row_view.xml | 2 +- .../main/res/layouts/tab/layout/tab_view.xml | 2 +- app/src/main/res/localization.xml | 2 +- app/src/main/res/values-ar/strings.xml | 2 +- app/src/main/res/values-ca/strings.xml | 2 +- app/src/main/res/values-ch/strings.xml | 2 +- app/src/main/res/values-de/strings.xml | 2 +- app/src/main/res/values-el/strings.xml | 2 +- app/src/main/res/values-fr/strings.xml | 2 +- app/src/main/res/values-hu/strings.xml | 2 +- app/src/main/res/values-it/strings.xml | 2 +- app/src/main/res/values-ja-rJP/strings.xml | 2 +- app/src/main/res/values-ko/strings.xml | 2 +- app/src/main/res/values-night/colors.xml | 3 +- app/src/main/res/values-pt/strings.xml | 2 +- app/src/main/res/values-ro/strings.xml | 2 +- app/src/main/res/values-ru/strings.xml | 2 +- app/src/main/res/values-th/strings.xml | 2 +- app/src/main/res/values-tr/strings.xml | 1062 ++--- app/src/main/res/values-ur/strings.xml | 2 +- app/src/main/res/values-vi/strings.xml | 1062 ++--- app/src/main/res/values-zh/strings.xml | 2 +- app/src/main/res/values/colors.xml | 1 + app/src/main/res/values/strings.xml | 2 +- app/variables.gradle | 2 +- orbotmanager/build.gradle | 134 +- orbotmanager/src/main/AndroidManifest.xml | 2 +- .../android/service/OrbotConstants.java | 76 +- .../android/service/OrbotService.java | 3949 ++++++++--------- .../android/service/StartTorReceiver.java | 80 +- .../android/service/TorEventHandler.java | 427 +- .../android/service/TorServiceConstants.java | 206 +- .../service/util/CustomNativeLoader.java | 256 +- .../android/service/util/CustomShell.java | 160 +- .../util/CustomTorResourceInstaller.java | 254 +- .../android/service/util/DummyActivity.java | 28 +- .../service/util/ExternalIPFetcher.java | 170 +- .../android/service/util/NativeLoader.java | 196 +- .../android/service/util/PortForwarder.java | 154 +- .../android/service/util/Prefs.java | 334 +- .../android/service/util/TCPSourceApp.java | 612 +-- .../android/service/util/TorServiceUtils.java | 54 +- .../android/service/util/Utils.java | 366 +- .../android/service/vpn/OrbotVpnManager.java | 821 ++-- .../android/service/vpn/TorifiedApp.java | 520 +-- .../android/service/vpn/Tun2Socks.java | 344 +- .../android/service/vpn/VpnPrefs.java | 16 +- .../android/service/vpn/VpnUtils.java | 272 +- .../android/service/wrapper/LocaleHelper.java | 4 +- .../service/wrapper/localHelperMethod.java | 2 +- .../android/service/wrapper/logRowModel.java | 2 +- .../service/wrapper/orbotLocalConstants.java | 2 +- 273 files changed, 14615 insertions(+), 14645 deletions(-) create mode 100644 app/src/main/assets/homepage/style/cs-font-awesome.css delete mode 100644 app/src/main/java/com/darkweb/genesissearchengine/dataManager/crawlerDataModel.java rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/activityContextManager.java (84%) mode change 100755 => 100644 rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/activityStateManager.java (84%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/activityThemeManager.java (93%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/bookmarkManager/bookmarkHome/bookmarkAdapter.java (95%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/bookmarkManager/bookmarkHome/bookmarkAdapterView.java (92%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/bookmarkManager/bookmarkHome/bookmarkController.java (84%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/bookmarkManager/bookmarkHome/bookmarkEnums.java (84%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/bookmarkManager/bookmarkHome/bookmarkModel.java (71%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/bookmarkManager/bookmarkHome/bookmarkViewController.java (95%) rename app/src/main/java/com/{darkweb/genesissearchengine/appManager/bookmarkManager/BookmarkSettings => hiddenservices/genesissearchengine.production/appManager/bookmarkManager/bookmarkSettings}/bookmarkSettingController.java (87%) rename app/src/main/java/com/{darkweb/genesissearchengine/appManager/bookmarkManager/BookmarkSettings => hiddenservices/genesissearchengine.production/appManager/bookmarkManager/bookmarkSettings}/bookmarkSettingEnums.java (83%) rename app/src/main/java/com/{darkweb/genesissearchengine/appManager/bookmarkManager/BookmarkSettings => hiddenservices/genesissearchengine.production/appManager/bookmarkManager/bookmarkSettings}/bookmarkSettingModelController.java (81%) rename app/src/main/java/com/{darkweb/genesissearchengine/appManager/bookmarkManager/BookmarkSettings => hiddenservices/genesissearchengine.production/appManager/bookmarkManager/bookmarkSettings}/bookmarkSettingViewController.java (87%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/bridgeManager/bridgeController.java (85%) mode change 100755 => 100644 rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/bridgeManager/bridgeEnums.java (72%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/bridgeManager/bridgeModel.java (74%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/bridgeManager/bridgeViewController.java (93%) mode change 100755 => 100644 rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/externalCommandManager/externalShortcutController.java (66%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/externalCommandManager/externalURLNavigationContoller.java (66%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/helpManager/editViewController.java (81%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/helpManager/helpAdapter.java (94%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/helpManager/helpController.java (87%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/helpManager/helpDataModel.java (82%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/helpManager/helpEnums.java (80%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/helpManager/helpModel.java (86%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/helpManager/helpViewController.java (93%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/historyManager/historyAdapter.java (95%) mode change 100755 => 100644 rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/historyManager/historyAdapterView.java (92%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/historyManager/historyController.java (88%) mode change 100755 => 100644 rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/historyManager/historyEnums.java (84%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/historyManager/historyModel.java (72%) mode change 100755 => 100644 rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/historyManager/historyViewController.java (95%) mode change 100755 => 100644 rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/homeManager/FakeLauncherActivity.kt (71%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/homeManager/geckoManager/NestedGeckoView.java (85%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/homeManager/geckoManager/errorHandler.java (95%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/homeManager/geckoManager/extendedGeckoView.java (96%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/homeManager/geckoManager/geckoClients.java (93%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/homeManager/geckoManager/geckoDownloadManager.java (82%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/homeManager/geckoManager/geckoPromptView.java (97%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/homeManager/geckoManager/geckoSession.java (93%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/homeManager/geckoManager/selectionActionDelegate.java (95%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/homeManager/hintManager/hintAdapter.java (91%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/homeManager/hintManager/hintModel.java (73%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/homeManager/homeController/editTextManager.java (89%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/homeManager/homeController/homeController.java (93%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/homeManager/homeController/homeModel.java (79%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/homeManager/homeController/homeViewController.java (95%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/kotlinHelperLibraries/BrowserIconManager.kt (90%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/kotlinHelperLibraries/defaultBrowser.kt (94%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/languageManager/languageAdapter.java (89%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/languageManager/languageController.java (84%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/languageManager/languageDataModel.java (84%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/languageManager/languageEnums.java (77%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/languageManager/languageModel.java (93%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/languageManager/languageViewController.java (90%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/orbotLogManager/orbotLogAdapter.java (78%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/orbotLogManager/orbotLogController.java (82%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/orbotLogManager/orbotLogEnums.java (82%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/orbotLogManager/orbotLogModel.java (78%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/orbotLogManager/orbotLogStatus.java (64%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/orbotLogManager/orbotLogViewController.java (90%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/orbotManager/orbotController.java (77%) mode change 100755 => 100644 rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/orbotManager/orbotEnums.java (74%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/orbotManager/orbotModel.java (51%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/orbotManager/orbotViewController.java (92%) mode change 100755 => 100644 rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/proxyStatusManager/proxyStatusController.java (81%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/proxyStatusManager/proxyStatusEnums.java (63%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/proxyStatusManager/proxyStatusModel.java (56%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/proxyStatusManager/proxyStatusViewController.java (94%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/settingManager/accessibilityManager/settingAccessibilityController.java (83%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/settingManager/accessibilityManager/settingAccessibilityEnums.java (67%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/settingManager/accessibilityManager/settingAccessibilityModel.java (77%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/settingManager/accessibilityManager/settingAccessibilityViewController.java (89%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/settingManager/advanceManager/settingAdvanceController.java (84%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/settingManager/advanceManager/settingAdvanceEnums.java (71%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/settingManager/advanceManager/settingAdvanceModel.java (86%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/settingManager/advanceManager/settingAdvanceViewController.java (94%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/settingManager/clearManager/settingClearController.java (89%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/settingManager/clearManager/settingClearEnums.java (58%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/settingManager/clearManager/settingClearModel.java (57%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/settingManager/clearManager/settingClearViewController.java (91%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/settingManager/generalManager/settingGeneralController.java (88%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/settingManager/generalManager/settingGeneralEnums.java (74%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/settingManager/generalManager/settingGeneralModel.java (79%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/settingManager/generalManager/settingGeneralViewController.java (88%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/settingManager/logManager/settingLogController.java (74%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/settingManager/logManager/settingLogEnums.java (66%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/settingManager/logManager/settingLogModel.java (70%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/settingManager/logManager/settingLogViewController.java (83%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/settingManager/notificationManager/settingNotificationController.java (77%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/settingManager/notificationManager/settingNotificationEnums.java (61%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/settingManager/notificationManager/settingNotificationModel.java (68%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/settingManager/notificationManager/settingNotificationViewController.java (86%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/settingManager/privacyManager/settingPrivacyController.java (82%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/settingManager/privacyManager/settingPrivacyEnums.java (70%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/settingManager/privacyManager/settingPrivacyModel.java (88%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/settingManager/privacyManager/settingPrivacyViewController.java (93%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/settingManager/searchEngineManager/settingSearchController.java (84%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/settingManager/searchEngineManager/settingSearchEnums.java (69%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/settingManager/searchEngineManager/settingSearchModel.java (80%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/settingManager/searchEngineManager/settingSearchViewController.java (91%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/settingManager/settingHomeManager/settingHomeController.java (75%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/settingManager/settingHomeManager/settingHomeEnums.java (56%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/settingManager/settingHomeManager/settingHomeModel.java (54%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/settingManager/settingHomeManager/settingHomeViewController.java (88%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/settingManager/trackingManager/settingTrackingController.java (77%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/settingManager/trackingManager/settingTrackingEnums.java (64%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/settingManager/trackingManager/settingTrackingModel.java (79%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/settingManager/trackingManager/settingTrackingViewController.java (92%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/tabManager/tabAdapter.java (92%) mode change 100755 => 100644 rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/tabManager/tabController.java (92%) mode change 100755 => 100644 rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/tabManager/tabEnums.java (91%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/tabManager/tabModel.java (84%) mode change 100755 => 100644 rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/appManager/tabManager/tabViewController.java (92%) mode change 100755 => 100644 rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/constants/constants.java (85%) mode change 100755 => 100644 rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/constants/enums.java (91%) mode change 100755 => 100644 rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/constants/keys.java (96%) mode change 100755 => 100644 rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/constants/messages.java (74%) mode change 100755 => 100644 rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/constants/responses.java (80%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/constants/sql.java (77%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/constants/status.java (96%) mode change 100755 => 100644 rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/constants/strings.java (98%) mode change 100755 => 100644 rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/dataManager/bookmarkDataModel.java (90%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/dataManager/bridgesDataModel.java (83%) create mode 100644 app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/crawlerDataModel.java rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/dataManager/dataController.java (91%) mode change 100755 => 100644 rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/dataManager/dataEnums.java (92%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/dataManager/helpDataModel.java (89%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/dataManager/historyDataModel.java (91%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/dataManager/imageDataModel.java (85%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/dataManager/models/bookmarkRowModel.java (89%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/dataManager/models/crawlerRowModel.java (79%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/dataManager/models/historyRowModel.java (91%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/dataManager/models/imageRowModel.java (83%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/dataManager/models/tabRowModel.java (82%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/dataManager/preferenceDataModel.java (94%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/dataManager/referenceWebsiteDataModel.java (84%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/dataManager/sqlCipherDataModel.java (89%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/dataManager/suggestionDataModel.java (96%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/dataManager/tabDataModel.java (93%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/eventObserver.java (71%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/helperManager/helperMethod.java (92%) mode change 100755 => 100644 rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/helperManager/sharedUIMethod.java (79%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/libs/netcipher/NetCipher.java (95%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/libs/netcipher/client/SocksAwareClientConnOperator.java (97%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/libs/netcipher/client/SocksAwareProxyRoutePlanner.java (94%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/libs/netcipher/client/StrongBuilder.java (94%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/libs/netcipher/client/StrongBuilderBase.java (92%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/libs/netcipher/client/StrongConnectionBuilder.java (94%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/libs/netcipher/client/StrongConstants.java (92%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/libs/netcipher/client/StrongHttpsClient.java (95%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/libs/netcipher/client/StrongSSLSocketFactory.java (95%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/libs/netcipher/client/TlsOnlySocketFactory.java (96%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/libs/netcipher/proxy/OrbotHelper.java (96%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/libs/netcipher/proxy/ProxyHelper.java (94%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/libs/netcipher/proxy/ProxySelector.java (91%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/libs/netcipher/proxy/PsiphonHelper.java (95%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/libs/netcipher/proxy/SetFromMap.java (94%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/libs/netcipher/proxy/SignatureUtils.java (97%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/libs/netcipher/proxy/StatusCallback.java (92%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/libs/netcipher/proxy/TorServiceUtils.java (95%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/libs/netcipher/web/WebkitProxy.java (96%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/libs/providers/ClientAuthContentProviderGenesis.java (94%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/libs/providers/ClientAuthDatabase.java (89%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/libs/providers/CookieContentProvider.java (93%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/libs/providers/HSContentProvider.java (94%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/libs/providers/HSDatabase.java (93%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/libs/providers/OnionServiceContentProvider.java (94%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/libs/providers/OnionServiceDatabase.java (92%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/libs/trueTime/trueTimeEncryption.java (81%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/libs/views/ColorAnimator.java (90%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/libs/views/KeyboardUtils.java (95%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/libs/views/ThumbnailCrop.java (93%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/pluginManager/adPluginManager/admobManager.java (78%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/pluginManager/adPluginManager/facebookAdsManager.java (79%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/pluginManager/adPluginManager/mopubManager.java (85%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/pluginManager/analyticPluginManager/analyticManager.java (78%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/pluginManager/downloadPluginManager/blobDownloader.java (95%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/pluginManager/downloadPluginManager/downloadManager.java (85%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/pluginManager/downloadPluginManager/downloadReciever.java (91%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/pluginManager/downloadPluginManager/downloadService.java (83%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/pluginManager/langPluginManager/langManager.java (93%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/pluginManager/messagePluginManager/messageManager.java (92%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/pluginManager/notificationPluginManager/localEngagementManager.java (89%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/pluginManager/notificationPluginManager/notifictionManager.java (87%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/pluginManager/orbotPluginManager/orbotLogManager.java (74%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/pluginManager/orbotPluginManager/orbotManager.java (86%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/pluginManager/orbotPluginManager/orbotPluginEnums.java (65%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/pluginManager/pluginController.java (79%) mode change 100755 => 100644 rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/pluginManager/pluginEnums.java (95%) rename app/src/main/java/com/{darkweb/genesissearchengine => hiddenservices/genesissearchengine.production}/pluginManager/pluginReciever/downloadNotificationReciever.java (73%) rename orbotmanager/src/main/java/org/{torproject => orbotproject}/android/service/OrbotConstants.java (93%) rename orbotmanager/src/main/java/org/{torproject => orbotproject}/android/service/OrbotService.java (93%) rename orbotmanager/src/main/java/org/{torproject => orbotproject}/android/service/StartTorReceiver.java (91%) rename orbotmanager/src/main/java/org/{torproject => orbotproject}/android/service/TorEventHandler.java (94%) rename orbotmanager/src/main/java/org/{torproject => orbotproject}/android/service/TorServiceConstants.java (96%) rename orbotmanager/src/main/java/org/{torproject => orbotproject}/android/service/util/CustomNativeLoader.java (95%) rename orbotmanager/src/main/java/org/{torproject => orbotproject}/android/service/util/CustomShell.java (95%) rename orbotmanager/src/main/java/org/{torproject => orbotproject}/android/service/util/CustomTorResourceInstaller.java (93%) rename orbotmanager/src/main/java/org/{torproject => orbotproject}/android/service/util/DummyActivity.java (81%) rename orbotmanager/src/main/java/org/{torproject => orbotproject}/android/service/util/ExternalIPFetcher.java (91%) rename orbotmanager/src/main/java/org/{torproject => orbotproject}/android/service/util/NativeLoader.java (95%) rename orbotmanager/src/main/java/org/{torproject => orbotproject}/android/service/util/PortForwarder.java (95%) rename orbotmanager/src/main/java/org/{torproject => orbotproject}/android/service/util/Prefs.java (95%) rename orbotmanager/src/main/java/org/{torproject => orbotproject}/android/service/util/TCPSourceApp.java (97%) rename orbotmanager/src/main/java/org/{torproject => orbotproject}/android/service/util/TorServiceUtils.java (85%) rename orbotmanager/src/main/java/org/{torproject => orbotproject}/android/service/util/Utils.java (95%) rename orbotmanager/src/main/java/org/{torproject => orbotproject}/android/service/vpn/OrbotVpnManager.java (91%) rename orbotmanager/src/main/java/org/{torproject => orbotproject}/android/service/vpn/TorifiedApp.java (93%) rename orbotmanager/src/main/java/org/{torproject => orbotproject}/android/service/vpn/Tun2Socks.java (95%) rename orbotmanager/src/main/java/org/{torproject => orbotproject}/android/service/vpn/VpnPrefs.java (69%) rename orbotmanager/src/main/java/org/{torproject => orbotproject}/android/service/vpn/VpnUtils.java (95%) rename orbotmanager/src/main/java/org/{torproject => orbotproject}/android/service/wrapper/LocaleHelper.java (93%) rename orbotmanager/src/main/java/org/{torproject => orbotproject}/android/service/wrapper/localHelperMethod.java (91%) rename orbotmanager/src/main/java/org/{torproject => orbotproject}/android/service/wrapper/logRowModel.java (86%) rename orbotmanager/src/main/java/org/{torproject => orbotproject}/android/service/wrapper/orbotLocalConstants.java (91%) diff --git a/app/google-services.json b/app/google-services.json index 71935c15..64ef9006 100755 --- a/app/google-services.json +++ b/app/google-services.json @@ -10,7 +10,7 @@ "client_info": { "mobilesdk_app_id": "1:1026582312920:android:056aacc3b6f0c3b3f164ad", "android_client_info": { - "package_name": "com.darkweb.genesissearchengine.production" + "package_name": "com.hiddenservices.genesissearchengine.production" } }, "oauth_client": [ diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 31ea4da0..a9f33721 100755 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -19,7 +19,7 @@ # https://stackoverflow.com/questions/9651703/using-proguard-with-android-without-obfuscation -optimizations !code/simplification/arithmetic,!field/*,!class/merging/*,!code/allocation/variable --keep class org.torproject.android.service.vpn.Tun2Socks { +-keep class org.orbotproject.android.service.vpn.Tun2Socks { void logTun2Socks(java.lang.String, java.lang.String, java.lang.String); } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 78d3fcbc..0cefd8a0 100755 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -30,7 +30,7 @@ android:usesCleartextTraffic="true" tools:targetApi="n"> @@ -45,86 +45,86 @@ @@ -151,10 +151,10 @@ @@ -207,17 +207,17 @@ android:value="ca-app-pub-6985886044951738~4177628900" /> --> - + @@ -225,7 +225,7 @@ @@ -235,7 +235,7 @@ diff --git a/app/src/main/assets/Homepage/homepage-dark.html b/app/src/main/assets/Homepage/homepage-dark.html index 8de70f62..522365fa 100644 --- a/app/src/main/assets/Homepage/homepage-dark.html +++ b/app/src/main/assets/Homepage/homepage-dark.html @@ -33,7 +33,7 @@

- Mobile App + Mobile App Proton mail Images @@ -100,7 +100,7 @@ -

Playstore

+

Playstore

Submit Website

diff --git a/app/src/main/assets/Homepage/homepage.html b/app/src/main/assets/Homepage/homepage.html index 3f819b2a..f495e8d9 100644 --- a/app/src/main/assets/Homepage/homepage.html +++ b/app/src/main/assets/Homepage/homepage.html @@ -10,7 +10,7 @@ - + @@ -37,7 +37,7 @@

- Mobile App + Mobile App Proton mail Images @@ -100,7 +100,7 @@ -

Playstore

+

Playstore

Submit Website

diff --git a/app/src/main/assets/homepage/style/cs-font-awesome.css b/app/src/main/assets/homepage/style/cs-font-awesome.css new file mode 100644 index 00000000..a420d72b --- /dev/null +++ b/app/src/main/assets/homepage/style/cs-font-awesome.css @@ -0,0 +1,5 @@ +/*! + * Font Awesome Free 5.7.0 by @fontawesome - https://fontawesome.com + * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) + */ +.fa,.fab,.fal,.far,.fas{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:inline-block;font-style:normal;font-variant:normal;text-rendering:auto;line-height:1}.fa-lg{font-size:1.33333em;line-height:.75em;vertical-align:-.0667em}.fa-xs{font-size:.75em}.fa-sm{font-size:.875em}.fa-1x{font-size:1em}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-6x{font-size:6em}.fa-7x{font-size:7em}.fa-8x{font-size:8em}.fa-9x{font-size:9em}.fa-10x{font-size:10em}.fa-fw{text-align:center;width:1.25em}.fa-ul{list-style-type:none;margin-left:2.5em;padding-left:0}.fa-ul>li{position:relative}.fa-li{left:-2em;position:absolute;text-align:center;width:2em;line-height:inherit}.fa-border{border:.08em solid #eee;border-radius:.1em;padding:.2em .25em .15em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left,.fab.fa-pull-left,.fal.fa-pull-left,.far.fa-pull-left,.fas.fa-pull-left{margin-right:.3em}.fa.fa-pull-right,.fab.fa-pull-right,.fal.fa-pull-right,.far.fa-pull-right,.fas.fa-pull-right{margin-left:.3em}.fa-spin{animation:fa-spin 2s infinite linear}.fa-pulse{animation:fa-spin 1s infinite steps(8)}@keyframes fa-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.fa-rotate-90{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";transform:rotate(90deg)}.fa-rotate-180{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";transform:rotate(180deg)}.fa-rotate-270{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";transform:rotate(270deg)}.fa-flip-horizontal{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";transform:scaleX(-1)}.fa-flip-vertical{transform:scaleY(-1)}.fa-flip-both,.fa-flip-horizontal.fa-flip-vertical,.fa-flip-vertical{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)"}.fa-flip-both,.fa-flip-horizontal.fa-flip-vertical{transform:scale(-1)}:root .fa-flip-both,:root .fa-flip-horizontal,:root .fa-flip-vertical,:root .fa-rotate-90,:root .fa-rotate-180,:root .fa-rotate-270{filter:none}.fa-stack{display:inline-block;height:2em;line-height:2em;position:relative;vertical-align:middle;width:2.5em}.fa-stack-1x,.fa-stack-2x{left:0;position:absolute;text-align:center;width:100%}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-500px:before{content:"\f26e"}.fa-accessible-icon:before{content:"\f368"}.fa-accusoft:before{content:"\f369"}.fa-acquisitions-incorporated:before{content:"\f6af"}.fa-ad:before{content:"\f641"}.fa-address-book:before{content:"\f2b9"}.fa-address-card:before{content:"\f2bb"}.fa-adjust:before{content:"\f042"}.fa-adn:before{content:"\f170"}.fa-adobe:before{content:"\f778"}.fa-adversal:before{content:"\f36a"}.fa-affiliatetheme:before{content:"\f36b"}.fa-air-freshener:before{content:"\f5d0"}.fa-algolia:before{content:"\f36c"}.fa-align-center:before{content:"\f037"}.fa-align-justify:before{content:"\f039"}.fa-align-left:before{content:"\f036"}.fa-align-right:before{content:"\f038"}.fa-alipay:before{content:"\f642"}.fa-allergies:before{content:"\f461"}.fa-amazon:before{content:"\f270"}.fa-amazon-pay:before{content:"\f42c"}.fa-ambulance:before{content:"\f0f9"}.fa-american-sign-language-interpreting:before{content:"\f2a3"}.fa-amilia:before{content:"\f36d"}.fa-anchor:before{content:"\f13d"}.fa-android:before{content:"\f17b"}.fa-angellist:before{content:"\f209"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-down:before{content:"\f107"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angry:before{content:"\f556"}.fa-angrycreative:before{content:"\f36e"}.fa-angular:before{content:"\f420"}.fa-ankh:before{content:"\f644"}.fa-app-store:before{content:"\f36f"}.fa-app-store-ios:before{content:"\f370"}.fa-apper:before{content:"\f371"}.fa-apple:before{content:"\f179"}.fa-apple-alt:before{content:"\f5d1"}.fa-apple-pay:before{content:"\f415"}.fa-archive:before{content:"\f187"}.fa-archway:before{content:"\f557"}.fa-arrow-alt-circle-down:before{content:"\f358"}.fa-arrow-alt-circle-left:before{content:"\f359"}.fa-arrow-alt-circle-right:before{content:"\f35a"}.fa-arrow-alt-circle-up:before{content:"\f35b"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-down:before{content:"\f063"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-up:before{content:"\f062"}.fa-arrows-alt:before{content:"\f0b2"}.fa-arrows-alt-h:before{content:"\f337"}.fa-arrows-alt-v:before{content:"\f338"}.fa-artstation:before{content:"\f77a"}.fa-assistive-listening-systems:before{content:"\f2a2"}.fa-asterisk:before{content:"\f069"}.fa-asymmetrik:before{content:"\f372"}.fa-at:before{content:"\f1fa"}.fa-atlas:before{content:"\f558"}.fa-atlassian:before{content:"\f77b"}.fa-atom:before{content:"\f5d2"}.fa-audible:before{content:"\f373"}.fa-audio-description:before{content:"\f29e"}.fa-autoprefixer:before{content:"\f41c"}.fa-avianex:before{content:"\f374"}.fa-aviato:before{content:"\f421"}.fa-award:before{content:"\f559"}.fa-aws:before{content:"\f375"}.fa-baby:before{content:"\f77c"}.fa-baby-carriage:before{content:"\f77d"}.fa-backspace:before{content:"\f55a"}.fa-backward:before{content:"\f04a"}.fa-bacon:before{content:"\f7e5"}.fa-balance-scale:before{content:"\f24e"}.fa-ban:before{content:"\f05e"}.fa-band-aid:before{content:"\f462"}.fa-bandcamp:before{content:"\f2d5"}.fa-barcode:before{content:"\f02a"}.fa-bars:before{content:"\f0c9"}.fa-baseball-ball:before{content:"\f433"}.fa-basketball-ball:before{content:"\f434"}.fa-bath:before{content:"\f2cd"}.fa-battery-empty:before{content:"\f244"}.fa-battery-full:before{content:"\f240"}.fa-battery-half:before{content:"\f242"}.fa-battery-quarter:before{content:"\f243"}.fa-battery-three-quarters:before{content:"\f241"}.fa-bed:before{content:"\f236"}.fa-beer:before{content:"\f0fc"}.fa-behance:before{content:"\f1b4"}.fa-behance-square:before{content:"\f1b5"}.fa-bell:before{content:"\f0f3"}.fa-bell-slash:before{content:"\f1f6"}.fa-bezier-curve:before{content:"\f55b"}.fa-bible:before{content:"\f647"}.fa-bicycle:before{content:"\f206"}.fa-bimobject:before{content:"\f378"}.fa-binoculars:before{content:"\f1e5"}.fa-biohazard:before{content:"\f780"}.fa-birthday-cake:before{content:"\f1fd"}.fa-bitbucket:before{content:"\f171"}.fa-bitcoin:before{content:"\f379"}.fa-bity:before{content:"\f37a"}.fa-black-tie:before{content:"\f27e"}.fa-blackberry:before{content:"\f37b"}.fa-blender:before{content:"\f517"}.fa-blender-phone:before{content:"\f6b6"}.fa-blind:before{content:"\f29d"}.fa-blog:before{content:"\f781"}.fa-blogger:before{content:"\f37c"}.fa-blogger-b:before{content:"\f37d"}.fa-bluetooth:before{content:"\f293"}.fa-bluetooth-b:before{content:"\f294"}.fa-bold:before{content:"\f032"}.fa-bolt:before{content:"\f0e7"}.fa-bomb:before{content:"\f1e2"}.fa-bone:before{content:"\f5d7"}.fa-bong:before{content:"\f55c"}.fa-book:before{content:"\f02d"}.fa-book-dead:before{content:"\f6b7"}.fa-book-medical:before{content:"\f7e6"}.fa-book-open:before{content:"\f518"}.fa-book-reader:before{content:"\f5da"}.fa-bookmark:before{content:"\f02e"}.fa-bowling-ball:before{content:"\f436"}.fa-box:before{content:"\f466"}.fa-box-open:before{content:"\f49e"}.fa-boxes:before{content:"\f468"}.fa-braille:before{content:"\f2a1"}.fa-brain:before{content:"\f5dc"}.fa-bread-slice:before{content:"\f7ec"}.fa-briefcase:before{content:"\f0b1"}.fa-briefcase-medical:before{content:"\f469"}.fa-broadcast-tower:before{content:"\f519"}.fa-broom:before{content:"\f51a"}.fa-brush:before{content:"\f55d"}.fa-btc:before{content:"\f15a"}.fa-bug:before{content:"\f188"}.fa-building:before{content:"\f1ad"}.fa-bullhorn:before{content:"\f0a1"}.fa-bullseye:before{content:"\f140"}.fa-burn:before{content:"\f46a"}.fa-buromobelexperte:before{content:"\f37f"}.fa-bus:before{content:"\f207"}.fa-bus-alt:before{content:"\f55e"}.fa-business-time:before{content:"\f64a"}.fa-buysellads:before{content:"\f20d"}.fa-calculator:before{content:"\f1ec"}.fa-calendar:before{content:"\f133"}.fa-calendar-alt:before{content:"\f073"}.fa-calendar-check:before{content:"\f274"}.fa-calendar-day:before{content:"\f783"}.fa-calendar-minus:before{content:"\f272"}.fa-calendar-plus:before{content:"\f271"}.fa-calendar-times:before{content:"\f273"}.fa-calendar-week:before{content:"\f784"}.fa-camera:before{content:"\f030"}.fa-camera-retro:before{content:"\f083"}.fa-campground:before{content:"\f6bb"}.fa-canadian-maple-leaf:before{content:"\f785"}.fa-candy-cane:before{content:"\f786"}.fa-cannabis:before{content:"\f55f"}.fa-capsules:before{content:"\f46b"}.fa-car:before{content:"\f1b9"}.fa-car-alt:before{content:"\f5de"}.fa-car-battery:before{content:"\f5df"}.fa-car-crash:before{content:"\f5e1"}.fa-car-side:before{content:"\f5e4"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-caret-square-down:before{content:"\f150"}.fa-caret-square-left:before{content:"\f191"}.fa-caret-square-right:before{content:"\f152"}.fa-caret-square-up:before{content:"\f151"}.fa-caret-up:before{content:"\f0d8"}.fa-carrot:before{content:"\f787"}.fa-cart-arrow-down:before{content:"\f218"}.fa-cart-plus:before{content:"\f217"}.fa-cash-register:before{content:"\f788"}.fa-cat:before{content:"\f6be"}.fa-cc-amazon-pay:before{content:"\f42d"}.fa-cc-amex:before{content:"\f1f3"}.fa-cc-apple-pay:before{content:"\f416"}.fa-cc-diners-club:before{content:"\f24c"}.fa-cc-discover:before{content:"\f1f2"}.fa-cc-jcb:before{content:"\f24b"}.fa-cc-mastercard:before{content:"\f1f1"}.fa-cc-paypal:before{content:"\f1f4"}.fa-cc-stripe:before{content:"\f1f5"}.fa-cc-visa:before{content:"\f1f0"}.fa-centercode:before{content:"\f380"}.fa-centos:before{content:"\f789"}.fa-certificate:before{content:"\f0a3"}.fa-chair:before{content:"\f6c0"}.fa-chalkboard:before{content:"\f51b"}.fa-chalkboard-teacher:before{content:"\f51c"}.fa-charging-station:before{content:"\f5e7"}.fa-chart-area:before{content:"\f1fe"}.fa-chart-bar:before{content:"\f080"}.fa-chart-line:before{content:"\f201"}.fa-chart-pie:before{content:"\f200"}.fa-check:before{content:"\f00c"}.fa-check-circle:before{content:"\f058"}.fa-check-double:before{content:"\f560"}.fa-check-square:before{content:"\f14a"}.fa-cheese:before{content:"\f7ef"}.fa-chess:before{content:"\f439"}.fa-chess-bishop:before{content:"\f43a"}.fa-chess-board:before{content:"\f43c"}.fa-chess-king:before{content:"\f43f"}.fa-chess-knight:before{content:"\f441"}.fa-chess-pawn:before{content:"\f443"}.fa-chess-queen:before{content:"\f445"}.fa-chess-rook:before{content:"\f447"}.fa-chevron-circle-down:before{content:"\f13a"}.fa-chevron-circle-left:before{content:"\f137"}.fa-chevron-circle-right:before{content:"\f138"}.fa-chevron-circle-up:before{content:"\f139"}.fa-chevron-down:before{content:"\f078"}.fa-chevron-left:before{content:"\f053"}.fa-chevron-right:before{content:"\f054"}.fa-chevron-up:before{content:"\f077"}.fa-child:before{content:"\f1ae"}.fa-chrome:before{content:"\f268"}.fa-church:before{content:"\f51d"}.fa-circle:before{content:"\f111"}.fa-circle-notch:before{content:"\f1ce"}.fa-city:before{content:"\f64f"}.fa-clinic-medical:before{content:"\f7f2"}.fa-clipboard:before{content:"\f328"}.fa-clipboard-check:before{content:"\f46c"}.fa-clipboard-list:before{content:"\f46d"}.fa-clock:before{content:"\f017"}.fa-clone:before{content:"\f24d"}.fa-closed-captioning:before{content:"\f20a"}.fa-cloud:before{content:"\f0c2"}.fa-cloud-download-alt:before{content:"\f381"}.fa-cloud-meatball:before{content:"\f73b"}.fa-cloud-moon:before{content:"\f6c3"}.fa-cloud-moon-rain:before{content:"\f73c"}.fa-cloud-rain:before{content:"\f73d"}.fa-cloud-showers-heavy:before{content:"\f740"}.fa-cloud-sun:before{content:"\f6c4"}.fa-cloud-sun-rain:before{content:"\f743"}.fa-cloud-upload-alt:before{content:"\f382"}.fa-cloudscale:before{content:"\f383"}.fa-cloudsmith:before{content:"\f384"}.fa-cloudversify:before{content:"\f385"}.fa-cocktail:before{content:"\f561"}.fa-code:before{content:"\f121"}.fa-code-branch:before{content:"\f126"}.fa-codepen:before{content:"\f1cb"}.fa-codiepie:before{content:"\f284"}.fa-coffee:before{content:"\f0f4"}.fa-cog:before{content:"\f013"}.fa-cogs:before{content:"\f085"}.fa-coins:before{content:"\f51e"}.fa-columns:before{content:"\f0db"}.fa-comment:before{content:"\f075"}.fa-comment-alt:before{content:"\f27a"}.fa-comment-dollar:before{content:"\f651"}.fa-comment-dots:before{content:"\f4ad"}.fa-comment-medical:before{content:"\f7f5"}.fa-comment-slash:before{content:"\f4b3"}.fa-comments:before{content:"\f086"}.fa-comments-dollar:before{content:"\f653"}.fa-compact-disc:before{content:"\f51f"}.fa-compass:before{content:"\f14e"}.fa-compress:before{content:"\f066"}.fa-compress-arrows-alt:before{content:"\f78c"}.fa-concierge-bell:before{content:"\f562"}.fa-confluence:before{content:"\f78d"}.fa-connectdevelop:before{content:"\f20e"}.fa-contao:before{content:"\f26d"}.fa-cookie:before{content:"\f563"}.fa-cookie-bite:before{content:"\f564"}.fa-copy:before{content:"\f0c5"}.fa-copyright:before{content:"\f1f9"}.fa-couch:before{content:"\f4b8"}.fa-cpanel:before{content:"\f388"}.fa-creative-commons:before{content:"\f25e"}.fa-creative-commons-by:before{content:"\f4e7"}.fa-creative-commons-nc:before{content:"\f4e8"}.fa-creative-commons-nc-eu:before{content:"\f4e9"}.fa-creative-commons-nc-jp:before{content:"\f4ea"}.fa-creative-commons-nd:before{content:"\f4eb"}.fa-creative-commons-pd:before{content:"\f4ec"}.fa-creative-commons-pd-alt:before{content:"\f4ed"}.fa-creative-commons-remix:before{content:"\f4ee"}.fa-creative-commons-sa:before{content:"\f4ef"}.fa-creative-commons-sampling:before{content:"\f4f0"}.fa-creative-commons-sampling-plus:before{content:"\f4f1"}.fa-creative-commons-share:before{content:"\f4f2"}.fa-creative-commons-zero:before{content:"\f4f3"}.fa-credit-card:before{content:"\f09d"}.fa-critical-role:before{content:"\f6c9"}.fa-crop:before{content:"\f125"}.fa-crop-alt:before{content:"\f565"}.fa-cross:before{content:"\f654"}.fa-crosshairs:before{content:"\f05b"}.fa-crow:before{content:"\f520"}.fa-crown:before{content:"\f521"}.fa-crutch:before{content:"\f7f7"}.fa-css3:before{content:"\f13c"}.fa-css3-alt:before{content:"\f38b"}.fa-cube:before{content:"\f1b2"}.fa-cubes:before{content:"\f1b3"}.fa-cut:before{content:"\f0c4"}.fa-cuttlefish:before{content:"\f38c"}.fa-d-and-d:before{content:"\f38d"}.fa-d-and-d-beyond:before{content:"\f6ca"}.fa-dashcube:before{content:"\f210"}.fa-database:before{content:"\f1c0"}.fa-deaf:before{content:"\f2a4"}.fa-delicious:before{content:"\f1a5"}.fa-democrat:before{content:"\f747"}.fa-deploydog:before{content:"\f38e"}.fa-deskpro:before{content:"\f38f"}.fa-desktop:before{content:"\f108"}.fa-dev:before{content:"\f6cc"}.fa-deviantart:before{content:"\f1bd"}.fa-dharmachakra:before{content:"\f655"}.fa-dhl:before{content:"\f790"}.fa-diagnoses:before{content:"\f470"}.fa-diaspora:before{content:"\f791"}.fa-dice:before{content:"\f522"}.fa-dice-d20:before{content:"\f6cf"}.fa-dice-d6:before{content:"\f6d1"}.fa-dice-five:before{content:"\f523"}.fa-dice-four:before{content:"\f524"}.fa-dice-one:before{content:"\f525"}.fa-dice-six:before{content:"\f526"}.fa-dice-three:before{content:"\f527"}.fa-dice-two:before{content:"\f528"}.fa-digg:before{content:"\f1a6"}.fa-digital-ocean:before{content:"\f391"}.fa-digital-tachograph:before{content:"\f566"}.fa-directions:before{content:"\f5eb"}.fa-discord:before{content:"\f392"}.fa-discourse:before{content:"\f393"}.fa-divide:before{content:"\f529"}.fa-dizzy:before{content:"\f567"}.fa-dna:before{content:"\f471"}.fa-dochub:before{content:"\f394"}.fa-docker:before{content:"\f395"}.fa-dog:before{content:"\f6d3"}.fa-dollar-sign:before{content:"\f155"}.fa-dolly:before{content:"\f472"}.fa-dolly-flatbed:before{content:"\f474"}.fa-donate:before{content:"\f4b9"}.fa-door-closed:before{content:"\f52a"}.fa-door-open:before{content:"\f52b"}.fa-dot-circle:before{content:"\f192"}.fa-dove:before{content:"\f4ba"}.fa-download:before{content:"\f019"}.fa-draft2digital:before{content:"\f396"}.fa-drafting-compass:before{content:"\f568"}.fa-dragon:before{content:"\f6d5"}.fa-draw-polygon:before{content:"\f5ee"}.fa-dribbble:before{content:"\f17d"}.fa-dribbble-square:before{content:"\f397"}.fa-dropbox:before{content:"\f16b"}.fa-drum:before{content:"\f569"}.fa-drum-steelpan:before{content:"\f56a"}.fa-drumstick-bite:before{content:"\f6d7"}.fa-drupal:before{content:"\f1a9"}.fa-dumbbell:before{content:"\f44b"}.fa-dumpster:before{content:"\f793"}.fa-dumpster-fire:before{content:"\f794"}.fa-dungeon:before{content:"\f6d9"}.fa-dyalog:before{content:"\f399"}.fa-earlybirds:before{content:"\f39a"}.fa-ebay:before{content:"\f4f4"}.fa-edge:before{content:"\f282"}.fa-edit:before{content:"\f044"}.fa-egg:before{content:"\f7fb"}.fa-eject:before{content:"\f052"}.fa-elementor:before{content:"\f430"}.fa-ellipsis-h:before{content:"\f141"}.fa-ellipsis-v:before{content:"\f142"}.fa-ello:before{content:"\f5f1"}.fa-ember:before{content:"\f423"}.fa-empire:before{content:"\f1d1"}.fa-envelope:before{content:"\f0e0"}.fa-envelope-open:before{content:"\f2b6"}.fa-envelope-open-text:before{content:"\f658"}.fa-envelope-square:before{content:"\f199"}.fa-envira:before{content:"\f299"}.fa-equals:before{content:"\f52c"}.fa-eraser:before{content:"\f12d"}.fa-erlang:before{content:"\f39d"}.fa-ethereum:before{content:"\f42e"}.fa-ethernet:before{content:"\f796"}.fa-etsy:before{content:"\f2d7"}.fa-euro-sign:before{content:"\f153"}.fa-exchange-alt:before{content:"\f362"}.fa-exclamation:before{content:"\f12a"}.fa-exclamation-circle:before{content:"\f06a"}.fa-exclamation-triangle:before{content:"\f071"}.fa-expand:before{content:"\f065"}.fa-expand-arrows-alt:before{content:"\f31e"}.fa-expeditedssl:before{content:"\f23e"}.fa-external-link-alt:before{content:"\f35d"}.fa-external-link-square-alt:before{content:"\f360"}.fa-eye:before{content:"\f06e"}.fa-eye-dropper:before{content:"\f1fb"}.fa-eye-slash:before{content:"\f070"}.fa-facebook:before{content:"\f09a"}.fa-facebook-f:before{content:"\f39e"}.fa-facebook-messenger:before{content:"\f39f"}.fa-facebook-square:before{content:"\f082"}.fa-fantasy-flight-games:before{content:"\f6dc"}.fa-fast-backward:before{content:"\f049"}.fa-fast-forward:before{content:"\f050"}.fa-fax:before{content:"\f1ac"}.fa-feather:before{content:"\f52d"}.fa-feather-alt:before{content:"\f56b"}.fa-fedex:before{content:"\f797"}.fa-fedora:before{content:"\f798"}.fa-female:before{content:"\f182"}.fa-fighter-jet:before{content:"\f0fb"}.fa-figma:before{content:"\f799"}.fa-file:before{content:"\f15b"}.fa-file-alt:before{content:"\f15c"}.fa-file-archive:before{content:"\f1c6"}.fa-file-audio:before{content:"\f1c7"}.fa-file-code:before{content:"\f1c9"}.fa-file-contract:before{content:"\f56c"}.fa-file-csv:before{content:"\f6dd"}.fa-file-download:before{content:"\f56d"}.fa-file-excel:before{content:"\f1c3"}.fa-file-export:before{content:"\f56e"}.fa-file-image:before{content:"\f1c5"}.fa-file-import:before{content:"\f56f"}.fa-file-invoice:before{content:"\f570"}.fa-file-invoice-dollar:before{content:"\f571"}.fa-file-medical:before{content:"\f477"}.fa-file-medical-alt:before{content:"\f478"}.fa-file-pdf:before{content:"\f1c1"}.fa-file-powerpoint:before{content:"\f1c4"}.fa-file-prescription:before{content:"\f572"}.fa-file-signature:before{content:"\f573"}.fa-file-upload:before{content:"\f574"}.fa-file-video:before{content:"\f1c8"}.fa-file-word:before{content:"\f1c2"}.fa-fill:before{content:"\f575"}.fa-fill-drip:before{content:"\f576"}.fa-film:before{content:"\f008"}.fa-filter:before{content:"\f0b0"}.fa-fingerprint:before{content:"\f577"}.fa-fire:before{content:"\f06d"}.fa-fire-alt:before{content:"\f7e4"}.fa-fire-extinguisher:before{content:"\f134"}.fa-firefox:before{content:"\f269"}.fa-first-aid:before{content:"\f479"}.fa-first-order:before{content:"\f2b0"}.fa-first-order-alt:before{content:"\f50a"}.fa-firstdraft:before{content:"\f3a1"}.fa-fish:before{content:"\f578"}.fa-fist-raised:before{content:"\f6de"}.fa-flag:before{content:"\f024"}.fa-flag-checkered:before{content:"\f11e"}.fa-flag-usa:before{content:"\f74d"}.fa-flask:before{content:"\f0c3"}.fa-flickr:before{content:"\f16e"}.fa-flipboard:before{content:"\f44d"}.fa-flushed:before{content:"\f579"}.fa-fly:before{content:"\f417"}.fa-folder:before{content:"\f07b"}.fa-folder-minus:before{content:"\f65d"}.fa-folder-open:before{content:"\f07c"}.fa-folder-plus:before{content:"\f65e"}.fa-font:before{content:"\f031"}.fa-font-awesome:before{content:"\f2b4"}.fa-font-awesome-alt:before{content:"\f35c"}.fa-font-awesome-flag:before{content:"\f425"}.fa-font-awesome-logo-full:before{content:"\f4e6"}.fa-fonticons:before{content:"\f280"}.fa-fonticons-fi:before{content:"\f3a2"}.fa-football-ball:before{content:"\f44e"}.fa-fort-awesome:before{content:"\f286"}.fa-fort-awesome-alt:before{content:"\f3a3"}.fa-forumbee:before{content:"\f211"}.fa-forward:before{content:"\f04e"}.fa-foursquare:before{content:"\f180"}.fa-free-code-camp:before{content:"\f2c5"}.fa-freebsd:before{content:"\f3a4"}.fa-frog:before{content:"\f52e"}.fa-frown:before{content:"\f119"}.fa-frown-open:before{content:"\f57a"}.fa-fulcrum:before{content:"\f50b"}.fa-funnel-dollar:before{content:"\f662"}.fa-futbol:before{content:"\f1e3"}.fa-galactic-republic:before{content:"\f50c"}.fa-galactic-senate:before{content:"\f50d"}.fa-gamepad:before{content:"\f11b"}.fa-gas-pump:before{content:"\f52f"}.fa-gavel:before{content:"\f0e3"}.fa-gem:before{content:"\f3a5"}.fa-genderless:before{content:"\f22d"}.fa-get-pocket:before{content:"\f265"}.fa-gg:before{content:"\f260"}.fa-gg-circle:before{content:"\f261"}.fa-ghost:before{content:"\f6e2"}.fa-gift:before{content:"\f06b"}.fa-gifts:before{content:"\f79c"}.fa-git:before{content:"\f1d3"}.fa-git-square:before{content:"\f1d2"}.fa-github:before{content:"\f09b"}.fa-github-alt:before{content:"\f113"}.fa-github-square:before{content:"\f092"}.fa-gitkraken:before{content:"\f3a6"}.fa-gitlab:before{content:"\f296"}.fa-gitter:before{content:"\f426"}.fa-glass-cheers:before{content:"\f79f"}.fa-glass-martini:before{content:"\f000"}.fa-glass-martini-alt:before{content:"\f57b"}.fa-glass-whiskey:before{content:"\f7a0"}.fa-glasses:before{content:"\f530"}.fa-glide:before{content:"\f2a5"}.fa-glide-g:before{content:"\f2a6"}.fa-globe:before{content:"\f0ac"}.fa-globe-africa:before{content:"\f57c"}.fa-globe-americas:before{content:"\f57d"}.fa-globe-asia:before{content:"\f57e"}.fa-globe-europe:before{content:"\f7a2"}.fa-gofore:before{content:"\f3a7"}.fa-golf-ball:before{content:"\f450"}.fa-goodreads:before{content:"\f3a8"}.fa-goodreads-g:before{content:"\f3a9"}.fa-google:before{content:"\f1a0"}.fa-google-drive:before{content:"\f3aa"}.fa-google-play:before{content:"\f3ab"}.fa-google-plus:before{content:"\f2b3"}.fa-google-plus-g:before{content:"\f0d5"}.fa-google-plus-square:before{content:"\f0d4"}.fa-google-wallet:before{content:"\f1ee"}.fa-gopuram:before{content:"\f664"}.fa-graduation-cap:before{content:"\f19d"}.fa-gratipay:before{content:"\f184"}.fa-grav:before{content:"\f2d6"}.fa-greater-than:before{content:"\f531"}.fa-greater-than-equal:before{content:"\f532"}.fa-grimace:before{content:"\f57f"}.fa-grin:before{content:"\f580"}.fa-grin-alt:before{content:"\f581"}.fa-grin-beam:before{content:"\f582"}.fa-grin-beam-sweat:before{content:"\f583"}.fa-grin-hearts:before{content:"\f584"}.fa-grin-squint:before{content:"\f585"}.fa-grin-squint-tears:before{content:"\f586"}.fa-grin-stars:before{content:"\f587"}.fa-grin-tears:before{content:"\f588"}.fa-grin-tongue:before{content:"\f589"}.fa-grin-tongue-squint:before{content:"\f58a"}.fa-grin-tongue-wink:before{content:"\f58b"}.fa-grin-wink:before{content:"\f58c"}.fa-grip-horizontal:before{content:"\f58d"}.fa-grip-lines:before{content:"\f7a4"}.fa-grip-lines-vertical:before{content:"\f7a5"}.fa-grip-vertical:before{content:"\f58e"}.fa-gripfire:before{content:"\f3ac"}.fa-grunt:before{content:"\f3ad"}.fa-guitar:before{content:"\f7a6"}.fa-gulp:before{content:"\f3ae"}.fa-h-square:before{content:"\f0fd"}.fa-hacker-news:before{content:"\f1d4"}.fa-hacker-news-square:before{content:"\f3af"}.fa-hackerrank:before{content:"\f5f7"}.fa-hamburger:before{content:"\f805"}.fa-hammer:before{content:"\f6e3"}.fa-hamsa:before{content:"\f665"}.fa-hand-holding:before{content:"\f4bd"}.fa-hand-holding-heart:before{content:"\f4be"}.fa-hand-holding-usd:before{content:"\f4c0"}.fa-hand-lizard:before{content:"\f258"}.fa-hand-middle-finger:before{content:"\f806"}.fa-hand-paper:before{content:"\f256"}.fa-hand-peace:before{content:"\f25b"}.fa-hand-point-down:before{content:"\f0a7"}.fa-hand-point-left:before{content:"\f0a5"}.fa-hand-point-right:before{content:"\f0a4"}.fa-hand-point-up:before{content:"\f0a6"}.fa-hand-pointer:before{content:"\f25a"}.fa-hand-rock:before{content:"\f255"}.fa-hand-scissors:before{content:"\f257"}.fa-hand-spock:before{content:"\f259"}.fa-hands:before{content:"\f4c2"}.fa-hands-helping:before{content:"\f4c4"}.fa-handshake:before{content:"\f2b5"}.fa-hanukiah:before{content:"\f6e6"}.fa-hard-hat:before{content:"\f807"}.fa-hashtag:before{content:"\f292"}.fa-hat-wizard:before{content:"\f6e8"}.fa-haykal:before{content:"\f666"}.fa-hdd:before{content:"\f0a0"}.fa-heading:before{content:"\f1dc"}.fa-headphones:before{content:"\f025"}.fa-headphones-alt:before{content:"\f58f"}.fa-headset:before{content:"\f590"}.fa-heart:before{content:"\f004"}.fa-heart-broken:before{content:"\f7a9"}.fa-heartbeat:before{content:"\f21e"}.fa-helicopter:before{content:"\f533"}.fa-highlighter:before{content:"\f591"}.fa-hiking:before{content:"\f6ec"}.fa-hippo:before{content:"\f6ed"}.fa-hips:before{content:"\f452"}.fa-hire-a-helper:before{content:"\f3b0"}.fa-history:before{content:"\f1da"}.fa-hockey-puck:before{content:"\f453"}.fa-holly-berry:before{content:"\f7aa"}.fa-home:before{content:"\f015"}.fa-hooli:before{content:"\f427"}.fa-hornbill:before{content:"\f592"}.fa-horse:before{content:"\f6f0"}.fa-horse-head:before{content:"\f7ab"}.fa-hospital:before{content:"\f0f8"}.fa-hospital-alt:before{content:"\f47d"}.fa-hospital-symbol:before{content:"\f47e"}.fa-hot-tub:before{content:"\f593"}.fa-hotdog:before{content:"\f80f"}.fa-hotel:before{content:"\f594"}.fa-hotjar:before{content:"\f3b1"}.fa-hourglass:before{content:"\f254"}.fa-hourglass-end:before{content:"\f253"}.fa-hourglass-half:before{content:"\f252"}.fa-hourglass-start:before{content:"\f251"}.fa-house-damage:before{content:"\f6f1"}.fa-houzz:before{content:"\f27c"}.fa-hryvnia:before{content:"\f6f2"}.fa-html5:before{content:"\f13b"}.fa-hubspot:before{content:"\f3b2"}.fa-i-cursor:before{content:"\f246"}.fa-ice-cream:before{content:"\f810"}.fa-icicles:before{content:"\f7ad"}.fa-id-badge:before{content:"\f2c1"}.fa-id-card:before{content:"\f2c2"}.fa-id-card-alt:before{content:"\f47f"}.fa-igloo:before{content:"\f7ae"}.fa-image:before{content:"\f03e"}.fa-images:before{content:"\f302"}.fa-imdb:before{content:"\f2d8"}.fa-inbox:before{content:"\f01c"}.fa-indent:before{content:"\f03c"}.fa-industry:before{content:"\f275"}.fa-infinity:before{content:"\f534"}.fa-info:before{content:"\f129"}.fa-info-circle:before{content:"\f05a"}.fa-instagram:before{content:"\f16d"}.fa-intercom:before{content:"\f7af"}.fa-internet-explorer:before{content:"\f26b"}.fa-invision:before{content:"\f7b0"}.fa-ioxhost:before{content:"\f208"}.fa-italic:before{content:"\f033"}.fa-itunes:before{content:"\f3b4"}.fa-itunes-note:before{content:"\f3b5"}.fa-java:before{content:"\f4e4"}.fa-jedi:before{content:"\f669"}.fa-jedi-order:before{content:"\f50e"}.fa-jenkins:before{content:"\f3b6"}.fa-jira:before{content:"\f7b1"}.fa-joget:before{content:"\f3b7"}.fa-joint:before{content:"\f595"}.fa-joomla:before{content:"\f1aa"}.fa-journal-whills:before{content:"\f66a"}.fa-js:before{content:"\f3b8"}.fa-js-square:before{content:"\f3b9"}.fa-jsfiddle:before{content:"\f1cc"}.fa-kaaba:before{content:"\f66b"}.fa-kaggle:before{content:"\f5fa"}.fa-key:before{content:"\f084"}.fa-keybase:before{content:"\f4f5"}.fa-keyboard:before{content:"\f11c"}.fa-keycdn:before{content:"\f3ba"}.fa-khanda:before{content:"\f66d"}.fa-kickstarter:before{content:"\f3bb"}.fa-kickstarter-k:before{content:"\f3bc"}.fa-kiss:before{content:"\f596"}.fa-kiss-beam:before{content:"\f597"}.fa-kiss-wink-heart:before{content:"\f598"}.fa-kiwi-bird:before{content:"\f535"}.fa-korvue:before{content:"\f42f"}.fa-landmark:before{content:"\f66f"}.fa-language:before{content:"\f1ab"}.fa-laptop:before{content:"\f109"}.fa-laptop-code:before{content:"\f5fc"}.fa-laptop-medical:before{content:"\f812"}.fa-laravel:before{content:"\f3bd"}.fa-lastfm:before{content:"\f202"}.fa-lastfm-square:before{content:"\f203"}.fa-laugh:before{content:"\f599"}.fa-laugh-beam:before{content:"\f59a"}.fa-laugh-squint:before{content:"\f59b"}.fa-laugh-wink:before{content:"\f59c"}.fa-layer-group:before{content:"\f5fd"}.fa-leaf:before{content:"\f06c"}.fa-leanpub:before{content:"\f212"}.fa-lemon:before{content:"\f094"}.fa-less:before{content:"\f41d"}.fa-less-than:before{content:"\f536"}.fa-less-than-equal:before{content:"\f537"}.fa-level-down-alt:before{content:"\f3be"}.fa-level-up-alt:before{content:"\f3bf"}.fa-life-ring:before{content:"\f1cd"}.fa-lightbulb:before{content:"\f0eb"}.fa-line:before{content:"\f3c0"}.fa-link:before{content:"\f0c1"}.fa-linkedin:before{content:"\f08c"}.fa-linkedin-in:before{content:"\f0e1"}.fa-linode:before{content:"\f2b8"}.fa-linux:before{content:"\f17c"}.fa-lira-sign:before{content:"\f195"}.fa-list:before{content:"\f03a"}.fa-list-alt:before{content:"\f022"}.fa-list-ol:before{content:"\f0cb"}.fa-list-ul:before{content:"\f0ca"}.fa-location-arrow:before{content:"\f124"}.fa-lock:before{content:"\f023"}.fa-lock-open:before{content:"\f3c1"}.fa-long-arrow-alt-down:before{content:"\f309"}.fa-long-arrow-alt-left:before{content:"\f30a"}.fa-long-arrow-alt-right:before{content:"\f30b"}.fa-long-arrow-alt-up:before{content:"\f30c"}.fa-low-vision:before{content:"\f2a8"}.fa-luggage-cart:before{content:"\f59d"}.fa-lyft:before{content:"\f3c3"}.fa-magento:before{content:"\f3c4"}.fa-magic:before{content:"\f0d0"}.fa-magnet:before{content:"\f076"}.fa-mail-bulk:before{content:"\f674"}.fa-mailchimp:before{content:"\f59e"}.fa-male:before{content:"\f183"}.fa-mandalorian:before{content:"\f50f"}.fa-map:before{content:"\f279"}.fa-map-marked:before{content:"\f59f"}.fa-map-marked-alt:before{content:"\f5a0"}.fa-map-marker:before{content:"\f041"}.fa-map-marker-alt:before{content:"\f3c5"}.fa-map-pin:before{content:"\f276"}.fa-map-signs:before{content:"\f277"}.fa-markdown:before{content:"\f60f"}.fa-marker:before{content:"\f5a1"}.fa-mars:before{content:"\f222"}.fa-mars-double:before{content:"\f227"}.fa-mars-stroke:before{content:"\f229"}.fa-mars-stroke-h:before{content:"\f22b"}.fa-mars-stroke-v:before{content:"\f22a"}.fa-mask:before{content:"\f6fa"}.fa-mastodon:before{content:"\f4f6"}.fa-maxcdn:before{content:"\f136"}.fa-medal:before{content:"\f5a2"}.fa-medapps:before{content:"\f3c6"}.fa-medium:before{content:"\f23a"}.fa-medium-m:before{content:"\f3c7"}.fa-medkit:before{content:"\f0fa"}.fa-medrt:before{content:"\f3c8"}.fa-meetup:before{content:"\f2e0"}.fa-megaport:before{content:"\f5a3"}.fa-meh:before{content:"\f11a"}.fa-meh-blank:before{content:"\f5a4"}.fa-meh-rolling-eyes:before{content:"\f5a5"}.fa-memory:before{content:"\f538"}.fa-mendeley:before{content:"\f7b3"}.fa-menorah:before{content:"\f676"}.fa-mercury:before{content:"\f223"}.fa-meteor:before{content:"\f753"}.fa-microchip:before{content:"\f2db"}.fa-microphone:before{content:"\f130"}.fa-microphone-alt:before{content:"\f3c9"}.fa-microphone-alt-slash:before{content:"\f539"}.fa-microphone-slash:before{content:"\f131"}.fa-microscope:before{content:"\f610"}.fa-microsoft:before{content:"\f3ca"}.fa-minus:before{content:"\f068"}.fa-minus-circle:before{content:"\f056"}.fa-minus-square:before{content:"\f146"}.fa-mitten:before{content:"\f7b5"}.fa-mix:before{content:"\f3cb"}.fa-mixcloud:before{content:"\f289"}.fa-mizuni:before{content:"\f3cc"}.fa-mobile:before{content:"\f10b"}.fa-mobile-alt:before{content:"\f3cd"}.fa-modx:before{content:"\f285"}.fa-monero:before{content:"\f3d0"}.fa-money-bill:before{content:"\f0d6"}.fa-money-bill-alt:before{content:"\f3d1"}.fa-money-bill-wave:before{content:"\f53a"}.fa-money-bill-wave-alt:before{content:"\f53b"}.fa-money-check:before{content:"\f53c"}.fa-money-check-alt:before{content:"\f53d"}.fa-monument:before{content:"\f5a6"}.fa-moon:before{content:"\f186"}.fa-mortar-pestle:before{content:"\f5a7"}.fa-mosque:before{content:"\f678"}.fa-motorcycle:before{content:"\f21c"}.fa-mountain:before{content:"\f6fc"}.fa-mouse-pointer:before{content:"\f245"}.fa-mug-hot:before{content:"\f7b6"}.fa-music:before{content:"\f001"}.fa-napster:before{content:"\f3d2"}.fa-neos:before{content:"\f612"}.fa-network-wired:before{content:"\f6ff"}.fa-neuter:before{content:"\f22c"}.fa-newspaper:before{content:"\f1ea"}.fa-nimblr:before{content:"\f5a8"}.fa-nintendo-switch:before{content:"\f418"}.fa-node:before{content:"\f419"}.fa-node-js:before{content:"\f3d3"}.fa-not-equal:before{content:"\f53e"}.fa-notes-medical:before{content:"\f481"}.fa-npm:before{content:"\f3d4"}.fa-ns8:before{content:"\f3d5"}.fa-nutritionix:before{content:"\f3d6"}.fa-object-group:before{content:"\f247"}.fa-object-ungroup:before{content:"\f248"}.fa-odnoklassniki:before{content:"\f263"}.fa-odnoklassniki-square:before{content:"\f264"}.fa-oil-can:before{content:"\f613"}.fa-old-republic:before{content:"\f510"}.fa-om:before{content:"\f679"}.fa-opencart:before{content:"\f23d"}.fa-openid:before{content:"\f19b"}.fa-opera:before{content:"\f26a"}.fa-optin-monster:before{content:"\f23c"}.fa-osi:before{content:"\f41a"}.fa-otter:before{content:"\f700"}.fa-outdent:before{content:"\f03b"}.fa-page4:before{content:"\f3d7"}.fa-pagelines:before{content:"\f18c"}.fa-pager:before{content:"\f815"}.fa-paint-brush:before{content:"\f1fc"}.fa-paint-roller:before{content:"\f5aa"}.fa-palette:before{content:"\f53f"}.fa-palfed:before{content:"\f3d8"}.fa-pallet:before{content:"\f482"}.fa-paper-plane:before{content:"\f1d8"}.fa-paperclip:before{content:"\f0c6"}.fa-parachute-box:before{content:"\f4cd"}.fa-paragraph:before{content:"\f1dd"}.fa-parking:before{content:"\f540"}.fa-passport:before{content:"\f5ab"}.fa-pastafarianism:before{content:"\f67b"}.fa-paste:before{content:"\f0ea"}.fa-patreon:before{content:"\f3d9"}.fa-pause:before{content:"\f04c"}.fa-pause-circle:before{content:"\f28b"}.fa-paw:before{content:"\f1b0"}.fa-paypal:before{content:"\f1ed"}.fa-peace:before{content:"\f67c"}.fa-pen:before{content:"\f304"}.fa-pen-alt:before{content:"\f305"}.fa-pen-fancy:before{content:"\f5ac"}.fa-pen-nib:before{content:"\f5ad"}.fa-pen-square:before{content:"\f14b"}.fa-pencil-alt:before{content:"\f303"}.fa-pencil-ruler:before{content:"\f5ae"}.fa-penny-arcade:before{content:"\f704"}.fa-people-carry:before{content:"\f4ce"}.fa-pepper-hot:before{content:"\f816"}.fa-percent:before{content:"\f295"}.fa-percentage:before{content:"\f541"}.fa-periscope:before{content:"\f3da"}.fa-person-booth:before{content:"\f756"}.fa-phabricator:before{content:"\f3db"}.fa-phoenix-framework:before{content:"\f3dc"}.fa-phoenix-squadron:before{content:"\f511"}.fa-phone:before{content:"\f095"}.fa-phone-slash:before{content:"\f3dd"}.fa-phone-square:before{content:"\f098"}.fa-phone-volume:before{content:"\f2a0"}.fa-php:before{content:"\f457"}.fa-pied-piper:before{content:"\f2ae"}.fa-pied-piper-alt:before{content:"\f1a8"}.fa-pied-piper-hat:before{content:"\f4e5"}.fa-pied-piper-pp:before{content:"\f1a7"}.fa-piggy-bank:before{content:"\f4d3"}.fa-pills:before{content:"\f484"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-p:before{content:"\f231"}.fa-pinterest-square:before{content:"\f0d3"}.fa-pizza-slice:before{content:"\f818"}.fa-place-of-worship:before{content:"\f67f"}.fa-plane:before{content:"\f072"}.fa-plane-arrival:before{content:"\f5af"}.fa-plane-departure:before{content:"\f5b0"}.fa-play:before{content:"\f04b"}.fa-play-circle:before{content:"\f144"}.fa-playstation:before{content:"\f3df"}.fa-plug:before{content:"\f1e6"}.fa-plus:before{content:"\f067"}.fa-plus-circle:before{content:"\f055"}.fa-plus-square:before{content:"\f0fe"}.fa-podcast:before{content:"\f2ce"}.fa-poll:before{content:"\f681"}.fa-poll-h:before{content:"\f682"}.fa-poo:before{content:"\f2fe"}.fa-poo-storm:before{content:"\f75a"}.fa-poop:before{content:"\f619"}.fa-portrait:before{content:"\f3e0"}.fa-pound-sign:before{content:"\f154"}.fa-power-off:before{content:"\f011"}.fa-pray:before{content:"\f683"}.fa-praying-hands:before{content:"\f684"}.fa-prescription:before{content:"\f5b1"}.fa-prescription-bottle:before{content:"\f485"}.fa-prescription-bottle-alt:before{content:"\f486"}.fa-print:before{content:"\f02f"}.fa-procedures:before{content:"\f487"}.fa-product-hunt:before{content:"\f288"}.fa-project-diagram:before{content:"\f542"}.fa-pushed:before{content:"\f3e1"}.fa-puzzle-piece:before{content:"\f12e"}.fa-python:before{content:"\f3e2"}.fa-qq:before{content:"\f1d6"}.fa-qrcode:before{content:"\f029"}.fa-question:before{content:"\f128"}.fa-question-circle:before{content:"\f059"}.fa-quidditch:before{content:"\f458"}.fa-quinscape:before{content:"\f459"}.fa-quora:before{content:"\f2c4"}.fa-quote-left:before{content:"\f10d"}.fa-quote-right:before{content:"\f10e"}.fa-quran:before{content:"\f687"}.fa-r-project:before{content:"\f4f7"}.fa-radiation:before{content:"\f7b9"}.fa-radiation-alt:before{content:"\f7ba"}.fa-rainbow:before{content:"\f75b"}.fa-random:before{content:"\f074"}.fa-raspberry-pi:before{content:"\f7bb"}.fa-ravelry:before{content:"\f2d9"}.fa-react:before{content:"\f41b"}.fa-reacteurope:before{content:"\f75d"}.fa-readme:before{content:"\f4d5"}.fa-rebel:before{content:"\f1d0"}.fa-receipt:before{content:"\f543"}.fa-recycle:before{content:"\f1b8"}.fa-red-river:before{content:"\f3e3"}.fa-reddit:before{content:"\f1a1"}.fa-reddit-alien:before{content:"\f281"}.fa-reddit-square:before{content:"\f1a2"}.fa-redhat:before{content:"\f7bc"}.fa-redo:before{content:"\f01e"}.fa-redo-alt:before{content:"\f2f9"}.fa-registered:before{content:"\f25d"}.fa-renren:before{content:"\f18b"}.fa-reply:before{content:"\f3e5"}.fa-reply-all:before{content:"\f122"}.fa-replyd:before{content:"\f3e6"}.fa-republican:before{content:"\f75e"}.fa-researchgate:before{content:"\f4f8"}.fa-resolving:before{content:"\f3e7"}.fa-restroom:before{content:"\f7bd"}.fa-retweet:before{content:"\f079"}.fa-rev:before{content:"\f5b2"}.fa-ribbon:before{content:"\f4d6"}.fa-ring:before{content:"\f70b"}.fa-road:before{content:"\f018"}.fa-robot:before{content:"\f544"}.fa-rocket:before{content:"\f135"}.fa-rocketchat:before{content:"\f3e8"}.fa-rockrms:before{content:"\f3e9"}.fa-route:before{content:"\f4d7"}.fa-rss:before{content:"\f09e"}.fa-rss-square:before{content:"\f143"}.fa-ruble-sign:before{content:"\f158"}.fa-ruler:before{content:"\f545"}.fa-ruler-combined:before{content:"\f546"}.fa-ruler-horizontal:before{content:"\f547"}.fa-ruler-vertical:before{content:"\f548"}.fa-running:before{content:"\f70c"}.fa-rupee-sign:before{content:"\f156"}.fa-sad-cry:before{content:"\f5b3"}.fa-sad-tear:before{content:"\f5b4"}.fa-safari:before{content:"\f267"}.fa-sass:before{content:"\f41e"}.fa-satellite:before{content:"\f7bf"}.fa-satellite-dish:before{content:"\f7c0"}.fa-save:before{content:"\f0c7"}.fa-schlix:before{content:"\f3ea"}.fa-school:before{content:"\f549"}.fa-screwdriver:before{content:"\f54a"}.fa-scribd:before{content:"\f28a"}.fa-scroll:before{content:"\f70e"}.fa-sd-card:before{content:"\f7c2"}.fa-search:before{content:"\f002"}.fa-search-dollar:before{content:"\f688"}.fa-search-location:before{content:"\f689"}.fa-search-minus:before{content:"\f010"}.fa-search-plus:before{content:"\f00e"}.fa-searchengin:before{content:"\f3eb"}.fa-seedling:before{content:"\f4d8"}.fa-sellcast:before{content:"\f2da"}.fa-sellsy:before{content:"\f213"}.fa-server:before{content:"\f233"}.fa-servicestack:before{content:"\f3ec"}.fa-shapes:before{content:"\f61f"}.fa-share:before{content:"\f064"}.fa-share-alt:before{content:"\f1e0"}.fa-share-alt-square:before{content:"\f1e1"}.fa-share-square:before{content:"\f14d"}.fa-shekel-sign:before{content:"\f20b"}.fa-shield-alt:before{content:"\f3ed"}.fa-ship:before{content:"\f21a"}.fa-shipping-fast:before{content:"\f48b"}.fa-shirtsinbulk:before{content:"\f214"}.fa-shoe-prints:before{content:"\f54b"}.fa-shopping-bag:before{content:"\f290"}.fa-shopping-basket:before{content:"\f291"}.fa-shopping-cart:before{content:"\f07a"}.fa-shopware:before{content:"\f5b5"}.fa-shower:before{content:"\f2cc"}.fa-shuttle-van:before{content:"\f5b6"}.fa-sign:before{content:"\f4d9"}.fa-sign-in-alt:before{content:"\f2f6"}.fa-sign-language:before{content:"\f2a7"}.fa-sign-out-alt:before{content:"\f2f5"}.fa-signal:before{content:"\f012"}.fa-signature:before{content:"\f5b7"}.fa-sim-card:before{content:"\f7c4"}.fa-simplybuilt:before{content:"\f215"}.fa-sistrix:before{content:"\f3ee"}.fa-sitemap:before{content:"\f0e8"}.fa-sith:before{content:"\f512"}.fa-skating:before{content:"\f7c5"}.fa-sketch:before{content:"\f7c6"}.fa-skiing:before{content:"\f7c9"}.fa-skiing-nordic:before{content:"\f7ca"}.fa-skull:before{content:"\f54c"}.fa-skull-crossbones:before{content:"\f714"}.fa-skyatlas:before{content:"\f216"}.fa-skype:before{content:"\f17e"}.fa-slack:before{content:"\f198"}.fa-slack-hash:before{content:"\f3ef"}.fa-slash:before{content:"\f715"}.fa-sleigh:before{content:"\f7cc"}.fa-sliders-h:before{content:"\f1de"}.fa-slideshare:before{content:"\f1e7"}.fa-smile:before{content:"\f118"}.fa-smile-beam:before{content:"\f5b8"}.fa-smile-wink:before{content:"\f4da"}.fa-smog:before{content:"\f75f"}.fa-smoking:before{content:"\f48d"}.fa-smoking-ban:before{content:"\f54d"}.fa-sms:before{content:"\f7cd"}.fa-snapchat:before{content:"\f2ab"}.fa-snapchat-ghost:before{content:"\f2ac"}.fa-snapchat-square:before{content:"\f2ad"}.fa-snowboarding:before{content:"\f7ce"}.fa-snowflake:before{content:"\f2dc"}.fa-snowman:before{content:"\f7d0"}.fa-snowplow:before{content:"\f7d2"}.fa-socks:before{content:"\f696"}.fa-solar-panel:before{content:"\f5ba"}.fa-sort:before{content:"\f0dc"}.fa-sort-alpha-down:before{content:"\f15d"}.fa-sort-alpha-up:before{content:"\f15e"}.fa-sort-amount-down:before{content:"\f160"}.fa-sort-amount-up:before{content:"\f161"}.fa-sort-down:before{content:"\f0dd"}.fa-sort-numeric-down:before{content:"\f162"}.fa-sort-numeric-up:before{content:"\f163"}.fa-sort-up:before{content:"\f0de"}.fa-soundcloud:before{content:"\f1be"}.fa-sourcetree:before{content:"\f7d3"}.fa-spa:before{content:"\f5bb"}.fa-space-shuttle:before{content:"\f197"}.fa-speakap:before{content:"\f3f3"}.fa-spider:before{content:"\f717"}.fa-spinner:before{content:"\f110"}.fa-splotch:before{content:"\f5bc"}.fa-spotify:before{content:"\f1bc"}.fa-spray-can:before{content:"\f5bd"}.fa-square:before{content:"\f0c8"}.fa-square-full:before{content:"\f45c"}.fa-square-root-alt:before{content:"\f698"}.fa-squarespace:before{content:"\f5be"}.fa-stack-exchange:before{content:"\f18d"}.fa-stack-overflow:before{content:"\f16c"}.fa-stamp:before{content:"\f5bf"}.fa-star:before{content:"\f005"}.fa-star-and-crescent:before{content:"\f699"}.fa-star-half:before{content:"\f089"}.fa-star-half-alt:before{content:"\f5c0"}.fa-star-of-david:before{content:"\f69a"}.fa-star-of-life:before{content:"\f621"}.fa-staylinked:before{content:"\f3f5"}.fa-steam:before{content:"\f1b6"}.fa-steam-square:before{content:"\f1b7"}.fa-steam-symbol:before{content:"\f3f6"}.fa-step-backward:before{content:"\f048"}.fa-step-forward:before{content:"\f051"}.fa-stethoscope:before{content:"\f0f1"}.fa-sticker-mule:before{content:"\f3f7"}.fa-sticky-note:before{content:"\f249"}.fa-stop:before{content:"\f04d"}.fa-stop-circle:before{content:"\f28d"}.fa-stopwatch:before{content:"\f2f2"}.fa-store:before{content:"\f54e"}.fa-store-alt:before{content:"\f54f"}.fa-strava:before{content:"\f428"}.fa-stream:before{content:"\f550"}.fa-street-view:before{content:"\f21d"}.fa-strikethrough:before{content:"\f0cc"}.fa-stripe:before{content:"\f429"}.fa-stripe-s:before{content:"\f42a"}.fa-stroopwafel:before{content:"\f551"}.fa-studiovinari:before{content:"\f3f8"}.fa-stumbleupon:before{content:"\f1a4"}.fa-stumbleupon-circle:before{content:"\f1a3"}.fa-subscript:before{content:"\f12c"}.fa-subway:before{content:"\f239"}.fa-suitcase:before{content:"\f0f2"}.fa-suitcase-rolling:before{content:"\f5c1"}.fa-sun:before{content:"\f185"}.fa-superpowers:before{content:"\f2dd"}.fa-superscript:before{content:"\f12b"}.fa-supple:before{content:"\f3f9"}.fa-surprise:before{content:"\f5c2"}.fa-suse:before{content:"\f7d6"}.fa-swatchbook:before{content:"\f5c3"}.fa-swimmer:before{content:"\f5c4"}.fa-swimming-pool:before{content:"\f5c5"}.fa-synagogue:before{content:"\f69b"}.fa-sync:before{content:"\f021"}.fa-sync-alt:before{content:"\f2f1"}.fa-syringe:before{content:"\f48e"}.fa-table:before{content:"\f0ce"}.fa-table-tennis:before{content:"\f45d"}.fa-tablet:before{content:"\f10a"}.fa-tablet-alt:before{content:"\f3fa"}.fa-tablets:before{content:"\f490"}.fa-tachometer-alt:before{content:"\f3fd"}.fa-tag:before{content:"\f02b"}.fa-tags:before{content:"\f02c"}.fa-tape:before{content:"\f4db"}.fa-tasks:before{content:"\f0ae"}.fa-taxi:before{content:"\f1ba"}.fa-teamspeak:before{content:"\f4f9"}.fa-teeth:before{content:"\f62e"}.fa-teeth-open:before{content:"\f62f"}.fa-telegram:before{content:"\f2c6"}.fa-telegram-plane:before{content:"\f3fe"}.fa-temperature-high:before{content:"\f769"}.fa-temperature-low:before{content:"\f76b"}.fa-tencent-weibo:before{content:"\f1d5"}.fa-tenge:before{content:"\f7d7"}.fa-terminal:before{content:"\f120"}.fa-text-height:before{content:"\f034"}.fa-text-width:before{content:"\f035"}.fa-th:before{content:"\f00a"}.fa-th-large:before{content:"\f009"}.fa-th-list:before{content:"\f00b"}.fa-the-red-yeti:before{content:"\f69d"}.fa-theater-masks:before{content:"\f630"}.fa-themeco:before{content:"\f5c6"}.fa-themeisle:before{content:"\f2b2"}.fa-thermometer:before{content:"\f491"}.fa-thermometer-empty:before{content:"\f2cb"}.fa-thermometer-full:before{content:"\f2c7"}.fa-thermometer-half:before{content:"\f2c9"}.fa-thermometer-quarter:before{content:"\f2ca"}.fa-thermometer-three-quarters:before{content:"\f2c8"}.fa-think-peaks:before{content:"\f731"}.fa-thumbs-down:before{content:"\f165"}.fa-thumbs-up:before{content:"\f164"}.fa-thumbtack:before{content:"\f08d"}.fa-ticket-alt:before{content:"\f3ff"}.fa-times:before{content:"\f00d"}.fa-times-circle:before{content:"\f057"}.fa-tint:before{content:"\f043"}.fa-tint-slash:before{content:"\f5c7"}.fa-tired:before{content:"\f5c8"}.fa-toggle-off:before{content:"\f204"}.fa-toggle-on:before{content:"\f205"}.fa-toilet:before{content:"\f7d8"}.fa-toilet-paper:before{content:"\f71e"}.fa-toolbox:before{content:"\f552"}.fa-tools:before{content:"\f7d9"}.fa-tooth:before{content:"\f5c9"}.fa-torah:before{content:"\f6a0"}.fa-torii-gate:before{content:"\f6a1"}.fa-tractor:before{content:"\f722"}.fa-trade-federation:before{content:"\f513"}.fa-trademark:before{content:"\f25c"}.fa-traffic-light:before{content:"\f637"}.fa-train:before{content:"\f238"}.fa-tram:before{content:"\f7da"}.fa-transgender:before{content:"\f224"}.fa-transgender-alt:before{content:"\f225"}.fa-trash:before{content:"\f1f8"}.fa-trash-alt:before{content:"\f2ed"}.fa-trash-restore:before{content:"\f829"}.fa-trash-restore-alt:before{content:"\f82a"}.fa-tree:before{content:"\f1bb"}.fa-trello:before{content:"\f181"}.fa-tripadvisor:before{content:"\f262"}.fa-trophy:before{content:"\f091"}.fa-truck:before{content:"\f0d1"}.fa-truck-loading:before{content:"\f4de"}.fa-truck-monster:before{content:"\f63b"}.fa-truck-moving:before{content:"\f4df"}.fa-truck-pickup:before{content:"\f63c"}.fa-tshirt:before{content:"\f553"}.fa-tty:before{content:"\f1e4"}.fa-tumblr:before{content:"\f173"}.fa-tumblr-square:before{content:"\f174"}.fa-tv:before{content:"\f26c"}.fa-twitch:before{content:"\f1e8"}.fa-twitter:before{content:"\f099"}.fa-twitter-square:before{content:"\f081"}.fa-typo3:before{content:"\f42b"}.fa-uber:before{content:"\f402"}.fa-ubuntu:before{content:"\f7df"}.fa-uikit:before{content:"\f403"}.fa-umbrella:before{content:"\f0e9"}.fa-umbrella-beach:before{content:"\f5ca"}.fa-underline:before{content:"\f0cd"}.fa-undo:before{content:"\f0e2"}.fa-undo-alt:before{content:"\f2ea"}.fa-uniregistry:before{content:"\f404"}.fa-universal-access:before{content:"\f29a"}.fa-university:before{content:"\f19c"}.fa-unlink:before{content:"\f127"}.fa-unlock:before{content:"\f09c"}.fa-unlock-alt:before{content:"\f13e"}.fa-untappd:before{content:"\f405"}.fa-upload:before{content:"\f093"}.fa-ups:before{content:"\f7e0"}.fa-usb:before{content:"\f287"}.fa-user:before{content:"\f007"}.fa-user-alt:before{content:"\f406"}.fa-user-alt-slash:before{content:"\f4fa"}.fa-user-astronaut:before{content:"\f4fb"}.fa-user-check:before{content:"\f4fc"}.fa-user-circle:before{content:"\f2bd"}.fa-user-clock:before{content:"\f4fd"}.fa-user-cog:before{content:"\f4fe"}.fa-user-edit:before{content:"\f4ff"}.fa-user-friends:before{content:"\f500"}.fa-user-graduate:before{content:"\f501"}.fa-user-injured:before{content:"\f728"}.fa-user-lock:before{content:"\f502"}.fa-user-md:before{content:"\f0f0"}.fa-user-minus:before{content:"\f503"}.fa-user-ninja:before{content:"\f504"}.fa-user-nurse:before{content:"\f82f"}.fa-user-plus:before{content:"\f234"}.fa-user-secret:before{content:"\f21b"}.fa-user-shield:before{content:"\f505"}.fa-user-slash:before{content:"\f506"}.fa-user-tag:before{content:"\f507"}.fa-user-tie:before{content:"\f508"}.fa-user-times:before{content:"\f235"}.fa-users:before{content:"\f0c0"}.fa-users-cog:before{content:"\f509"}.fa-usps:before{content:"\f7e1"}.fa-ussunnah:before{content:"\f407"}.fa-utensil-spoon:before{content:"\f2e5"}.fa-utensils:before{content:"\f2e7"}.fa-vaadin:before{content:"\f408"}.fa-vector-square:before{content:"\f5cb"}.fa-venus:before{content:"\f221"}.fa-venus-double:before{content:"\f226"}.fa-venus-mars:before{content:"\f228"}.fa-viacoin:before{content:"\f237"}.fa-viadeo:before{content:"\f2a9"}.fa-viadeo-square:before{content:"\f2aa"}.fa-vial:before{content:"\f492"}.fa-vials:before{content:"\f493"}.fa-viber:before{content:"\f409"}.fa-video:before{content:"\f03d"}.fa-video-slash:before{content:"\f4e2"}.fa-vihara:before{content:"\f6a7"}.fa-vimeo:before{content:"\f40a"}.fa-vimeo-square:before{content:"\f194"}.fa-vimeo-v:before{content:"\f27d"}.fa-vine:before{content:"\f1ca"}.fa-vk:before{content:"\f189"}.fa-vnv:before{content:"\f40b"}.fa-volleyball-ball:before{content:"\f45f"}.fa-volume-down:before{content:"\f027"}.fa-volume-mute:before{content:"\f6a9"}.fa-volume-off:before{content:"\f026"}.fa-volume-up:before{content:"\f028"}.fa-vote-yea:before{content:"\f772"}.fa-vr-cardboard:before{content:"\f729"}.fa-vuejs:before{content:"\f41f"}.fa-walking:before{content:"\f554"}.fa-wallet:before{content:"\f555"}.fa-warehouse:before{content:"\f494"}.fa-water:before{content:"\f773"}.fa-weebly:before{content:"\f5cc"}.fa-weibo:before{content:"\f18a"}.fa-weight:before{content:"\f496"}.fa-weight-hanging:before{content:"\f5cd"}.fa-weixin:before{content:"\f1d7"}.fa-whatsapp:before{content:"\f232"}.fa-whatsapp-square:before{content:"\f40c"}.fa-wheelchair:before{content:"\f193"}.fa-whmcs:before{content:"\f40d"}.fa-wifi:before{content:"\f1eb"}.fa-wikipedia-w:before{content:"\f266"}.fa-wind:before{content:"\f72e"}.fa-window-close:before{content:"\f410"}.fa-window-maximize:before{content:"\f2d0"}.fa-window-minimize:before{content:"\f2d1"}.fa-window-restore:before{content:"\f2d2"}.fa-windows:before{content:"\f17a"}.fa-wine-bottle:before{content:"\f72f"}.fa-wine-glass:before{content:"\f4e3"}.fa-wine-glass-alt:before{content:"\f5ce"}.fa-wix:before{content:"\f5cf"}.fa-wizards-of-the-coast:before{content:"\f730"}.fa-wolf-pack-battalion:before{content:"\f514"}.fa-won-sign:before{content:"\f159"}.fa-wordpress:before{content:"\f19a"}.fa-wordpress-simple:before{content:"\f411"}.fa-wpbeginner:before{content:"\f297"}.fa-wpexplorer:before{content:"\f2de"}.fa-wpforms:before{content:"\f298"}.fa-wpressr:before{content:"\f3e4"}.fa-wrench:before{content:"\f0ad"}.fa-x-ray:before{content:"\f497"}.fa-xbox:before{content:"\f412"}.fa-xing:before{content:"\f168"}.fa-xing-square:before{content:"\f169"}.fa-y-combinator:before{content:"\f23b"}.fa-yahoo:before{content:"\f19e"}.fa-yandex:before{content:"\f413"}.fa-yandex-international:before{content:"\f414"}.fa-yarn:before{content:"\f7e3"}.fa-yelp:before{content:"\f1e9"}.fa-yen-sign:before{content:"\f157"}.fa-yin-yang:before{content:"\f6ad"}.fa-yoast:before{content:"\f2b1"}.fa-youtube:before{content:"\f167"}.fa-youtube-square:before{content:"\f431"}.fa-zhihu:before{content:"\f63f"}.sr-only{border:0;clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.sr-only-focusable:active,.sr-only-focusable:focus{clip:auto;height:auto;margin:0;overflow:visible;position:static;width:auto}@font-face{font-family:"Font Awesome 5 Brands";font-style:normal;font-weight:normal;font-display:auto;src:url(../webfonts/fa-brands-400.eot);src:url(../webfonts/fa-brands-400.eot?#iefix) format("embedded-opentype"),url(../webfonts/fa-brands-400.woff2) format("woff2"),url(../webfonts/fa-brands-400.woff) format("woff"),url(../webfonts/fa-brands-400.ttf) format("truetype"),url(../webfonts/fa-brands-400.svg#fontawesome) format("svg")}.fab{font-family:"Font Awesome 5 Brands"}@font-face{font-family:"Font Awesome 5 Free";font-style:normal;font-weight:400;font-display:auto;src:url(../webfonts/fa-regular-400.eot);src:url(../webfonts/fa-regular-400.eot?#iefix) format("embedded-opentype"),url(../webfonts/fa-regular-400.woff2) format("woff2"),url(../webfonts/fa-regular-400.woff) format("woff"),url(../webfonts/fa-regular-400.ttf) format("truetype"),url(../webfonts/fa-regular-400.svg#fontawesome) format("svg")}.far{font-weight:400}@font-face{font-family:"Font Awesome 5 Free";font-style:normal;font-weight:900;font-display:auto;src:url(../webfonts/fa-solid-900.eot);src:url(../webfonts/fa-solid-900.eot?#iefix) format("embedded-opentype"),url(../webfonts/fa-solid-900.woff2) format("woff2"),url(../webfonts/fa-solid-900.woff) format("woff"),url(../webfonts/fa-solid-900.ttf) format("truetype"),url(../webfonts/fa-solid-900.svg#fontawesome) format("svg")}.fa,.far,.fas{font-family:"Font Awesome 5 Free"}.fa,.fas{font-weight:900} \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/crawlerDataModel.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/crawlerDataModel.java deleted file mode 100644 index b0313fd1..00000000 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/crawlerDataModel.java +++ /dev/null @@ -1,172 +0,0 @@ -package com.darkweb.genesissearchengine.dataManager; - -import android.annotation.SuppressLint; -import androidx.appcompat.app.AppCompatActivity; -import com.android.volley.Request; -import com.android.volley.RequestQueue; -import com.android.volley.toolbox.StringRequest; -import com.android.volley.toolbox.Volley; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.constants.strings; -import com.darkweb.genesissearchengine.dataManager.models.crawlerRowModel; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import org.jsoup.Jsoup; -import org.jsoup.nodes.Document; -import org.jsoup.nodes.Element; -import org.jsoup.select.Elements; -import org.mozilla.thirdparty.com.google.android.exoplayer2.util.Log; - -import java.net.URLEncoder; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -@SuppressLint("CommitPrefEdits") -class crawlerDataModel -{ - /* Initializations */ - private Set mDuplicate; - private ArrayList mHTML; - private AppCompatActivity mContext; - - crawlerDataModel(AppCompatActivity pContext){ - mDuplicate = new HashSet<>(); - mHTML = new ArrayList<>(); - mContext = pContext; - } - - private void onInit(){ - if(!status.sCrawlerStatusStarted){ - status.sCrawlerStatusStarted = true; - onExecute(); - } - } - - private void onParseHTML(String pHtml, String pURL){ - String mHost = helperMethod.getHost(pURL); - - if(mHost.contains(".onion") && !mHost.contains("genesis") && !mDuplicate.contains(pURL)){ - mHTML.add(new crawlerRowModel(pURL, pHtml)); - mDuplicate.add(pURL); - } - } - - /* Helper Methods */ - - public void onExecute(){ - new Thread(){ - - String mHtml = strings.GENERIC_EMPTY_STR; - String mURL = strings.GENERIC_EMPTY_STR; - String mTitle = strings.GENERIC_EMPTY_STR; - String mDescription = strings.GENERIC_EMPTY_STR; - String mKeywords = strings.GENERIC_EMPTY_STR; - String mtype = strings.CRAWLER_GENERIC_TYPE; - - private void onParseHTML(){ - Document pDoc = Jsoup.parse(mHtml); - Map metas = new HashMap<>(); - Elements metaTags = pDoc.getElementsByTag("meta"); - for (Element metaTag : metaTags) { - String content = metaTag.attr("content"); - String name = metaTag.attr("name"); - metas.put(name, content); - } - if(metas.containsKey("description")){ - mDescription = metas.get("description"); - } - if(metas.containsKey("keywords")){ - mKeywords = metas.get("keywords"); - } - mTitle = pDoc.title(); - - if(mDescription.length()<200){ - Elements p= pDoc.getElementsByTag("h1"); - for (Element x: p) { - mDescription+= " " + x.text(); - } - } - if(mDescription.length()<200){ - Elements p= pDoc.getElementsByTag("p"); - for (Element x: p) { - mDescription+= " " + x.text(); - } - } - } - - private void onCleanData(){ - mDescription = mDescription.trim().replaceAll(" +", " "); - mDescription = mDescription.trim().replaceAll("\n", ""); - - if(mTitle!=null && mTitle.length()>500){ - mTitle = mTitle.substring(0,500); - } - if(mDescription!=null && mDescription.length()>1000){ - mDescription = mDescription.substring(0,1000); - } - if(mKeywords!=null && mKeywords.length()>500){ - mKeywords = mKeywords.substring(0,500); - } - } - - private void onSendRequest(){ - String mURL_POST = "https://www.trcip42ymcgvv5hsa7nxpwdnott46ebomnn5pm5lovg5hpszyo4n35yd.onion/update_cache?url="+mURL+"&key_word="+mKeywords+"&desc="+mDescription+"&title="+mTitle+"&s_type="+mtype; - - StringRequest stringRequest = new StringRequest(Request.Method.GET, mURL_POST, - response -> { - Log.i("adsa","asd"); - }, - error -> { - Log.i("adsa","asd"); - }); - - RequestQueue requestQueue = Volley.newRequestQueue(mContext); - requestQueue.add(stringRequest); - } - - private void onEncodeData(){ - mURL = URLEncoder.encode(mURL); - mTitle = URLEncoder.encode(mTitle); - mDescription = URLEncoder.encode(mDescription); - mKeywords = URLEncoder.encode(mKeywords); - } - - public void run(){ - while (true){ - try { - sleep(1000); - if(mHTML.size()>0){ - crawlerRowModel mModel = mHTML.remove(0); - mHtml = mModel.getHTML(); - mURL = mModel.getURL(); - - onParseHTML(); - onCleanData(); - onEncodeData(); - onSendRequest(); - - } - } catch (Exception ex) { - ex.printStackTrace(); - } - } - } - }.start(); - } - - /* External Triggers */ - - public Object onTrigger(dataEnums.eCrawlerCommands pCommands, List pData){ - if(pCommands.equals(dataEnums.eCrawlerCommands.M_INDEX_URL)){ - onParseHTML(pData.get(0).toString(), pData.get(1).toString()); - } - if(pCommands.equals(dataEnums.eCrawlerCommands.M_INIT)){ - onInit(); - } - return null; - } - -} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/activityContextManager.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/activityContextManager.java old mode 100755 new mode 100644 similarity index 84% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/activityContextManager.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/activityContextManager.java index ed579d66..8ca0ce09 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/activityContextManager.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/activityContextManager.java @@ -1,16 +1,16 @@ -package com.darkweb.genesissearchengine.appManager; +package com.hiddenservices.genesissearchengine.production.appManager; import android.content.Context; import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkHome.bookmarkController; -import com.darkweb.genesissearchengine.appManager.bridgeManager.bridgeController; -import com.darkweb.genesissearchengine.appManager.historyManager.historyController; -import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController; -import com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogController; -import com.darkweb.genesissearchengine.appManager.settingManager.generalManager.settingGeneralController; -import com.darkweb.genesissearchengine.appManager.settingManager.settingHomeManager.settingHomeController; -import com.darkweb.genesissearchengine.appManager.tabManager.tabController; +import com.hiddenservices.genesissearchengine.production.appManager.bookmarkManager.bookmarkHome.bookmarkController; +import com.hiddenservices.genesissearchengine.production.appManager.bridgeManager.bridgeController; +import com.hiddenservices.genesissearchengine.production.appManager.historyManager.historyController; +import com.hiddenservices.genesissearchengine.production.appManager.homeManager.homeController.homeController; +import com.hiddenservices.genesissearchengine.production.appManager.orbotLogManager.orbotLogController; +import com.hiddenservices.genesissearchengine.production.appManager.settingManager.generalManager.settingGeneralController; +import com.hiddenservices.genesissearchengine.production.appManager.settingManager.settingHomeManager.settingHomeController; +import com.hiddenservices.genesissearchengine.production.appManager.tabManager.tabController; import java.lang.ref.WeakReference; import java.util.ArrayList; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/activityStateManager.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/activityStateManager.java similarity index 84% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/activityStateManager.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/activityStateManager.java index 1caa6a4b..0dcdd22f 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/activityStateManager.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/activityStateManager.java @@ -1,11 +1,11 @@ -package com.darkweb.genesissearchengine.appManager; +package com.hiddenservices.genesissearchengine.production.appManager; import android.app.Service; import android.content.Intent; import android.os.IBinder; -import com.darkweb.genesissearchengine.constants.status; +import com.hiddenservices.genesissearchengine.production.constants.status; -import org.torproject.android.service.OrbotService; +import org.orbotproject.android.service.OrbotService; public class activityStateManager extends Service { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/activityThemeManager.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/activityThemeManager.java similarity index 93% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/activityThemeManager.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/activityThemeManager.java index 360972e7..2f79baa3 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/activityThemeManager.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/activityThemeManager.java @@ -1,12 +1,12 @@ -package com.darkweb.genesissearchengine.appManager; +package com.hiddenservices.genesissearchengine.production.appManager; import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatDelegate; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.constants.status; +import com.hiddenservices.genesissearchengine.production.constants.enums; +import com.hiddenservices.genesissearchengine.production.constants.status; public class activityThemeManager { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkHome/bookmarkAdapter.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/bookmarkManager/bookmarkHome/bookmarkAdapter.java similarity index 95% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkHome/bookmarkAdapter.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/bookmarkManager/bookmarkHome/bookmarkAdapter.java index 85fb2f51..5c22ca35 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkHome/bookmarkAdapter.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/bookmarkManager/bookmarkHome/bookmarkAdapter.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkHome; +package com.hiddenservices.genesissearchengine.production.appManager.bookmarkManager.bookmarkHome; import android.annotation.SuppressLint; import android.content.Context; @@ -12,11 +12,11 @@ import android.widget.*; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.RecyclerView; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.constants.strings; -import com.darkweb.genesissearchengine.dataManager.models.bookmarkRowModel; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.constants.enums; +import com.hiddenservices.genesissearchengine.production.constants.strings; +import com.hiddenservices.genesissearchengine.production.dataManager.models.bookmarkRowModel; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; import com.example.myapplication.R; import java.util.ArrayList; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkHome/bookmarkAdapterView.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/bookmarkManager/bookmarkHome/bookmarkAdapterView.java similarity index 92% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkHome/bookmarkAdapterView.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/bookmarkManager/bookmarkHome/bookmarkAdapterView.java index 07a66ab3..1f8d5145 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkHome/bookmarkAdapterView.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/bookmarkManager/bookmarkHome/bookmarkAdapterView.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkHome; +package com.hiddenservices.genesissearchengine.production.appManager.bookmarkManager.bookmarkHome; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; @@ -9,8 +9,8 @@ import android.widget.ImageView; import android.widget.PopupWindow; import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; import com.example.myapplication.R; import java.util.List; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkHome/bookmarkController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/bookmarkManager/bookmarkHome/bookmarkController.java similarity index 84% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkHome/bookmarkController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/bookmarkManager/bookmarkHome/bookmarkController.java index 128a1111..31627baa 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkHome/bookmarkController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/bookmarkManager/bookmarkHome/bookmarkController.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkHome; +package com.hiddenservices.genesissearchengine.production.appManager.bookmarkManager.bookmarkHome; import android.content.Context; import android.content.Intent; @@ -23,36 +23,36 @@ import android.widget.TextView; import androidx.recyclerview.widget.ItemTouchHelper; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkSettings.bookmarkSettingController; -import com.darkweb.genesissearchengine.dataManager.models.bookmarkRowModel; -import com.darkweb.genesissearchengine.appManager.homeManager.homeController.editTextManager; -import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.constants.strings; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.appManager.activityThemeManager; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.hiddenservices.genesissearchengine.production.appManager.activityContextManager; +import com.hiddenservices.genesissearchengine.production.appManager.bookmarkManager.bookmarkSettings.bookmarkSettingController; +import com.hiddenservices.genesissearchengine.production.dataManager.models.bookmarkRowModel; +import com.hiddenservices.genesissearchengine.production.appManager.homeManager.homeController.editTextManager; +import com.hiddenservices.genesissearchengine.production.appManager.homeManager.homeController.homeController; +import com.hiddenservices.genesissearchengine.production.constants.enums; +import com.hiddenservices.genesissearchengine.production.constants.keys; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.constants.strings; +import com.hiddenservices.genesissearchengine.production.dataManager.dataController; +import com.hiddenservices.genesissearchengine.production.dataManager.dataEnums; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.appManager.activityThemeManager; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginController; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums; import com.example.myapplication.R; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Objects; -import static com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkHome.bookmarkEnums.eBookmarkViewCommands.M_VERTIFY_SELECTION_MENU; -import static com.darkweb.genesissearchengine.constants.keys.M_ACTIVITY_RESPONSE; -import static com.darkweb.genesissearchengine.constants.responses.BOOKMARK_SETTING_CONTROLLER_SHOW_DELETE_ALERT; -import static com.darkweb.genesissearchengine.constants.responses.BOOKMARK_SETTING_CONTROLLER_SHOW_SUCCESS_ALERT; -import static com.darkweb.genesissearchengine.constants.sql.SQL_CLEAR_BOOKMARK; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_CLEAR_BOOKMARK; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_DELETE_BOOKMARK; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_UPDATE_BOOKMARK; +import static com.hiddenservices.genesissearchengine.production.appManager.bookmarkManager.bookmarkHome.bookmarkEnums.eBookmarkViewCommands.M_VERTIFY_SELECTION_MENU; +import static com.hiddenservices.genesissearchengine.production.constants.keys.M_ACTIVITY_RESPONSE; +import static com.hiddenservices.genesissearchengine.production.constants.responses.BOOKMARK_SETTING_CONTROLLER_SHOW_DELETE_ALERT; +import static com.hiddenservices.genesissearchengine.production.constants.responses.BOOKMARK_SETTING_CONTROLLER_SHOW_SUCCESS_ALERT; +import static com.hiddenservices.genesissearchengine.production.constants.sql.SQL_CLEAR_BOOKMARK; +import static com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums.eMessageManager.M_CLEAR_BOOKMARK; +import static com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums.eMessageManager.M_DELETE_BOOKMARK; +import static com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums.eMessageManager.M_UPDATE_BOOKMARK; public class bookmarkController extends AppCompatActivity diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkHome/bookmarkEnums.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/bookmarkManager/bookmarkHome/bookmarkEnums.java similarity index 84% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkHome/bookmarkEnums.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/bookmarkManager/bookmarkHome/bookmarkEnums.java index 428f9f4b..061d7959 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkHome/bookmarkEnums.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/bookmarkManager/bookmarkHome/bookmarkEnums.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkHome; +package com.hiddenservices.genesissearchengine.production.appManager.bookmarkManager.bookmarkHome; public class bookmarkEnums { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkHome/bookmarkModel.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/bookmarkManager/bookmarkHome/bookmarkModel.java similarity index 71% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkHome/bookmarkModel.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/bookmarkManager/bookmarkHome/bookmarkModel.java index ae54a827..ef0b781d 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkHome/bookmarkModel.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/bookmarkManager/bookmarkHome/bookmarkModel.java @@ -1,6 +1,6 @@ -package com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkHome; +package com.hiddenservices.genesissearchengine.production.appManager.bookmarkManager.bookmarkHome; -import com.darkweb.genesissearchengine.dataManager.models.bookmarkRowModel; +import com.hiddenservices.genesissearchengine.production.dataManager.models.bookmarkRowModel; import java.util.ArrayList; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkHome/bookmarkViewController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/bookmarkManager/bookmarkHome/bookmarkViewController.java similarity index 95% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkHome/bookmarkViewController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/bookmarkManager/bookmarkHome/bookmarkViewController.java index 5ccc6ee7..b8b08cc7 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkHome/bookmarkViewController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/bookmarkManager/bookmarkHome/bookmarkViewController.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkHome; +package com.hiddenservices.genesissearchengine.production.appManager.bookmarkManager.bookmarkHome; import android.content.Context; import android.graphics.Bitmap; @@ -27,9 +27,9 @@ import androidx.core.content.ContextCompat; import androidx.recyclerview.widget.ItemTouchHelper; import androidx.recyclerview.widget.RecyclerView; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.constants.strings; -import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.constants.strings; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; import com.example.myapplication.R; import java.util.List; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/BookmarkSettings/bookmarkSettingController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/bookmarkManager/bookmarkSettings/bookmarkSettingController.java similarity index 87% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/BookmarkSettings/bookmarkSettingController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/bookmarkManager/bookmarkSettings/bookmarkSettingController.java index c98d6771..b8735457 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/BookmarkSettings/bookmarkSettingController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/bookmarkManager/bookmarkSettings/bookmarkSettingController.java @@ -1,200 +1,200 @@ -package com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkSettings; - -import androidx.annotation.NonNull; -import androidx.appcompat.app.AppCompatActivity; -import android.annotation.SuppressLint; -import android.content.Intent; -import android.content.res.Configuration; -import android.os.Bundle; -import android.text.Editable; -import android.text.TextWatcher; -import android.view.View; -import android.widget.EditText; -import android.widget.ScrollView; -import android.widget.TextView; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.sharedUIMethod; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; -import com.example.myapplication.R; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import static com.darkweb.genesissearchengine.constants.keys.M_ACTIVITY_RESPONSE; -import static com.darkweb.genesissearchengine.constants.responses.BOOKMARK_SETTING_CONTROLLER_SHOW_DELETE_ALERT; -import static com.darkweb.genesissearchengine.constants.responses.BOOKMARK_SETTING_CONTROLLER_SHOW_SUCCESS_ALERT; - -public class bookmarkSettingController extends AppCompatActivity { - - /* Private Variables */ - - private bookmarkSettingModelController mBookmarkSettingModel; - private bookmarkSettingViewController mBookmarkSettingViewController; - - /* UI Variables */ - - private EditText mBookmarName; - private TextView mBookmarURL; - private ScrollView mScrollView; - - - /* Initializations */ - - @Override - protected void onCreate(Bundle savedInstanceState) { - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); - activityContextManager.getInstance().onStack(this); - - super.onCreate(savedInstanceState); - setContentView(R.layout.bookmark_setting_view); - - initializeViews(); - initializeModels(); - initializeLocalEventHandlers(); - } - - private void initializeViews() { - mBookmarName = findViewById(R.id.pBookmarkName); - mBookmarURL = findViewById(R.id.pBookmarkURL); - mScrollView = findViewById(R.id.pScrollView); - } - - @SuppressLint("ClickableViewAccessibility") - private void initializeLocalEventHandlers() { - - mBookmarName.addTextChangedListener(new TextWatcher() { - @Override - public void afterTextChanged(Editable s) { - String mBookmarkName = (String) mBookmarkSettingViewController.onTrigger(bookmarkSettingEnums.eBookmarkSettingViewCommands.M_GET_BOOKMARK_NAME); - boolean mValidationStatus = (boolean)mBookmarkSettingModel.onTrigger(bookmarkSettingEnums.eBookmarkSettingModelCommands.M_VALIDATE_FORM, Collections.singletonList(mBookmarkName)); - - mBookmarkSettingModel.onTrigger(bookmarkSettingEnums.eBookmarkSettingModelCommands.M_SET_BOOOKMARK_CHANGED_STATUS, Collections.singletonList(true)); - mBookmarkSettingViewController.onTrigger(bookmarkSettingEnums.eBookmarkSettingViewCommands.M_BOOKMARK_NAME_VALIDATION_RESPONSE, Collections.singletonList(mValidationStatus)); - } - - @Override - public void beforeTextChanged(CharSequence s, int start,int count, int after) { - } - - @Override - public void onTextChanged(CharSequence s, int start,int before, int count) { - } - }); - - mBookmarName.setOnFocusChangeListener((v, hasFocus) -> { - if(!hasFocus){ - mBookmarkSettingViewController.onTrigger(bookmarkSettingEnums.eBookmarkSettingViewCommands.M_CLEAR_FORM_FOCUS); - } - }); - - mScrollView.setOnTouchListener((v, event) -> { - mBookmarkSettingViewController.onTrigger(bookmarkSettingEnums.eBookmarkSettingViewCommands.M_CLEAR_FORM_FOCUS); - return false; - }); - - } - - private void initializeModels(){ - String mBookmarkName = getIntent().getStringExtra(keys.BOOKMARK_SETTING_NAME); - String mBookmarkURL = getIntent().getStringExtra(keys.BOOKMARK_SETTING_URL); - int mBookmarkID = getIntent().getIntExtra(keys.BOOKMARK_SETTING_ID, -1); - - mBookmarkSettingViewController = new bookmarkSettingViewController(this, new bookmarkSettingViewCallback(), mBookmarName, mBookmarURL); - mBookmarkSettingViewController.onTrigger(bookmarkSettingEnums.eBookmarkSettingViewCommands.M_INITIALIZE, Arrays.asList(mBookmarkName,mBookmarkURL)); - mBookmarkSettingModel = new bookmarkSettingModelController(this, new bookmarkSettingModelCallback(), mBookmarkID, mBookmarkURL); - } - - private void initCallableResponse(bookmarkSettingEnums.eActivityResponseCommands pResponse){ - Intent data = new Intent(); - if(pResponse.equals(bookmarkSettingEnums.eActivityResponseCommands.M_OPEN_UPDATE_ALERT)){ - data.putExtra(M_ACTIVITY_RESPONSE, BOOKMARK_SETTING_CONTROLLER_SHOW_SUCCESS_ALERT); - } - else if(pResponse.equals(bookmarkSettingEnums.eActivityResponseCommands.M_OPEN_DELETE_ALERT)){ - data.putExtra(M_ACTIVITY_RESPONSE, BOOKMARK_SETTING_CONTROLLER_SHOW_DELETE_ALERT); - } - setResult(RESULT_OK,data); - } - - /* Local Override */ - - @Override - public void onConfigurationChanged(@NonNull Configuration newConfig) { - sharedUIMethod.onSharedConfigurationChanged(newConfig, this); - - super.onConfigurationChanged(newConfig); - } - - @Override - public void onResume() - { - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); - activityContextManager.getInstance().setCurrentActivity(this); - super.onResume(); - } - - @Override - protected void onDestroy() { - activityContextManager.getInstance().onRemoveStack(this); - super.onDestroy(); - } - - @Override - public void onBackPressed() { - onCloseTrigger(null); - } - - /* UI Redirection */ - - public void onCloseTrigger(View view){ - finish(); - } - - public void onUITrigger(View view){ - if(view.getId()==R.id.pBookmarkUpdate){ - mBookmarkSettingViewController.onTrigger(bookmarkSettingEnums.eBookmarkSettingViewCommands.M_CLEAR_FORM); - - String mBookmarkName = (String) mBookmarkSettingViewController.onTrigger(bookmarkSettingEnums.eBookmarkSettingViewCommands.M_GET_BOOKMARK_NAME); - boolean mValid = (boolean) mBookmarkSettingModel.onTrigger(bookmarkSettingEnums.eBookmarkSettingModelCommands.M_VALIDATE_FORM, Collections.singletonList(mBookmarkName)); - boolean mBookmarkChanged = (boolean) mBookmarkSettingModel.onTrigger(bookmarkSettingEnums.eBookmarkSettingModelCommands.M_GET_UPDATE_STATUS); - - if(mValid){ - mBookmarkSettingModel.onTrigger(bookmarkSettingEnums.eBookmarkSettingModelCommands.M_UPDATE_BOOKMARK, Collections.singletonList(mBookmarkName)); - mBookmarkSettingViewController.onTrigger(bookmarkSettingEnums.eBookmarkSettingViewCommands.M_CLEAR_FORM_FOCUS); - if(mBookmarkChanged){ - initCallableResponse(bookmarkSettingEnums.eActivityResponseCommands.M_OPEN_UPDATE_ALERT); - } - onCloseTrigger(null); - }else { - mBookmarkSettingViewController.onTrigger(bookmarkSettingEnums.eBookmarkSettingViewCommands.M_BOOKMARK_NAME_VALIDATION_RESPONSE, Collections.singletonList(false)); - } - } - if(view.getId()==R.id.pRemoveBookmark){ - mBookmarkSettingViewController.onTrigger(bookmarkSettingEnums.eBookmarkSettingViewCommands.M_CLEAR_FORM_FOCUS); - initCallableResponse(bookmarkSettingEnums.eActivityResponseCommands.M_OPEN_DELETE_ALERT); - mBookmarkSettingModel.onTrigger(bookmarkSettingEnums.eBookmarkSettingModelCommands.M_DELETE_BOOKMARK); - onCloseTrigger(null); - } - } - - /* Callbacks */ - - private class bookmarkSettingViewCallback implements eventObserver.eventListener{ - - @Override - public Object invokeObserver(List pData, Object pType) - { - return null; - } - } - - private class bookmarkSettingModelCallback implements eventObserver.eventListener{ - - @Override - public Object invokeObserver(List pData, Object pType) - { - return null; - } - } +package com.hiddenservices.genesissearchengine.production.appManager.bookmarkManager.bookmarkSettings; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; +import android.annotation.SuppressLint; +import android.content.Intent; +import android.content.res.Configuration; +import android.os.Bundle; +import android.text.Editable; +import android.text.TextWatcher; +import android.view.View; +import android.widget.EditText; +import android.widget.ScrollView; +import android.widget.TextView; +import com.hiddenservices.genesissearchengine.production.appManager.activityContextManager; +import com.hiddenservices.genesissearchengine.production.constants.keys; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.helperManager.sharedUIMethod; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginController; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums; +import com.example.myapplication.R; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import static com.hiddenservices.genesissearchengine.production.constants.keys.M_ACTIVITY_RESPONSE; +import static com.hiddenservices.genesissearchengine.production.constants.responses.BOOKMARK_SETTING_CONTROLLER_SHOW_DELETE_ALERT; +import static com.hiddenservices.genesissearchengine.production.constants.responses.BOOKMARK_SETTING_CONTROLLER_SHOW_SUCCESS_ALERT; + +public class bookmarkSettingController extends AppCompatActivity { + + /* Private Variables */ + + private bookmarkSettingModelController mBookmarkSettingModel; + private bookmarkSettingViewController mBookmarkSettingViewController; + + /* UI Variables */ + + private EditText mBookmarName; + private TextView mBookmarURL; + private ScrollView mScrollView; + + + /* Initializations */ + + @Override + protected void onCreate(Bundle savedInstanceState) { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + activityContextManager.getInstance().onStack(this); + + super.onCreate(savedInstanceState); + setContentView(R.layout.bookmark_setting_view); + + initializeViews(); + initializeModels(); + initializeLocalEventHandlers(); + } + + private void initializeViews() { + mBookmarName = findViewById(R.id.pBookmarkName); + mBookmarURL = findViewById(R.id.pBookmarkURL); + mScrollView = findViewById(R.id.pScrollView); + } + + @SuppressLint("ClickableViewAccessibility") + private void initializeLocalEventHandlers() { + + mBookmarName.addTextChangedListener(new TextWatcher() { + @Override + public void afterTextChanged(Editable s) { + String mBookmarkName = (String) mBookmarkSettingViewController.onTrigger(bookmarkSettingEnums.eBookmarkSettingViewCommands.M_GET_BOOKMARK_NAME); + boolean mValidationStatus = (boolean)mBookmarkSettingModel.onTrigger(bookmarkSettingEnums.eBookmarkSettingModelCommands.M_VALIDATE_FORM, Collections.singletonList(mBookmarkName)); + + mBookmarkSettingModel.onTrigger(bookmarkSettingEnums.eBookmarkSettingModelCommands.M_SET_BOOOKMARK_CHANGED_STATUS, Collections.singletonList(true)); + mBookmarkSettingViewController.onTrigger(bookmarkSettingEnums.eBookmarkSettingViewCommands.M_BOOKMARK_NAME_VALIDATION_RESPONSE, Collections.singletonList(mValidationStatus)); + } + + @Override + public void beforeTextChanged(CharSequence s, int start,int count, int after) { + } + + @Override + public void onTextChanged(CharSequence s, int start,int before, int count) { + } + }); + + mBookmarName.setOnFocusChangeListener((v, hasFocus) -> { + if(!hasFocus){ + mBookmarkSettingViewController.onTrigger(bookmarkSettingEnums.eBookmarkSettingViewCommands.M_CLEAR_FORM_FOCUS); + } + }); + + mScrollView.setOnTouchListener((v, event) -> { + mBookmarkSettingViewController.onTrigger(bookmarkSettingEnums.eBookmarkSettingViewCommands.M_CLEAR_FORM_FOCUS); + return false; + }); + + } + + private void initializeModels(){ + String mBookmarkName = getIntent().getStringExtra(keys.BOOKMARK_SETTING_NAME); + String mBookmarkURL = getIntent().getStringExtra(keys.BOOKMARK_SETTING_URL); + int mBookmarkID = getIntent().getIntExtra(keys.BOOKMARK_SETTING_ID, -1); + + mBookmarkSettingViewController = new bookmarkSettingViewController(this, new bookmarkSettingViewCallback(), mBookmarName, mBookmarURL); + mBookmarkSettingViewController.onTrigger(bookmarkSettingEnums.eBookmarkSettingViewCommands.M_INITIALIZE, Arrays.asList(mBookmarkName,mBookmarkURL)); + mBookmarkSettingModel = new bookmarkSettingModelController(this, new bookmarkSettingModelCallback(), mBookmarkID, mBookmarkURL); + } + + private void initCallableResponse(bookmarkSettingEnums.eActivityResponseCommands pResponse){ + Intent data = new Intent(); + if(pResponse.equals(bookmarkSettingEnums.eActivityResponseCommands.M_OPEN_UPDATE_ALERT)){ + data.putExtra(M_ACTIVITY_RESPONSE, BOOKMARK_SETTING_CONTROLLER_SHOW_SUCCESS_ALERT); + } + else if(pResponse.equals(bookmarkSettingEnums.eActivityResponseCommands.M_OPEN_DELETE_ALERT)){ + data.putExtra(M_ACTIVITY_RESPONSE, BOOKMARK_SETTING_CONTROLLER_SHOW_DELETE_ALERT); + } + setResult(RESULT_OK,data); + } + + /* Local Override */ + + @Override + public void onConfigurationChanged(@NonNull Configuration newConfig) { + sharedUIMethod.onSharedConfigurationChanged(newConfig, this); + + super.onConfigurationChanged(newConfig); + } + + @Override + public void onResume() + { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); + activityContextManager.getInstance().setCurrentActivity(this); + super.onResume(); + } + + @Override + protected void onDestroy() { + activityContextManager.getInstance().onRemoveStack(this); + super.onDestroy(); + } + + @Override + public void onBackPressed() { + onCloseTrigger(null); + } + + /* UI Redirection */ + + public void onCloseTrigger(View view){ + finish(); + } + + public void onUITrigger(View view){ + if(view.getId()==R.id.pBookmarkUpdate){ + mBookmarkSettingViewController.onTrigger(bookmarkSettingEnums.eBookmarkSettingViewCommands.M_CLEAR_FORM); + + String mBookmarkName = (String) mBookmarkSettingViewController.onTrigger(bookmarkSettingEnums.eBookmarkSettingViewCommands.M_GET_BOOKMARK_NAME); + boolean mValid = (boolean) mBookmarkSettingModel.onTrigger(bookmarkSettingEnums.eBookmarkSettingModelCommands.M_VALIDATE_FORM, Collections.singletonList(mBookmarkName)); + boolean mBookmarkChanged = (boolean) mBookmarkSettingModel.onTrigger(bookmarkSettingEnums.eBookmarkSettingModelCommands.M_GET_UPDATE_STATUS); + + if(mValid){ + mBookmarkSettingModel.onTrigger(bookmarkSettingEnums.eBookmarkSettingModelCommands.M_UPDATE_BOOKMARK, Collections.singletonList(mBookmarkName)); + mBookmarkSettingViewController.onTrigger(bookmarkSettingEnums.eBookmarkSettingViewCommands.M_CLEAR_FORM_FOCUS); + if(mBookmarkChanged){ + initCallableResponse(bookmarkSettingEnums.eActivityResponseCommands.M_OPEN_UPDATE_ALERT); + } + onCloseTrigger(null); + }else { + mBookmarkSettingViewController.onTrigger(bookmarkSettingEnums.eBookmarkSettingViewCommands.M_BOOKMARK_NAME_VALIDATION_RESPONSE, Collections.singletonList(false)); + } + } + if(view.getId()==R.id.pRemoveBookmark){ + mBookmarkSettingViewController.onTrigger(bookmarkSettingEnums.eBookmarkSettingViewCommands.M_CLEAR_FORM_FOCUS); + initCallableResponse(bookmarkSettingEnums.eActivityResponseCommands.M_OPEN_DELETE_ALERT); + mBookmarkSettingModel.onTrigger(bookmarkSettingEnums.eBookmarkSettingModelCommands.M_DELETE_BOOKMARK); + onCloseTrigger(null); + } + } + + /* Callbacks */ + + private class bookmarkSettingViewCallback implements eventObserver.eventListener{ + + @Override + public Object invokeObserver(List pData, Object pType) + { + return null; + } + } + + private class bookmarkSettingModelCallback implements eventObserver.eventListener{ + + @Override + public Object invokeObserver(List pData, Object pType) + { + return null; + } + } } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/BookmarkSettings/bookmarkSettingEnums.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/bookmarkManager/bookmarkSettings/bookmarkSettingEnums.java similarity index 83% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/BookmarkSettings/bookmarkSettingEnums.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/bookmarkManager/bookmarkSettings/bookmarkSettingEnums.java index 007ecfd2..f965cf2d 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/BookmarkSettings/bookmarkSettingEnums.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/bookmarkManager/bookmarkSettings/bookmarkSettingEnums.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkSettings; +package com.hiddenservices.genesissearchengine.production.appManager.bookmarkManager.bookmarkSettings; public class bookmarkSettingEnums { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/BookmarkSettings/bookmarkSettingModelController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/bookmarkManager/bookmarkSettings/bookmarkSettingModelController.java similarity index 81% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/BookmarkSettings/bookmarkSettingModelController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/bookmarkManager/bookmarkSettings/bookmarkSettingModelController.java index cb6ac11a..4f2a35ce 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/BookmarkSettings/bookmarkSettingModelController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/bookmarkManager/bookmarkSettings/bookmarkSettingModelController.java @@ -1,87 +1,87 @@ -package com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkSettings; - -import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.constants.strings; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.eventObserver; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import static com.darkweb.genesissearchengine.dataManager.dataEnums.eBookmarkCommands.M_DELETE_BOOKMARK_FROM_MENU; - -class bookmarkSettingModelController -{ - /* Local Variables Variables */ - - private boolean mBookmarkUpdateStatus = false; - private int mBookmarkID; - private String mBookmarkURL; - - /* Private Variables */ - - private AppCompatActivity mContext; - private eventObserver.eventListener mEvent; - - public bookmarkSettingModelController(AppCompatActivity pContext, eventObserver.eventListener pEvent, int pBookmarkID, String pBookmarkURL){ - this.mContext = pContext; - this.mEvent = pEvent; - this.mBookmarkID = pBookmarkID; - this.mBookmarkURL = pBookmarkURL; - } - - /* Helper Methods */ - - private void onUpdateBookmark(String pBookmarkName){ - dataController.getInstance().invokeBookmark(dataEnums.eBookmarkCommands.M_UPDATE_BOOKMARK, Arrays.asList(pBookmarkName, mBookmarkURL, mBookmarkID)); - } - - private boolean validateForm(String pBookmarkName){ - if(pBookmarkName.equals(strings.GENERIC_EMPTY_STR)){ - return false; - }else { - return true; - } - } - - private boolean getBookmarkUpdateStatus(){ - return mBookmarkUpdateStatus; - } - - private void setBookmarkUpdateStatus(boolean pBookmarkUpdateStatus){ - mBookmarkUpdateStatus = pBookmarkUpdateStatus; - } - - private void onDeleteBookmark(){ - dataController.getInstance().invokeBookmark(M_DELETE_BOOKMARK_FROM_MENU, Collections.singletonList(mBookmarkURL)); - } - - /* Event Observer */ - - public Object onTrigger(bookmarkSettingEnums.eBookmarkSettingModelCommands pCommands, List pData){ - if(bookmarkSettingEnums.eBookmarkSettingModelCommands.M_UPDATE_BOOKMARK.equals(pCommands)){ - onUpdateBookmark((String) pData.get(0)); - } - if(bookmarkSettingEnums.eBookmarkSettingModelCommands.M_VALIDATE_FORM.equals(pCommands)){ - return validateForm((String) pData.get(0)); - } - if(bookmarkSettingEnums.eBookmarkSettingModelCommands.M_SET_BOOOKMARK_CHANGED_STATUS.equals(pCommands)){ - setBookmarkUpdateStatus((boolean)pData.get(0)); - } - if(bookmarkSettingEnums.eBookmarkSettingModelCommands.M_DELETE_BOOKMARK.equals(pCommands)){ - onDeleteBookmark(); - } - return null; - } - - public Object onTrigger(bookmarkSettingEnums.eBookmarkSettingModelCommands pCommands){ - if(bookmarkSettingEnums.eBookmarkSettingModelCommands.M_DELETE_BOOKMARK.equals(pCommands)){ - onDeleteBookmark(); - } - if(bookmarkSettingEnums.eBookmarkSettingModelCommands.M_GET_UPDATE_STATUS.equals(pCommands)){ - return getBookmarkUpdateStatus(); - } - return null; - } - +package com.hiddenservices.genesissearchengine.production.appManager.bookmarkManager.bookmarkSettings; + +import androidx.appcompat.app.AppCompatActivity; +import com.hiddenservices.genesissearchengine.production.constants.strings; +import com.hiddenservices.genesissearchengine.production.dataManager.dataController; +import com.hiddenservices.genesissearchengine.production.dataManager.dataEnums; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import static com.hiddenservices.genesissearchengine.production.dataManager.dataEnums.eBookmarkCommands.M_DELETE_BOOKMARK_FROM_MENU; + +class bookmarkSettingModelController +{ + /* Local Variables Variables */ + + private boolean mBookmarkUpdateStatus = false; + private int mBookmarkID; + private String mBookmarkURL; + + /* Private Variables */ + + private AppCompatActivity mContext; + private eventObserver.eventListener mEvent; + + public bookmarkSettingModelController(AppCompatActivity pContext, eventObserver.eventListener pEvent, int pBookmarkID, String pBookmarkURL){ + this.mContext = pContext; + this.mEvent = pEvent; + this.mBookmarkID = pBookmarkID; + this.mBookmarkURL = pBookmarkURL; + } + + /* Helper Methods */ + + private void onUpdateBookmark(String pBookmarkName){ + dataController.getInstance().invokeBookmark(dataEnums.eBookmarkCommands.M_UPDATE_BOOKMARK, Arrays.asList(pBookmarkName, mBookmarkURL, mBookmarkID)); + } + + private boolean validateForm(String pBookmarkName){ + if(pBookmarkName.equals(strings.GENERIC_EMPTY_STR)){ + return false; + }else { + return true; + } + } + + private boolean getBookmarkUpdateStatus(){ + return mBookmarkUpdateStatus; + } + + private void setBookmarkUpdateStatus(boolean pBookmarkUpdateStatus){ + mBookmarkUpdateStatus = pBookmarkUpdateStatus; + } + + private void onDeleteBookmark(){ + dataController.getInstance().invokeBookmark(M_DELETE_BOOKMARK_FROM_MENU, Collections.singletonList(mBookmarkURL)); + } + + /* Event Observer */ + + public Object onTrigger(bookmarkSettingEnums.eBookmarkSettingModelCommands pCommands, List pData){ + if(bookmarkSettingEnums.eBookmarkSettingModelCommands.M_UPDATE_BOOKMARK.equals(pCommands)){ + onUpdateBookmark((String) pData.get(0)); + } + if(bookmarkSettingEnums.eBookmarkSettingModelCommands.M_VALIDATE_FORM.equals(pCommands)){ + return validateForm((String) pData.get(0)); + } + if(bookmarkSettingEnums.eBookmarkSettingModelCommands.M_SET_BOOOKMARK_CHANGED_STATUS.equals(pCommands)){ + setBookmarkUpdateStatus((boolean)pData.get(0)); + } + if(bookmarkSettingEnums.eBookmarkSettingModelCommands.M_DELETE_BOOKMARK.equals(pCommands)){ + onDeleteBookmark(); + } + return null; + } + + public Object onTrigger(bookmarkSettingEnums.eBookmarkSettingModelCommands pCommands){ + if(bookmarkSettingEnums.eBookmarkSettingModelCommands.M_DELETE_BOOKMARK.equals(pCommands)){ + onDeleteBookmark(); + } + if(bookmarkSettingEnums.eBookmarkSettingModelCommands.M_GET_UPDATE_STATUS.equals(pCommands)){ + return getBookmarkUpdateStatus(); + } + return null; + } + } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/BookmarkSettings/bookmarkSettingViewController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/bookmarkManager/bookmarkSettings/bookmarkSettingViewController.java similarity index 87% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/BookmarkSettings/bookmarkSettingViewController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/bookmarkManager/bookmarkSettings/bookmarkSettingViewController.java index c63313d4..11393207 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/BookmarkSettings/bookmarkSettingViewController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/bookmarkManager/bookmarkSettings/bookmarkSettingViewController.java @@ -1,14 +1,13 @@ -package com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkSettings; +package com.hiddenservices.genesissearchengine.production.appManager.bookmarkManager.bookmarkSettings; import android.widget.EditText; import android.widget.TextView; import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.helperManager.sharedUIMethod; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.helperManager.sharedUIMethod; import com.example.myapplication.R; -import org.xmlpull.v1.XmlPullParserException; -import java.io.IOException; + import java.util.List; class bookmarkSettingViewController diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bridgeManager/bridgeController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/bridgeManager/bridgeController.java old mode 100755 new mode 100644 similarity index 85% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/bridgeManager/bridgeController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/bridgeManager/bridgeController.java index 502b3406..536e9efe --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bridgeManager/bridgeController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/bridgeManager/bridgeController.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.bridgeManager; +package com.hiddenservices.genesissearchengine.production.appManager.bridgeManager; import android.content.res.Configuration; import android.os.Bundle; @@ -12,24 +12,24 @@ import android.widget.RadioButton; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.helpManager.helpController; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.appManager.activityThemeManager; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.hiddenservices.genesissearchengine.production.appManager.activityContextManager; +import com.hiddenservices.genesissearchengine.production.appManager.helpManager.helpController; +import com.hiddenservices.genesissearchengine.production.constants.constants; +import com.hiddenservices.genesissearchengine.production.constants.keys; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.dataManager.dataController; +import com.hiddenservices.genesissearchengine.production.dataManager.dataEnums; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.appManager.activityThemeManager; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginController; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums; import com.example.myapplication.R; import java.util.Arrays; import java.util.Collections; import java.util.List; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_BRIDGE_MAIL; +import static com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums.eMessageManager.M_BRIDGE_MAIL; public class bridgeController extends AppCompatActivity implements View.OnFocusChangeListener, TextWatcher { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bridgeManager/bridgeEnums.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/bridgeManager/bridgeEnums.java similarity index 72% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/bridgeManager/bridgeEnums.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/bridgeManager/bridgeEnums.java index 48a101dc..c7f31cf7 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bridgeManager/bridgeEnums.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/bridgeManager/bridgeEnums.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.bridgeManager; +package com.hiddenservices.genesissearchengine.production.appManager.bridgeManager; public class bridgeEnums { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bridgeManager/bridgeModel.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/bridgeManager/bridgeModel.java similarity index 74% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/bridgeManager/bridgeModel.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/bridgeManager/bridgeModel.java index d0c9b42d..c2dcc546 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bridgeManager/bridgeModel.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/bridgeManager/bridgeModel.java @@ -1,22 +1,22 @@ -package com.darkweb.genesissearchengine.appManager.bridgeManager; +package com.hiddenservices.genesissearchengine.production.appManager.bridgeManager; import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.pluginManager.pluginController; +import com.hiddenservices.genesissearchengine.production.constants.constants; +import com.hiddenservices.genesissearchengine.production.constants.keys; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.dataManager.dataController; +import com.hiddenservices.genesissearchengine.production.dataManager.dataEnums; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginController; import java.util.Arrays; import java.util.List; -import static com.darkweb.genesissearchengine.constants.strings.BRIDGE_CUSTOM_BRIDGE_MEEK; -import static com.darkweb.genesissearchengine.constants.strings.BRIDGE_CUSTOM_BRIDGE_OBFS4; -import static com.darkweb.genesissearchengine.constants.strings.GENERIC_EMPTY_STR; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_BRIDGE_MAIL; +import static com.hiddenservices.genesissearchengine.production.constants.strings.BRIDGE_CUSTOM_BRIDGE_MEEK; +import static com.hiddenservices.genesissearchengine.production.constants.strings.BRIDGE_CUSTOM_BRIDGE_OBFS4; +import static com.hiddenservices.genesissearchengine.production.constants.strings.GENERIC_EMPTY_STR; +import static com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums.eMessageManager.M_BRIDGE_MAIL; class bridgeModel { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bridgeManager/bridgeViewController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/bridgeManager/bridgeViewController.java old mode 100755 new mode 100644 similarity index 93% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/bridgeManager/bridgeViewController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/bridgeManager/bridgeViewController.java index b4ccba0e..f7e0cf39 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bridgeManager/bridgeViewController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/bridgeManager/bridgeViewController.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.bridgeManager; +package com.hiddenservices.genesissearchengine.production.appManager.bridgeManager; import android.animation.ArgbEvaluator; import android.animation.ObjectAnimator; @@ -14,9 +14,9 @@ import android.widget.TextView; import androidx.appcompat.app.AppCompatActivity; import androidx.core.content.ContextCompat; -import com.darkweb.genesissearchengine.constants.strings; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.helperManager.sharedUIMethod; +import com.hiddenservices.genesissearchengine.production.constants.strings; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.helperManager.sharedUIMethod; import com.example.myapplication.R; import java.util.List; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/externalCommandManager/externalShortcutController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/externalCommandManager/externalShortcutController.java similarity index 66% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/externalCommandManager/externalShortcutController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/externalCommandManager/externalShortcutController.java index 7530699e..df951103 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/externalCommandManager/externalShortcutController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/externalCommandManager/externalShortcutController.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.externalCommandManager; +package com.hiddenservices.genesissearchengine.production.appManager.externalCommandManager; import android.content.Intent; import android.os.Bundle; @@ -6,17 +6,17 @@ import android.view.View; import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.constants.strings; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.appManager.activityContextManager; +import com.hiddenservices.genesissearchengine.production.appManager.homeManager.homeController.homeController; +import com.hiddenservices.genesissearchengine.production.constants.constants; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.constants.strings; +import com.hiddenservices.genesissearchengine.production.dataManager.dataController; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; import com.example.myapplication.R; -import org.torproject.android.service.wrapper.orbotLocalConstants; -import static com.darkweb.genesissearchengine.constants.constants.CONST_EXTERNAL_SHORTCUT_COMMAND_ERASE; -import static com.darkweb.genesissearchengine.constants.keys.EXTERNAL_SHORTCUT_COMMAND; +import org.orbotproject.android.service.wrapper.orbotLocalConstants; +import static com.hiddenservices.genesissearchengine.production.constants.constants.CONST_EXTERNAL_SHORTCUT_COMMAND_ERASE; +import static com.hiddenservices.genesissearchengine.production.constants.keys.EXTERNAL_SHORTCUT_COMMAND; public class externalShortcutController extends AppCompatActivity { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/externalCommandManager/externalURLNavigationContoller.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/externalCommandManager/externalURLNavigationContoller.java similarity index 66% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/externalCommandManager/externalURLNavigationContoller.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/externalCommandManager/externalURLNavigationContoller.java index f3f4c38f..7dd70a9c 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/externalCommandManager/externalURLNavigationContoller.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/externalCommandManager/externalURLNavigationContoller.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.externalCommandManager; +package com.hiddenservices.genesissearchengine.production.appManager.externalCommandManager; import android.content.Intent; import android.net.Uri; @@ -6,14 +6,14 @@ import android.os.Build; import android.os.Bundle; import androidx.annotation.RequiresApi; import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.constants.strings; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import static com.darkweb.genesissearchengine.constants.constants.CONST_PACKAGE_NAME; -import static com.darkweb.genesissearchengine.constants.keys.EXTERNAL_SHORTCUT_COMMAND_NAVIGATE; +import com.hiddenservices.genesissearchengine.production.appManager.activityContextManager; +import com.hiddenservices.genesissearchengine.production.appManager.homeManager.homeController.homeController; +import com.hiddenservices.genesissearchengine.production.constants.constants; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.constants.strings; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; + +import static com.hiddenservices.genesissearchengine.production.constants.keys.EXTERNAL_SHORTCUT_COMMAND_NAVIGATE; public class externalURLNavigationContoller extends AppCompatActivity { @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP_MR1) diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/editViewController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/helpManager/editViewController.java similarity index 81% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/editViewController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/helpManager/editViewController.java index a7368729..612a545f 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/editViewController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/helpManager/editViewController.java @@ -1,12 +1,12 @@ -package com.darkweb.genesissearchengine.appManager.helpManager; +package com.hiddenservices.genesissearchengine.production.appManager.helpManager; import android.content.Context; import android.util.AttributeSet; import android.view.KeyEvent; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.eventObserver; +import com.hiddenservices.genesissearchengine.production.constants.enums; +import com.hiddenservices.genesissearchengine.production.eventObserver; public class editViewController extends androidx.appcompat.widget.AppCompatAutoCompleteTextView { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpAdapter.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/helpManager/helpAdapter.java similarity index 94% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpAdapter.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/helpManager/helpAdapter.java index 0cd26ff4..68eadb32 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpAdapter.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/helpManager/helpAdapter.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.helpManager; +package com.hiddenservices.genesissearchengine.production.appManager.helpManager; import android.content.Context; import android.content.res.Resources; @@ -13,7 +13,7 @@ import android.widget.RelativeLayout; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; -import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; import com.example.myapplication.R; import java.util.ArrayList; import java.util.List; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/helpManager/helpController.java similarity index 87% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/helpManager/helpController.java index bbfd4c97..230dfd8f 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/helpManager/helpController.java @@ -1,261 +1,261 @@ -package com.darkweb.genesissearchengine.appManager.helpManager; - -import android.content.res.Configuration; -import android.os.Bundle; -import android.os.Handler; -import android.text.Editable; -import android.text.TextWatcher; -import android.view.MotionEvent; -import android.view.View; -import android.widget.Button; -import android.widget.ProgressBar; - -import androidx.annotation.NonNull; -import androidx.appcompat.app.AppCompatActivity; -import androidx.constraintlayout.widget.ConstraintLayout; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; -import androidx.recyclerview.widget.SimpleItemAnimator; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.appManager.activityThemeManager; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; -import com.example.myapplication.R; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Objects; - -import static com.darkweb.genesissearchengine.appManager.helpManager.helpEnums.eHelpModel.M_IS_LOADED; - -public class helpController extends AppCompatActivity { - - /*Initializations*/ - private helpViewController mHelpViewController; - private helpModel mHelpModel; - private helpAdapter mHelpAdapter; - private ProgressBar mProgressBar; - private RecyclerView mRecycleView; - private ConstraintLayout mRetryContainer; - private Button mReloadButton; - private editViewController mSearchInput; - - /*Private Variables*/ - private Handler mSearchInvokedHandler = new Handler(); - private Runnable postToServerRunnable; - - @Override - protected void onCreate(Bundle savedInstanceState) { - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); - super.onCreate(savedInstanceState); - setContentView(R.layout.help_view); - - initializeViews(); - initializeAppModel(); - initializeLocalEventHandlers(); - } - - @Override - public void onConfigurationChanged(@NonNull Configuration newConfig) { - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); - - if(newConfig.uiMode != getResources().getConfiguration().uiMode){ - activityContextManager.getInstance().onResetTheme(); - activityThemeManager.getInstance().onConfigurationChanged(this); - } - - super.onConfigurationChanged(newConfig); - } - - private void initializeAppModel() - { - mHelpModel = new helpModel(this, new helpAdapterCallback()); - mHelpModel.onTrigger(helpEnums.eHelpModel.M_LOAD_HELP_DATA,null); - if((boolean)mHelpModel.onTrigger(M_IS_LOADED,null)){ - mProgressBar.setVisibility(View.GONE); - } - } - - private void initializeViews(){ - mHelpViewController = new helpViewController(); - mProgressBar = findViewById(R.id.pProgressBar); - mRecycleView = findViewById(R.id.pRecycleView); - mRetryContainer = findViewById(R.id.pRetryContainer); - mReloadButton = findViewById(R.id.pReloadButton); - mSearchInput = findViewById(R.id.pSearchInput); - - mHelpViewController.initialization(new helpViewCallback(),this, mProgressBar, mRecycleView, mRetryContainer, mReloadButton); - mHelpViewController.onTrigger(helpEnums.eHelpViewController.M_INIT_VIEWS, null); - - } - - private void initializeLocalEventHandlers(){ - - mRecycleView.addOnItemTouchListener(new RecyclerView.OnItemTouchListener() { - - @Override - public boolean onInterceptTouchEvent(RecyclerView recyclerView, MotionEvent motionEvent) { - if (motionEvent.getAction() != MotionEvent.ACTION_UP) { - return false; - } - View child = recyclerView.findChildViewUnder(motionEvent.getX(), motionEvent.getY()); - if (child != null) { - return false; - } else { - mSearchInput.clearFocus(); - helperMethod.hideKeyboard(helpController.this); - return true; - } - } - - @Override - public void onTouchEvent(RecyclerView recyclerView, MotionEvent motionEvent) { - } - - @Override - public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) { - - } - }); - - mSearchInput.setEventHandler(new edittextManagerCallback()); - - if(mHelpAdapter!=null){ - postToServerRunnable = () -> mHelpAdapter.onTrigger(helpEnums.eHelpAdapter.M_INIT_FILTER, Collections.singletonList(mSearchInput.getText().toString())); - } - - mSearchInput.addTextChangedListener(new TextWatcher() { - - @Override - public void afterTextChanged(Editable s) { - mSearchInvokedHandler.removeCallbacks(postToServerRunnable); - mSearchInvokedHandler.postDelayed(postToServerRunnable, 50); - } - - @Override - public void beforeTextChanged(CharSequence s, int start,int count, int after) { - } - - @Override - public void onTextChanged(CharSequence s, int start,int before, int count) { - } - }); - } - - - - /*HELPER FUNCTIONS*/ - - private void onShowHelperManager(ArrayList pHelpListModel){ - mHelpAdapter = new helpAdapter(pHelpListModel, getApplicationContext()); - mRecycleView.setLayoutManager(new LinearLayoutManager(this)); - - mRecycleView.setAdapter(mHelpAdapter); - ((SimpleItemAnimator) Objects.requireNonNull(mRecycleView.getItemAnimator())).setSupportsChangeAnimations(false); - mHelpViewController.onTrigger(helpEnums.eHelpViewController.M_DATA_LOADED, null); - mSearchInput.setVisibility(View.VISIBLE); - mSearchInput.animate().setDuration(300).alpha(1); - } - - /*Ediitext Callback*/ - - private class edittextManagerCallback implements eventObserver.eventListener { - - @Override - public Object invokeObserver(List data, Object e_type) { - - if(e_type.equals(enums.etype.ON_KEYBOARD_CLOSE)){ - mSearchInput.clearFocus(); - //helperMethod.hideKeyboard(helpController.this); - } - return null; - } - } - - /*Helper View Callback*/ - - private class helpViewCallback implements eventObserver.eventListener{ - - @Override - public Object invokeObserver(List data, Object e_type) - { - return null; - } - } - - - /*Adapter Callbacks*/ - - private class helpAdapterCallback implements eventObserver.eventListener{ - - @Override - public Object invokeObserver(List data, Object e_type) - { - if(helpEnums.eHelpModelCallback.M_LOAD_JSON_RESPONSE_SUCCESS.equals(e_type)) - { - onShowHelperManager((ArrayList) data.get(0)); - } - else if(helpEnums.eHelpModelCallback.M_LOAD_JSON_RESPONSE_FAILURE.equals(e_type)) - { - mHelpViewController.onTrigger(helpEnums.eHelpViewController.M_LOAD_ERROR, null); - } - return null; - } - } - - /*UI Redirection*/ - - public void onClose(View view) { - finish(); - } - - public void onReloadData(View view) { - mHelpViewController.onTrigger(helpEnums.eHelpViewController.M_RELOAD_DATA, null); - mHelpModel.onTrigger(helpEnums.eHelpModel.M_LOAD_HELP_DATA,null); - } - - public void onOpenHelp(View view) { - helperMethod.sendIssueEmail(this); - } - - public void onOpenHelpExternal(View view) { - if(!status.sSettingIsAppStarted){ - activityContextManager.getInstance().getHomeController().onStartApplication(null); - } - - if(status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(this)){ - activityContextManager.getInstance().getHomeController().onDisableAdvert(); - activityContextManager.getInstance().getHomeController().onLoadURL(constants.CONST_GENESIS_HELP_URL_CACHE); - }else { - activityContextManager.getInstance().getHomeController().onDisableAdvert(); - activityContextManager.getInstance().getHomeController().onLoadURL(constants.CONST_GENESIS_HELP_URL_CACHE_DARK); - } - finish(); - activityContextManager.getInstance().onClearStack(); - } - - /*Local Overrides*/ - - @Override - protected void onResume() { - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); - super.onResume(); - } - - @Override - public void onBackPressed() { - if(mSearchInput.hasFocus()){ - mSearchInput.clearFocus(); - }else { - finish(); - } - super.onBackPressed(); - } - - -} +package com.hiddenservices.genesissearchengine.production.appManager.helpManager; + +import android.content.res.Configuration; +import android.os.Bundle; +import android.os.Handler; +import android.text.Editable; +import android.text.TextWatcher; +import android.view.MotionEvent; +import android.view.View; +import android.widget.Button; +import android.widget.ProgressBar; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; +import androidx.constraintlayout.widget.ConstraintLayout; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; +import androidx.recyclerview.widget.SimpleItemAnimator; +import com.hiddenservices.genesissearchengine.production.appManager.activityContextManager; +import com.hiddenservices.genesissearchengine.production.constants.constants; +import com.hiddenservices.genesissearchengine.production.constants.enums; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.appManager.activityThemeManager; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginController; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums; +import com.example.myapplication.R; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Objects; + +import static com.hiddenservices.genesissearchengine.production.appManager.helpManager.helpEnums.eHelpModel.M_IS_LOADED; + +public class helpController extends AppCompatActivity { + + /*Initializations*/ + private helpViewController mHelpViewController; + private helpModel mHelpModel; + private helpAdapter mHelpAdapter; + private ProgressBar mProgressBar; + private RecyclerView mRecycleView; + private ConstraintLayout mRetryContainer; + private Button mReloadButton; + private editViewController mSearchInput; + + /*Private Variables*/ + private Handler mSearchInvokedHandler = new Handler(); + private Runnable postToServerRunnable; + + @Override + protected void onCreate(Bundle savedInstanceState) { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + super.onCreate(savedInstanceState); + setContentView(R.layout.help_view); + + initializeViews(); + initializeAppModel(); + initializeLocalEventHandlers(); + } + + @Override + public void onConfigurationChanged(@NonNull Configuration newConfig) { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + + if(newConfig.uiMode != getResources().getConfiguration().uiMode){ + activityContextManager.getInstance().onResetTheme(); + activityThemeManager.getInstance().onConfigurationChanged(this); + } + + super.onConfigurationChanged(newConfig); + } + + private void initializeAppModel() + { + mHelpModel = new helpModel(this, new helpAdapterCallback()); + mHelpModel.onTrigger(helpEnums.eHelpModel.M_LOAD_HELP_DATA,null); + if((boolean)mHelpModel.onTrigger(M_IS_LOADED,null)){ + mProgressBar.setVisibility(View.GONE); + } + } + + private void initializeViews(){ + mHelpViewController = new helpViewController(); + mProgressBar = findViewById(R.id.pProgressBar); + mRecycleView = findViewById(R.id.pRecycleView); + mRetryContainer = findViewById(R.id.pRetryContainer); + mReloadButton = findViewById(R.id.pReloadButton); + mSearchInput = findViewById(R.id.pSearchInput); + + mHelpViewController.initialization(new helpViewCallback(),this, mProgressBar, mRecycleView, mRetryContainer, mReloadButton); + mHelpViewController.onTrigger(helpEnums.eHelpViewController.M_INIT_VIEWS, null); + + } + + private void initializeLocalEventHandlers(){ + + mRecycleView.addOnItemTouchListener(new RecyclerView.OnItemTouchListener() { + + @Override + public boolean onInterceptTouchEvent(RecyclerView recyclerView, MotionEvent motionEvent) { + if (motionEvent.getAction() != MotionEvent.ACTION_UP) { + return false; + } + View child = recyclerView.findChildViewUnder(motionEvent.getX(), motionEvent.getY()); + if (child != null) { + return false; + } else { + mSearchInput.clearFocus(); + helperMethod.hideKeyboard(helpController.this); + return true; + } + } + + @Override + public void onTouchEvent(RecyclerView recyclerView, MotionEvent motionEvent) { + } + + @Override + public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) { + + } + }); + + mSearchInput.setEventHandler(new edittextManagerCallback()); + + if(mHelpAdapter!=null){ + postToServerRunnable = () -> mHelpAdapter.onTrigger(helpEnums.eHelpAdapter.M_INIT_FILTER, Collections.singletonList(mSearchInput.getText().toString())); + } + + mSearchInput.addTextChangedListener(new TextWatcher() { + + @Override + public void afterTextChanged(Editable s) { + mSearchInvokedHandler.removeCallbacks(postToServerRunnable); + mSearchInvokedHandler.postDelayed(postToServerRunnable, 50); + } + + @Override + public void beforeTextChanged(CharSequence s, int start,int count, int after) { + } + + @Override + public void onTextChanged(CharSequence s, int start,int before, int count) { + } + }); + } + + + + /*HELPER FUNCTIONS*/ + + private void onShowHelperManager(ArrayList pHelpListModel){ + mHelpAdapter = new helpAdapter(pHelpListModel, getApplicationContext()); + mRecycleView.setLayoutManager(new LinearLayoutManager(this)); + + mRecycleView.setAdapter(mHelpAdapter); + ((SimpleItemAnimator) Objects.requireNonNull(mRecycleView.getItemAnimator())).setSupportsChangeAnimations(false); + mHelpViewController.onTrigger(helpEnums.eHelpViewController.M_DATA_LOADED, null); + mSearchInput.setVisibility(View.VISIBLE); + mSearchInput.animate().setDuration(300).alpha(1); + } + + /*Ediitext Callback*/ + + private class edittextManagerCallback implements eventObserver.eventListener { + + @Override + public Object invokeObserver(List data, Object e_type) { + + if(e_type.equals(enums.etype.ON_KEYBOARD_CLOSE)){ + mSearchInput.clearFocus(); + //helperMethod.hideKeyboard(helpController.this); + } + return null; + } + } + + /*Helper View Callback*/ + + private class helpViewCallback implements eventObserver.eventListener{ + + @Override + public Object invokeObserver(List data, Object e_type) + { + return null; + } + } + + + /*Adapter Callbacks*/ + + private class helpAdapterCallback implements eventObserver.eventListener{ + + @Override + public Object invokeObserver(List data, Object e_type) + { + if(helpEnums.eHelpModelCallback.M_LOAD_JSON_RESPONSE_SUCCESS.equals(e_type)) + { + onShowHelperManager((ArrayList) data.get(0)); + } + else if(helpEnums.eHelpModelCallback.M_LOAD_JSON_RESPONSE_FAILURE.equals(e_type)) + { + mHelpViewController.onTrigger(helpEnums.eHelpViewController.M_LOAD_ERROR, null); + } + return null; + } + } + + /*UI Redirection*/ + + public void onClose(View view) { + finish(); + } + + public void onReloadData(View view) { + mHelpViewController.onTrigger(helpEnums.eHelpViewController.M_RELOAD_DATA, null); + mHelpModel.onTrigger(helpEnums.eHelpModel.M_LOAD_HELP_DATA,null); + } + + public void onOpenHelp(View view) { + helperMethod.sendIssueEmail(this); + } + + public void onOpenHelpExternal(View view) { + if(!status.sSettingIsAppStarted){ + activityContextManager.getInstance().getHomeController().onStartApplication(null); + } + + if(status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(this)){ + activityContextManager.getInstance().getHomeController().onDisableAdvert(); + activityContextManager.getInstance().getHomeController().onLoadURL(constants.CONST_GENESIS_HELP_URL_CACHE); + }else { + activityContextManager.getInstance().getHomeController().onDisableAdvert(); + activityContextManager.getInstance().getHomeController().onLoadURL(constants.CONST_GENESIS_HELP_URL_CACHE_DARK); + } + finish(); + activityContextManager.getInstance().onClearStack(); + } + + /*Local Overrides*/ + + @Override + protected void onResume() { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); + super.onResume(); + } + + @Override + public void onBackPressed() { + if(mSearchInput.hasFocus()){ + mSearchInput.clearFocus(); + }else { + finish(); + } + super.onBackPressed(); + } + + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpDataModel.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/helpManager/helpDataModel.java similarity index 82% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpDataModel.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/helpManager/helpDataModel.java index 1628caf4..e7cf605e 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpDataModel.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/helpManager/helpDataModel.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.helpManager; +package com.hiddenservices.genesissearchengine.production.appManager.helpManager; public class helpDataModel { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpEnums.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/helpManager/helpEnums.java similarity index 80% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpEnums.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/helpManager/helpEnums.java index 8c1b4d19..a1e84df1 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpEnums.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/helpManager/helpEnums.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.helpManager; +package com.hiddenservices.genesissearchengine.production.appManager.helpManager; class helpEnums { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpModel.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/helpManager/helpModel.java similarity index 86% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpModel.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/helpManager/helpModel.java index 015893b8..fcd748f3 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpModel.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/helpManager/helpModel.java @@ -1,21 +1,21 @@ -package com.darkweb.genesissearchengine.appManager.helpManager; +package com.hiddenservices.genesissearchengine.production.appManager.helpManager; import androidx.appcompat.app.AppCompatActivity; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.toolbox.StringRequest; import com.android.volley.toolbox.Volley; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.eventObserver; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.dataManager.dataController; +import com.hiddenservices.genesissearchengine.production.dataManager.dataEnums; +import com.hiddenservices.genesissearchengine.production.eventObserver; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import static com.darkweb.genesissearchengine.constants.constants.*; +import static com.hiddenservices.genesissearchengine.production.constants.constants.*; class helpModel { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpViewController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/helpManager/helpViewController.java similarity index 93% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpViewController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/helpManager/helpViewController.java index da42b04f..ce6cbf3a 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpViewController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/helpManager/helpViewController.java @@ -1,105 +1,105 @@ -package com.darkweb.genesissearchengine.appManager.helpManager; - -import android.os.Build; -import android.view.View; -import android.view.Window; -import android.view.WindowManager; -import android.widget.Button; -import android.widget.ProgressBar; - -import androidx.appcompat.app.AppCompatActivity; -import androidx.appcompat.app.AppCompatDelegate; -import androidx.constraintlayout.widget.ConstraintLayout; -import androidx.core.content.ContextCompat; -import androidx.recyclerview.widget.RecyclerView; - -import com.darkweb.genesissearchengine.eventObserver; -import com.example.myapplication.R; - -import java.util.List; - -class helpViewController -{ - /*ViewControllers*/ - private AppCompatActivity mContext; - private eventObserver.eventListener mEvent; - private ProgressBar mProgressBar; - private RecyclerView mRecyclerView; - private ConstraintLayout mRetryContainer; - private Button mReloadButton; - - void initialization(eventObserver.eventListener event, AppCompatActivity context, ProgressBar pProgressBar, RecyclerView pRecyclerView, ConstraintLayout pRetryContainer, Button pReloadButton){ - this.mContext = context; - this.mProgressBar = pProgressBar; - this.mRecyclerView = pRecyclerView; - this.mRetryContainer = pRetryContainer; - this.mReloadButton = pReloadButton; - } - - private void initPostUI(){ - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - Window window = mContext.getWindow(); - window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); - - if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { - window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); - } - else { - if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ - mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); - } - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); - } - } - } - - private void onDataLoaded(){ - mProgressBar.animate().cancel(); - mRetryContainer.animate().cancel(); - mRecyclerView.animate().cancel(); - - mRecyclerView.animate().setDuration(300).alpha(1); - mProgressBar.animate().setDuration(300).alpha(0); - } - - private void onLoadError(){ - mRecyclerView.animate().setDuration(300).alpha(0); - mProgressBar.setVisibility(View.VISIBLE); - mProgressBar.setAlpha(1); - - mRetryContainer.bringToFront(); - mProgressBar.animate().setDuration(300).setStartDelay(200).alpha(0).withEndAction(() -> { - mRetryContainer.setAlpha(0); - mRetryContainer.animate().setDuration(300).alpha(1).withEndAction(() -> mReloadButton.setClickable(true)); - mRetryContainer.setVisibility(View.VISIBLE); - }); - } - - private void onReloadData(){ - mRecyclerView.animate().setDuration(300).alpha(0); - mReloadButton.setClickable(false); - mRetryContainer.animate().cancel(); - mProgressBar.animate().cancel(); - mProgressBar.animate().setDuration(300).alpha(1); - mRetryContainer.animate().alpha(0).withEndAction(() -> { - mRetryContainer.setVisibility(View.GONE); - }); - } - - public void onTrigger(helpEnums.eHelpViewController pCommands, List pData){ - if(pCommands.equals(helpEnums.eHelpViewController.M_INIT_VIEWS)){ - initPostUI(); - } - else if(pCommands.equals(helpEnums.eHelpViewController.M_DATA_LOADED)){ - onDataLoaded(); - } - else if(pCommands.equals(helpEnums.eHelpViewController.M_LOAD_ERROR)){ - onLoadError(); - } - else if(pCommands.equals(helpEnums.eHelpViewController.M_RELOAD_DATA)){ - onReloadData(); - } - } - -} +package com.hiddenservices.genesissearchengine.production.appManager.helpManager; + +import android.os.Build; +import android.view.View; +import android.view.Window; +import android.view.WindowManager; +import android.widget.Button; +import android.widget.ProgressBar; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatDelegate; +import androidx.constraintlayout.widget.ConstraintLayout; +import androidx.core.content.ContextCompat; +import androidx.recyclerview.widget.RecyclerView; + +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.example.myapplication.R; + +import java.util.List; + +class helpViewController +{ + /*ViewControllers*/ + private AppCompatActivity mContext; + private eventObserver.eventListener mEvent; + private ProgressBar mProgressBar; + private RecyclerView mRecyclerView; + private ConstraintLayout mRetryContainer; + private Button mReloadButton; + + void initialization(eventObserver.eventListener event, AppCompatActivity context, ProgressBar pProgressBar, RecyclerView pRecyclerView, ConstraintLayout pRetryContainer, Button pReloadButton){ + this.mContext = context; + this.mProgressBar = pProgressBar; + this.mRecyclerView = pRecyclerView; + this.mRetryContainer = pRetryContainer; + this.mReloadButton = pReloadButton; + } + + private void initPostUI(){ + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + Window window = mContext.getWindow(); + window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); + + if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { + window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); + } + else { + if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ + mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); + } + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); + } + } + } + + private void onDataLoaded(){ + mProgressBar.animate().cancel(); + mRetryContainer.animate().cancel(); + mRecyclerView.animate().cancel(); + + mRecyclerView.animate().setDuration(300).alpha(1); + mProgressBar.animate().setDuration(300).alpha(0); + } + + private void onLoadError(){ + mRecyclerView.animate().setDuration(300).alpha(0); + mProgressBar.setVisibility(View.VISIBLE); + mProgressBar.setAlpha(1); + + mRetryContainer.bringToFront(); + mProgressBar.animate().setDuration(300).setStartDelay(200).alpha(0).withEndAction(() -> { + mRetryContainer.setAlpha(0); + mRetryContainer.animate().setDuration(300).alpha(1).withEndAction(() -> mReloadButton.setClickable(true)); + mRetryContainer.setVisibility(View.VISIBLE); + }); + } + + private void onReloadData(){ + mRecyclerView.animate().setDuration(300).alpha(0); + mReloadButton.setClickable(false); + mRetryContainer.animate().cancel(); + mProgressBar.animate().cancel(); + mProgressBar.animate().setDuration(300).alpha(1); + mRetryContainer.animate().alpha(0).withEndAction(() -> { + mRetryContainer.setVisibility(View.GONE); + }); + } + + public void onTrigger(helpEnums.eHelpViewController pCommands, List pData){ + if(pCommands.equals(helpEnums.eHelpViewController.M_INIT_VIEWS)){ + initPostUI(); + } + else if(pCommands.equals(helpEnums.eHelpViewController.M_DATA_LOADED)){ + onDataLoaded(); + } + else if(pCommands.equals(helpEnums.eHelpViewController.M_LOAD_ERROR)){ + onLoadError(); + } + else if(pCommands.equals(helpEnums.eHelpViewController.M_RELOAD_DATA)){ + onReloadData(); + } + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyAdapter.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/historyManager/historyAdapter.java old mode 100755 new mode 100644 similarity index 95% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyAdapter.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/historyManager/historyAdapter.java index 361041dd..930bc0a2 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyAdapter.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/historyManager/historyAdapter.java @@ -1,8 +1,7 @@ -package com.darkweb.genesissearchengine.appManager.historyManager; +package com.hiddenservices.genesissearchengine.production.appManager.historyManager; import android.annotation.SuppressLint; import android.content.Context; -import android.graphics.drawable.Drawable; import android.os.Handler; import android.view.LayoutInflater; import android.view.MotionEvent; @@ -14,11 +13,11 @@ import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.RecyclerView; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.constants.strings; -import com.darkweb.genesissearchengine.dataManager.models.historyRowModel; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.constants.enums; +import com.hiddenservices.genesissearchengine.production.constants.strings; +import com.hiddenservices.genesissearchengine.production.dataManager.models.historyRowModel; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; import com.example.myapplication.R; import java.util.ArrayList; @@ -26,9 +25,7 @@ import java.util.Arrays; import java.util.Calendar; import java.util.Collections; import java.util.Date; -import java.util.HashMap; import java.util.List; -import java.util.Map; import systems.intelligo.slight.ImageLoader; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyAdapterView.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/historyManager/historyAdapterView.java similarity index 92% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyAdapterView.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/historyManager/historyAdapterView.java index b4a7f4fc..6be6e11d 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyAdapterView.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/historyManager/historyAdapterView.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.historyManager; +package com.hiddenservices.genesissearchengine.production.appManager.historyManager; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; @@ -9,8 +9,8 @@ import android.widget.ImageView; import android.widget.PopupWindow; import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; import com.example.myapplication.R; import java.util.List; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/historyManager/historyController.java old mode 100755 new mode 100644 similarity index 88% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/historyManager/historyController.java index cbec4955..b10a5ae4 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/historyManager/historyController.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.historyManager; +package com.hiddenservices.genesissearchengine.production.appManager.historyManager; import android.content.Context; import android.content.res.Configuration; @@ -23,29 +23,29 @@ import android.widget.TextView; import androidx.recyclerview.widget.ItemTouchHelper; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.dataManager.models.historyRowModel; -import com.darkweb.genesissearchengine.appManager.homeManager.homeController.editTextManager; -import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.constants.strings; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.appManager.activityThemeManager; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.hiddenservices.genesissearchengine.production.appManager.activityContextManager; +import com.hiddenservices.genesissearchengine.production.dataManager.models.historyRowModel; +import com.hiddenservices.genesissearchengine.production.appManager.homeManager.homeController.editTextManager; +import com.hiddenservices.genesissearchengine.production.appManager.homeManager.homeController.homeController; +import com.hiddenservices.genesissearchengine.production.constants.enums; +import com.hiddenservices.genesissearchengine.production.constants.keys; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.constants.strings; +import com.hiddenservices.genesissearchengine.production.dataManager.dataController; +import com.hiddenservices.genesissearchengine.production.dataManager.dataEnums; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.appManager.activityThemeManager; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginController; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums; import com.example.myapplication.R; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; -import static com.darkweb.genesissearchengine.appManager.historyManager.historyEnums.eHistoryViewCommands.M_VERTIFY_SELECTION_MENU; -import static com.darkweb.genesissearchengine.constants.sql.SQL_CLEAR_HISTORY; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_CLEAR_HISTORY; +import static com.hiddenservices.genesissearchengine.production.appManager.historyManager.historyEnums.eHistoryViewCommands.M_VERTIFY_SELECTION_MENU; +import static com.hiddenservices.genesissearchengine.production.constants.sql.SQL_CLEAR_HISTORY; +import static com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums.eMessageManager.M_CLEAR_HISTORY; public class historyController extends AppCompatActivity { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyEnums.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/historyManager/historyEnums.java similarity index 84% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyEnums.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/historyManager/historyEnums.java index 4bd8e482..72b3f107 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyEnums.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/historyManager/historyEnums.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.historyManager; +package com.hiddenservices.genesissearchengine.production.appManager.historyManager; public class historyEnums { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyModel.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/historyManager/historyModel.java old mode 100755 new mode 100644 similarity index 72% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyModel.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/historyManager/historyModel.java index 88c95aa6..968f1e87 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyModel.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/historyManager/historyModel.java @@ -1,6 +1,6 @@ -package com.darkweb.genesissearchengine.appManager.historyManager; +package com.hiddenservices.genesissearchengine.production.appManager.historyManager; -import com.darkweb.genesissearchengine.dataManager.models.historyRowModel; +import com.hiddenservices.genesissearchengine.production.dataManager.models.historyRowModel; import java.util.ArrayList; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyViewController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/historyManager/historyViewController.java old mode 100755 new mode 100644 similarity index 95% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyViewController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/historyManager/historyViewController.java index 67377150..b7f0d7f8 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyViewController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/historyManager/historyViewController.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.historyManager; +package com.hiddenservices.genesissearchengine.production.appManager.historyManager; import android.content.Context; import android.graphics.Bitmap; @@ -27,9 +27,9 @@ import androidx.core.content.ContextCompat; import androidx.recyclerview.widget.ItemTouchHelper; import androidx.recyclerview.widget.RecyclerView; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.constants.strings; -import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.constants.strings; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; import com.example.myapplication.R; import java.util.List; import java.util.Objects; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/FakeLauncherActivity.kt b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/FakeLauncherActivity.kt similarity index 71% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/FakeLauncherActivity.kt rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/FakeLauncherActivity.kt index a93a363c..a6d80890 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/FakeLauncherActivity.kt +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/FakeLauncherActivity.kt @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.homeManager +package com.hiddenservices.genesissearchengine.production.appManager.homeManager import androidx.appcompat.app.AppCompatActivity import android.os.Bundle diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/NestedGeckoView.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/geckoManager/NestedGeckoView.java similarity index 85% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/NestedGeckoView.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/geckoManager/NestedGeckoView.java index a4d40e54..569b2df3 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/NestedGeckoView.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/geckoManager/NestedGeckoView.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.homeManager.geckoManager; +package com.hiddenservices.genesissearchengine.production.appManager.homeManager.geckoManager; import android.content.Context; import androidx.core.view.NestedScrollingChildHelper; @@ -8,24 +8,18 @@ import android.os.Handler; import android.util.AttributeSet; import android.util.Log; import android.view.MotionEvent; -import android.view.View; -import android.view.ViewTreeObserver; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.eventObserver; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.eventObserver; import org.mozilla.geckoview.GeckoView; -import java.util.Arrays; import java.util.Collections; -import static com.darkweb.genesissearchengine.constants.enums.etype.GECKO_SCROLL_DOWN; -import static com.darkweb.genesissearchengine.constants.enums.etype.GECKO_SCROLL_DOWN_MOVE; -import static com.darkweb.genesissearchengine.constants.enums.etype.GECKO_SCROLL_UP; -import static com.darkweb.genesissearchengine.constants.enums.etype.GECKO_SCROLL_UP_ALWAYS; -import static com.darkweb.genesissearchengine.constants.enums.etype.GECKO_SCROLL_UP_MOVE; -import static com.darkweb.genesissearchengine.constants.enums.etype.WAS_SCROLL_CHANGED; +import static com.hiddenservices.genesissearchengine.production.constants.enums.etype.GECKO_SCROLL_DOWN; +import static com.hiddenservices.genesissearchengine.production.constants.enums.etype.GECKO_SCROLL_DOWN_MOVE; +import static com.hiddenservices.genesissearchengine.production.constants.enums.etype.GECKO_SCROLL_UP_ALWAYS; +import static com.hiddenservices.genesissearchengine.production.constants.enums.etype.GECKO_SCROLL_UP_MOVE; +import static com.hiddenservices.genesissearchengine.production.constants.enums.etype.WAS_SCROLL_CHANGED; public class NestedGeckoView extends GeckoView { private int mLastY; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/errorHandler.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/geckoManager/errorHandler.java similarity index 95% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/errorHandler.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/geckoManager/errorHandler.java index 58021225..728c6f10 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/errorHandler.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/geckoManager/errorHandler.java @@ -1,8 +1,8 @@ -package com.darkweb.genesissearchengine.appManager.homeManager.geckoManager; +package com.hiddenservices.genesissearchengine.production.appManager.homeManager.geckoManager; import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.constants.strings; -import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.constants.strings; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; import com.example.myapplication.R; import org.mozilla.geckoview.WebRequestError; import java.io.BufferedReader; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/extendedGeckoView.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/geckoManager/extendedGeckoView.java similarity index 96% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/extendedGeckoView.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/geckoManager/extendedGeckoView.java index 417f541b..539b0146 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/extendedGeckoView.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/geckoManager/extendedGeckoView.java @@ -1,24 +1,19 @@ -package com.darkweb.genesissearchengine.appManager.homeManager.geckoManager; +package com.hiddenservices.genesissearchengine.production.appManager.homeManager.geckoManager; import org.mozilla.gecko.AndroidGamepadManager; -import org.mozilla.gecko.EventDispatcher; import org.mozilla.gecko.InputMethods; import org.mozilla.gecko.SurfaceViewWrapper; //import org.mozilla.gecko.util.ActivityUtils; import org.mozilla.gecko.util.ThreadUtils; import org.mozilla.geckoview.Autofill; -import org.mozilla.geckoview.BasicSelectionActionDelegate; import org.mozilla.geckoview.GeckoDisplay; import org.mozilla.geckoview.GeckoResult; -import org.mozilla.geckoview.GeckoRuntime; import org.mozilla.geckoview.GeckoSession; import org.mozilla.geckoview.PanZoomController; import android.annotation.SuppressLint; import android.annotation.TargetApi; -import android.app.Activity; import android.content.Context; -import android.content.res.Configuration; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoClients.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/geckoManager/geckoClients.java similarity index 93% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoClients.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/geckoManager/geckoClients.java index c3bc1939..81e64e39 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoClients.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/geckoManager/geckoClients.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.homeManager.geckoManager; +package com.hiddenservices.genesissearchengine.production.appManager.homeManager.geckoManager; import android.annotation.SuppressLint; import android.content.Context; @@ -9,24 +9,24 @@ import android.util.Log; import android.widget.ImageView; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.kotlinHelperLibraries.BrowserIconManager; -import com.darkweb.genesissearchengine.constants.*; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.appManager.activityContextManager; +import com.hiddenservices.genesissearchengine.production.appManager.kotlinHelperLibraries.BrowserIconManager; +import com.hiddenservices.genesissearchengine.production.constants.*; +import com.hiddenservices.genesissearchengine.production.dataManager.dataController; +import com.hiddenservices.genesissearchengine.production.dataManager.dataEnums; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.Arrays; import java.util.List; -import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_URL_CACHED; -import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_URL_CACHED_DARK; -import static com.darkweb.genesissearchengine.constants.constants.CONST_REPORT_URL; -import static com.darkweb.genesissearchengine.constants.enums.etype.M_INDEX_WEBSITE; -import static com.darkweb.genesissearchengine.constants.enums.etype.on_handle_external_intent; +import static com.hiddenservices.genesissearchengine.production.constants.constants.CONST_GENESIS_URL_CACHED; +import static com.hiddenservices.genesissearchengine.production.constants.constants.CONST_GENESIS_URL_CACHED_DARK; +import static com.hiddenservices.genesissearchengine.production.constants.constants.CONST_REPORT_URL; +import static com.hiddenservices.genesissearchengine.production.constants.enums.etype.M_INDEX_WEBSITE; +import static com.hiddenservices.genesissearchengine.production.constants.enums.etype.on_handle_external_intent; import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_MOBILE; import static org.mozilla.geckoview.StorageController.ClearFlags.AUTH_SESSIONS; import static org.mozilla.geckoview.StorageController.ClearFlags.COOKIES; @@ -44,7 +44,7 @@ import org.mozilla.geckoview.GeckoRuntimeSettings; import org.mozilla.geckoview.GeckoView; import org.mozilla.geckoview.WebExtension; import org.mozilla.geckoview.WebResponse; -import org.torproject.android.service.wrapper.orbotLocalConstants; +import org.orbotproject.android.service.wrapper.orbotLocalConstants; public class geckoClients { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoDownloadManager.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/geckoManager/geckoDownloadManager.java similarity index 82% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoDownloadManager.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/geckoManager/geckoDownloadManager.java index 98b044be..c20ddfe1 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoDownloadManager.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/geckoManager/geckoDownloadManager.java @@ -1,17 +1,16 @@ -package com.darkweb.genesissearchengine.appManager.homeManager.geckoManager; +package com.hiddenservices.genesissearchengine.production.appManager.homeManager.geckoManager; import android.Manifest; import android.content.pm.PackageManager; import android.net.Uri; -import android.util.Log; import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.ActivityCompat; import androidx.core.content.ContextCompat; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.constants.strings; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.constants.enums; +import com.hiddenservices.genesissearchengine.production.constants.strings; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; import org.mozilla.geckoview.WebResponse; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoPromptView.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/geckoManager/geckoPromptView.java similarity index 97% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoPromptView.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/geckoManager/geckoPromptView.java index 69c44ff9..45b4455e 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoPromptView.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/geckoManager/geckoPromptView.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.homeManager.geckoManager; +package com.hiddenservices.genesissearchengine.production.appManager.homeManager.geckoManager; import android.annotation.TargetApi; import android.app.Activity; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoSession.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/geckoManager/geckoSession.java similarity index 93% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoSession.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/geckoManager/geckoSession.java index 58b77846..a0877701 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoSession.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/geckoManager/geckoSession.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.homeManager.geckoManager; +package com.hiddenservices.genesissearchengine.production.appManager.homeManager.geckoManager; import android.app.NotificationChannel; import android.app.NotificationManager; @@ -29,17 +29,17 @@ import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.NotificationCompat; import androidx.core.content.FileProvider; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.constants.strings; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.libs.trueTime.trueTimeEncryption; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.hiddenservices.genesissearchengine.production.constants.constants; +import com.hiddenservices.genesissearchengine.production.constants.enums; +import com.hiddenservices.genesissearchengine.production.constants.keys; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.constants.strings; +import com.hiddenservices.genesissearchengine.production.dataManager.dataEnums; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.libs.trueTime.trueTimeEncryption; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginController; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums; import com.example.myapplication.R; import org.json.JSONException; @@ -55,7 +55,7 @@ import org.mozilla.geckoview.SlowScriptResponse; import org.mozilla.geckoview.WebExtension; import org.mozilla.geckoview.WebRequestError; import org.mozilla.geckoview.WebResponse; -import org.torproject.android.service.wrapper.orbotLocalConstants; +import org.orbotproject.android.service.wrapper.orbotLocalConstants; import java.io.File; import java.io.FileOutputStream; @@ -69,17 +69,17 @@ import java.util.Date; import java.util.List; import java.util.Objects; -import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_ERROR_CACHED; -import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_ERROR_CACHED_DARK; -import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_HELP_URL_CACHE; -import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_HELP_URL_CACHE_DARK; -import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_URL_CACHED; -import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_URL_CACHED_DARK; -import static com.darkweb.genesissearchengine.constants.enums.etype.M_DEFAULT_BROWSER; -import static com.darkweb.genesissearchengine.constants.enums.etype.M_RATE_COUNT; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_LONG_PRESS_URL; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_LONG_PRESS_WITH_LINK; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManagerCallbacks.M_RATE_APPLICATION; +import static com.hiddenservices.genesissearchengine.production.constants.constants.CONST_GENESIS_ERROR_CACHED; +import static com.hiddenservices.genesissearchengine.production.constants.constants.CONST_GENESIS_ERROR_CACHED_DARK; +import static com.hiddenservices.genesissearchengine.production.constants.constants.CONST_GENESIS_HELP_URL_CACHE; +import static com.hiddenservices.genesissearchengine.production.constants.constants.CONST_GENESIS_HELP_URL_CACHE_DARK; +import static com.hiddenservices.genesissearchengine.production.constants.constants.CONST_GENESIS_URL_CACHED; +import static com.hiddenservices.genesissearchengine.production.constants.constants.CONST_GENESIS_URL_CACHED_DARK; +import static com.hiddenservices.genesissearchengine.production.constants.enums.etype.M_DEFAULT_BROWSER; +import static com.hiddenservices.genesissearchengine.production.constants.enums.etype.M_RATE_COUNT; +import static com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums.eMessageManager.M_LONG_PRESS_URL; +import static com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums.eMessageManager.M_LONG_PRESS_WITH_LINK; +import static com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums.eMessageManagerCallbacks.M_RATE_APPLICATION; import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_DESKTOP; import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_MOBILE; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/selectionActionDelegate.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/geckoManager/selectionActionDelegate.java similarity index 95% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/selectionActionDelegate.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/geckoManager/selectionActionDelegate.java index e8d3b492..b5b5f4a7 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/selectionActionDelegate.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/geckoManager/selectionActionDelegate.java @@ -1,11 +1,8 @@ -package com.darkweb.genesissearchengine.appManager.homeManager.geckoManager; +package com.hiddenservices.genesissearchengine.production.appManager.homeManager.geckoManager; import android.annotation.TargetApi; import android.app.Activity; import android.content.ActivityNotFoundException; -import android.content.ClipData; -import android.content.ClipboardManager; -import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.graphics.Matrix; @@ -21,7 +18,7 @@ import android.view.Menu; import android.view.MenuItem; import android.view.View; -import com.darkweb.genesissearchengine.appManager.activityContextManager; +import com.hiddenservices.genesissearchengine.production.appManager.activityContextManager; import org.mozilla.gecko.util.ThreadUtils; import org.mozilla.geckoview.GeckoSession; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/hintManager/hintAdapter.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/hintManager/hintAdapter.java similarity index 91% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/hintManager/hintAdapter.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/hintManager/hintAdapter.java index acebb611..53352e24 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/hintManager/hintAdapter.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/hintManager/hintAdapter.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.homeManager.hintManager; +package com.hiddenservices.genesissearchengine.production.appManager.homeManager.hintManager; import android.annotation.SuppressLint; import android.content.res.ColorStateList; @@ -19,12 +19,12 @@ import androidx.appcompat.app.AppCompatActivity; import androidx.cardview.widget.CardView; import androidx.recyclerview.widget.RecyclerView; -import com.darkweb.genesissearchengine.dataManager.models.historyRowModel; -import com.darkweb.genesissearchengine.appManager.tabManager.tabEnums; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.constants.strings; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.dataManager.models.historyRowModel; +import com.hiddenservices.genesissearchengine.production.appManager.tabManager.tabEnums; +import com.hiddenservices.genesissearchengine.production.constants.enums; +import com.hiddenservices.genesissearchengine.production.constants.strings; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; import com.example.myapplication.R; import java.util.ArrayList; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/hintManager/hintModel.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/hintManager/hintModel.java similarity index 73% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/hintManager/hintModel.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/hintManager/hintModel.java index 4272030c..5adc6799 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/hintManager/hintModel.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/hintManager/hintModel.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.homeManager.hintManager; +package com.hiddenservices.genesissearchengine.production.appManager.homeManager.hintManager; public class hintModel { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/editTextManager.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/homeController/editTextManager.java similarity index 89% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/editTextManager.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/homeController/editTextManager.java index f6a3730c..2d515747 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/editTextManager.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/homeController/editTextManager.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.homeManager.homeController; +package com.hiddenservices.genesissearchengine.production.appManager.homeManager.homeController; import android.content.ClipData; import android.content.ClipboardManager; @@ -11,8 +11,8 @@ import android.view.KeyEvent; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.eventObserver; +import com.hiddenservices.genesissearchengine.production.constants.enums; +import com.hiddenservices.genesissearchengine.production.eventObserver; public class editTextManager extends androidx.appcompat.widget.AppCompatAutoCompleteTextView { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/homeController/homeController.java similarity index 93% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/homeController/homeController.java index 259a7223..b9b88746 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/homeController/homeController.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.homeManager.homeController; +package com.hiddenservices.genesissearchengine.production.appManager.homeManager.homeController; import android.annotation.SuppressLint; import android.app.ActivityManager; @@ -46,36 +46,36 @@ import androidx.core.widget.NestedScrollView; import androidx.fragment.app.FragmentContainerView; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkSettings.bookmarkSettingController; -import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkHome.bookmarkController; -import com.darkweb.genesissearchengine.appManager.historyManager.historyController; -import com.darkweb.genesissearchengine.dataManager.models.historyRowModel; -import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.NestedGeckoView; -import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.*; -import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.geckoSession; -import com.darkweb.genesissearchengine.appManager.homeManager.hintManager.hintAdapter; -import com.darkweb.genesissearchengine.appManager.languageManager.languageController; -import com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogController; -import com.darkweb.genesissearchengine.appManager.orbotManager.orbotController; -import com.darkweb.genesissearchengine.appManager.settingManager.searchEngineManager.settingSearchController; -import com.darkweb.genesissearchengine.appManager.settingManager.settingHomeManager.settingHomeController; -import com.darkweb.genesissearchengine.dataManager.models.tabRowModel; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.constants.strings; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.libs.views.KeyboardUtils; -import com.darkweb.genesissearchengine.appManager.activityStateManager; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.appManager.activityThemeManager; -import com.darkweb.genesissearchengine.libs.trueTime.trueTimeEncryption; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.hiddenservices.genesissearchengine.production.appManager.activityContextManager; +import com.hiddenservices.genesissearchengine.production.appManager.bookmarkManager.bookmarkSettings.bookmarkSettingController; +import com.hiddenservices.genesissearchengine.production.appManager.bookmarkManager.bookmarkHome.bookmarkController; +import com.hiddenservices.genesissearchengine.production.appManager.historyManager.historyController; +import com.hiddenservices.genesissearchengine.production.dataManager.models.historyRowModel; +import com.hiddenservices.genesissearchengine.production.appManager.homeManager.geckoManager.NestedGeckoView; +import com.hiddenservices.genesissearchengine.production.appManager.homeManager.geckoManager.*; +import com.hiddenservices.genesissearchengine.production.appManager.homeManager.geckoManager.geckoSession; +import com.hiddenservices.genesissearchengine.production.appManager.homeManager.hintManager.hintAdapter; +import com.hiddenservices.genesissearchengine.production.appManager.languageManager.languageController; +import com.hiddenservices.genesissearchengine.production.appManager.orbotLogManager.orbotLogController; +import com.hiddenservices.genesissearchengine.production.appManager.orbotManager.orbotController; +import com.hiddenservices.genesissearchengine.production.appManager.settingManager.searchEngineManager.settingSearchController; +import com.hiddenservices.genesissearchengine.production.appManager.settingManager.settingHomeManager.settingHomeController; +import com.hiddenservices.genesissearchengine.production.dataManager.models.tabRowModel; +import com.hiddenservices.genesissearchengine.production.constants.constants; +import com.hiddenservices.genesissearchengine.production.constants.enums; +import com.hiddenservices.genesissearchengine.production.constants.keys; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.constants.strings; +import com.hiddenservices.genesissearchengine.production.dataManager.dataController; +import com.hiddenservices.genesissearchengine.production.dataManager.dataEnums; +import com.hiddenservices.genesissearchengine.production.libs.views.KeyboardUtils; +import com.hiddenservices.genesissearchengine.production.appManager.activityStateManager; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.appManager.activityThemeManager; +import com.hiddenservices.genesissearchengine.production.libs.trueTime.trueTimeEncryption; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginController; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums; import com.example.myapplication.R; import com.mopub.mobileads.MoPubView; import com.widget.Genesis.widgetManager.widgetController; @@ -83,10 +83,10 @@ import com.widget.Genesis.widgetManager.widgetController; import org.mozilla.geckoview.ContentBlocking; import org.mozilla.geckoview.GeckoResult; import org.mozilla.geckoview.GeckoSession; -import org.torproject.android.service.OrbotService; -import org.torproject.android.service.util.Prefs; -import org.torproject.android.service.wrapper.LocaleHelper; -import org.torproject.android.service.wrapper.orbotLocalConstants; +import org.orbotproject.android.service.OrbotService; +import org.orbotproject.android.service.util.Prefs; +import org.orbotproject.android.service.wrapper.LocaleHelper; +import org.orbotproject.android.service.wrapper.orbotLocalConstants; import java.lang.ref.WeakReference; import java.lang.reflect.Field; import java.lang.reflect.Method; @@ -103,31 +103,31 @@ import mozilla.components.support.utils.DownloadUtils; import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; import static android.content.Intent.FLAG_ACTIVITY_NO_ANIMATION; import static androidx.appcompat.app.AppCompatDelegate.setDefaultNightMode; -import static com.darkweb.genesissearchengine.constants.constants.CONST_EXTERNAL_SHORTCUT_COMMAND_ERASE_OPEN; -import static com.darkweb.genesissearchengine.constants.constants.CONST_EXTERNAL_SHORTCUT_COMMAND_RESTART; -import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_HELP_URL_CACHE; -import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_HELP_URL_CACHE_DARK; -import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_URL_CACHED; -import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_URL_CACHED_DARK; -import static com.darkweb.genesissearchengine.constants.enums.etype.GECKO_SCROLL_DOWN; -import static com.darkweb.genesissearchengine.constants.enums.etype.GECKO_SCROLL_UP_MOVE; -import static com.darkweb.genesissearchengine.constants.enums.etype.M_CLOSE_TAB_BACK; -import static com.darkweb.genesissearchengine.constants.enums.etype.M_HOME_BUTTON_PRESSED; -import static com.darkweb.genesissearchengine.constants.enums.etype.M_INITIALIZE_TAB_LINK; -import static com.darkweb.genesissearchengine.constants.enums.etype.M_INITIALIZE_TAB_SINGLE; -import static com.darkweb.genesissearchengine.constants.enums.etype.M_NEW_LINK_IN_NEW_TAB; -import static com.darkweb.genesissearchengine.constants.enums.etype.M_NEW_LINK_IN_NEW_TAB_LOAD; -import static com.darkweb.genesissearchengine.constants.enums.etype.WAS_SCROLL_CHANGED; -import static com.darkweb.genesissearchengine.constants.enums.etype.open_new_tab; -import static com.darkweb.genesissearchengine.constants.keys.EXTERNAL_SHORTCUT_COMMAND; -import static com.darkweb.genesissearchengine.constants.keys.EXTERNAL_SHORTCUT_COMMAND_NAVIGATE; -import static com.darkweb.genesissearchengine.constants.keys.M_ACTIVITY_RESPONSE; -import static com.darkweb.genesissearchengine.constants.responses.BOOKMARK_SETTING_CONTROLLER_SHOW_DELETE_ALERT; -import static com.darkweb.genesissearchengine.constants.responses.BOOKMARK_SETTING_CONTROLLER_SHOW_SUCCESS_ALERT; -import static com.darkweb.genesissearchengine.constants.sql.SQL_CLEAR_HISTORY; -import static com.darkweb.genesissearchengine.dataManager.dataEnums.eBookmarkCommands.M_INTENT_BOOKMARK; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.*; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManagerCallbacks.M_RATE_APPLICATION; +import static com.hiddenservices.genesissearchengine.production.constants.constants.CONST_EXTERNAL_SHORTCUT_COMMAND_ERASE_OPEN; +import static com.hiddenservices.genesissearchengine.production.constants.constants.CONST_EXTERNAL_SHORTCUT_COMMAND_RESTART; +import static com.hiddenservices.genesissearchengine.production.constants.constants.CONST_GENESIS_HELP_URL_CACHE; +import static com.hiddenservices.genesissearchengine.production.constants.constants.CONST_GENESIS_HELP_URL_CACHE_DARK; +import static com.hiddenservices.genesissearchengine.production.constants.constants.CONST_GENESIS_URL_CACHED; +import static com.hiddenservices.genesissearchengine.production.constants.constants.CONST_GENESIS_URL_CACHED_DARK; +import static com.hiddenservices.genesissearchengine.production.constants.enums.etype.GECKO_SCROLL_DOWN; +import static com.hiddenservices.genesissearchengine.production.constants.enums.etype.GECKO_SCROLL_UP_MOVE; +import static com.hiddenservices.genesissearchengine.production.constants.enums.etype.M_CLOSE_TAB_BACK; +import static com.hiddenservices.genesissearchengine.production.constants.enums.etype.M_HOME_BUTTON_PRESSED; +import static com.hiddenservices.genesissearchengine.production.constants.enums.etype.M_INITIALIZE_TAB_LINK; +import static com.hiddenservices.genesissearchengine.production.constants.enums.etype.M_INITIALIZE_TAB_SINGLE; +import static com.hiddenservices.genesissearchengine.production.constants.enums.etype.M_NEW_LINK_IN_NEW_TAB; +import static com.hiddenservices.genesissearchengine.production.constants.enums.etype.M_NEW_LINK_IN_NEW_TAB_LOAD; +import static com.hiddenservices.genesissearchengine.production.constants.enums.etype.WAS_SCROLL_CHANGED; +import static com.hiddenservices.genesissearchengine.production.constants.enums.etype.open_new_tab; +import static com.hiddenservices.genesissearchengine.production.constants.keys.EXTERNAL_SHORTCUT_COMMAND; +import static com.hiddenservices.genesissearchengine.production.constants.keys.EXTERNAL_SHORTCUT_COMMAND_NAVIGATE; +import static com.hiddenservices.genesissearchengine.production.constants.keys.M_ACTIVITY_RESPONSE; +import static com.hiddenservices.genesissearchengine.production.constants.responses.BOOKMARK_SETTING_CONTROLLER_SHOW_DELETE_ALERT; +import static com.hiddenservices.genesissearchengine.production.constants.responses.BOOKMARK_SETTING_CONTROLLER_SHOW_SUCCESS_ALERT; +import static com.hiddenservices.genesissearchengine.production.constants.sql.SQL_CLEAR_HISTORY; +import static com.hiddenservices.genesissearchengine.production.dataManager.dataEnums.eBookmarkCommands.M_INTENT_BOOKMARK; +import static com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums.eMessageManager.*; +import static com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums.eMessageManagerCallbacks.M_RATE_APPLICATION; import static java.lang.Character.isLetter; import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY; @@ -1771,6 +1771,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba }else { helperMethod.copyURL(mSearchBarPreviousText,this); } + helperMethod.showToastMessage("copied to clipboard", this); } public void onFindNext(View view){ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeModel.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/homeController/homeModel.java similarity index 79% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeModel.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/homeController/homeModel.java index 62a3dc05..a232b24c 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeModel.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/homeController/homeModel.java @@ -1,9 +1,9 @@ -package com.darkweb.genesissearchengine.appManager.homeManager.homeController; +package com.hiddenservices.genesissearchengine.production.appManager.homeManager.homeController; import android.util.Patterns; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; import java.net.URL; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeViewController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/homeController/homeViewController.java similarity index 95% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeViewController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/homeController/homeViewController.java index 11888ba3..70d6d3fb 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeViewController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/homeManager/homeController/homeViewController.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.homeManager.homeController; +package com.hiddenservices.genesissearchengine.production.appManager.homeManager.homeController; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; @@ -41,25 +41,25 @@ import androidx.core.graphics.ColorUtils; import androidx.core.widget.NestedScrollView; import androidx.fragment.app.FragmentContainerView; import androidx.recyclerview.widget.RecyclerView; -import com.darkweb.genesissearchengine.constants.*; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.libs.views.ColorAnimator; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.constants.*; +import com.hiddenservices.genesissearchengine.production.dataManager.dataController; +import com.hiddenservices.genesissearchengine.production.dataManager.dataEnums; +import com.hiddenservices.genesissearchengine.production.libs.views.ColorAnimator; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; import com.example.myapplication.R; import com.google.android.material.appbar.AppBarLayout; import com.mopub.mobileads.MoPubView; import org.mozilla.geckoview.GeckoView; -import org.torproject.android.service.wrapper.orbotLocalConstants; +import org.orbotproject.android.service.wrapper.orbotLocalConstants; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.concurrent.Callable; import static android.content.Context.LAYOUT_INFLATER_SERVICE; -import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_DOMAIN_URL; -import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_URL_CACHED; -import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_URL_CACHED_DARK; +import static com.hiddenservices.genesissearchengine.production.constants.constants.CONST_GENESIS_DOMAIN_URL; +import static com.hiddenservices.genesissearchengine.production.constants.constants.CONST_GENESIS_URL_CACHED; +import static com.hiddenservices.genesissearchengine.production.constants.constants.CONST_GENESIS_URL_CACHED_DARK; import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_DESKTOP; import static java.lang.Thread.sleep; @@ -167,6 +167,7 @@ class homeViewController initializeViews(); stopScroll(); onFullScreen(false); + initSplashOrientation(); } @SuppressLint("WrongConstant") @@ -483,7 +484,7 @@ class homeViewController } public void initStatusBarColor(boolean mInstant) { - int mDelay = 1500; + int mDelay = 1000; if(status.mThemeApplying || mInstant || status.sSettingIsAppStarted){ mDelay = 0; } @@ -596,7 +597,10 @@ class homeViewController View root = mSearchbar.getRootView(); root.setBackgroundColor(ContextCompat.getColor(mContext, R.color.c_background_keyboard)); - + int orientation = mContext.getResources().getConfiguration().orientation; + if (orientation == Configuration.ORIENTATION_LANDSCAPE) { + setOrientation(true); + } } private LogHandler mLogHandler; @@ -1563,7 +1567,7 @@ class homeViewController } } } - com.darkweb.genesissearchengine.constants.status.sFullScreenBrowsing = false; + com.hiddenservices.genesissearchengine.production.constants.status.sFullScreenBrowsing = false; mNestedScroll.setLayoutParams(params); @@ -1591,7 +1595,7 @@ class homeViewController mTopBar.setVisibility(View.VISIBLE); mEvent.invokeObserver(Collections.singletonList(!isLandscape), enums.etype.on_init_ads); - com.darkweb.genesissearchengine.constants.status.sFullScreenBrowsing = (boolean) dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_FULL_SCREEN_BROWSIING,false)); + com.hiddenservices.genesissearchengine.production.constants.status.sFullScreenBrowsing = (boolean) dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_FULL_SCREEN_BROWSIING,false)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if(status.sTheme == enums.Theme.THEME_DARK || status.sDefaultNightMode){ @@ -1637,7 +1641,6 @@ class homeViewController if (orientation == Configuration.ORIENTATION_LANDSCAPE) { mWebviewContainer.setPadding(0,0,0,helperMethod.pxFromDp(60)); } else { - helperMethod.showToastMessage("sadadsasd",mContext); mWebviewContainer.setPadding(0,0,0,helperMethod.pxFromDp(0)); } } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/kotlinHelperLibraries/BrowserIconManager.kt b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/kotlinHelperLibraries/BrowserIconManager.kt similarity index 90% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/kotlinHelperLibraries/BrowserIconManager.kt rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/kotlinHelperLibraries/BrowserIconManager.kt index 8d79e845..bb30bce9 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/kotlinHelperLibraries/BrowserIconManager.kt +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/kotlinHelperLibraries/BrowserIconManager.kt @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.kotlinHelperLibraries +package com.hiddenservices.genesissearchengine.production.appManager.kotlinHelperLibraries import android.content.Context import android.widget.ImageView diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/kotlinHelperLibraries/defaultBrowser.kt b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/kotlinHelperLibraries/defaultBrowser.kt similarity index 94% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/kotlinHelperLibraries/defaultBrowser.kt rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/kotlinHelperLibraries/defaultBrowser.kt index dff3f491..32ddcd1f 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/kotlinHelperLibraries/defaultBrowser.kt +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/kotlinHelperLibraries/defaultBrowser.kt @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.kotlinHelperLibraries +package com.hiddenservices.genesissearchengine.production.appManager.kotlinHelperLibraries import android.app.Activity import android.view.View diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageAdapter.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/languageManager/languageAdapter.java similarity index 89% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageAdapter.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/languageManager/languageAdapter.java index c6235aff..a7a8cc77 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageAdapter.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/languageManager/languageAdapter.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.languageManager; +package com.hiddenservices.genesissearchengine.production.appManager.languageManager; import android.content.Context; import android.content.res.Resources; @@ -13,14 +13,14 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.core.content.ContextCompat; import androidx.recyclerview.widget.RecyclerView; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.eventObserver; import com.example.myapplication.R; import java.util.ArrayList; import java.util.Arrays; -import static com.darkweb.genesissearchengine.appManager.languageManager.languageEnums.eLanguageAdapterCallback.*; -import static com.darkweb.genesissearchengine.constants.constants.CONST_LANGUAGE_DEFAULT_LANG; -import static com.darkweb.genesissearchengine.constants.strings.LANGUAGE_NOT_SUPPORTED; +import static com.hiddenservices.genesissearchengine.production.appManager.languageManager.languageEnums.eLanguageAdapterCallback.*; +import static com.hiddenservices.genesissearchengine.production.constants.constants.CONST_LANGUAGE_DEFAULT_LANG; +import static com.hiddenservices.genesissearchengine.production.constants.strings.LANGUAGE_NOT_SUPPORTED; public class languageAdapter extends RecyclerView.Adapter{ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/languageManager/languageController.java similarity index 84% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/languageManager/languageController.java index 4b2fcd69..9293e75f 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/languageManager/languageController.java @@ -1,252 +1,252 @@ -package com.darkweb.genesissearchengine.appManager.languageManager; - -import android.content.Intent; -import android.content.res.Configuration; -import android.content.res.Resources; -import android.os.Bundle; -import android.view.View; -import android.widget.ImageView; - -import androidx.annotation.NonNull; -import androidx.appcompat.app.AppCompatActivity; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; -import androidx.recyclerview.widget.SimpleItemAnimator; - -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.helpManager.helpController; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.appManager.activityThemeManager; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; -import com.example.myapplication.R; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Locale; -import java.util.Objects; - -import static com.darkweb.genesissearchengine.appManager.languageManager.languageEnums.eLanguageModel.M_ACTIVE_LANGUAGE; -import static com.darkweb.genesissearchengine.constants.constants.CONST_LANGUAGE_DEFAULT_LANG; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eLangManager.M_SUPPORTED_SYSTEM_LANGUAGE_INFO; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_LANGUAGE_SUPPORT_FAILURE; - -public class languageController extends AppCompatActivity { - - /*Private Variables*/ - - private languageViewController mLanguageViewController; - private languageModel mLanguageModel; - private ImageView mBlocker; - private boolean mThemeApplied = false; - private Locale mLanguagePrevious = status.mSystemLocale; - - private RecyclerView mRecycleView; - private languageAdapter mLanguageAdapter; - - /*Initializations*/ - - @Override - protected void onCreate(Bundle savedInstanceState) { - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); - super.onCreate(savedInstanceState); - setContentView(R.layout.language_view); - - initializeAppModel(); - initializeConnections(); - initializeAdapter(); - onInitScroll(); - } - - @Override - public void onConfigurationChanged(@NonNull Configuration newConfig) { - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); - super.onConfigurationChanged(newConfig); - - if(newConfig.uiMode != getResources().getConfiguration().uiMode){ - activityContextManager.getInstance().onResetTheme(); - activityThemeManager.getInstance().onConfigurationChanged(this); - } - } - - private void initializeAppModel() - { - mLanguageViewController = new languageViewController(); - mLanguageModel = new languageModel(); - } - - private void initializeConnections() - { - activityContextManager.getInstance().onStack(this); - mRecycleView = findViewById(R.id.pRecycleView); - mBlocker = findViewById(R.id.pSecureRootBlocker); - - mLanguageViewController.initialization(new languageViewCallback(),this, mBlocker); - } - - private void initializeAdapter(){ - mLanguageAdapter = new languageAdapter((ArrayList)mLanguageModel.onTrigger(languageEnums.eLanguageModel.M_SUPPORTED_LANGUAGE,null), this, status.sSettingLanguage, new languageAdapterCallback()); - ((SimpleItemAnimator) Objects.requireNonNull(mRecycleView.getItemAnimator())).setSupportsChangeAnimations(false); - - mRecycleView.setAdapter(mLanguageAdapter); - mRecycleView.setItemViewCacheSize(100); - mRecycleView.setNestedScrollingEnabled(false); - mRecycleView.setHasFixedSize(true); - mRecycleView.setItemViewCacheSize(100); - mRecycleView.setDrawingCacheEnabled(true); - mRecycleView.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH); - mRecycleView.setLayoutManager(new LinearLayoutManager(this)); - - mRecycleView.setAdapter(mLanguageAdapter); - } - - private void onInitScroll(){ - int mPosition = (int)mLanguageModel.onTrigger(M_ACTIVE_LANGUAGE,null); - if(!getIntent().getExtras().containsKey("activity_restarted")){ - if(mPosition>0){ - mPosition -= 1; - } - mRecycleView.scrollToPosition(mPosition); - }else { - int mPositionOffset = getIntent().getExtras().getInt("activity_restarted"); - mThemeApplied = true; - Objects.requireNonNull(mRecycleView.getLayoutManager()).scrollToPosition(mPositionOffset); - } - } - - /*UI Redirections*/ - - public void onOpenInfo(View view) { - helperMethod.openActivity(helpController.class, constants.CONST_LIST_HISTORY, this,true); - } - - public void onClose(View view) { - activityContextManager.getInstance().onRemoveStack(this); - finish(); - } - - /*Helper Methods*/ - - private boolean changeLanguage(String pLanguageCode, String pLanguageRegion){ - boolean mDefaultLanguageNotSupported = false; - if(pLanguageCode.equals(CONST_LANGUAGE_DEFAULT_LANG)){ - Locale mSystemLocale = Resources.getSystem().getConfiguration().locale; - String mSystemLangugage = mSystemLocale.toString(); - status.sSettingLanguage = CONST_LANGUAGE_DEFAULT_LANG; - status.sSettingLanguageRegion = CONST_LANGUAGE_DEFAULT_LANG; - if(!mSystemLangugage.equals("cs_CZ") && !mSystemLangugage.equals("en_US") && !mSystemLangugage.equals("ur_PK") && !mSystemLangugage.equals("de_DE") && !mSystemLangugage.equals("ca_ES") && !mSystemLangugage.equals("zh_CN") && !mSystemLangugage.equals("ch_CZ") && !mSystemLangugage.equals("nl_NL") && !mSystemLangugage.equals("fr_FR") && !mSystemLangugage.equals("el_GR") && !mSystemLangugage.equals("hu_HU") && !mSystemLangugage.equals("in_ID") && !mSystemLangugage.equals("it_IT") && !mSystemLangugage.equals("ja_JP") && !mSystemLangugage.equals("ko_KR") && !mSystemLangugage.equals("pt_PT") && !mSystemLangugage.equals("ro_RO") && !mSystemLangugage.equals("ru_RU") && !mSystemLangugage.equals("th_TH") && !mSystemLangugage.equals("tr_TR") && !mSystemLangugage.equals("uk_UA") && !mSystemLangugage.equals("vi_VN")){ - mDefaultLanguageNotSupported = true; - } - }else { - if(status.sSettingLanguage.equals(pLanguageCode)){ - return true; - } - status.sSettingLanguage = pLanguageCode; - status.sSettingLanguageRegion = pLanguageRegion; - } - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_LANGUAGE,status.sSettingLanguage)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_LANGUAGE_REGION,status.sSettingLanguageRegion)); - - if(activityContextManager.getInstance().getSettingController()!=null && !activityContextManager.getInstance().getSettingController().isDestroyed()){ - activityContextManager.getInstance().getSettingController().onRedrawXML(); - } - if(activityContextManager.getInstance().getSettingGeneralController()!=null && !activityContextManager.getInstance().getSettingGeneralController().isDestroyed()){ - activityContextManager.getInstance().getSettingGeneralController().onLanguageChanged(); - } - - if(mDefaultLanguageNotSupported){ - pluginController.getInstance().onMessageManagerInvoke(Arrays.asList(Resources.getSystem().getConfiguration().locale.getDisplayName(), this),M_LANGUAGE_SUPPORT_FAILURE); - } - - status.mThemeApplying = true; - mThemeApplied = true; - - Intent intent = new Intent(this, languageController.class); - intent.putExtra("activity_restarted",((LinearLayoutManager) Objects.requireNonNull(mRecycleView.getLayoutManager())).findFirstCompletelyVisibleItemPosition()); - this.startActivity(intent); - - overridePendingTransition(R.anim.fade_in_lang, R.anim.fade_out_lang); - this.finish(); - - return true; - } - - /*View Callbacks*/ - - @Override - protected void onDestroy() { - activityContextManager.getInstance().onRemoveStack(this); - super.onDestroy(); - } - - private class languageViewCallback implements eventObserver.eventListener{ - - @Override - public Object invokeObserver(List data, Object e_type) - { - return null; - } - } - - /*Adapter Callbacks*/ - - private class languageAdapterCallback implements eventObserver.eventListener { - - @Override - public Object invokeObserver(List data, Object e_type) { - if(e_type.equals(languageEnums.eLanguageAdapterCallback.M_UPDATE_LANGUAGE)){ - return changeLanguage((String)data.get(0), (String)data.get(1)); - } - else if(e_type.equals(languageEnums.eLanguageAdapterCallback.M_DISABLE_VIEW_CLICK)){ - mLanguageViewController.onTrigger(languageEnums.eLanguagevViewController.M_UPDATE_BLOCKER, Collections.singletonList(false)); - } - else if(e_type.equals(languageEnums.eLanguageAdapterCallback.M_ENABLE_VIEW_CLICK)){ - mLanguageViewController.onTrigger(languageEnums.eLanguagevViewController.M_UPDATE_BLOCKER, Collections.singletonList(true)); - } - else if(e_type.equals(languageEnums.eLanguageAdapterCallback.M_SYSTEM_LANGUAGE_SUPPORT_INFO)){ - return pluginController.getInstance().onLanguageInvoke(Collections.singletonList(status.sSettingLanguage), M_SUPPORTED_SYSTEM_LANGUAGE_INFO); - } - return null; - } - } - - /*Override Methods*/ - - @Override - protected void onResume() { - if(mLanguageAdapter!=null){ - mLanguageAdapter.notifyDataSetChanged(); - } - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); - super.onResume(); - } - - @Override - protected void onPause() { - if(mThemeApplied && !status.mThemeApplying){ - helperMethod.updateResources(activityContextManager.getInstance().getHomeController(), status.mSystemLocale.getLanguage()); - activityContextManager.getInstance().onResetTheme(); - - String mSystemLangugage = status.mSystemLocale.toString(); - if(mSystemLangugage.equals("ur_PK") || mSystemLangugage.equals("ur_UR") || mLanguagePrevious.toString().equals("ur_PK") || mLanguagePrevious.toString().equals("ur_UR")){ - activityContextManager.getInstance().getHomeController().recreate(); - } - mLanguagePrevious = status.mSystemLocale; - } - status.mThemeApplying = false; - super.onPause(); - } - - @Override - public void onBackPressed() { - onClose(null); - super.onBackPressed(); - } +package com.hiddenservices.genesissearchengine.production.appManager.languageManager; + +import android.content.Intent; +import android.content.res.Configuration; +import android.content.res.Resources; +import android.os.Bundle; +import android.view.View; +import android.widget.ImageView; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; +import androidx.recyclerview.widget.SimpleItemAnimator; + +import com.hiddenservices.genesissearchengine.production.appManager.activityContextManager; +import com.hiddenservices.genesissearchengine.production.appManager.helpManager.helpController; +import com.hiddenservices.genesissearchengine.production.constants.constants; +import com.hiddenservices.genesissearchengine.production.constants.keys; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.dataManager.dataController; +import com.hiddenservices.genesissearchengine.production.dataManager.dataEnums; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.appManager.activityThemeManager; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginController; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums; +import com.example.myapplication.R; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Locale; +import java.util.Objects; + +import static com.hiddenservices.genesissearchengine.production.appManager.languageManager.languageEnums.eLanguageModel.M_ACTIVE_LANGUAGE; +import static com.hiddenservices.genesissearchengine.production.constants.constants.CONST_LANGUAGE_DEFAULT_LANG; +import static com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums.eLangManager.M_SUPPORTED_SYSTEM_LANGUAGE_INFO; +import static com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums.eMessageManager.M_LANGUAGE_SUPPORT_FAILURE; + +public class languageController extends AppCompatActivity { + + /*Private Variables*/ + + private languageViewController mLanguageViewController; + private languageModel mLanguageModel; + private ImageView mBlocker; + private boolean mThemeApplied = false; + private Locale mLanguagePrevious = status.mSystemLocale; + + private RecyclerView mRecycleView; + private languageAdapter mLanguageAdapter; + + /*Initializations*/ + + @Override + protected void onCreate(Bundle savedInstanceState) { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + super.onCreate(savedInstanceState); + setContentView(R.layout.language_view); + + initializeAppModel(); + initializeConnections(); + initializeAdapter(); + onInitScroll(); + } + + @Override + public void onConfigurationChanged(@NonNull Configuration newConfig) { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + super.onConfigurationChanged(newConfig); + + if(newConfig.uiMode != getResources().getConfiguration().uiMode){ + activityContextManager.getInstance().onResetTheme(); + activityThemeManager.getInstance().onConfigurationChanged(this); + } + } + + private void initializeAppModel() + { + mLanguageViewController = new languageViewController(); + mLanguageModel = new languageModel(); + } + + private void initializeConnections() + { + activityContextManager.getInstance().onStack(this); + mRecycleView = findViewById(R.id.pRecycleView); + mBlocker = findViewById(R.id.pSecureRootBlocker); + + mLanguageViewController.initialization(new languageViewCallback(),this, mBlocker); + } + + private void initializeAdapter(){ + mLanguageAdapter = new languageAdapter((ArrayList)mLanguageModel.onTrigger(languageEnums.eLanguageModel.M_SUPPORTED_LANGUAGE,null), this, status.sSettingLanguage, new languageAdapterCallback()); + ((SimpleItemAnimator) Objects.requireNonNull(mRecycleView.getItemAnimator())).setSupportsChangeAnimations(false); + + mRecycleView.setAdapter(mLanguageAdapter); + mRecycleView.setItemViewCacheSize(100); + mRecycleView.setNestedScrollingEnabled(false); + mRecycleView.setHasFixedSize(true); + mRecycleView.setItemViewCacheSize(100); + mRecycleView.setDrawingCacheEnabled(true); + mRecycleView.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH); + mRecycleView.setLayoutManager(new LinearLayoutManager(this)); + + mRecycleView.setAdapter(mLanguageAdapter); + } + + private void onInitScroll(){ + int mPosition = (int)mLanguageModel.onTrigger(M_ACTIVE_LANGUAGE,null); + if(!getIntent().getExtras().containsKey("activity_restarted")){ + if(mPosition>0){ + mPosition -= 1; + } + mRecycleView.scrollToPosition(mPosition); + }else { + int mPositionOffset = getIntent().getExtras().getInt("activity_restarted"); + mThemeApplied = true; + Objects.requireNonNull(mRecycleView.getLayoutManager()).scrollToPosition(mPositionOffset); + } + } + + /*UI Redirections*/ + + public void onOpenInfo(View view) { + helperMethod.openActivity(helpController.class, constants.CONST_LIST_HISTORY, this,true); + } + + public void onClose(View view) { + activityContextManager.getInstance().onRemoveStack(this); + finish(); + } + + /*Helper Methods*/ + + private boolean changeLanguage(String pLanguageCode, String pLanguageRegion){ + boolean mDefaultLanguageNotSupported = false; + if(pLanguageCode.equals(CONST_LANGUAGE_DEFAULT_LANG)){ + Locale mSystemLocale = Resources.getSystem().getConfiguration().locale; + String mSystemLangugage = mSystemLocale.toString(); + status.sSettingLanguage = CONST_LANGUAGE_DEFAULT_LANG; + status.sSettingLanguageRegion = CONST_LANGUAGE_DEFAULT_LANG; + if(!mSystemLangugage.equals("cs_CZ") && !mSystemLangugage.equals("en_US") && !mSystemLangugage.equals("ur_PK") && !mSystemLangugage.equals("de_DE") && !mSystemLangugage.equals("ca_ES") && !mSystemLangugage.equals("zh_CN") && !mSystemLangugage.equals("ch_CZ") && !mSystemLangugage.equals("nl_NL") && !mSystemLangugage.equals("fr_FR") && !mSystemLangugage.equals("el_GR") && !mSystemLangugage.equals("hu_HU") && !mSystemLangugage.equals("in_ID") && !mSystemLangugage.equals("it_IT") && !mSystemLangugage.equals("ja_JP") && !mSystemLangugage.equals("ko_KR") && !mSystemLangugage.equals("pt_PT") && !mSystemLangugage.equals("ro_RO") && !mSystemLangugage.equals("ru_RU") && !mSystemLangugage.equals("th_TH") && !mSystemLangugage.equals("tr_TR") && !mSystemLangugage.equals("uk_UA") && !mSystemLangugage.equals("vi_VN")){ + mDefaultLanguageNotSupported = true; + } + }else { + if(status.sSettingLanguage.equals(pLanguageCode)){ + return true; + } + status.sSettingLanguage = pLanguageCode; + status.sSettingLanguageRegion = pLanguageRegion; + } + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_LANGUAGE,status.sSettingLanguage)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_LANGUAGE_REGION,status.sSettingLanguageRegion)); + + if(activityContextManager.getInstance().getSettingController()!=null && !activityContextManager.getInstance().getSettingController().isDestroyed()){ + activityContextManager.getInstance().getSettingController().onRedrawXML(); + } + if(activityContextManager.getInstance().getSettingGeneralController()!=null && !activityContextManager.getInstance().getSettingGeneralController().isDestroyed()){ + activityContextManager.getInstance().getSettingGeneralController().onLanguageChanged(); + } + + if(mDefaultLanguageNotSupported){ + pluginController.getInstance().onMessageManagerInvoke(Arrays.asList(Resources.getSystem().getConfiguration().locale.getDisplayName(), this),M_LANGUAGE_SUPPORT_FAILURE); + } + + status.mThemeApplying = true; + mThemeApplied = true; + + Intent intent = new Intent(this, languageController.class); + intent.putExtra("activity_restarted",((LinearLayoutManager) Objects.requireNonNull(mRecycleView.getLayoutManager())).findFirstCompletelyVisibleItemPosition()); + this.startActivity(intent); + + overridePendingTransition(R.anim.fade_in_lang, R.anim.fade_out_lang); + this.finish(); + + return true; + } + + /*View Callbacks*/ + + @Override + protected void onDestroy() { + activityContextManager.getInstance().onRemoveStack(this); + super.onDestroy(); + } + + private class languageViewCallback implements eventObserver.eventListener{ + + @Override + public Object invokeObserver(List data, Object e_type) + { + return null; + } + } + + /*Adapter Callbacks*/ + + private class languageAdapterCallback implements eventObserver.eventListener { + + @Override + public Object invokeObserver(List data, Object e_type) { + if(e_type.equals(languageEnums.eLanguageAdapterCallback.M_UPDATE_LANGUAGE)){ + return changeLanguage((String)data.get(0), (String)data.get(1)); + } + else if(e_type.equals(languageEnums.eLanguageAdapterCallback.M_DISABLE_VIEW_CLICK)){ + mLanguageViewController.onTrigger(languageEnums.eLanguagevViewController.M_UPDATE_BLOCKER, Collections.singletonList(false)); + } + else if(e_type.equals(languageEnums.eLanguageAdapterCallback.M_ENABLE_VIEW_CLICK)){ + mLanguageViewController.onTrigger(languageEnums.eLanguagevViewController.M_UPDATE_BLOCKER, Collections.singletonList(true)); + } + else if(e_type.equals(languageEnums.eLanguageAdapterCallback.M_SYSTEM_LANGUAGE_SUPPORT_INFO)){ + return pluginController.getInstance().onLanguageInvoke(Collections.singletonList(status.sSettingLanguage), M_SUPPORTED_SYSTEM_LANGUAGE_INFO); + } + return null; + } + } + + /*Override Methods*/ + + @Override + protected void onResume() { + if(mLanguageAdapter!=null){ + mLanguageAdapter.notifyDataSetChanged(); + } + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); + super.onResume(); + } + + @Override + protected void onPause() { + if(mThemeApplied && !status.mThemeApplying){ + helperMethod.updateResources(activityContextManager.getInstance().getHomeController(), status.mSystemLocale.getLanguage()); + activityContextManager.getInstance().onResetTheme(); + + String mSystemLangugage = status.mSystemLocale.toString(); + if(mSystemLangugage.equals("ur_PK") || mSystemLangugage.equals("ur_UR") || mLanguagePrevious.toString().equals("ur_PK") || mLanguagePrevious.toString().equals("ur_UR")){ + activityContextManager.getInstance().getHomeController().recreate(); + } + mLanguagePrevious = status.mSystemLocale; + } + status.mThemeApplying = false; + super.onPause(); + } + + @Override + public void onBackPressed() { + onClose(null); + super.onBackPressed(); + } } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageDataModel.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/languageManager/languageDataModel.java similarity index 84% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageDataModel.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/languageManager/languageDataModel.java index c9ee4eb2..180dd4f4 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageDataModel.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/languageManager/languageDataModel.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.languageManager; +package com.hiddenservices.genesissearchengine.production.appManager.languageManager; public class languageDataModel { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageEnums.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/languageManager/languageEnums.java similarity index 77% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageEnums.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/languageManager/languageEnums.java index 5291cea4..8794cadd 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageEnums.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/languageManager/languageEnums.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.languageManager; +package com.hiddenservices.genesissearchengine.production.appManager.languageManager; class languageEnums { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageModel.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/languageManager/languageModel.java similarity index 93% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageModel.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/languageManager/languageModel.java index c37ed207..7abbaba1 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageModel.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/languageManager/languageModel.java @@ -1,6 +1,6 @@ -package com.darkweb.genesissearchengine.appManager.languageManager; +package com.hiddenservices.genesissearchengine.production.appManager.languageManager; -import com.darkweb.genesissearchengine.constants.status; +import com.hiddenservices.genesissearchengine.production.constants.status; import java.util.ArrayList; import java.util.List; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageViewController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/languageManager/languageViewController.java similarity index 90% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageViewController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/languageManager/languageViewController.java index e8c5f190..8b8a460b 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageViewController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/languageManager/languageViewController.java @@ -1,67 +1,67 @@ -package com.darkweb.genesissearchengine.appManager.languageManager; - -import android.os.Build; -import android.view.View; -import android.view.Window; -import android.view.WindowManager; -import android.widget.ImageView; -import androidx.appcompat.app.AppCompatActivity; -import androidx.appcompat.app.AppCompatDelegate; -import androidx.core.content.ContextCompat; -import com.darkweb.genesissearchengine.eventObserver; -import com.example.myapplication.R; - -import java.util.List; - -class languageViewController -{ - /*Private Variables*/ - - private AppCompatActivity mContext; - private eventObserver.eventListener mEvent; - private ImageView mBlocker; - - /*Initializations*/ - - protected void initialization(eventObserver.eventListener pEvent, AppCompatActivity context, ImageView pBlocker){ - this.mContext = context; - this.mBlocker = pBlocker; - this.mEvent = pEvent; - - initPostUI(); - } - - private void initPostUI(){ - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - Window window = mContext.getWindow(); - window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); - - if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { - window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); - } - else { - if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ - mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); - } - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); - } - } - } - - private void initBlocker(boolean pStatus){ - if(pStatus){ - mBlocker.setVisibility(View.VISIBLE); - }else { - mBlocker.setVisibility(View.GONE); - } - } - - public Object onTrigger(languageEnums.eLanguagevViewController pCommands, List pData){ - if(languageEnums.eLanguagevViewController.M_UPDATE_BLOCKER.equals(pCommands)){ - initBlocker((boolean)pData.get(0)); - } - return null; - } - -} +package com.hiddenservices.genesissearchengine.production.appManager.languageManager; + +import android.os.Build; +import android.view.View; +import android.view.Window; +import android.view.WindowManager; +import android.widget.ImageView; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatDelegate; +import androidx.core.content.ContextCompat; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.example.myapplication.R; + +import java.util.List; + +class languageViewController +{ + /*Private Variables*/ + + private AppCompatActivity mContext; + private eventObserver.eventListener mEvent; + private ImageView mBlocker; + + /*Initializations*/ + + protected void initialization(eventObserver.eventListener pEvent, AppCompatActivity context, ImageView pBlocker){ + this.mContext = context; + this.mBlocker = pBlocker; + this.mEvent = pEvent; + + initPostUI(); + } + + private void initPostUI(){ + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + Window window = mContext.getWindow(); + window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); + + if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { + window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); + } + else { + if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ + mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); + } + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); + } + } + } + + private void initBlocker(boolean pStatus){ + if(pStatus){ + mBlocker.setVisibility(View.VISIBLE); + }else { + mBlocker.setVisibility(View.GONE); + } + } + + public Object onTrigger(languageEnums.eLanguagevViewController pCommands, List pData){ + if(languageEnums.eLanguagevViewController.M_UPDATE_BLOCKER.equals(pCommands)){ + initBlocker((boolean)pData.get(0)); + } + return null; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogAdapter.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/orbotLogManager/orbotLogAdapter.java similarity index 78% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogAdapter.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/orbotLogManager/orbotLogAdapter.java index 6459d68f..0eaed0c5 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogAdapter.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/orbotLogManager/orbotLogAdapter.java @@ -1,11 +1,6 @@ -package com.darkweb.genesissearchengine.appManager.orbotLogManager; +package com.hiddenservices.genesissearchengine.production.appManager.orbotLogManager; -import static com.darkweb.genesissearchengine.constants.constants.CONST_PACKAGE_NAME; - -import android.app.SearchManager; -import android.content.Intent; import android.net.Uri; -import android.os.Build; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -13,14 +8,14 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.constraintlayout.widget.ConstraintLayout; import androidx.recyclerview.widget.RecyclerView; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.tabManager.tabEnums; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.appManager.activityContextManager; +import com.hiddenservices.genesissearchengine.production.appManager.tabManager.tabEnums; +import com.hiddenservices.genesissearchengine.production.constants.constants; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; import com.example.myapplication.R; -import org.torproject.android.service.wrapper.logRowModel; +import org.orbotproject.android.service.wrapper.logRowModel; import java.util.ArrayList; import java.util.List; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/orbotLogManager/orbotLogController.java similarity index 82% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/orbotLogManager/orbotLogController.java index 90eca81f..879d9a9b 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/orbotLogManager/orbotLogController.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.orbotLogManager; +package com.hiddenservices.genesissearchengine.production.appManager.orbotLogManager; import android.annotation.SuppressLint; import android.content.res.Configuration; @@ -15,33 +15,33 @@ import androidx.appcompat.app.AppCompatActivity; import androidx.core.widget.NestedScrollView; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.settingManager.logManager.settingLogController; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.appManager.activityThemeManager; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.hiddenservices.genesissearchengine.production.appManager.activityContextManager; +import com.hiddenservices.genesissearchengine.production.appManager.settingManager.logManager.settingLogController; +import com.hiddenservices.genesissearchengine.production.constants.constants; +import com.hiddenservices.genesissearchengine.production.constants.enums; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.appManager.activityThemeManager; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginController; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums; import com.example.myapplication.R; import com.google.android.material.floatingactionbutton.FloatingActionButton; -import org.torproject.android.service.wrapper.logRowModel; +import org.orbotproject.android.service.wrapper.logRowModel; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Objects; -import static com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogEnums.eOrbotLogModelCallbackCommands.M_UPDATE_FLOATING_BUTTON; -import static com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogEnums.eOrbotLogModelCallbackCommands.M_UPDATE_LOGS; -import static com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogEnums.eOrbotLogModelCallbackCommands.M_UPDATE_RECYCLE_VIEW; -import static com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogEnums.eOrbotLogModelCommands.M_GET_LIST; -import static com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogEnums.eOrbotLogModelCommands.M_GET_LIST_SIZE; -import static com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogEnums.eOrbotLogViewCommands.M_FLOAT_BUTTON_UPDATE; -import static com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogEnums.eOrbotLogViewCommands.M_SCROLL_BOTTOM; -import static com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogEnums.eOrbotLogViewCommands.M_SCROLL_TOP; -import static com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogEnums.eOrbotLogViewCommands.M_SCROLL_TO_POSITION; -import static com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogEnums.eOrbotLogViewCommands.M_SHOW_FLOATING_TOOLBAR; +import static com.hiddenservices.genesissearchengine.production.appManager.orbotLogManager.orbotLogEnums.eOrbotLogModelCallbackCommands.M_UPDATE_FLOATING_BUTTON; +import static com.hiddenservices.genesissearchengine.production.appManager.orbotLogManager.orbotLogEnums.eOrbotLogModelCallbackCommands.M_UPDATE_LOGS; +import static com.hiddenservices.genesissearchengine.production.appManager.orbotLogManager.orbotLogEnums.eOrbotLogModelCallbackCommands.M_UPDATE_RECYCLE_VIEW; +import static com.hiddenservices.genesissearchengine.production.appManager.orbotLogManager.orbotLogEnums.eOrbotLogModelCommands.M_GET_LIST; +import static com.hiddenservices.genesissearchengine.production.appManager.orbotLogManager.orbotLogEnums.eOrbotLogModelCommands.M_GET_LIST_SIZE; +import static com.hiddenservices.genesissearchengine.production.appManager.orbotLogManager.orbotLogEnums.eOrbotLogViewCommands.M_FLOAT_BUTTON_UPDATE; +import static com.hiddenservices.genesissearchengine.production.appManager.orbotLogManager.orbotLogEnums.eOrbotLogViewCommands.M_SCROLL_BOTTOM; +import static com.hiddenservices.genesissearchengine.production.appManager.orbotLogManager.orbotLogEnums.eOrbotLogViewCommands.M_SCROLL_TOP; +import static com.hiddenservices.genesissearchengine.production.appManager.orbotLogManager.orbotLogEnums.eOrbotLogViewCommands.M_SCROLL_TO_POSITION; +import static com.hiddenservices.genesissearchengine.production.appManager.orbotLogManager.orbotLogEnums.eOrbotLogViewCommands.M_SHOW_FLOATING_TOOLBAR; public class orbotLogController extends AppCompatActivity implements ViewTreeObserver.OnScrollChangedListener, ViewTreeObserver.OnGlobalLayoutListener { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogEnums.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/orbotLogManager/orbotLogEnums.java similarity index 82% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogEnums.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/orbotLogManager/orbotLogEnums.java index c72e00b5..6595efa9 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogEnums.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/orbotLogManager/orbotLogEnums.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.orbotLogManager; +package com.hiddenservices.genesissearchengine.production.appManager.orbotLogManager; public class orbotLogEnums { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogModel.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/orbotLogManager/orbotLogModel.java similarity index 78% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogModel.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/orbotLogManager/orbotLogModel.java index 44f7fa17..6aad8bfd 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogModel.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/orbotLogManager/orbotLogModel.java @@ -1,22 +1,22 @@ -package com.darkweb.genesissearchengine.appManager.orbotLogManager; +package com.hiddenservices.genesissearchengine.production.appManager.orbotLogManager; import android.annotation.SuppressLint; import android.os.AsyncTask; import android.util.Log; import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import org.torproject.android.service.wrapper.logRowModel; -import org.torproject.android.service.wrapper.orbotLocalConstants; +import com.hiddenservices.genesissearchengine.production.constants.constants; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; +import org.orbotproject.android.service.wrapper.logRowModel; +import org.orbotproject.android.service.wrapper.orbotLocalConstants; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import static com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogEnums.eOrbotLogModelCallbackCommands.M_UPDATE_FLOATING_BUTTON; -import static com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogEnums.eOrbotLogModelCallbackCommands.M_UPDATE_LOGS; -import static com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogEnums.eOrbotLogModelCallbackCommands.M_UPDATE_RECYCLE_VIEW; +import static com.hiddenservices.genesissearchengine.production.appManager.orbotLogManager.orbotLogEnums.eOrbotLogModelCallbackCommands.M_UPDATE_FLOATING_BUTTON; +import static com.hiddenservices.genesissearchengine.production.appManager.orbotLogManager.orbotLogEnums.eOrbotLogModelCallbackCommands.M_UPDATE_LOGS; +import static com.hiddenservices.genesissearchengine.production.appManager.orbotLogManager.orbotLogEnums.eOrbotLogModelCallbackCommands.M_UPDATE_RECYCLE_VIEW; import static java.lang.Thread.sleep; import static org.mozilla.gecko.util.ThreadUtils.runOnUiThread; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogStatus.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/orbotLogManager/orbotLogStatus.java similarity index 64% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogStatus.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/orbotLogManager/orbotLogStatus.java index ebb02142..fed08332 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogStatus.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/orbotLogManager/orbotLogStatus.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.orbotLogManager; +package com.hiddenservices.genesissearchengine.production.appManager.orbotLogManager; public class orbotLogStatus { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogViewController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/orbotLogManager/orbotLogViewController.java similarity index 90% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogViewController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/orbotLogManager/orbotLogViewController.java index fbf7a3cd..a0590b3d 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogViewController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/orbotLogManager/orbotLogViewController.java @@ -1,13 +1,13 @@ -package com.darkweb.genesissearchengine.appManager.orbotLogManager; +package com.hiddenservices.genesissearchengine.production.appManager.orbotLogManager; import android.view.View; import android.widget.TextView; import androidx.appcompat.app.AppCompatActivity; import androidx.core.widget.NestedScrollView; import androidx.recyclerview.widget.RecyclerView; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.sharedUIMethod; +import com.hiddenservices.genesissearchengine.production.constants.enums; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.helperManager.sharedUIMethod; import com.google.android.material.floatingactionbutton.FloatingActionButton; import java.util.List; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/orbotManager/orbotController.java old mode 100755 new mode 100644 similarity index 77% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/orbotManager/orbotController.java index 50a11e15..458f6bf8 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/orbotManager/orbotController.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.orbotManager; +package com.hiddenservices.genesissearchengine.production.appManager.orbotManager; import android.content.res.Configuration; import android.os.Bundle; @@ -6,16 +6,16 @@ import android.view.View; import android.widget.LinearLayout; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.bridgeManager.bridgeController; -import com.darkweb.genesissearchengine.appManager.helpManager.helpController; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.appManager.activityThemeManager; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.hiddenservices.genesissearchengine.production.appManager.activityContextManager; +import com.hiddenservices.genesissearchengine.production.appManager.bridgeManager.bridgeController; +import com.hiddenservices.genesissearchengine.production.appManager.helpManager.helpController; +import com.hiddenservices.genesissearchengine.production.constants.constants; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.appManager.activityThemeManager; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginController; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums; import com.example.myapplication.R; import com.google.android.material.switchmaterial.SwitchMaterial; import java.util.Arrays; @@ -25,8 +25,8 @@ import java.util.List; public class orbotController extends AppCompatActivity { /* PRIVATE VARIABLES */ - private com.darkweb.genesissearchengine.appManager.orbotManager.orbotModel mOrbotModel; - private com.darkweb.genesissearchengine.appManager.orbotManager.orbotViewController mOrbotViewController; + private com.hiddenservices.genesissearchengine.production.appManager.orbotManager.orbotModel mOrbotModel; + private com.hiddenservices.genesissearchengine.production.appManager.orbotManager.orbotViewController mOrbotViewController; private SwitchMaterial mOrbotSettingBridgeSwitch; private SwitchMaterial mOrbotSettingVPNSwitch; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotEnums.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/orbotManager/orbotEnums.java similarity index 74% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotEnums.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/orbotManager/orbotEnums.java index ec298675..5f0dcd63 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotEnums.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/orbotManager/orbotEnums.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.orbotManager; +package com.hiddenservices.genesissearchengine.production.appManager.orbotManager; public class orbotEnums { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotModel.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/orbotManager/orbotModel.java similarity index 51% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotModel.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/orbotManager/orbotModel.java index dcfa7ae7..c20b754e 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotModel.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/orbotManager/orbotModel.java @@ -1,12 +1,12 @@ -package com.darkweb.genesissearchengine.appManager.orbotManager; +package com.hiddenservices.genesissearchengine.production.appManager.orbotManager; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.hiddenservices.genesissearchengine.production.constants.keys; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.dataManager.dataController; +import com.hiddenservices.genesissearchengine.production.dataManager.dataEnums; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginController; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums; import java.util.Arrays; import java.util.Collections; @@ -39,11 +39,11 @@ class orbotModel } - public void onTrigger(com.darkweb.genesissearchengine.appManager.orbotManager.orbotEnums.eOrbotModelCommands pCommands, List pData){ - if(pCommands == com.darkweb.genesissearchengine.appManager.orbotManager.orbotEnums.eOrbotModelCommands.M_BRIDGE_SWITCH){ + public void onTrigger(com.hiddenservices.genesissearchengine.production.appManager.orbotManager.orbotEnums.eOrbotModelCommands pCommands, List pData){ + if(pCommands == com.hiddenservices.genesissearchengine.production.appManager.orbotManager.orbotEnums.eOrbotModelCommands.M_BRIDGE_SWITCH){ onBridgeSwitch((boolean) pData.get(0)); } - else if(pCommands == com.darkweb.genesissearchengine.appManager.orbotManager.orbotEnums.eOrbotModelCommands.M_VPN_SWITCH){ + else if(pCommands == com.hiddenservices.genesissearchengine.production.appManager.orbotManager.orbotEnums.eOrbotModelCommands.M_VPN_SWITCH){ onVPNSwitch((boolean) pData.get(0)); } } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotViewController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/orbotManager/orbotViewController.java old mode 100755 new mode 100644 similarity index 92% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotViewController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/orbotManager/orbotViewController.java index 54508522..df13dcbb --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotViewController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/orbotManager/orbotViewController.java @@ -1,9 +1,9 @@ -package com.darkweb.genesissearchengine.appManager.orbotManager; +package com.hiddenservices.genesissearchengine.production.appManager.orbotManager; import android.view.View; import android.widget.LinearLayout; import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.helperManager.sharedUIMethod; +import com.hiddenservices.genesissearchengine.production.helperManager.sharedUIMethod; import com.google.android.material.switchmaterial.SwitchMaterial; import java.util.List; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/proxyStatusManager/proxyStatusController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/proxyStatusManager/proxyStatusController.java similarity index 81% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/proxyStatusManager/proxyStatusController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/proxyStatusManager/proxyStatusController.java index 64c940c9..dfa5482c 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/proxyStatusManager/proxyStatusController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/proxyStatusManager/proxyStatusController.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.proxyStatusManager; +package com.hiddenservices.genesissearchengine.production.appManager.proxyStatusManager; import android.content.res.Configuration; import android.os.Bundle; @@ -6,15 +6,15 @@ import android.view.View; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogController; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.appManager.activityThemeManager; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.hiddenservices.genesissearchengine.production.appManager.activityContextManager; +import com.hiddenservices.genesissearchengine.production.appManager.orbotLogManager.orbotLogController; +import com.hiddenservices.genesissearchengine.production.constants.constants; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.appManager.activityThemeManager; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginController; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums; import com.example.myapplication.R; import com.google.android.material.switchmaterial.SwitchMaterial; import java.util.Arrays; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/proxyStatusManager/proxyStatusEnums.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/proxyStatusManager/proxyStatusEnums.java similarity index 63% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/proxyStatusManager/proxyStatusEnums.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/proxyStatusManager/proxyStatusEnums.java index cefdd775..62564d06 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/proxyStatusManager/proxyStatusEnums.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/proxyStatusManager/proxyStatusEnums.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.proxyStatusManager; +package com.hiddenservices.genesissearchengine.production.appManager.proxyStatusManager; public class proxyStatusEnums { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/proxyStatusManager/proxyStatusModel.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/proxyStatusManager/proxyStatusModel.java similarity index 56% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/proxyStatusManager/proxyStatusModel.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/proxyStatusManager/proxyStatusModel.java index 2b83ef7b..6137b732 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/proxyStatusManager/proxyStatusModel.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/proxyStatusManager/proxyStatusModel.java @@ -1,6 +1,6 @@ -package com.darkweb.genesissearchengine.appManager.proxyStatusManager; +package com.hiddenservices.genesissearchengine.production.appManager.proxyStatusManager; -import com.darkweb.genesissearchengine.eventObserver; +import com.hiddenservices.genesissearchengine.production.eventObserver; class proxyStatusModel { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/proxyStatusManager/proxyStatusViewController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/proxyStatusManager/proxyStatusViewController.java similarity index 94% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/proxyStatusManager/proxyStatusViewController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/proxyStatusManager/proxyStatusViewController.java index c0e307c5..8fa7b2fa 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/proxyStatusManager/proxyStatusViewController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/proxyStatusManager/proxyStatusViewController.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.proxyStatusManager; +package com.hiddenservices.genesissearchengine.production.appManager.proxyStatusManager; import android.os.Build; import android.view.View; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/accessibilityManager/settingAccessibilityController.java similarity index 83% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/accessibilityManager/settingAccessibilityController.java index 1713a390..d68a53b4 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/accessibilityManager/settingAccessibilityController.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.accessibilityManager; +package com.hiddenservices.genesissearchengine.production.appManager.settingManager.accessibilityManager; import android.content.res.Configuration; import android.os.Bundle; @@ -9,18 +9,18 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.helpManager.helpController; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.appManager.activityThemeManager; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.hiddenservices.genesissearchengine.production.appManager.activityContextManager; +import com.hiddenservices.genesissearchengine.production.appManager.helpManager.helpController; +import com.hiddenservices.genesissearchengine.production.constants.constants; +import com.hiddenservices.genesissearchengine.production.constants.keys; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.dataManager.dataController; +import com.hiddenservices.genesissearchengine.production.dataManager.dataEnums; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.appManager.activityThemeManager; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginController; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums; import com.example.myapplication.R; import com.google.android.material.switchmaterial.SwitchMaterial; import java.util.Arrays; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityEnums.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/accessibilityManager/settingAccessibilityEnums.java similarity index 67% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityEnums.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/accessibilityManager/settingAccessibilityEnums.java index c577b6a0..92d1a6b3 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityEnums.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/accessibilityManager/settingAccessibilityEnums.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.accessibilityManager; +package com.hiddenservices.genesissearchengine.production.appManager.settingManager.accessibilityManager; class settingAccessibilityEnums { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityModel.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/accessibilityManager/settingAccessibilityModel.java similarity index 77% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityModel.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/accessibilityManager/settingAccessibilityModel.java index b58063b4..94bc5311 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityModel.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/accessibilityManager/settingAccessibilityModel.java @@ -1,7 +1,7 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.accessibilityManager; +package com.hiddenservices.genesissearchengine.production.appManager.settingManager.accessibilityManager; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.eventObserver; import java.util.List; class settingAccessibilityModel diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityViewController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/accessibilityManager/settingAccessibilityViewController.java similarity index 89% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityViewController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/accessibilityManager/settingAccessibilityViewController.java index 87dbd56e..7538a805 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityViewController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/accessibilityManager/settingAccessibilityViewController.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.accessibilityManager; +package com.hiddenservices.genesissearchengine.production.appManager.settingManager.accessibilityManager; import android.os.Build; import android.view.View; @@ -9,9 +9,9 @@ import android.widget.TextView; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatDelegate; import androidx.core.content.ContextCompat; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; +import com.hiddenservices.genesissearchengine.production.constants.constants; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.eventObserver; import com.example.myapplication.R; import com.google.android.material.switchmaterial.SwitchMaterial; import java.util.List; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/advanceManager/settingAdvanceController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/advanceManager/settingAdvanceController.java similarity index 84% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/advanceManager/settingAdvanceController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/advanceManager/settingAdvanceController.java index 8d11eb5d..c52cbe29 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/advanceManager/settingAdvanceController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/advanceManager/settingAdvanceController.java @@ -1,7 +1,6 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.advanceManager; +package com.hiddenservices.genesissearchengine.production.appManager.settingManager.advanceManager; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_IMAGE_UPDATE; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_UPDATE_BOOKMARK; +import static com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums.eMessageManager.M_IMAGE_UPDATE; import android.content.res.Configuration; import android.os.Bundle; @@ -10,18 +9,18 @@ import android.widget.RadioButton; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.helpManager.helpController; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.appManager.activityThemeManager; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.hiddenservices.genesissearchengine.production.appManager.activityContextManager; +import com.hiddenservices.genesissearchengine.production.appManager.helpManager.helpController; +import com.hiddenservices.genesissearchengine.production.constants.constants; +import com.hiddenservices.genesissearchengine.production.constants.keys; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.dataManager.dataController; +import com.hiddenservices.genesissearchengine.production.dataManager.dataEnums; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.appManager.activityThemeManager; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginController; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums; import com.example.myapplication.R; import com.google.android.material.switchmaterial.SwitchMaterial; import java.util.ArrayList; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/advanceManager/settingAdvanceEnums.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/advanceManager/settingAdvanceEnums.java similarity index 71% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/advanceManager/settingAdvanceEnums.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/advanceManager/settingAdvanceEnums.java index b95a25c9..f4bb42c0 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/advanceManager/settingAdvanceEnums.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/advanceManager/settingAdvanceEnums.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.advanceManager; +package com.hiddenservices.genesissearchengine.production.appManager.settingManager.advanceManager; class settingAdvanceEnums { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/advanceManager/settingAdvanceModel.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/advanceManager/settingAdvanceModel.java similarity index 86% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/advanceManager/settingAdvanceModel.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/advanceManager/settingAdvanceModel.java index 5b147c9d..4566662a 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/advanceManager/settingAdvanceModel.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/advanceManager/settingAdvanceModel.java @@ -1,9 +1,9 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.advanceManager; +package com.hiddenservices.genesissearchengine.production.appManager.settingManager.advanceManager; import android.view.View; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.eventObserver; import com.example.myapplication.R; import java.util.List; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/advanceManager/settingAdvanceViewController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/advanceManager/settingAdvanceViewController.java similarity index 94% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/advanceManager/settingAdvanceViewController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/advanceManager/settingAdvanceViewController.java index 09d62e86..e2584bd4 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/advanceManager/settingAdvanceViewController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/advanceManager/settingAdvanceViewController.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.advanceManager; +package com.hiddenservices.genesissearchengine.production.appManager.settingManager.advanceManager; import android.content.res.ColorStateList; import android.os.Build; @@ -9,8 +9,8 @@ import android.widget.RadioButton; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatDelegate; import androidx.core.content.ContextCompat; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.eventObserver; import com.example.myapplication.R; import com.google.android.material.switchmaterial.SwitchMaterial; import java.util.ArrayList; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/clearManager/settingClearController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/clearManager/settingClearController.java similarity index 89% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/clearManager/settingClearController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/clearManager/settingClearController.java index e4d8806c..0296f8c5 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/clearManager/settingClearController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/clearManager/settingClearController.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.clearManager; +package com.hiddenservices.genesissearchengine.production.appManager.settingManager.clearManager; import android.content.res.ColorStateList; import android.content.res.Configuration; @@ -10,20 +10,20 @@ import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatDelegate; import androidx.core.content.ContextCompat; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.helpManager.helpController; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.constants.strings; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.appManager.activityThemeManager; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.hiddenservices.genesissearchengine.production.appManager.activityContextManager; +import com.hiddenservices.genesissearchengine.production.appManager.helpManager.helpController; +import com.hiddenservices.genesissearchengine.production.constants.constants; +import com.hiddenservices.genesissearchengine.production.constants.enums; +import com.hiddenservices.genesissearchengine.production.constants.keys; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.constants.strings; +import com.hiddenservices.genesissearchengine.production.dataManager.dataController; +import com.hiddenservices.genesissearchengine.production.dataManager.dataEnums; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.appManager.activityThemeManager; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginController; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums; import com.example.myapplication.R; import org.mozilla.geckoview.ContentBlocking; @@ -33,9 +33,9 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import static com.darkweb.genesissearchengine.constants.sql.SQL_CLEAR_BOOKMARK; -import static com.darkweb.genesissearchengine.constants.sql.SQL_CLEAR_HISTORY; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_DATA_CLEARED; +import static com.hiddenservices.genesissearchengine.production.constants.sql.SQL_CLEAR_BOOKMARK; +import static com.hiddenservices.genesissearchengine.production.constants.sql.SQL_CLEAR_HISTORY; +import static com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums.eMessageManager.M_DATA_CLEARED; import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY; public class settingClearController extends AppCompatActivity { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/clearManager/settingClearEnums.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/clearManager/settingClearEnums.java similarity index 58% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/clearManager/settingClearEnums.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/clearManager/settingClearEnums.java index b37932d4..e88205b1 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/clearManager/settingClearEnums.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/clearManager/settingClearEnums.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.clearManager; +package com.hiddenservices.genesissearchengine.production.appManager.settingManager.clearManager; class settingClearEnums { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/clearManager/settingClearModel.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/clearManager/settingClearModel.java similarity index 57% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/clearManager/settingClearModel.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/clearManager/settingClearModel.java index 1426a62a..37a570d4 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/clearManager/settingClearModel.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/clearManager/settingClearModel.java @@ -1,6 +1,6 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.clearManager; +package com.hiddenservices.genesissearchengine.production.appManager.settingManager.clearManager; -import com.darkweb.genesissearchengine.eventObserver; +import com.hiddenservices.genesissearchengine.production.eventObserver; class settingClearModel { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/clearManager/settingClearViewController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/clearManager/settingClearViewController.java similarity index 91% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/clearManager/settingClearViewController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/clearManager/settingClearViewController.java index 58326933..e9306b64 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/clearManager/settingClearViewController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/clearManager/settingClearViewController.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.clearManager; +package com.hiddenservices.genesissearchengine.production.appManager.settingManager.clearManager; import android.content.res.ColorStateList; import android.os.Build; @@ -9,7 +9,7 @@ import android.widget.CheckBox; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatDelegate; import androidx.core.content.ContextCompat; -import com.darkweb.genesissearchengine.eventObserver; +import com.hiddenservices.genesissearchengine.production.eventObserver; import com.example.myapplication.R; import java.util.ArrayList; import java.util.List; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/generalManager/settingGeneralController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/generalManager/settingGeneralController.java similarity index 88% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/generalManager/settingGeneralController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/generalManager/settingGeneralController.java index e2b62064..cc1af6a1 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/generalManager/settingGeneralController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/generalManager/settingGeneralController.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.generalManager; +package com.hiddenservices.genesissearchengine.production.appManager.settingManager.generalManager; import android.content.res.Configuration; import android.os.Bundle; @@ -9,20 +9,20 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatDelegate; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.helpManager.helpController; -import com.darkweb.genesissearchengine.appManager.languageManager.languageController; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.appManager.activityThemeManager; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.hiddenservices.genesissearchengine.production.appManager.activityContextManager; +import com.hiddenservices.genesissearchengine.production.appManager.helpManager.helpController; +import com.hiddenservices.genesissearchengine.production.appManager.languageManager.languageController; +import com.hiddenservices.genesissearchengine.production.constants.constants; +import com.hiddenservices.genesissearchengine.production.constants.enums; +import com.hiddenservices.genesissearchengine.production.constants.keys; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.dataManager.dataController; +import com.hiddenservices.genesissearchengine.production.dataManager.dataEnums; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.appManager.activityThemeManager; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginController; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums; import com.example.myapplication.R; import com.google.android.material.switchmaterial.SwitchMaterial; import java.util.Arrays; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/generalManager/settingGeneralEnums.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/generalManager/settingGeneralEnums.java similarity index 74% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/generalManager/settingGeneralEnums.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/generalManager/settingGeneralEnums.java index b840ee51..511ab7a5 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/generalManager/settingGeneralEnums.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/generalManager/settingGeneralEnums.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.generalManager; +package com.hiddenservices.genesissearchengine.production.appManager.settingManager.generalManager; class settingGeneralEnums { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/generalManager/settingGeneralModel.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/generalManager/settingGeneralModel.java similarity index 79% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/generalManager/settingGeneralModel.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/generalManager/settingGeneralModel.java index 8fdaf3b0..dae4ef18 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/generalManager/settingGeneralModel.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/generalManager/settingGeneralModel.java @@ -1,7 +1,7 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.generalManager; +package com.hiddenservices.genesissearchengine.production.appManager.settingManager.generalManager; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.eventObserver; import java.util.List; class settingGeneralModel diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/generalManager/settingGeneralViewController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/generalManager/settingGeneralViewController.java similarity index 88% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/generalManager/settingGeneralViewController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/generalManager/settingGeneralViewController.java index b49ca97a..ec53204c 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/generalManager/settingGeneralViewController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/generalManager/settingGeneralViewController.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.generalManager; +package com.hiddenservices.genesissearchengine.production.appManager.settingManager.generalManager; import android.content.res.ColorStateList; import android.os.Build; @@ -10,16 +10,16 @@ import android.widget.TextView; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatDelegate; import androidx.core.content.ContextCompat; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.constants.enums; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; import com.example.myapplication.R; import com.google.android.material.switchmaterial.SwitchMaterial; import java.util.Collections; import java.util.List; -import static com.darkweb.genesissearchengine.appManager.settingManager.generalManager.settingGeneralEnums.eGeneralViewCallback.M_RESET_THEME_INVOKED_BACK; +import static com.hiddenservices.genesissearchengine.production.appManager.settingManager.generalManager.settingGeneralEnums.eGeneralViewCallback.M_RESET_THEME_INVOKED_BACK; class settingGeneralViewController { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/logManager/settingLogController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/logManager/settingLogController.java similarity index 74% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/logManager/settingLogController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/logManager/settingLogController.java index 5f42c863..3d6fa63c 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/logManager/settingLogController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/logManager/settingLogController.java @@ -1,28 +1,28 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.logManager; +package com.hiddenservices.genesissearchengine.production.appManager.settingManager.logManager; import android.content.res.Configuration; import android.os.Bundle; import android.view.View; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.helpManager.helpController; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.appManager.activityThemeManager; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.hiddenservices.genesissearchengine.production.appManager.activityContextManager; +import com.hiddenservices.genesissearchengine.production.appManager.helpManager.helpController; +import com.hiddenservices.genesissearchengine.production.constants.constants; +import com.hiddenservices.genesissearchengine.production.constants.keys; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.dataManager.dataController; +import com.hiddenservices.genesissearchengine.production.dataManager.dataEnums; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.appManager.activityThemeManager; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginController; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums; import com.example.myapplication.R; import com.google.android.material.switchmaterial.SwitchMaterial; import java.util.Arrays; import java.util.Collections; import java.util.List; -import static com.darkweb.genesissearchengine.appManager.settingManager.logManager.settingLogEnums.eLogViewController.M_TOOGLE_LOG_VIEW; +import static com.hiddenservices.genesissearchengine.production.appManager.settingManager.logManager.settingLogEnums.eLogViewController.M_TOOGLE_LOG_VIEW; public class settingLogController extends AppCompatActivity { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/logManager/settingLogEnums.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/logManager/settingLogEnums.java similarity index 66% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/logManager/settingLogEnums.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/logManager/settingLogEnums.java index eb10e840..f12d2f2f 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/logManager/settingLogEnums.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/logManager/settingLogEnums.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.logManager; +package com.hiddenservices.genesissearchengine.production.appManager.settingManager.logManager; class settingLogEnums { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/logManager/settingLogModel.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/logManager/settingLogModel.java similarity index 70% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/logManager/settingLogModel.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/logManager/settingLogModel.java index b76d950e..c7e8366d 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/logManager/settingLogModel.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/logManager/settingLogModel.java @@ -1,7 +1,7 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.logManager; +package com.hiddenservices.genesissearchengine.production.appManager.settingManager.logManager; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.eventObserver; import java.util.List; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/logManager/settingLogViewController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/logManager/settingLogViewController.java similarity index 83% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/logManager/settingLogViewController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/logManager/settingLogViewController.java index 7693f36b..24fb714b 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/logManager/settingLogViewController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/logManager/settingLogViewController.java @@ -1,8 +1,8 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.logManager; +package com.hiddenservices.genesissearchengine.production.appManager.settingManager.logManager; import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.sharedUIMethod; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.helperManager.sharedUIMethod; import com.google.android.material.switchmaterial.SwitchMaterial; import java.util.List; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/notificationManager/settingNotificationController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/notificationManager/settingNotificationController.java similarity index 77% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/notificationManager/settingNotificationController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/notificationManager/settingNotificationController.java index 78dc69b8..0a47d291 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/notificationManager/settingNotificationController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/notificationManager/settingNotificationController.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.notificationManager; +package com.hiddenservices.genesissearchengine.production.appManager.settingManager.notificationManager; import android.content.res.Configuration; import android.os.Bundle; @@ -6,18 +6,18 @@ import android.view.View; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.helpManager.helpController; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.appManager.activityThemeManager; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.hiddenservices.genesissearchengine.production.appManager.activityContextManager; +import com.hiddenservices.genesissearchengine.production.appManager.helpManager.helpController; +import com.hiddenservices.genesissearchengine.production.constants.constants; +import com.hiddenservices.genesissearchengine.production.constants.keys; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.dataManager.dataController; +import com.hiddenservices.genesissearchengine.production.dataManager.dataEnums; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.appManager.activityThemeManager; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginController; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums; import com.example.myapplication.R; import com.google.android.material.switchmaterial.SwitchMaterial; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/notificationManager/settingNotificationEnums.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/notificationManager/settingNotificationEnums.java similarity index 61% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/notificationManager/settingNotificationEnums.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/notificationManager/settingNotificationEnums.java index 36c7c18b..4789c08c 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/notificationManager/settingNotificationEnums.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/notificationManager/settingNotificationEnums.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.notificationManager; +package com.hiddenservices.genesissearchengine.production.appManager.settingManager.notificationManager; class settingNotificationEnums { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/notificationManager/settingNotificationModel.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/notificationManager/settingNotificationModel.java similarity index 68% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/notificationManager/settingNotificationModel.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/notificationManager/settingNotificationModel.java index 233fe388..2c51a328 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/notificationManager/settingNotificationModel.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/notificationManager/settingNotificationModel.java @@ -1,9 +1,9 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.notificationManager; +package com.hiddenservices.genesissearchengine.production.appManager.settingManager.notificationManager; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginController; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums; import java.util.List; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/notificationManager/settingNotificationViewController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/notificationManager/settingNotificationViewController.java similarity index 86% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/notificationManager/settingNotificationViewController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/notificationManager/settingNotificationViewController.java index 44872c7f..d7aaa4ca 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/notificationManager/settingNotificationViewController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/notificationManager/settingNotificationViewController.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.notificationManager; +package com.hiddenservices.genesissearchengine.production.appManager.settingManager.notificationManager; import android.os.Build; import android.view.View; @@ -7,8 +7,8 @@ import android.view.WindowManager; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatDelegate; import androidx.core.content.ContextCompat; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.eventObserver; import com.example.myapplication.R; import com.google.android.material.switchmaterial.SwitchMaterial; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/privacyManager/settingPrivacyController.java similarity index 82% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/privacyManager/settingPrivacyController.java index bae3766c..902c2460 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/privacyManager/settingPrivacyController.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.privacyManager; +package com.hiddenservices.genesissearchengine.production.appManager.settingManager.privacyManager; import android.content.res.Configuration; import android.os.Bundle; @@ -7,19 +7,19 @@ import android.widget.RadioButton; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.helpManager.helpController; -import com.darkweb.genesissearchengine.appManager.settingManager.trackingManager.settingTrackingController; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.appManager.activityThemeManager; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.hiddenservices.genesissearchengine.production.appManager.activityContextManager; +import com.hiddenservices.genesissearchengine.production.appManager.helpManager.helpController; +import com.hiddenservices.genesissearchengine.production.appManager.settingManager.trackingManager.settingTrackingController; +import com.hiddenservices.genesissearchengine.production.constants.constants; +import com.hiddenservices.genesissearchengine.production.constants.keys; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.dataManager.dataController; +import com.hiddenservices.genesissearchengine.production.dataManager.dataEnums; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.appManager.activityThemeManager; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginController; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums; import com.example.myapplication.R; import com.google.android.material.switchmaterial.SwitchMaterial; import java.util.ArrayList; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyEnums.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/privacyManager/settingPrivacyEnums.java similarity index 70% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyEnums.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/privacyManager/settingPrivacyEnums.java index d5152e54..4b64eba3 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyEnums.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/privacyManager/settingPrivacyEnums.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.privacyManager; +package com.hiddenservices.genesissearchengine.production.appManager.settingManager.privacyManager; class settingPrivacyEnums { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyModel.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/privacyManager/settingPrivacyModel.java similarity index 88% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyModel.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/privacyManager/settingPrivacyModel.java index 57bc1949..9037b948 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyModel.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/privacyManager/settingPrivacyModel.java @@ -1,9 +1,9 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.privacyManager; +package com.hiddenservices.genesissearchengine.production.appManager.settingManager.privacyManager; import android.view.View; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.eventObserver; import com.example.myapplication.R; import java.util.List; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyViewController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/privacyManager/settingPrivacyViewController.java similarity index 93% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyViewController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/privacyManager/settingPrivacyViewController.java index 3c78cc59..d57882cb 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyViewController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/privacyManager/settingPrivacyViewController.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.privacyManager; +package com.hiddenservices.genesissearchengine.production.appManager.settingManager.privacyManager; import android.content.res.ColorStateList; import android.os.Build; @@ -9,8 +9,8 @@ import android.widget.RadioButton; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatDelegate; import androidx.core.content.ContextCompat; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.eventObserver; import com.example.myapplication.R; import com.google.android.material.switchmaterial.SwitchMaterial; import java.util.ArrayList; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/searchEngineManager/settingSearchController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/searchEngineManager/settingSearchController.java similarity index 84% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/searchEngineManager/settingSearchController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/searchEngineManager/settingSearchController.java index 148c75d2..8390d7d2 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/searchEngineManager/settingSearchController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/searchEngineManager/settingSearchController.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.searchEngineManager; +package com.hiddenservices.genesissearchengine.production.appManager.settingManager.searchEngineManager; import android.content.res.Configuration; import android.os.Bundle; @@ -7,18 +7,18 @@ import android.widget.RadioButton; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.helpManager.helpController; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.appManager.activityThemeManager; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.hiddenservices.genesissearchengine.production.appManager.activityContextManager; +import com.hiddenservices.genesissearchengine.production.appManager.helpManager.helpController; +import com.hiddenservices.genesissearchengine.production.constants.constants; +import com.hiddenservices.genesissearchengine.production.constants.keys; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.dataManager.dataController; +import com.hiddenservices.genesissearchengine.production.dataManager.dataEnums; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.appManager.activityThemeManager; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginController; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums; import com.example.myapplication.R; import com.google.android.material.switchmaterial.SwitchMaterial; import java.util.ArrayList; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/searchEngineManager/settingSearchEnums.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/searchEngineManager/settingSearchEnums.java similarity index 69% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/searchEngineManager/settingSearchEnums.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/searchEngineManager/settingSearchEnums.java index ff67cdfd..7066ad03 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/searchEngineManager/settingSearchEnums.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/searchEngineManager/settingSearchEnums.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.searchEngineManager; +package com.hiddenservices.genesissearchengine.production.appManager.settingManager.searchEngineManager; class settingSearchEnums { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/searchEngineManager/settingSearchModel.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/searchEngineManager/settingSearchModel.java similarity index 80% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/searchEngineManager/settingSearchModel.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/searchEngineManager/settingSearchModel.java index 6e55f8c3..718fe2a1 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/searchEngineManager/settingSearchModel.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/searchEngineManager/settingSearchModel.java @@ -1,7 +1,7 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.searchEngineManager; +package com.hiddenservices.genesissearchengine.production.appManager.settingManager.searchEngineManager; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.eventObserver; import java.util.List; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/searchEngineManager/settingSearchViewController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/searchEngineManager/settingSearchViewController.java similarity index 91% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/searchEngineManager/settingSearchViewController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/searchEngineManager/settingSearchViewController.java index a0bb345d..a70b244a 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/searchEngineManager/settingSearchViewController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/searchEngineManager/settingSearchViewController.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.searchEngineManager; +package com.hiddenservices.genesissearchengine.production.appManager.settingManager.searchEngineManager; import android.content.res.ColorStateList; import android.os.Build; @@ -9,9 +9,9 @@ import android.widget.RadioButton; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatDelegate; import androidx.core.content.ContextCompat; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; +import com.hiddenservices.genesissearchengine.production.constants.constants; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.eventObserver; import com.example.myapplication.R; import com.google.android.material.switchmaterial.SwitchMaterial; import java.util.ArrayList; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/settingHomeManager/settingHomeController.java similarity index 75% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/settingHomeManager/settingHomeController.java index e02aaa73..97f0bc2b 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/settingHomeManager/settingHomeController.java @@ -1,35 +1,35 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.settingHomeManager; +package com.hiddenservices.genesissearchengine.production.appManager.settingManager.settingHomeManager; import android.content.res.Configuration; import android.os.Build; import android.os.Bundle; import android.view.View; -import android.widget.Toast; + import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatDelegate; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.helpManager.helpController; -import com.darkweb.genesissearchengine.appManager.proxyStatusManager.proxyStatusController; -import com.darkweb.genesissearchengine.appManager.settingManager.accessibilityManager.settingAccessibilityController; -import com.darkweb.genesissearchengine.appManager.settingManager.advanceManager.settingAdvanceController; -import com.darkweb.genesissearchengine.appManager.settingManager.clearManager.settingClearController; -import com.darkweb.genesissearchengine.appManager.settingManager.generalManager.settingGeneralController; -import com.darkweb.genesissearchengine.appManager.settingManager.notificationManager.settingNotificationController; -import com.darkweb.genesissearchengine.appManager.settingManager.privacyManager.settingPrivacyController; -import com.darkweb.genesissearchengine.appManager.settingManager.searchEngineManager.settingSearchController; -import com.darkweb.genesissearchengine.appManager.settingManager.trackingManager.settingTrackingController; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.appManager.activityThemeManager; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.hiddenservices.genesissearchengine.production.appManager.activityContextManager; +import com.hiddenservices.genesissearchengine.production.appManager.helpManager.helpController; +import com.hiddenservices.genesissearchengine.production.appManager.proxyStatusManager.proxyStatusController; +import com.hiddenservices.genesissearchengine.production.appManager.settingManager.accessibilityManager.settingAccessibilityController; +import com.hiddenservices.genesissearchengine.production.appManager.settingManager.advanceManager.settingAdvanceController; +import com.hiddenservices.genesissearchengine.production.appManager.settingManager.clearManager.settingClearController; +import com.hiddenservices.genesissearchengine.production.appManager.settingManager.generalManager.settingGeneralController; +import com.hiddenservices.genesissearchengine.production.appManager.settingManager.notificationManager.settingNotificationController; +import com.hiddenservices.genesissearchengine.production.appManager.settingManager.privacyManager.settingPrivacyController; +import com.hiddenservices.genesissearchengine.production.appManager.settingManager.searchEngineManager.settingSearchController; +import com.hiddenservices.genesissearchengine.production.appManager.settingManager.trackingManager.settingTrackingController; +import com.hiddenservices.genesissearchengine.production.constants.constants; +import com.hiddenservices.genesissearchengine.production.constants.enums; +import com.hiddenservices.genesissearchengine.production.constants.keys; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.dataManager.dataController; +import com.hiddenservices.genesissearchengine.production.dataManager.dataEnums; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.appManager.activityThemeManager; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginController; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums; import com.example.myapplication.R; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; @@ -37,7 +37,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; import static androidx.appcompat.app.AppCompatDelegate.setDefaultNightMode; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.*; +import static com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums.eMessageManager.*; public class settingHomeController extends AppCompatActivity { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeEnums.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/settingHomeManager/settingHomeEnums.java similarity index 56% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeEnums.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/settingHomeManager/settingHomeEnums.java index c87345b2..2176747a 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeEnums.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/settingHomeManager/settingHomeEnums.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.settingHomeManager; +package com.hiddenservices.genesissearchengine.production.appManager.settingManager.settingHomeManager; public class settingHomeEnums { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeModel.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/settingHomeManager/settingHomeModel.java similarity index 54% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeModel.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/settingHomeManager/settingHomeModel.java index 3c139249..c5cd2200 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeModel.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/settingHomeManager/settingHomeModel.java @@ -1,6 +1,6 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.settingHomeManager; +package com.hiddenservices.genesissearchengine.production.appManager.settingManager.settingHomeManager; -import com.darkweb.genesissearchengine.eventObserver; +import com.hiddenservices.genesissearchengine.production.eventObserver; class settingHomeModel { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeViewController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/settingHomeManager/settingHomeViewController.java similarity index 88% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeViewController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/settingHomeManager/settingHomeViewController.java index 691d7d29..53a57b8c 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeViewController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/settingHomeManager/settingHomeViewController.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.settingHomeManager; +package com.hiddenservices.genesissearchengine.production.appManager.settingManager.settingHomeManager; import android.os.Build; import android.view.View; @@ -7,7 +7,7 @@ import android.view.WindowManager; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatDelegate; import androidx.core.content.ContextCompat; -import com.darkweb.genesissearchengine.eventObserver; +import com.hiddenservices.genesissearchengine.production.eventObserver; import com.example.myapplication.R; import java.util.List; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/trackingManager/settingTrackingController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/trackingManager/settingTrackingController.java similarity index 77% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/trackingManager/settingTrackingController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/trackingManager/settingTrackingController.java index d870b47b..695e5bf1 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/trackingManager/settingTrackingController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/trackingManager/settingTrackingController.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.trackingManager; +package com.hiddenservices.genesissearchengine.production.appManager.settingManager.trackingManager; import android.content.res.Configuration; import android.os.Bundle; @@ -7,18 +7,18 @@ import android.widget.RadioButton; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.helpManager.helpController; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.appManager.activityThemeManager; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.hiddenservices.genesissearchengine.production.appManager.activityContextManager; +import com.hiddenservices.genesissearchengine.production.appManager.helpManager.helpController; +import com.hiddenservices.genesissearchengine.production.constants.constants; +import com.hiddenservices.genesissearchengine.production.constants.keys; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.dataManager.dataController; +import com.hiddenservices.genesissearchengine.production.dataManager.dataEnums; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.appManager.activityThemeManager; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginController; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums; import com.example.myapplication.R; import java.util.ArrayList; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/trackingManager/settingTrackingEnums.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/trackingManager/settingTrackingEnums.java similarity index 64% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/trackingManager/settingTrackingEnums.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/trackingManager/settingTrackingEnums.java index 889db3a0..45bfc510 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/trackingManager/settingTrackingEnums.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/trackingManager/settingTrackingEnums.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.trackingManager; +package com.hiddenservices.genesissearchengine.production.appManager.settingManager.trackingManager; class settingTrackingEnums { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/trackingManager/settingTrackingModel.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/trackingManager/settingTrackingModel.java similarity index 79% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/trackingManager/settingTrackingModel.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/trackingManager/settingTrackingModel.java index 1d2aa748..4e7488b6 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/trackingManager/settingTrackingModel.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/trackingManager/settingTrackingModel.java @@ -1,9 +1,9 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.trackingManager; +package com.hiddenservices.genesissearchengine.production.appManager.settingManager.trackingManager; import android.view.View; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.eventObserver; import com.example.myapplication.R; import org.mozilla.geckoview.ContentBlocking; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/trackingManager/settingTrackingViewController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/trackingManager/settingTrackingViewController.java similarity index 92% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/trackingManager/settingTrackingViewController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/trackingManager/settingTrackingViewController.java index aa7a3e65..882767b4 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/trackingManager/settingTrackingViewController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/settingManager/trackingManager/settingTrackingViewController.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.trackingManager; +package com.hiddenservices.genesissearchengine.production.appManager.settingManager.trackingManager; import android.content.res.ColorStateList; import android.os.Build; @@ -9,8 +9,8 @@ import android.widget.RadioButton; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatDelegate; import androidx.core.content.ContextCompat; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.eventObserver; import com.example.myapplication.R; import org.mozilla.geckoview.ContentBlocking; import java.util.ArrayList; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabAdapter.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/tabManager/tabAdapter.java old mode 100755 new mode 100644 similarity index 92% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabAdapter.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/tabManager/tabAdapter.java index 1d6f7028..baeb405d --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabAdapter.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/tabManager/tabAdapter.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.tabManager; +package com.hiddenservices.genesissearchengine.production.appManager.tabManager; import android.animation.ObjectAnimator; import android.annotation.SuppressLint; @@ -21,24 +21,24 @@ import androidx.cardview.widget.CardView; import androidx.constraintlayout.widget.ConstraintLayout; import androidx.core.content.ContextCompat; import androidx.recyclerview.widget.RecyclerView; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.dataManager.models.tabRowModel; -import com.darkweb.genesissearchengine.libs.views.ThumbnailCrop; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.appManager.activityContextManager; +import com.hiddenservices.genesissearchengine.production.constants.enums; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.dataManager.models.tabRowModel; +import com.hiddenservices.genesissearchengine.production.libs.views.ThumbnailCrop; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; import com.example.myapplication.R; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; -import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_DOMAIN_URL; -import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_HELP_URL; -import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_HELP_URL_CACHE; -import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_HELP_URL_CACHE_DARK; -import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_URL_CACHED; -import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_URL_CACHED_DARK; +import static com.hiddenservices.genesissearchengine.production.constants.constants.CONST_GENESIS_DOMAIN_URL; +import static com.hiddenservices.genesissearchengine.production.constants.constants.CONST_GENESIS_HELP_URL; +import static com.hiddenservices.genesissearchengine.production.constants.constants.CONST_GENESIS_HELP_URL_CACHE; +import static com.hiddenservices.genesissearchengine.production.constants.constants.CONST_GENESIS_HELP_URL_CACHE_DARK; +import static com.hiddenservices.genesissearchengine.production.constants.constants.CONST_GENESIS_URL_CACHED; +import static com.hiddenservices.genesissearchengine.production.constants.constants.CONST_GENESIS_URL_CACHED_DARK; public class tabAdapter extends RecyclerView.Adapter { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/tabManager/tabController.java old mode 100755 new mode 100644 similarity index 92% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/tabManager/tabController.java index 644f2ce1..5822ef02 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/tabManager/tabController.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.tabManager; +package com.hiddenservices.genesissearchengine.production.appManager.tabManager; import android.animation.ObjectAnimator; import android.animation.PropertyValuesHolder; @@ -24,19 +24,19 @@ import androidx.recyclerview.widget.ItemTouchHelper; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.SimpleItemAnimator; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.geckoSession; -import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController; -import com.darkweb.genesissearchengine.appManager.settingManager.advanceManager.settingAdvanceController; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.dataManager.models.tabRowModel; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.pluginManager.pluginController; +import com.hiddenservices.genesissearchengine.production.appManager.activityContextManager; +import com.hiddenservices.genesissearchengine.production.appManager.homeManager.geckoManager.geckoSession; +import com.hiddenservices.genesissearchengine.production.appManager.homeManager.homeController.homeController; +import com.hiddenservices.genesissearchengine.production.appManager.settingManager.advanceManager.settingAdvanceController; +import com.hiddenservices.genesissearchengine.production.constants.constants; +import com.hiddenservices.genesissearchengine.production.constants.enums; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.dataManager.dataController; +import com.hiddenservices.genesissearchengine.production.dataManager.dataEnums; +import com.hiddenservices.genesissearchengine.production.dataManager.models.tabRowModel; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginController; import com.example.myapplication.R; import java.util.ArrayList; import java.util.Arrays; @@ -44,9 +44,8 @@ import java.util.Collections; import java.util.List; import java.util.Objects; -import static com.darkweb.genesissearchengine.appManager.tabManager.tabEnums.eTabViewCommands.ON_HIDE_UNDO_DIALOG_FORCED; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_RESET; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_UNDO; +import static com.hiddenservices.genesissearchengine.production.appManager.tabManager.tabEnums.eTabViewCommands.ON_HIDE_UNDO_DIALOG_FORCED; +import static com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums.eMessageManager.M_RESET; import static org.mozilla.gecko.util.ThreadUtils.runOnUiThread; public class tabController extends Fragment diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabEnums.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/tabManager/tabEnums.java similarity index 91% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabEnums.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/tabManager/tabEnums.java index 3ae17b53..42fc1189 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabEnums.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/tabManager/tabEnums.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.tabManager; +package com.hiddenservices.genesissearchengine.production.appManager.tabManager; public class tabEnums { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabModel.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/tabManager/tabModel.java old mode 100755 new mode 100644 similarity index 84% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabModel.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/tabManager/tabModel.java index 38c2f752..07505803 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabModel.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/tabManager/tabModel.java @@ -1,8 +1,8 @@ -package com.darkweb.genesissearchengine.appManager.tabManager; +package com.hiddenservices.genesissearchengine.production.appManager.tabManager; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.dataManager.models.tabRowModel; +import com.hiddenservices.genesissearchengine.production.dataManager.dataController; +import com.hiddenservices.genesissearchengine.production.dataManager.dataEnums; +import com.hiddenservices.genesissearchengine.production.dataManager.models.tabRowModel; import java.util.ArrayList; import java.util.Arrays; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabViewController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/tabManager/tabViewController.java old mode 100755 new mode 100644 similarity index 92% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabViewController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/tabManager/tabViewController.java index a755b366..f3c1c348 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabViewController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/appManager/tabManager/tabViewController.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.tabManager; +package com.hiddenservices.genesissearchengine.production.appManager.tabManager; import android.annotation.SuppressLint; import android.graphics.Bitmap; @@ -8,33 +8,25 @@ import android.graphics.Color; import android.graphics.Paint; import android.graphics.RectF; import android.graphics.drawable.ColorDrawable; -import android.os.Build; import android.os.Handler; import android.view.LayoutInflater; import android.view.View; -import android.view.ViewGroup; -import android.view.Window; -import android.view.WindowManager; import android.widget.ActionMenuView; import android.widget.Button; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.PopupWindow; -import android.widget.RelativeLayout; import android.widget.TextView; -import androidx.appcompat.app.AppCompatDelegate; -import androidx.core.content.ContextCompat; import androidx.core.widget.NestedScrollView; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.ItemTouchHelper; import androidx.recyclerview.widget.RecyclerView; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.constants.enums; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; import com.example.myapplication.R; import java.util.List; import static android.content.Context.LAYOUT_INFLATER_SERVICE; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/constants.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/constants/constants.java old mode 100755 new mode 100644 similarity index 85% rename from app/src/main/java/com/darkweb/genesissearchengine/constants/constants.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/constants/constants.java index e8c9bb47..e645ca49 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/constants.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/constants/constants.java @@ -1,14 +1,17 @@ -package com.darkweb.genesissearchengine.constants; +package com.hiddenservices.genesissearchengine.production.constants; public class constants { /*LOCAL URL CONSTANTS*/ - public static final String CONST_PLAYSTORE_URL = "http://play.google.com/store/apps/details?id=com.darkweb.genesissearchengine.production"; + public static final String CONST_PLAYSTORE_URL = "http://play.google.com/store/apps/details?id=com.hiddenservices.genesissearchengine.production"; + public static final String CONST_AMAZON_URL = "http://www.amazon.com/gp/mas/dl/android?p=com.hiddenservices.genesissearchengine.production"; + public static final String CONST_SAMSUNG_URL = "http://www.samsungapps.com/appquery/appDetail.as?appId=com.hiddenservices.genesissearchengine.production"; + public static final String CONST_PRIVACY_POLICY_URL = "http://trcip42ymcgvv5hsa7nxpwdnott46ebomnn5pm5lovg5hpszyo4n35yd.onion/privacy"; public static final String CONST_REPORT_URL = "https://trcip42ymcgvv5hsa7nxpwdnott46ebomnn5pm5lovg5hpszyo4n35yd.onion/reportus?url="; public static final String CONST_SITEMAP = "https://trcip42ymcgvv5hsa7nxpwdnott46ebomnn5pm5lovg5hpszyo4n35yd.onion/create"; - public static final String CONST_PACKAGE_NAME = "com.darkweb.genesissearchengine.production"; + public static final String CONST_PACKAGE_NAME = "com.hiddenservices.genesissearchengine.production"; public static final String CONST_GENESIS_ONION = "genesis.onion"; public static final String CONST_GENESIS_ONION_V2 = "trcip42ymcgvv5hsa7nxpwdnott46ebomnn5pm5lovg5hpszyo4n35yd.onion"; @@ -26,16 +29,16 @@ public class constants /*URL CONSTANTS*/ - public static final String CONST_GENESIS_URL_CACHED = "resource://android/assets/Homepage/homepage.html"; - public static final String CONST_GENESIS_URL_CACHED_DARK = "resource://android/assets/Homepage/homepage-dark.html"; - public static final String CONST_GENESIS_ERROR_CACHED = "Error/error.html"; - public static final String CONST_GENESIS_ERROR_CACHED_DARK = "Error/error-dark.html"; + public static final String CONST_GENESIS_URL_CACHED = "resource://android/assets/homepage/homepage.html"; + public static final String CONST_GENESIS_URL_CACHED_DARK = "resource://android/assets/homepage/homepage-dark.html"; + public static final String CONST_GENESIS_ERROR_CACHED = "error/error.html"; + public static final String CONST_GENESIS_ERROR_CACHED_DARK = "error/error-dark.html"; public static final String CONST_GENESIS_DOMAIN_URL_SLASHED = "https://trcip42ymcgvv5hsa7nxpwdnott46ebomnn5pm5lovg5hpszyo4n35yd.onion/"; public static final String CONST_GENESIS_DOMAIN_URL = "https://trcip42ymcgvv5hsa7nxpwdnott46ebomnn5pm5lovg5hpszyo4n35yd.onion"; public static final String CONST_GENESIS_LOCAL_TIME_GET_KEY = "pLocalTimeVerificationToken"; public static final String CONST_GENESIS_GMT_TIME_GET_KEY = "pSecretToken"; - public static final String CONST_GENESIS_HELP_URL_CACHE = "resource://android/assets/Help/help.html"; - public static final String CONST_GENESIS_HELP_URL_CACHE_DARK = "resource://android/assets/Help/help-dark.html"; + public static final String CONST_GENESIS_HELP_URL_CACHE = "resource://android/assets/help/help.html"; + public static final String CONST_GENESIS_HELP_URL_CACHE_DARK = "resource://android/assets/help/help-dark.html"; public static final String CONST_GENESIS_HELP_URL = "https://genesis.onion/help"; public static final String CONST_GENESIS_HELP_URL_SUB = "trcip42ymcgvv5hsa7nxpwdnott46ebomnn5pm5lovg5hpszyo4n35yd.onion/help"; public static final String CONST_BACKEND_GENESIS_URL = "http://trcip42ymcgvv5hsa7nxpwdnott46ebomnn5pm5lovg5hpszyo4n35yd.onion/search?q=$s&p_num=1&s_type=all"; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/constants/enums.java old mode 100755 new mode 100644 similarity index 91% rename from app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/constants/enums.java index ad10f4f7..6b6cded2 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/constants/enums.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.constants; +package com.hiddenservices.genesissearchengine.production.constants; public class enums { @@ -12,6 +12,11 @@ public class enums } /*General Enums*/ + public static class StoreType { + public static final int GOOGLE_PLAY = 0; + public static final int AMAZON = 1; + public static final int SAMSUNG = 2; + } public static class AddTabCallback { public static final int TAB_ADDED = 0; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/keys.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/constants/keys.java old mode 100755 new mode 100644 similarity index 96% rename from app/src/main/java/com/darkweb/genesissearchengine/constants/keys.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/constants/keys.java index a01c64d9..f8dd55e6 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/keys.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/constants/keys.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.constants; +package com.hiddenservices.genesissearchengine.production.constants; public class keys { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/messages.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/constants/messages.java old mode 100755 new mode 100644 similarity index 74% rename from app/src/main/java/com/darkweb/genesissearchengine/constants/messages.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/constants/messages.java index 367fb622..c0b5f855 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/messages.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/constants/messages.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.constants; +package com.hiddenservices.genesissearchengine.production.constants; public class messages { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/responses.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/constants/responses.java similarity index 80% rename from app/src/main/java/com/darkweb/genesissearchengine/constants/responses.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/constants/responses.java index 97ca1df3..69d96af8 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/responses.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/constants/responses.java @@ -1,10 +1,10 @@ -package com.darkweb.genesissearchengine.constants; - -public class responses -{ - /*Notification Manager Manager*/ - public static final String BOOKMARK_SETTING_CONTROLLER_SHOW_SUCCESS_ALERT = "BOOKMARK_SETTING_CONTROLLER_SHOW_SUCCESS_ALERT"; - public static final String BOOKMARK_SETTING_CONTROLLER_SHOW_DELETE_ALERT = "BOOKMARK_SETTING_CONTROLLER_SHOW_DELETE_ALERT"; - -} - +package com.hiddenservices.genesissearchengine.production.constants; + +public class responses +{ + /*Notification Manager Manager*/ + public static final String BOOKMARK_SETTING_CONTROLLER_SHOW_SUCCESS_ALERT = "BOOKMARK_SETTING_CONTROLLER_SHOW_SUCCESS_ALERT"; + public static final String BOOKMARK_SETTING_CONTROLLER_SHOW_DELETE_ALERT = "BOOKMARK_SETTING_CONTROLLER_SHOW_DELETE_ALERT"; + +} + diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/sql.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/constants/sql.java similarity index 77% rename from app/src/main/java/com/darkweb/genesissearchengine/constants/sql.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/constants/sql.java index 6b3e5c64..301f1410 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/sql.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/constants/sql.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.constants; +package com.hiddenservices.genesissearchengine.production.constants; public class sql { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/constants/status.java old mode 100755 new mode 100644 similarity index 96% rename from app/src/main/java/com/darkweb/genesissearchengine/constants/status.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/constants/status.java index ef7e6394..a701a0e5 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/constants/status.java @@ -1,9 +1,9 @@ -package com.darkweb.genesissearchengine.constants; +package com.hiddenservices.genesissearchengine.production.constants; import android.content.Context; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; +import com.hiddenservices.genesissearchengine.production.dataManager.dataController; +import com.hiddenservices.genesissearchengine.production.dataManager.dataEnums; import org.mozilla.geckoview.ContentBlocking; @@ -18,6 +18,7 @@ public class status public static boolean sPaidStatus = false; public static boolean sDeveloperBuild = false; + public static int sStoreType = enums.StoreType.GOOGLE_PLAY; /*Settings Status*/ public static Locale mSystemLocale = null; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/strings.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/constants/strings.java old mode 100755 new mode 100644 similarity index 98% rename from app/src/main/java/com/darkweb/genesissearchengine/constants/strings.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/constants/strings.java index f350a136..18c646f3 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/strings.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/constants/strings.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.constants; +package com.hiddenservices.genesissearchengine.production.constants; public class strings { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/bookmarkDataModel.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/bookmarkDataModel.java similarity index 90% rename from app/src/main/java/com/darkweb/genesissearchengine/dataManager/bookmarkDataModel.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/bookmarkDataModel.java index 350aefe6..22e193ea 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/bookmarkDataModel.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/bookmarkDataModel.java @@ -1,13 +1,13 @@ -package com.darkweb.genesissearchengine.dataManager; +package com.hiddenservices.genesissearchengine.production.dataManager; import android.content.Intent; import android.util.Log; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.dataManager.models.bookmarkRowModel; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.strings; -import com.darkweb.genesissearchengine.eventObserver; +import com.hiddenservices.genesissearchengine.production.constants.keys; +import com.hiddenservices.genesissearchengine.production.dataManager.models.bookmarkRowModel; +import com.hiddenservices.genesissearchengine.production.constants.constants; +import com.hiddenservices.genesissearchengine.production.constants.strings; +import com.hiddenservices.genesissearchengine.production.eventObserver; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/bridgesDataModel.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/bridgesDataModel.java similarity index 83% rename from app/src/main/java/com/darkweb/genesissearchengine/dataManager/bridgesDataModel.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/bridgesDataModel.java index a151fbed..b946d925 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/bridgesDataModel.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/bridgesDataModel.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.dataManager; +package com.hiddenservices.genesissearchengine.production.dataManager; import android.content.Context; @@ -6,12 +6,12 @@ import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.toolbox.StringRequest; import com.android.volley.toolbox.Volley; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.constants.strings; +import com.hiddenservices.genesissearchengine.production.constants.keys; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.constants.strings; import java.util.Arrays; import java.util.List; -import static com.darkweb.genesissearchengine.constants.constants.*; +import static com.hiddenservices.genesissearchengine.production.constants.constants.*; public class bridgesDataModel { diff --git a/app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/crawlerDataModel.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/crawlerDataModel.java new file mode 100644 index 00000000..bf00222d --- /dev/null +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/crawlerDataModel.java @@ -0,0 +1,164 @@ +package com.hiddenservices.genesissearchengine.production.dataManager; + +import android.annotation.SuppressLint; +import android.text.Html; + +import androidx.appcompat.app.AppCompatActivity; +import com.android.volley.Request; +import com.android.volley.RequestQueue; +import com.android.volley.Response; +import com.android.volley.VolleyError; +import com.android.volley.toolbox.HttpStack; +import com.android.volley.toolbox.HurlStack; +import com.android.volley.toolbox.StringRequest; +import com.android.volley.toolbox.Volley; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.constants.strings; +import com.hiddenservices.genesissearchengine.production.dataManager.models.crawlerRowModel; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; + +import org.json.JSONObject; +import org.jsoup.Jsoup; +import org.jsoup.nodes.Document; +import org.jsoup.nodes.Element; +import org.jsoup.select.Elements; +import org.mozilla.thirdparty.com.google.android.exoplayer2.util.Log; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.DataOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.UnsupportedEncodingException; +import java.net.HttpURLConnection; +import java.net.InetSocketAddress; +import java.net.MalformedURLException; +import java.net.Proxy; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URL; +import java.net.URLConnection; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ch.boye.httpclientandroidlib.NameValuePair; +import ch.boye.httpclientandroidlib.client.methods.CloseableHttpResponse; +import ch.boye.httpclientandroidlib.client.methods.HttpUriRequest; +import ch.boye.httpclientandroidlib.client.methods.RequestBuilder; +import ch.boye.httpclientandroidlib.impl.client.CloseableHttpClient; +import ch.boye.httpclientandroidlib.impl.client.HttpClients; +import ch.boye.httpclientandroidlib.message.BasicNameValuePair; +import ch.boye.httpclientandroidlib.util.EntityUtils; + +@SuppressLint("CommitPrefEdits") +class crawlerDataModel +{ + /* Initializations */ + private Set mDuplicate; + private ArrayList mHTML; + private AppCompatActivity mContext; + + crawlerDataModel(AppCompatActivity pContext){ + mDuplicate = new HashSet<>(); + mHTML = new ArrayList<>(); + mContext = pContext; + } + + private void onInit(){ + if(!status.sCrawlerStatusStarted){ + status.sCrawlerStatusStarted = true; + onExecute(); + } + } + + private void onParseHTML(String pHtml, String pURL){ + String mHost = helperMethod.getHost(pURL); + try { + pURL = helperMethod.normalize(pURL); + if(mDuplicate.size()<30 && mHost.contains(".onion") && !mHost.contains("genesis") && !mHost.contains("trcip42ymcgvv5hsa7nxpwdnott46ebomnn5pm5lovg5hpszyo4n35yd") && !mDuplicate.contains(pURL)){ + mHTML.add(new crawlerRowModel(pURL, pHtml)); + mDuplicate.add(pURL); + } + } catch (URISyntaxException e) { + e.printStackTrace(); + } + } + + public class ProxiedHurlStack extends HurlStack { + + @Override + protected HttpURLConnection createConnection(URL url) throws IOException { + + Proxy mProxy = new Proxy(Proxy.Type.SOCKS, InetSocketAddress.createUnresolved("127.0.0.1", 9050));//the proxy server(Can be your laptop ip or company proxy) + HttpURLConnection mConnection = (HttpURLConnection) url.openConnection(mProxy); + + return mConnection; + } + } + + public void onExecute(){ + new Thread(){ + + String mHtml = strings.GENERIC_EMPTY_STR; + String mURL = strings.GENERIC_EMPTY_STR; + + private void onSendRequest(){ + RequestQueue mRequestQueue = Volley.newRequestQueue(mContext, new ProxiedHurlStack()); + String url = "http://trcip42ymcgvv5hsa7nxpwdnott46ebomnn5pm5lovg5hpszyo4n35yd.onion/user_index/"; + StringRequest mRequestData = new StringRequest(Request.Method.POST, url, response -> { + Log.d("",response); + }, error -> { + Log.d("",error.toString()); + }) { + protected Map getParams() { + Map MyData = new HashMap<>(); + MyData.put("m_html", mHtml); + MyData.put("m_url", mURL); + return MyData; + } + }; + mRequestQueue.add(mRequestData); + } + + public void run(){ + while (true){ + try { + sleep(1000); + if(mHTML.size()>0){ + crawlerRowModel mModel = mHTML.remove(0); + mHtml = mModel.getHTML(); + mURL = mModel.getURL(); + + onParseHTML(mHtml, mURL); + onSendRequest(); + + } + } catch (Exception ex) { + ex.printStackTrace(); + } + } + } + }.start(); + } + + /* External Triggers */ + + public Object onTrigger(dataEnums.eCrawlerCommands pCommands, List pData){ + if(pCommands.equals(dataEnums.eCrawlerCommands.M_INDEX_URL)){ + onParseHTML(pData.get(0).toString(), pData.get(1).toString()); + } + if(pCommands.equals(dataEnums.eCrawlerCommands.M_INIT)){ + onInit(); + } + return null; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/dataController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/dataController.java old mode 100755 new mode 100644 similarity index 91% rename from app/src/main/java/com/darkweb/genesissearchengine/dataManager/dataController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/dataController.java index e05d70e8..8e7f7047 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/dataController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/dataController.java @@ -1,15 +1,15 @@ -package com.darkweb.genesissearchengine.dataManager; +package com.hiddenservices.genesissearchengine.production.dataManager; import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.dataManager.models.bookmarkRowModel; -import com.darkweb.genesissearchengine.dataManager.models.tabRowModel; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.strings; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; +import com.hiddenservices.genesissearchengine.production.appManager.activityContextManager; +import com.hiddenservices.genesissearchengine.production.dataManager.models.bookmarkRowModel; +import com.hiddenservices.genesissearchengine.production.dataManager.models.tabRowModel; +import com.hiddenservices.genesissearchengine.production.constants.enums; +import com.hiddenservices.genesissearchengine.production.constants.keys; +import com.hiddenservices.genesissearchengine.production.constants.strings; +import com.hiddenservices.genesissearchengine.production.constants.constants; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.eventObserver; import org.mozilla.geckoview.ContentBlocking; @@ -17,8 +17,8 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; -import static com.darkweb.genesissearchengine.constants.sql.*; -import static com.darkweb.genesissearchengine.constants.status.mThemeApplying; +import static com.hiddenservices.genesissearchengine.production.constants.sql.*; +import static com.hiddenservices.genesissearchengine.production.constants.status.mThemeApplying; import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY; public class dataController diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/dataEnums.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/dataEnums.java similarity index 92% rename from app/src/main/java/com/darkweb/genesissearchengine/dataManager/dataEnums.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/dataEnums.java index b3abed19..8fa1d212 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/dataEnums.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/dataEnums.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.dataManager; +package com.hiddenservices.genesissearchengine.production.dataManager; public class dataEnums { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/helpDataModel.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/helpDataModel.java similarity index 89% rename from app/src/main/java/com/darkweb/genesissearchengine/dataManager/helpDataModel.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/helpDataModel.java index 61845664..f5cd6a1d 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/helpDataModel.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/helpDataModel.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.dataManager; +package com.hiddenservices.genesissearchengine.production.dataManager; import android.annotation.SuppressLint; import java.util.ArrayList; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/historyDataModel.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/historyDataModel.java similarity index 91% rename from app/src/main/java/com/darkweb/genesissearchengine/dataManager/historyDataModel.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/historyDataModel.java index cdc598a2..dc7a6881 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/historyDataModel.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/historyDataModel.java @@ -1,10 +1,10 @@ -package com.darkweb.genesissearchengine.dataManager; +package com.hiddenservices.genesissearchengine.production.dataManager; -import com.darkweb.genesissearchengine.dataManager.models.historyRowModel; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.dataManager.models.historyRowModel; +import com.hiddenservices.genesissearchengine.production.constants.constants; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/imageDataModel.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/imageDataModel.java similarity index 85% rename from app/src/main/java/com/darkweb/genesissearchengine/dataManager/imageDataModel.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/imageDataModel.java index a79865bd..2311ba11 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/imageDataModel.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/imageDataModel.java @@ -1,15 +1,14 @@ -package com.darkweb.genesissearchengine.dataManager; +package com.hiddenservices.genesissearchengine.production.dataManager; import android.annotation.SuppressLint; import android.graphics.Bitmap; import android.graphics.BitmapFactory; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.dataManager.models.imageRowModel; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import org.torproject.android.service.wrapper.orbotLocalConstants; +import com.hiddenservices.genesissearchengine.production.dataManager.models.imageRowModel; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; + +import org.orbotproject.android.service.wrapper.orbotLocalConstants; -import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.InetSocketAddress; @@ -19,8 +18,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import static com.darkweb.genesissearchengine.constants.constants.*; -import static com.darkweb.genesissearchengine.constants.enums.ImageQueueStatus.*; +import static com.hiddenservices.genesissearchengine.production.constants.constants.*; +import static com.hiddenservices.genesissearchengine.production.constants.enums.ImageQueueStatus.*; @SuppressLint("CommitPrefEdits") class imageDataModel diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/bookmarkRowModel.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/models/bookmarkRowModel.java similarity index 89% rename from app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/bookmarkRowModel.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/models/bookmarkRowModel.java index 805a5fb1..0106fc98 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/bookmarkRowModel.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/models/bookmarkRowModel.java @@ -1,6 +1,5 @@ -package com.darkweb.genesissearchengine.dataManager.models; +package com.hiddenservices.genesissearchengine.production.dataManager.models; -import android.widget.ImageView; import java.util.Calendar; import java.util.Date; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/crawlerRowModel.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/models/crawlerRowModel.java similarity index 79% rename from app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/crawlerRowModel.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/models/crawlerRowModel.java index 13f74eb1..81e0a72a 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/crawlerRowModel.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/models/crawlerRowModel.java @@ -1,27 +1,27 @@ -package com.darkweb.genesissearchengine.dataManager.models; - -public class crawlerRowModel -{ - /*Private Variables*/ - - private String mURL; - private String mHTML; - - /*Initializations*/ - - public crawlerRowModel(String pHeader, String pDescription) { - mURL = pHeader; - mHTML = pDescription; - } - - /*Variable Getters*/ - - public String getURL(){ - return mURL; - } - - public String getHTML(){ - return mHTML; - } - -} +package com.hiddenservices.genesissearchengine.production.dataManager.models; + +public class crawlerRowModel +{ + /*Private Variables*/ + + private String mURL; + private String mHTML; + + /*Initializations*/ + + public crawlerRowModel(String pHeader, String pDescription) { + mURL = pHeader; + mHTML = pDescription; + } + + /*Variable Getters*/ + + public String getURL(){ + return mURL; + } + + public String getHTML(){ + return mHTML; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/historyRowModel.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/models/historyRowModel.java similarity index 91% rename from app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/historyRowModel.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/models/historyRowModel.java index b1399263..2eee5419 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/historyRowModel.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/models/historyRowModel.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.dataManager.models; +package com.hiddenservices.genesissearchengine.production.dataManager.models; import android.widget.ImageView; import java.util.Calendar; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/imageRowModel.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/models/imageRowModel.java similarity index 83% rename from app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/imageRowModel.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/models/imageRowModel.java index 0c5d7f8a..9a074327 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/imageRowModel.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/models/imageRowModel.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.dataManager.models; +package com.hiddenservices.genesissearchengine.production.dataManager.models; import android.graphics.Bitmap; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/tabRowModel.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/models/tabRowModel.java similarity index 82% rename from app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/tabRowModel.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/models/tabRowModel.java index 0487e5c0..c0093da9 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/tabRowModel.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/models/tabRowModel.java @@ -1,18 +1,15 @@ -package com.darkweb.genesissearchengine.dataManager.models; +package com.hiddenservices.genesissearchengine.production.dataManager.models; import android.graphics.Bitmap; import android.graphics.BitmapFactory; -import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.geckoSession; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.appManager.homeManager.geckoManager.geckoSession; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; import org.mozilla.geckoview.GeckoSession; import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.util.zip.Deflater; public class tabRowModel { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/preferenceDataModel.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/preferenceDataModel.java similarity index 94% rename from app/src/main/java/com/darkweb/genesissearchengine/dataManager/preferenceDataModel.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/preferenceDataModel.java index 7c628944..2e167804 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/preferenceDataModel.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/preferenceDataModel.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.dataManager; +package com.hiddenservices.genesissearchengine.production.dataManager; import android.annotation.SuppressLint; import android.content.SharedPreferences; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/referenceWebsiteDataModel.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/referenceWebsiteDataModel.java similarity index 84% rename from app/src/main/java/com/darkweb/genesissearchengine/dataManager/referenceWebsiteDataModel.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/referenceWebsiteDataModel.java index 4f4c5f1d..6ea94f98 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/referenceWebsiteDataModel.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/referenceWebsiteDataModel.java @@ -1,15 +1,15 @@ -package com.darkweb.genesissearchengine.dataManager; +package com.hiddenservices.genesissearchengine.production.dataManager; import android.content.Context; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.toolbox.StringRequest; import com.android.volley.toolbox.Volley; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.status; +import com.hiddenservices.genesissearchengine.production.constants.keys; +import com.hiddenservices.genesissearchengine.production.constants.status; import java.util.Arrays; import java.util.List; -import static com.darkweb.genesissearchengine.constants.constants.*; +import static com.hiddenservices.genesissearchengine.production.constants.constants.*; public class referenceWebsiteDataModel { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/sqlCipherDataModel.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/sqlCipherDataModel.java similarity index 89% rename from app/src/main/java/com/darkweb/genesissearchengine/dataManager/sqlCipherDataModel.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/sqlCipherDataModel.java index ff456fcf..f274ac68 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/sqlCipherDataModel.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/sqlCipherDataModel.java @@ -1,16 +1,16 @@ -package com.darkweb.genesissearchengine.dataManager; +package com.hiddenservices.genesissearchengine.production.dataManager; import android.content.ContentValues; import android.database.Cursor; import android.util.Log; import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.dataManager.models.bookmarkRowModel; -import com.darkweb.genesissearchengine.dataManager.models.historyRowModel; -import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.geckoSession; -import com.darkweb.genesissearchengine.dataManager.models.tabRowModel; -import com.darkweb.genesissearchengine.constants.constants; +import com.hiddenservices.genesissearchengine.production.appManager.activityContextManager; +import com.hiddenservices.genesissearchengine.production.dataManager.models.bookmarkRowModel; +import com.hiddenservices.genesissearchengine.production.dataManager.models.historyRowModel; +import com.hiddenservices.genesissearchengine.production.appManager.homeManager.geckoManager.geckoSession; +import com.hiddenservices.genesissearchengine.production.dataManager.models.tabRowModel; +import com.hiddenservices.genesissearchengine.production.constants.constants; import net.sqlcipher.database.SQLiteDatabaseHook; import net.sqlcipher.database.SQLiteDatabase; import org.mozilla.geckoview.GeckoSession; @@ -23,7 +23,7 @@ import java.util.List; import java.util.Locale; import java.util.Objects; -import static com.darkweb.genesissearchengine.constants.constants.CONST_DATABASE_NAME; +import static com.hiddenservices.genesissearchengine.production.constants.constants.CONST_DATABASE_NAME; public class sqlCipherDataModel diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/suggestionDataModel.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/suggestionDataModel.java similarity index 96% rename from app/src/main/java/com/darkweb/genesissearchengine/dataManager/suggestionDataModel.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/suggestionDataModel.java index 620737af..a45a981a 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/suggestionDataModel.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/suggestionDataModel.java @@ -1,15 +1,15 @@ -package com.darkweb.genesissearchengine.dataManager; +package com.hiddenservices.genesissearchengine.production.dataManager; import android.content.Context; import android.view.textservice.SentenceSuggestionsInfo; import android.view.textservice.SpellCheckerSession; import android.view.textservice.SuggestionsInfo; -import com.darkweb.genesissearchengine.dataManager.models.bookmarkRowModel; -import com.darkweb.genesissearchengine.dataManager.models.historyRowModel; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.constants.strings; -import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.dataManager.models.bookmarkRowModel; +import com.hiddenservices.genesissearchengine.production.dataManager.models.historyRowModel; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.constants.strings; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; import java.util.ArrayList; import java.util.List; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/tabDataModel.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/tabDataModel.java similarity index 93% rename from app/src/main/java/com/darkweb/genesissearchengine/dataManager/tabDataModel.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/tabDataModel.java index 9b29a88b..fdd98373 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/tabDataModel.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/dataManager/tabDataModel.java @@ -1,363 +1,359 @@ -package com.darkweb.genesissearchengine.dataManager; - -import android.annotation.SuppressLint; -import android.content.ContentValues; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; -import android.os.AsyncTask; -import android.os.Handler; -import android.util.Log; -import android.widget.ImageView; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.geckoSession; -import com.darkweb.genesissearchengine.dataManager.models.tabRowModel; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.constants.strings; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; - -import org.mozilla.geckoview.GeckoResult; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Calendar; -import java.util.HashSet; -import java.util.List; -import java.util.Locale; -import java.util.Set; - -import static java.lang.Thread.sleep; - -@SuppressLint("CommitPrefEdits") -class tabDataModel -{ - - /* Local Variables */ - - private eventObserver.eventListener mExternalEvents; - - /* Initializations */ - - public tabDataModel(eventObserver.eventListener pExternalEvents){ - mExternalEvents = pExternalEvents; - } - - private ArrayList mTabs = new ArrayList<>(); - void initializeTab(ArrayList pTabMdel){ - mTabs.clear(); - mTabs.addAll(pTabMdel); - } - - /* Helper Methods */ - - ArrayList getTab(){ - return mTabs; - } - - geckoSession getHomePage(){ - if(mTabs.size()>0){ - return mTabs.get(0).getSession(); - }else { - return null; - } - } - - int addTabs(geckoSession mSession,boolean pIsDataSavable){ - tabRowModel mTabModel = new tabRowModel(mSession); - mTabs.add(0,mTabModel); - - if(mTabs.size()>20){ - closeTab(mTabs.get(mTabs.size()-1).getSession(), mTabs.get(mTabs.size()-1).getmId()); - return enums.AddTabCallback.TAB_FULL; - } - - if(pIsDataSavable){ - String[] params = new String[3]; - params[0] = mTabModel.getSession().getTitle(); - params[1] = mTabModel.getSession().getCurrentURL(); - params[2] = mTabModel.getSession().getTheme(); - String m_date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.ENGLISH).format(Calendar.getInstance().getTime()); - - if(mTabModel.getSession().getTitle().equals("about:blank") || mTabModel.getSession().getTitle().equals("$TITLE") || mTabModel.getSession().getTitle().startsWith("http://loading") || mTabModel.getSession().getTitle().startsWith("loading")){ - return enums.AddTabCallback.TAB_ADDED; - } - - if(mTabModel.getSession().getCurrentURL().equals("about:blank") || mTabModel.getSession().getCurrentURL().equals("$TITLE") || mTabModel.getSession().getCurrentURL().startsWith("http://loading") || mTabModel.getSession().getCurrentURL().startsWith("loading")){ - return enums.AddTabCallback.TAB_ADDED; - } - } - return enums.AddTabCallback.TAB_ADDED; - } - - void clearTab() { - int size = mTabs.size(); - for(int counter = 0; counter< size; counter++){ - if(mTabs.size()>0){ - mTabs.get(0).getSession().stop(); - mTabs.get(0).getSession().close(); - mTabs.remove(0); - } - } - if(mTabs.size()>0){ - mTabs.get(0).getSession().close(); - mTabs.remove(0); - } - - mExternalEvents.invokeObserver(Arrays.asList("DELETE FROM tab WHERE 1",null), dataEnums.eTabCallbackCommands.M_EXEC_SQL); - - } - - void closeTab(geckoSession mSession,Object pID) { - mSession.stop(); - mSession.close(); - - try { - String mID = strings.GENERIC_EMPTY_STR; - for(int counter = 0; counter< mTabs.size(); counter++){ - if(mTabs.get(counter).getSession().getSessionID().equals(mSession.getSessionID())) - { - mTabs.get(counter).getSession().stop(); - mTabs.get(counter).getSession().close(); - mID = mTabs.get(counter).getmId(); - mTabs.remove(counter); - break; - } - } - - mExternalEvents.invokeObserver(Arrays.asList("DELETE FROM tab WHERE mid='" + mID + "'",null), dataEnums.eTabCallbackCommands.M_EXEC_SQL); - }catch (Exception ex){ - ex.printStackTrace(); - } - } - - void moveTabToTop(geckoSession mSession) { - for(int counter = 0; counter< mTabs.size(); counter++){ - - try{ - if(mTabs.get(counter).getSession().getSessionID().equals(mSession.getSessionID())) - { - String m_date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.ENGLISH).format(Calendar.getInstance().getTime()); - - mExternalEvents.invokeObserver(Arrays.asList("UPDATE tab SET date = '" + m_date + "' WHERE mid='"+mTabs.get(counter).getmId() + "'",null), dataEnums.eTabCallbackCommands.M_EXEC_SQL); - mTabs.add(0,mTabs.remove(counter)); - break; - } - }catch (Exception ex){ - Log.i(ex.getMessage(), ex.getMessage()); - } - } - } - - void updateSession(String mSessionState, String mSessionID) { - for(int counter = 0; counter< mTabs.size(); counter++){ - - try{ - if(mTabs.get(counter).getSession().getSessionID().equals(mSessionID)) - { - String[] params = new String[1]; - params[0] = mSessionState; - - mExternalEvents.invokeObserver(Arrays.asList("UPDATE tab SET session = ? WHERE mid='"+mTabs.get(counter).getmId() + "'",params), dataEnums.eTabCallbackCommands.M_EXEC_SQL); - mTabs.add(0,mTabs.remove(counter)); - break; - } - }catch (Exception ex){ - Log.i(ex.getMessage(), ex.getMessage()); - } - } - } - - boolean updateTab(String mSessionID, geckoSession pSession) { - - for(int counter = 0; counter< mTabs.size(); counter++){ - - if(mTabs.get(counter).getSession().getSessionID().equals(mSessionID)) - { - String[] params = new String[3]; - params[0] = mTabs.get(counter).getSession().getTitle(); - params[1] = mTabs.get(counter).getSession().getCurrentURL(); - params[2] = mTabs.get(counter).getSession().getTheme(); - String m_date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.ENGLISH).format(Calendar.getInstance().getTime()); - - if(mTabs.get(counter).getSession().getTitle().equals("about:blank") || mTabs.get(counter).getSession().getTitle().equals("$TITLE") || mTabs.get(counter).getSession().getTitle().startsWith("http://loading") || mTabs.get(counter).getSession().getTitle().startsWith("loading")){ - return false; - } - - if(mTabs.get(counter).getSession().getCurrentURL().equals("about:blank") || mTabs.get(counter).getSession().getCurrentURL().equals("$TITLE") || mTabs.get(counter).getSession().getCurrentURL().startsWith("http://loading") || mTabs.get(counter).getSession().getCurrentURL().startsWith("loading")){ - return false; - } - - if(mTabs.get(counter).getmId()!=null){ - mExternalEvents.invokeObserver(Arrays.asList("REPLACE INTO tab(mid,date,title,url,theme) VALUES('"+ mTabs.get(counter).getmId() +"','" + m_date + "',?,?,?);",params), dataEnums.eTabCallbackCommands.M_EXEC_SQL); - } - return true; - } - } - addTabs(pSession, true); - return false; - } - - - tabRowModel getCurrentTab(){ - if(mTabs.size()>0){ - return mTabs.get(0); - } - else { - return null; - } - } - - tabRowModel getRecentTab(){ - if(mTabs.size()>1){ - return mTabs.get(1); - } - else { - return null; - } - } - - tabRowModel getLastTab(){ - if(mTabs.size()>0){ - return mTabs.get(mTabs.size()-1); - } - else { - return null; - } - } - - public void updatePixels(String pSessionID, GeckoResult pBitmapManager, ImageView pImageView, boolean pOpenTabView){ - updatePixelThread mThread = new updatePixelThread(); - mThread.pBitmapManager = pBitmapManager; - mThread.pImageView = pImageView; - mThread.pOpenTabView = pOpenTabView; - mThread.pSessionID = pSessionID; - mThread.execute(); - } - - @SuppressLint("StaticFieldLeak") - private class updatePixelThread extends AsyncTask { - - public String pSessionID; - public GeckoResult pBitmapManager; - public ImageView pImageView; - public boolean pOpenTabView; - - @Override - protected void onPreExecute() { - } - - @Override - protected String doInBackground(String... strings) { - try { - for(int counter = 0; counter< mTabs.size(); counter++) { - int finalCounter = counter; - if (mTabs.get(counter).getSession().getSessionID().equals(pSessionID)) { - Bitmap mBitmap = pBitmapManager.poll(10000); - - ByteArrayOutputStream out = new ByteArrayOutputStream(); - mBitmap.compress(Bitmap.CompressFormat.JPEG, 35, out); - - Bitmap decoded = BitmapFactory.decodeStream(new ByteArrayInputStream(out.toByteArray())); - Bitmap emptyBitmap = Bitmap.createBitmap(decoded.getWidth(), decoded.getHeight(), decoded.getConfig()); - if (!decoded.sameAs(emptyBitmap)) { - - if(pImageView!=null){ - activityContextManager.getInstance().getHomeController().runOnUiThread(() -> { - pImageView.setImageBitmap(mBitmap); - }); - } - - mTabs.get(finalCounter).decodeByteArraysetmBitmap(decoded); - ContentValues mContentValues = new ContentValues(); - mContentValues.put("mThumbnail", out.toByteArray()); - mExternalEvents.invokeObserver(Arrays.asList("tab",mContentValues, "mid = ?", new String[]{mTabs.get(finalCounter).getmId()}), dataEnums.eTabCallbackCommands.M_EXEC_SQL_USING_CONTENT); - } - break; - } - } - } catch (Throwable ex) { - ex.printStackTrace(); - } - if(pOpenTabView){ - activityContextManager.getInstance().getHomeController().onLoadFirstElement(); - } - return ""; - } - - @Override - protected void onPostExecute(String bitmap) { - } - } - public ArrayList> getSuggestions(String pQuery){ - ArrayList> mModel = new ArrayList<>(); - for(int count = 0; count<= mTabs.size()-1 && mTabs.size()<500; count++){ - if(mTabs.get(count).getSession().getTitle().toLowerCase().contains(pQuery) || mTabs.get(count).getSession().getCurrentURL().toLowerCase().contains(pQuery)){ - ArrayList mTempModel = new ArrayList<>(); - mTempModel.add(mTabs.get(count).getSession().getTitle().toLowerCase()); - mTempModel.add(mTabs.get(count).getSession().getCurrentURL()); - mModel.add(mTempModel); - } - } - return mModel; - } - - int getTotalTabs(){ - return mTabs.size(); - } - - /*List Suggestion*/ - public Object onTrigger(dataEnums.eTabCommands pCommands, List pData){ - if(pCommands == dataEnums.eTabCommands.GET_TOTAL_TAB){ - return getTotalTabs(); - } - else if(pCommands == dataEnums.eTabCommands.GET_CURRENT_TAB){ - return getCurrentTab(); - } - else if(pCommands == dataEnums.eTabCommands.GET_RECENT_TAB){ - return getRecentTab(); - } - else if(pCommands == dataEnums.eTabCommands.GET_LAST_TAB){ - return getLastTab(); - } - else if(pCommands == dataEnums.eTabCommands.MOVE_TAB_TO_TOP){ - moveTabToTop((geckoSession)pData.get(0)); - } - else if(pCommands == dataEnums.eTabCommands.CLOSE_TAB){ - closeTab((geckoSession)pData.get(0), pData.get(1)); - activityContextManager.getInstance().getHomeController().initTabCountForced(); - } - else if(pCommands == dataEnums.eTabCommands.M_CLEAR_TAB){ - clearTab(); - activityContextManager.getInstance().getHomeController().initTabCountForced(); - } - else if(pCommands == dataEnums.eTabCommands.M_ADD_TAB){ - int mTabs = addTabs((geckoSession)pData.get(0), (boolean)pData.get(1)); - //activityContextManager.getInstance().getHomeController().initTabCountForced(); - - return mTabs; - } - else if(pCommands == dataEnums.eTabCommands.M_UPDATE_SESSION_STATE){ - updateSession((String) pData.get(5), (String) pData.get(1)); - } - else if(pCommands == dataEnums.eTabCommands.M_UPDATE_TAB){ - updateTab((String) pData.get(1), (geckoSession) pData.get(5)); - activityContextManager.getInstance().getHomeController().initTabCountForced(); - } - else if(pCommands == dataEnums.eTabCommands.GET_TAB){ - return getTab(); - } - else if(pCommands == dataEnums.eTabCommands.M_GET_SUGGESTIONS){ - return getSuggestions((String) pData.get(0)); - } - else if(pCommands == dataEnums.eTabCommands.M_UPDATE_PIXEL){ - updatePixels((String)pData.get(0), (GeckoResult)pData.get(1), (ImageView) pData.get(2), (Boolean) pData.get(4)); - } - else if(pCommands == dataEnums.eTabCommands.M_HOME_PAGE){ - return getHomePage(); - } - - return null; - } -} +package com.hiddenservices.genesissearchengine.production.dataManager; + +import android.annotation.SuppressLint; +import android.content.ContentValues; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.os.AsyncTask; +import android.util.Log; +import android.widget.ImageView; +import com.hiddenservices.genesissearchengine.production.appManager.activityContextManager; +import com.hiddenservices.genesissearchengine.production.appManager.homeManager.geckoManager.geckoSession; +import com.hiddenservices.genesissearchengine.production.dataManager.models.tabRowModel; +import com.hiddenservices.genesissearchengine.production.constants.enums; +import com.hiddenservices.genesissearchengine.production.constants.strings; +import com.hiddenservices.genesissearchengine.production.eventObserver; + +import org.mozilla.geckoview.GeckoResult; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.List; +import java.util.Locale; + +import static java.lang.Thread.sleep; + +@SuppressLint("CommitPrefEdits") +class tabDataModel +{ + + /* Local Variables */ + + private eventObserver.eventListener mExternalEvents; + + /* Initializations */ + + public tabDataModel(eventObserver.eventListener pExternalEvents){ + mExternalEvents = pExternalEvents; + } + + private ArrayList mTabs = new ArrayList<>(); + void initializeTab(ArrayList pTabMdel){ + mTabs.clear(); + mTabs.addAll(pTabMdel); + } + + /* Helper Methods */ + + ArrayList getTab(){ + return mTabs; + } + + geckoSession getHomePage(){ + if(mTabs.size()>0){ + return mTabs.get(0).getSession(); + }else { + return null; + } + } + + int addTabs(geckoSession mSession,boolean pIsDataSavable){ + tabRowModel mTabModel = new tabRowModel(mSession); + mTabs.add(0,mTabModel); + + if(mTabs.size()>20){ + closeTab(mTabs.get(mTabs.size()-1).getSession(), mTabs.get(mTabs.size()-1).getmId()); + return enums.AddTabCallback.TAB_FULL; + } + + if(pIsDataSavable){ + String[] params = new String[3]; + params[0] = mTabModel.getSession().getTitle(); + params[1] = mTabModel.getSession().getCurrentURL(); + params[2] = mTabModel.getSession().getTheme(); + String m_date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.ENGLISH).format(Calendar.getInstance().getTime()); + + if(mTabModel.getSession().getTitle().equals("about:blank") || mTabModel.getSession().getTitle().equals("$TITLE") || mTabModel.getSession().getTitle().startsWith("http://loading") || mTabModel.getSession().getTitle().startsWith("loading")){ + return enums.AddTabCallback.TAB_ADDED; + } + + if(mTabModel.getSession().getCurrentURL().equals("about:blank") || mTabModel.getSession().getCurrentURL().equals("$TITLE") || mTabModel.getSession().getCurrentURL().startsWith("http://loading") || mTabModel.getSession().getCurrentURL().startsWith("loading")){ + return enums.AddTabCallback.TAB_ADDED; + } + } + return enums.AddTabCallback.TAB_ADDED; + } + + void clearTab() { + int size = mTabs.size(); + for(int counter = 0; counter< size; counter++){ + if(mTabs.size()>0){ + mTabs.get(0).getSession().stop(); + mTabs.get(0).getSession().close(); + mTabs.remove(0); + } + } + if(mTabs.size()>0){ + mTabs.get(0).getSession().close(); + mTabs.remove(0); + } + + mExternalEvents.invokeObserver(Arrays.asList("DELETE FROM tab WHERE 1",null), dataEnums.eTabCallbackCommands.M_EXEC_SQL); + + } + + void closeTab(geckoSession mSession,Object pID) { + mSession.stop(); + mSession.close(); + + try { + String mID = strings.GENERIC_EMPTY_STR; + for(int counter = 0; counter< mTabs.size(); counter++){ + if(mTabs.get(counter).getSession().getSessionID().equals(mSession.getSessionID())) + { + mTabs.get(counter).getSession().stop(); + mTabs.get(counter).getSession().close(); + mID = mTabs.get(counter).getmId(); + mTabs.remove(counter); + break; + } + } + + mExternalEvents.invokeObserver(Arrays.asList("DELETE FROM tab WHERE mid='" + mID + "'",null), dataEnums.eTabCallbackCommands.M_EXEC_SQL); + }catch (Exception ex){ + ex.printStackTrace(); + } + } + + void moveTabToTop(geckoSession mSession) { + for(int counter = 0; counter< mTabs.size(); counter++){ + + try{ + if(mTabs.get(counter).getSession().getSessionID().equals(mSession.getSessionID())) + { + String m_date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.ENGLISH).format(Calendar.getInstance().getTime()); + + mExternalEvents.invokeObserver(Arrays.asList("UPDATE tab SET date = '" + m_date + "' WHERE mid='"+mTabs.get(counter).getmId() + "'",null), dataEnums.eTabCallbackCommands.M_EXEC_SQL); + mTabs.add(0,mTabs.remove(counter)); + break; + } + }catch (Exception ex){ + Log.i(ex.getMessage(), ex.getMessage()); + } + } + } + + void updateSession(String mSessionState, String mSessionID) { + for(int counter = 0; counter< mTabs.size(); counter++){ + + try{ + if(mTabs.get(counter).getSession().getSessionID().equals(mSessionID)) + { + String[] params = new String[1]; + params[0] = mSessionState; + + mExternalEvents.invokeObserver(Arrays.asList("UPDATE tab SET session = ? WHERE mid='"+mTabs.get(counter).getmId() + "'",params), dataEnums.eTabCallbackCommands.M_EXEC_SQL); + mTabs.add(0,mTabs.remove(counter)); + break; + } + }catch (Exception ex){ + Log.i(ex.getMessage(), ex.getMessage()); + } + } + } + + boolean updateTab(String mSessionID, geckoSession pSession) { + + for(int counter = 0; counter< mTabs.size(); counter++){ + + if(mTabs.get(counter).getSession().getSessionID().equals(mSessionID)) + { + String[] params = new String[3]; + params[0] = mTabs.get(counter).getSession().getTitle(); + params[1] = mTabs.get(counter).getSession().getCurrentURL(); + params[2] = mTabs.get(counter).getSession().getTheme(); + String m_date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.ENGLISH).format(Calendar.getInstance().getTime()); + + if(mTabs.get(counter).getSession().getTitle().equals("about:blank") || mTabs.get(counter).getSession().getTitle().equals("$TITLE") || mTabs.get(counter).getSession().getTitle().startsWith("http://loading") || mTabs.get(counter).getSession().getTitle().startsWith("loading")){ + return false; + } + + if(mTabs.get(counter).getSession().getCurrentURL().equals("about:blank") || mTabs.get(counter).getSession().getCurrentURL().equals("$TITLE") || mTabs.get(counter).getSession().getCurrentURL().startsWith("http://loading") || mTabs.get(counter).getSession().getCurrentURL().startsWith("loading")){ + return false; + } + + if(mTabs.get(counter).getmId()!=null){ + mExternalEvents.invokeObserver(Arrays.asList("REPLACE INTO tab(mid,date,title,url,theme) VALUES('"+ mTabs.get(counter).getmId() +"','" + m_date + "',?,?,?);",params), dataEnums.eTabCallbackCommands.M_EXEC_SQL); + } + return true; + } + } + addTabs(pSession, true); + return false; + } + + + tabRowModel getCurrentTab(){ + if(mTabs.size()>0){ + return mTabs.get(0); + } + else { + return null; + } + } + + tabRowModel getRecentTab(){ + if(mTabs.size()>1){ + return mTabs.get(1); + } + else { + return null; + } + } + + tabRowModel getLastTab(){ + if(mTabs.size()>0){ + return mTabs.get(mTabs.size()-1); + } + else { + return null; + } + } + + public void updatePixels(String pSessionID, GeckoResult pBitmapManager, ImageView pImageView, boolean pOpenTabView){ + updatePixelThread mThread = new updatePixelThread(); + mThread.pBitmapManager = pBitmapManager; + mThread.pImageView = pImageView; + mThread.pOpenTabView = pOpenTabView; + mThread.pSessionID = pSessionID; + mThread.execute(); + } + + @SuppressLint("StaticFieldLeak") + private class updatePixelThread extends AsyncTask { + + public String pSessionID; + public GeckoResult pBitmapManager; + public ImageView pImageView; + public boolean pOpenTabView; + + @Override + protected void onPreExecute() { + } + + @Override + protected String doInBackground(String... strings) { + try { + for(int counter = 0; counter< mTabs.size(); counter++) { + int finalCounter = counter; + if (mTabs.get(counter).getSession().getSessionID().equals(pSessionID)) { + Bitmap mBitmap = pBitmapManager.poll(10000); + + ByteArrayOutputStream out = new ByteArrayOutputStream(); + mBitmap.compress(Bitmap.CompressFormat.JPEG, 35, out); + + Bitmap decoded = BitmapFactory.decodeStream(new ByteArrayInputStream(out.toByteArray())); + Bitmap emptyBitmap = Bitmap.createBitmap(decoded.getWidth(), decoded.getHeight(), decoded.getConfig()); + if (!decoded.sameAs(emptyBitmap)) { + + if(pImageView!=null){ + activityContextManager.getInstance().getHomeController().runOnUiThread(() -> { + pImageView.setImageBitmap(mBitmap); + }); + } + + mTabs.get(finalCounter).decodeByteArraysetmBitmap(decoded); + ContentValues mContentValues = new ContentValues(); + mContentValues.put("mThumbnail", out.toByteArray()); + mExternalEvents.invokeObserver(Arrays.asList("tab",mContentValues, "mid = ?", new String[]{mTabs.get(finalCounter).getmId()}), dataEnums.eTabCallbackCommands.M_EXEC_SQL_USING_CONTENT); + } + break; + } + } + } catch (Throwable ex) { + ex.printStackTrace(); + } + if(pOpenTabView){ + activityContextManager.getInstance().getHomeController().onLoadFirstElement(); + } + return ""; + } + + @Override + protected void onPostExecute(String bitmap) { + } + } + public ArrayList> getSuggestions(String pQuery){ + ArrayList> mModel = new ArrayList<>(); + for(int count = 0; count<= mTabs.size()-1 && mTabs.size()<500; count++){ + if(mTabs.get(count).getSession().getTitle().toLowerCase().contains(pQuery) || mTabs.get(count).getSession().getCurrentURL().toLowerCase().contains(pQuery)){ + ArrayList mTempModel = new ArrayList<>(); + mTempModel.add(mTabs.get(count).getSession().getTitle().toLowerCase()); + mTempModel.add(mTabs.get(count).getSession().getCurrentURL()); + mModel.add(mTempModel); + } + } + return mModel; + } + + int getTotalTabs(){ + return mTabs.size(); + } + + /*List Suggestion*/ + public Object onTrigger(dataEnums.eTabCommands pCommands, List pData){ + if(pCommands == dataEnums.eTabCommands.GET_TOTAL_TAB){ + return getTotalTabs(); + } + else if(pCommands == dataEnums.eTabCommands.GET_CURRENT_TAB){ + return getCurrentTab(); + } + else if(pCommands == dataEnums.eTabCommands.GET_RECENT_TAB){ + return getRecentTab(); + } + else if(pCommands == dataEnums.eTabCommands.GET_LAST_TAB){ + return getLastTab(); + } + else if(pCommands == dataEnums.eTabCommands.MOVE_TAB_TO_TOP){ + moveTabToTop((geckoSession)pData.get(0)); + } + else if(pCommands == dataEnums.eTabCommands.CLOSE_TAB){ + closeTab((geckoSession)pData.get(0), pData.get(1)); + activityContextManager.getInstance().getHomeController().initTabCountForced(); + } + else if(pCommands == dataEnums.eTabCommands.M_CLEAR_TAB){ + clearTab(); + activityContextManager.getInstance().getHomeController().initTabCountForced(); + } + else if(pCommands == dataEnums.eTabCommands.M_ADD_TAB){ + int mTabs = addTabs((geckoSession)pData.get(0), (boolean)pData.get(1)); + //activityContextManager.getInstance().getHomeController().initTabCountForced(); + + return mTabs; + } + else if(pCommands == dataEnums.eTabCommands.M_UPDATE_SESSION_STATE){ + updateSession((String) pData.get(5), (String) pData.get(1)); + } + else if(pCommands == dataEnums.eTabCommands.M_UPDATE_TAB){ + updateTab((String) pData.get(1), (geckoSession) pData.get(5)); + activityContextManager.getInstance().getHomeController().initTabCountForced(); + } + else if(pCommands == dataEnums.eTabCommands.GET_TAB){ + return getTab(); + } + else if(pCommands == dataEnums.eTabCommands.M_GET_SUGGESTIONS){ + return getSuggestions((String) pData.get(0)); + } + else if(pCommands == dataEnums.eTabCommands.M_UPDATE_PIXEL){ + updatePixels((String)pData.get(0), (GeckoResult)pData.get(1), (ImageView) pData.get(2), (Boolean) pData.get(4)); + } + else if(pCommands == dataEnums.eTabCommands.M_HOME_PAGE){ + return getHomePage(); + } + + return null; + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/eventObserver.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/eventObserver.java similarity index 71% rename from app/src/main/java/com/darkweb/genesissearchengine/eventObserver.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/eventObserver.java index a04781fc..6b3b9305 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/eventObserver.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/eventObserver.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine; +package com.hiddenservices.genesissearchengine.production; import java.util.List; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/helperMethod.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/helperManager/helperMethod.java old mode 100755 new mode 100644 similarity index 92% rename from app/src/main/java/com/darkweb/genesissearchengine/helperManager/helperMethod.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/helperManager/helperMethod.java index b36b71c5..e5beeb0d --- a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/helperMethod.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/helperManager/helperMethod.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.helperManager; +package com.hiddenservices.genesissearchengine.production.helperManager; import android.Manifest; import android.animation.Animator; @@ -31,7 +31,6 @@ import android.os.Vibrator; import android.text.SpannableString; import android.text.Spanned; import android.text.style.ForegroundColorSpan; -import android.util.Log; import android.view.Display; import android.view.Gravity; import android.view.LayoutInflater; @@ -53,15 +52,14 @@ import androidx.core.content.ContextCompat; import androidx.core.content.FileProvider; import androidx.core.graphics.ColorUtils; -import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.geckoSession; -import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController; -import com.darkweb.genesissearchengine.appManager.kotlinHelperLibraries.defaultBrowser; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.strings; -import com.darkweb.genesissearchengine.pluginManager.pluginController; +import com.hiddenservices.genesissearchengine.production.appManager.homeManager.geckoManager.geckoSession; +import com.hiddenservices.genesissearchengine.production.appManager.kotlinHelperLibraries.defaultBrowser; +import com.hiddenservices.genesissearchengine.production.constants.enums; +import com.hiddenservices.genesissearchengine.production.constants.keys; +import com.hiddenservices.genesissearchengine.production.constants.strings; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginController; import com.example.myapplication.R; -import org.xmlpull.v1.XmlPullParserException; + import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; @@ -70,12 +68,10 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.lang.reflect.Field; import java.net.MalformedURLException; -import java.net.Socket; -import java.net.SocketException; import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import java.net.URLConnection; -import java.nio.ByteBuffer; import java.security.Key; import java.text.SimpleDateFormat; import java.util.ArrayList; @@ -93,12 +89,11 @@ import javax.net.ssl.HttpsURLConnection; import static android.content.Context.LAYOUT_INFLATER_SERVICE; import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; import static android.content.Intent.FLAG_ACTIVITY_NO_ANIMATION; -import static com.darkweb.genesissearchengine.constants.constants.CONST_LIST_EXTERNAL_SHORTCUT; -import static com.darkweb.genesissearchengine.constants.constants.CONST_PACKAGE_NAME; -import static com.darkweb.genesissearchengine.constants.constants.CONST_PLAYSTORE_URL; -import static com.darkweb.genesissearchengine.constants.keys.M_ACTIVITY_NAVIGATION_BUNDLE_KEY; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_IMAGE_UPDATE; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_OPEN_ACTIVITY_FAILED; +import static com.hiddenservices.genesissearchengine.production.constants.constants.CONST_LIST_EXTERNAL_SHORTCUT; +import static com.hiddenservices.genesissearchengine.production.constants.constants.CONST_PACKAGE_NAME; +import static com.hiddenservices.genesissearchengine.production.constants.constants.CONST_PLAYSTORE_URL; +import static com.hiddenservices.genesissearchengine.production.constants.keys.M_ACTIVITY_NAVIGATION_BUNDLE_KEY; +import static com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums.eMessageManager.M_OPEN_ACTIVITY_FAILED; public class helperMethod { @@ -516,6 +511,34 @@ public class helperMethod } } + public static String normalize(String url) throws URISyntaxException, NullPointerException { + String pathSeparator = "/"; + + URI uri = new URI(url); + uri = uri.normalize(); + + String path = uri.getPath(); + + if (!path.startsWith(pathSeparator)) { + path = pathSeparator + path; + } + + if (path.endsWith(pathSeparator)) { + path = path.substring(0, path.length() - 1); + } + + String urlStr = uri.getScheme() + "://" + uri.getHost(); + int port = uri.getPort(); + + if (port != -1) { + urlStr = urlStr + ":" + port; + } + + urlStr = urlStr + path; + + return urlStr; + } + static public String getHost(String link){ URL url; try @@ -806,7 +829,7 @@ public class helperMethod if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.N){ try { - Uri uri = FileProvider.getUriForFile(context, "com.darkweb.genesissearchengine.production.provider", url); + Uri uri = FileProvider.getUriForFile(context, "com.hiddenservices.genesissearchengine.production.provider", url); Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse(url.toString())); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); @@ -817,7 +840,7 @@ public class helperMethod } } else{ try { - Uri uri = FileProvider.getUriForFile(context, "com.darkweb.genesissearchengine.production.provider", url); + Uri uri = FileProvider.getUriForFile(context, "com.hiddenservices.genesissearchengine.production.provider", url); Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse(url.toString())); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); @@ -834,7 +857,6 @@ public class helperMethod ClipData clip = ClipData.newPlainText("link", url); clipboard.setPrimaryClip(clip); - } public static void showToastMessage(String message,Context context){ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/sharedUIMethod.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/helperManager/sharedUIMethod.java similarity index 79% rename from app/src/main/java/com/darkweb/genesissearchengine/helperManager/sharedUIMethod.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/helperManager/sharedUIMethod.java index bbeaf5ba..c717254f 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/sharedUIMethod.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/helperManager/sharedUIMethod.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.helperManager; +package com.hiddenservices.genesissearchengine.production.helperManager; import android.content.res.Configuration; @@ -9,10 +9,10 @@ import android.view.WindowManager; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatDelegate; import androidx.core.content.ContextCompat; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.activityThemeManager; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.hiddenservices.genesissearchengine.production.appManager.activityContextManager; +import com.hiddenservices.genesissearchengine.production.appManager.activityThemeManager; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginController; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums; import com.example.myapplication.R; import java.util.Collections; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/NetCipher.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/NetCipher.java similarity index 95% rename from app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/NetCipher.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/NetCipher.java index a80bb339..3f647bf1 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/NetCipher.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/NetCipher.java @@ -1,360 +1,360 @@ -/* - * Copyright 2014-2016 Hans-Christoph Steiner - * Copyright 2012-2016 Nathan Freitas - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.darkweb.genesissearchengine.libs.netcipher; - -import android.net.Uri; -import android.os.Build; -import android.text.TextUtils; -import android.util.Log; - -import com.darkweb.genesissearchengine.libs.netcipher.client.TlsOnlySocketFactory; -import com.darkweb.genesissearchengine.libs.netcipher.proxy.OrbotHelper; - -import org.torproject.android.service.wrapper.orbotLocalConstants; - -import java.io.IOException; -import java.net.HttpURLConnection; -import java.net.InetSocketAddress; -import java.net.Proxy; -import java.net.URI; -import java.net.URL; -import java.security.KeyManagementException; -import java.security.NoSuchAlgorithmException; - -import javax.net.ssl.HttpsURLConnection; -import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLSocketFactory; - - -public class NetCipher { - private static final String TAG = "NetCipher"; - - private NetCipher() { - // this is a utility class with only static methods - } - - public final static Proxy ORBOT_HTTP_PROXY = new Proxy(Proxy.Type.HTTP, - new InetSocketAddress("127.0.0.1", orbotLocalConstants.mHTTPPort)); - - private static Proxy proxy; - - /** - * Set the global HTTP proxy for all new {@link HttpURLConnection}s and - * {@link HttpsURLConnection}s that are created after this is called. - *

- * {@link #useTor()} will override this setting. Traffic must be directed - * to Tor using the proxy settings, and Orbot has its own proxy settings - * for connections that need proxies to work. So if "use Tor" is enabled, - * as tested by looking for the static instance of Proxy, then no other - * proxy settings are allowed to override the current Tor proxy. - * - * @param host the IP address for the HTTP proxy to use globally - * @param port the port number for the HTTP proxy to use globally - */ - public static void setProxy(String host, int port) { - if (!TextUtils.isEmpty(host) && port > 0) { - InetSocketAddress isa = new InetSocketAddress(host, port); - setProxy(new Proxy(Proxy.Type.HTTP, isa)); - } else if (NetCipher.proxy != ORBOT_HTTP_PROXY) { - setProxy(null); - } - } - - /** - * Set the global HTTP proxy for all new {@link HttpURLConnection}s and - * {@link HttpsURLConnection}s that are created after this is called. - *

- * {@link #useTor()} will override this setting. Traffic must be directed - * to Tor using the proxy settings, and Orbot has its own proxy settings - * for connections that need proxies to work. So if "use Tor" is enabled, - * as tested by looking for the static instance of Proxy, then no other - * proxy settings are allowed to override the current Tor proxy. - * - * @param proxy the HTTP proxy to use globally - */ - public static void setProxy(Proxy proxy) { - if (proxy != null && NetCipher.proxy == ORBOT_HTTP_PROXY) { - Log.w(TAG, "useTor is enabled, ignoring new proxy settings!"); - } else { - NetCipher.proxy = proxy; - } - } - - /** - * Get the currently active global HTTP {@link Proxy}. - * - * @return the active HTTP {@link Proxy} - */ - public static Proxy getProxy() { - return proxy; - } - - /** - * Clear the global HTTP proxy for all new {@link HttpURLConnection}s and - * {@link HttpsURLConnection}s that are created after this is called. This - * returns things to the default, proxy-less state. - */ - public static void clearProxy() { - setProxy(null); - } - - /** - * Set Orbot as the global HTTP proxy for all new {@link HttpURLConnection} - * s and {@link HttpsURLConnection}s that are created after this is called. - * This overrides all future calls to {@link #setProxy(Proxy)}, except to - * clear the proxy, e.g. {@code #setProxy(null)} or {@link #clearProxy()}. - *

- * Traffic must be directed to Tor using the proxy settings, and Orbot has its - * own proxy settings for connections that need proxies to work. So if "use - * Tor" is enabled, as tested by looking for the static instance of Proxy, - * then no other proxy settings are allowed to override the current Tor proxy. - */ - public static void useTor() { - setProxy(ORBOT_HTTP_PROXY); - } - - /** - * Get a {@link TlsOnlySocketFactory} from NetCipher. - * - * @see HttpsURLConnection#setDefaultSSLSocketFactory(SSLSocketFactory) - */ - public static TlsOnlySocketFactory getTlsOnlySocketFactory() { - return getTlsOnlySocketFactory(false); - } - - /** - * Get a {@link TlsOnlySocketFactory} from NetCipher, and specify whether - * it should use a more compatible, but less strong, suite of ciphers. - * - * @see HttpsURLConnection#setDefaultSSLSocketFactory(SSLSocketFactory) - */ - public static TlsOnlySocketFactory getTlsOnlySocketFactory(boolean compatible) { - SSLContext sslcontext; - try { - sslcontext = SSLContext.getInstance("TLSv1"); - sslcontext.init(null, null, null); - } catch (NoSuchAlgorithmException e) { - throw new IllegalArgumentException(e); - } catch (KeyManagementException e) { - throw new IllegalArgumentException(e); - } - return new TlsOnlySocketFactory(sslcontext.getSocketFactory(), compatible); - } - - /** - * Get a {@link HttpURLConnection} from a {@link URL}, and specify whether - * it should use a more compatible, but less strong, suite of ciphers. - * - * @param url - * @param compatible - * @return the {@code url} in an instance of {@link HttpURLConnection} - * @throws IOException - * @throws IllegalArgumentException if the proxy or TLS setup is incorrect - */ - public static HttpURLConnection getHttpURLConnection(URL url, boolean compatible) - throws IOException { - // .onion addresses only work via Tor, so force Tor for all of them - Proxy proxy = NetCipher.proxy; - if (OrbotHelper.isOnionAddress(url)) - proxy = ORBOT_HTTP_PROXY; - - HttpURLConnection connection; - if (proxy != null) { - connection = (HttpURLConnection) url.openConnection(proxy); - } else { - connection = (HttpURLConnection) url.openConnection(); - } - - if (connection instanceof HttpsURLConnection) { - HttpsURLConnection httpsConnection = ((HttpsURLConnection) connection); - SSLSocketFactory tlsOnly = getTlsOnlySocketFactory(compatible); - httpsConnection.setSSLSocketFactory(tlsOnly); - if (Build.VERSION.SDK_INT < 16) { - httpsConnection.setHostnameVerifier(org.apache.http.conn.ssl.SSLSocketFactory.STRICT_HOSTNAME_VERIFIER); - } - } - return connection; - } - - /** - * Get a {@link HttpsURLConnection} from a URL {@link String} using the best - * TLS configuration available on the device. - * - * @param urlString - * @return the URL in an instance of {@link HttpsURLConnection} - * @throws IOException - * @throws IllegalArgumentException if the proxy or TLS setup is incorrect, - * or if an HTTP URL is given that does not support HTTPS - */ - public static HttpsURLConnection getHttpsURLConnection(String urlString) throws IOException { - URL url = new URL(urlString.replaceFirst("^[Hh][Tt][Tt][Pp]:", "https:")); - return getHttpsURLConnection(url, false); - } - - /** - * Get a {@link HttpsURLConnection} from a {@link Uri} using the best TLS - * configuration available on the device. - * - * @param uri - * @return the {@code uri} in an instance of {@link HttpsURLConnection} - * @throws IOException - * @throws IllegalArgumentException if the proxy or TLS setup is incorrect, - * or if an HTTP URL is given that does not support HTTPS - */ - public static HttpsURLConnection getHttpsURLConnection(Uri uri) throws IOException { - return getHttpsURLConnection(uri.toString()); - } - - /** - * Get a {@link HttpsURLConnection} from a {@link URI} using the best TLS - * configuration available on the device. - * - * @param uri - * @return the {@code uri} in an instance of {@link HttpsURLConnection} - * @throws IOException - * @throws IllegalArgumentException if the proxy or TLS setup is incorrect, - * or if an HTTP URL is given that does not support HTTPS - */ - public static HttpsURLConnection getHttpsURLConnection(URI uri) throws IOException { - if (TextUtils.equals(uri.getScheme(), "https")) - return getHttpsURLConnection(uri.toURL(), false); - else - // otherwise force scheme to https - return getHttpsURLConnection(uri.toString()); - } - - /** - * Get a {@link HttpsURLConnection} from a {@link URL} using the best TLS - * configuration available on the device. - * - * @param url - * @return the {@code url} in an instance of {@link HttpsURLConnection} - * @throws IOException - * @throws IllegalArgumentException if the proxy or TLS setup is incorrect, - * or if an HTTP URL is given that does not support HTTPS - */ - public static HttpsURLConnection getHttpsURLConnection(URL url) throws IOException { - return getHttpsURLConnection(url, false); - } - - /** - * Get a {@link HttpsURLConnection} from a {@link URL} using a more - * compatible, but less strong, suite of ciphers. - * - * @param url - * @return the {@code url} in an instance of {@link HttpsURLConnection} - * @throws IOException - * @throws IllegalArgumentException if the proxy or TLS setup is incorrect, - * or if an HTTP URL is given that does not support HTTPS - */ - public static HttpsURLConnection getCompatibleHttpsURLConnection(URL url) throws IOException { - return getHttpsURLConnection(url, true); - } - - /** - * Get a {@link HttpsURLConnection} from a {@link URL}, and specify whether - * it should use a more compatible, but less strong, suite of ciphers. - * - * @param url - * @param compatible - * @return the {@code url} in an instance of {@link HttpsURLConnection} - * @throws IOException - * @throws IllegalArgumentException if the proxy or TLS setup is incorrect, - * or if an HTTP URL is given that does not support HTTPS - */ - public static HttpsURLConnection getHttpsURLConnection(URL url, boolean compatible) - throws IOException { - // use default method, but enforce a HttpsURLConnection - HttpURLConnection connection = getHttpURLConnection(url, compatible); - if (connection instanceof HttpsURLConnection) { - return (HttpsURLConnection) connection; - } else { - throw new IllegalArgumentException("not an HTTPS connection!"); - } - } - - /** - * Get a {@link HttpURLConnection} from a {@link URL}. If the connection is - * {@code https://}, it will use a more compatible, but less strong, TLS - * configuration. - * - * @param url - * @return the {@code url} in an instance of {@link HttpsURLConnection} - * @throws IOException - * @throws IllegalArgumentException if the proxy or TLS setup is incorrect - */ - public static HttpURLConnection getCompatibleHttpURLConnection(URL url) throws IOException { - return getHttpURLConnection(url, true); - } - - /** - * Get a {@link HttpURLConnection} from a URL {@link String}. If it is an - * {@code https://} link, then this will use the best TLS configuration - * available on the device. - * - * @param urlString - * @return the URL in an instance of {@link HttpURLConnection} - * @throws IOException - * @throws IllegalArgumentException if the proxy or TLS setup is incorrect - */ - public static HttpURLConnection getHttpURLConnection(String urlString) throws IOException { - return getHttpURLConnection(new URL(urlString)); - } - - /** - * Get a {@link HttpURLConnection} from a {@link Uri}. If it is an - * {@code https://} link, then this will use the best TLS configuration - * available on the device. - * - * @param uri - * @return the {@code uri} in an instance of {@link HttpURLConnection} - * @throws IOException - * @throws IllegalArgumentException if the proxy or TLS setup is incorrect - */ - public static HttpURLConnection getHttpURLConnection(Uri uri) throws IOException { - return getHttpURLConnection(uri.toString()); - } - - /** - * Get a {@link HttpURLConnection} from a {@link URI}. If it is an - * {@code https://} link, then this will use the best TLS configuration - * available on the device. - * - * @param uri - * @return the {@code uri} in an instance of {@link HttpURLConnection} - * @throws IOException - * @throws IllegalArgumentException if the proxy or TLS setup is incorrect - */ - public static HttpURLConnection getHttpURLConnection(URI uri) throws IOException { - return getHttpURLConnection(uri.toURL()); - } - - /** - * Get a {@link HttpURLConnection} from a {@link URL}. If it is an - * {@code https://} link, then this will use the best TLS configuration - * available on the device. - * - * @param url - * @return the {@code url} in an instance of {@link HttpURLConnection} - * @throws IOException - * @throws IllegalArgumentException if the proxy or TLS setup is incorrect - */ - public static HttpURLConnection getHttpURLConnection(URL url) throws IOException { - return (HttpURLConnection) getHttpURLConnection(url, false); - } -} +/* + * Copyright 2014-2016 Hans-Christoph Steiner + * Copyright 2012-2016 Nathan Freitas + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.hiddenservices.genesissearchengine.production.libs.netcipher; + +import android.net.Uri; +import android.os.Build; +import android.text.TextUtils; +import android.util.Log; + +import com.hiddenservices.genesissearchengine.production.libs.netcipher.client.TlsOnlySocketFactory; +import com.hiddenservices.genesissearchengine.production.libs.netcipher.proxy.OrbotHelper; + +import org.orbotproject.android.service.wrapper.orbotLocalConstants; + +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.InetSocketAddress; +import java.net.Proxy; +import java.net.URI; +import java.net.URL; +import java.security.KeyManagementException; +import java.security.NoSuchAlgorithmException; + +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSocketFactory; + + +public class NetCipher { + private static final String TAG = "NetCipher"; + + private NetCipher() { + // this is a utility class with only static methods + } + + public final static Proxy ORBOT_HTTP_PROXY = new Proxy(Proxy.Type.HTTP, + new InetSocketAddress("127.0.0.1", orbotLocalConstants.mHTTPPort)); + + private static Proxy proxy; + + /** + * Set the global HTTP proxy for all new {@link HttpURLConnection}s and + * {@link HttpsURLConnection}s that are created after this is called. + *

+ * {@link #useTor()} will override this setting. Traffic must be directed + * to Tor using the proxy settings, and Orbot has its own proxy settings + * for connections that need proxies to work. So if "use Tor" is enabled, + * as tested by looking for the static instance of Proxy, then no other + * proxy settings are allowed to override the current Tor proxy. + * + * @param host the IP address for the HTTP proxy to use globally + * @param port the port number for the HTTP proxy to use globally + */ + public static void setProxy(String host, int port) { + if (!TextUtils.isEmpty(host) && port > 0) { + InetSocketAddress isa = new InetSocketAddress(host, port); + setProxy(new Proxy(Proxy.Type.HTTP, isa)); + } else if (NetCipher.proxy != ORBOT_HTTP_PROXY) { + setProxy(null); + } + } + + /** + * Set the global HTTP proxy for all new {@link HttpURLConnection}s and + * {@link HttpsURLConnection}s that are created after this is called. + *

+ * {@link #useTor()} will override this setting. Traffic must be directed + * to Tor using the proxy settings, and Orbot has its own proxy settings + * for connections that need proxies to work. So if "use Tor" is enabled, + * as tested by looking for the static instance of Proxy, then no other + * proxy settings are allowed to override the current Tor proxy. + * + * @param proxy the HTTP proxy to use globally + */ + public static void setProxy(Proxy proxy) { + if (proxy != null && NetCipher.proxy == ORBOT_HTTP_PROXY) { + Log.w(TAG, "useTor is enabled, ignoring new proxy settings!"); + } else { + NetCipher.proxy = proxy; + } + } + + /** + * Get the currently active global HTTP {@link Proxy}. + * + * @return the active HTTP {@link Proxy} + */ + public static Proxy getProxy() { + return proxy; + } + + /** + * Clear the global HTTP proxy for all new {@link HttpURLConnection}s and + * {@link HttpsURLConnection}s that are created after this is called. This + * returns things to the default, proxy-less state. + */ + public static void clearProxy() { + setProxy(null); + } + + /** + * Set Orbot as the global HTTP proxy for all new {@link HttpURLConnection} + * s and {@link HttpsURLConnection}s that are created after this is called. + * This overrides all future calls to {@link #setProxy(Proxy)}, except to + * clear the proxy, e.g. {@code #setProxy(null)} or {@link #clearProxy()}. + *

+ * Traffic must be directed to Tor using the proxy settings, and Orbot has its + * own proxy settings for connections that need proxies to work. So if "use + * Tor" is enabled, as tested by looking for the static instance of Proxy, + * then no other proxy settings are allowed to override the current Tor proxy. + */ + public static void useTor() { + setProxy(ORBOT_HTTP_PROXY); + } + + /** + * Get a {@link TlsOnlySocketFactory} from NetCipher. + * + * @see HttpsURLConnection#setDefaultSSLSocketFactory(SSLSocketFactory) + */ + public static TlsOnlySocketFactory getTlsOnlySocketFactory() { + return getTlsOnlySocketFactory(false); + } + + /** + * Get a {@link TlsOnlySocketFactory} from NetCipher, and specify whether + * it should use a more compatible, but less strong, suite of ciphers. + * + * @see HttpsURLConnection#setDefaultSSLSocketFactory(SSLSocketFactory) + */ + public static TlsOnlySocketFactory getTlsOnlySocketFactory(boolean compatible) { + SSLContext sslcontext; + try { + sslcontext = SSLContext.getInstance("TLSv1"); + sslcontext.init(null, null, null); + } catch (NoSuchAlgorithmException e) { + throw new IllegalArgumentException(e); + } catch (KeyManagementException e) { + throw new IllegalArgumentException(e); + } + return new TlsOnlySocketFactory(sslcontext.getSocketFactory(), compatible); + } + + /** + * Get a {@link HttpURLConnection} from a {@link URL}, and specify whether + * it should use a more compatible, but less strong, suite of ciphers. + * + * @param url + * @param compatible + * @return the {@code url} in an instance of {@link HttpURLConnection} + * @throws IOException + * @throws IllegalArgumentException if the proxy or TLS setup is incorrect + */ + public static HttpURLConnection getHttpURLConnection(URL url, boolean compatible) + throws IOException { + // .onion addresses only work via Tor, so force Tor for all of them + Proxy proxy = NetCipher.proxy; + if (OrbotHelper.isOnionAddress(url)) + proxy = ORBOT_HTTP_PROXY; + + HttpURLConnection connection; + if (proxy != null) { + connection = (HttpURLConnection) url.openConnection(proxy); + } else { + connection = (HttpURLConnection) url.openConnection(); + } + + if (connection instanceof HttpsURLConnection) { + HttpsURLConnection httpsConnection = ((HttpsURLConnection) connection); + SSLSocketFactory tlsOnly = getTlsOnlySocketFactory(compatible); + httpsConnection.setSSLSocketFactory(tlsOnly); + if (Build.VERSION.SDK_INT < 16) { + httpsConnection.setHostnameVerifier(org.apache.http.conn.ssl.SSLSocketFactory.STRICT_HOSTNAME_VERIFIER); + } + } + return connection; + } + + /** + * Get a {@link HttpsURLConnection} from a URL {@link String} using the best + * TLS configuration available on the device. + * + * @param urlString + * @return the URL in an instance of {@link HttpsURLConnection} + * @throws IOException + * @throws IllegalArgumentException if the proxy or TLS setup is incorrect, + * or if an HTTP URL is given that does not support HTTPS + */ + public static HttpsURLConnection getHttpsURLConnection(String urlString) throws IOException { + URL url = new URL(urlString.replaceFirst("^[Hh][Tt][Tt][Pp]:", "https:")); + return getHttpsURLConnection(url, false); + } + + /** + * Get a {@link HttpsURLConnection} from a {@link Uri} using the best TLS + * configuration available on the device. + * + * @param uri + * @return the {@code uri} in an instance of {@link HttpsURLConnection} + * @throws IOException + * @throws IllegalArgumentException if the proxy or TLS setup is incorrect, + * or if an HTTP URL is given that does not support HTTPS + */ + public static HttpsURLConnection getHttpsURLConnection(Uri uri) throws IOException { + return getHttpsURLConnection(uri.toString()); + } + + /** + * Get a {@link HttpsURLConnection} from a {@link URI} using the best TLS + * configuration available on the device. + * + * @param uri + * @return the {@code uri} in an instance of {@link HttpsURLConnection} + * @throws IOException + * @throws IllegalArgumentException if the proxy or TLS setup is incorrect, + * or if an HTTP URL is given that does not support HTTPS + */ + public static HttpsURLConnection getHttpsURLConnection(URI uri) throws IOException { + if (TextUtils.equals(uri.getScheme(), "https")) + return getHttpsURLConnection(uri.toURL(), false); + else + // otherwise force scheme to https + return getHttpsURLConnection(uri.toString()); + } + + /** + * Get a {@link HttpsURLConnection} from a {@link URL} using the best TLS + * configuration available on the device. + * + * @param url + * @return the {@code url} in an instance of {@link HttpsURLConnection} + * @throws IOException + * @throws IllegalArgumentException if the proxy or TLS setup is incorrect, + * or if an HTTP URL is given that does not support HTTPS + */ + public static HttpsURLConnection getHttpsURLConnection(URL url) throws IOException { + return getHttpsURLConnection(url, false); + } + + /** + * Get a {@link HttpsURLConnection} from a {@link URL} using a more + * compatible, but less strong, suite of ciphers. + * + * @param url + * @return the {@code url} in an instance of {@link HttpsURLConnection} + * @throws IOException + * @throws IllegalArgumentException if the proxy or TLS setup is incorrect, + * or if an HTTP URL is given that does not support HTTPS + */ + public static HttpsURLConnection getCompatibleHttpsURLConnection(URL url) throws IOException { + return getHttpsURLConnection(url, true); + } + + /** + * Get a {@link HttpsURLConnection} from a {@link URL}, and specify whether + * it should use a more compatible, but less strong, suite of ciphers. + * + * @param url + * @param compatible + * @return the {@code url} in an instance of {@link HttpsURLConnection} + * @throws IOException + * @throws IllegalArgumentException if the proxy or TLS setup is incorrect, + * or if an HTTP URL is given that does not support HTTPS + */ + public static HttpsURLConnection getHttpsURLConnection(URL url, boolean compatible) + throws IOException { + // use default method, but enforce a HttpsURLConnection + HttpURLConnection connection = getHttpURLConnection(url, compatible); + if (connection instanceof HttpsURLConnection) { + return (HttpsURLConnection) connection; + } else { + throw new IllegalArgumentException("not an HTTPS connection!"); + } + } + + /** + * Get a {@link HttpURLConnection} from a {@link URL}. If the connection is + * {@code https://}, it will use a more compatible, but less strong, TLS + * configuration. + * + * @param url + * @return the {@code url} in an instance of {@link HttpsURLConnection} + * @throws IOException + * @throws IllegalArgumentException if the proxy or TLS setup is incorrect + */ + public static HttpURLConnection getCompatibleHttpURLConnection(URL url) throws IOException { + return getHttpURLConnection(url, true); + } + + /** + * Get a {@link HttpURLConnection} from a URL {@link String}. If it is an + * {@code https://} link, then this will use the best TLS configuration + * available on the device. + * + * @param urlString + * @return the URL in an instance of {@link HttpURLConnection} + * @throws IOException + * @throws IllegalArgumentException if the proxy or TLS setup is incorrect + */ + public static HttpURLConnection getHttpURLConnection(String urlString) throws IOException { + return getHttpURLConnection(new URL(urlString)); + } + + /** + * Get a {@link HttpURLConnection} from a {@link Uri}. If it is an + * {@code https://} link, then this will use the best TLS configuration + * available on the device. + * + * @param uri + * @return the {@code uri} in an instance of {@link HttpURLConnection} + * @throws IOException + * @throws IllegalArgumentException if the proxy or TLS setup is incorrect + */ + public static HttpURLConnection getHttpURLConnection(Uri uri) throws IOException { + return getHttpURLConnection(uri.toString()); + } + + /** + * Get a {@link HttpURLConnection} from a {@link URI}. If it is an + * {@code https://} link, then this will use the best TLS configuration + * available on the device. + * + * @param uri + * @return the {@code uri} in an instance of {@link HttpURLConnection} + * @throws IOException + * @throws IllegalArgumentException if the proxy or TLS setup is incorrect + */ + public static HttpURLConnection getHttpURLConnection(URI uri) throws IOException { + return getHttpURLConnection(uri.toURL()); + } + + /** + * Get a {@link HttpURLConnection} from a {@link URL}. If it is an + * {@code https://} link, then this will use the best TLS configuration + * available on the device. + * + * @param url + * @return the {@code url} in an instance of {@link HttpURLConnection} + * @throws IOException + * @throws IllegalArgumentException if the proxy or TLS setup is incorrect + */ + public static HttpURLConnection getHttpURLConnection(URL url) throws IOException { + return (HttpURLConnection) getHttpURLConnection(url, false); + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/SocksAwareClientConnOperator.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/client/SocksAwareClientConnOperator.java similarity index 97% rename from app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/SocksAwareClientConnOperator.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/client/SocksAwareClientConnOperator.java index f97fc47f..1aa6370b 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/SocksAwareClientConnOperator.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/client/SocksAwareClientConnOperator.java @@ -1,255 +1,255 @@ -/* - * Copyright 2015 str4d - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.darkweb.genesissearchengine.libs.netcipher.client; - -import android.util.Log; - -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; -import java.net.ConnectException; -import java.net.InetAddress; -import java.net.InetSocketAddress; -import java.net.Socket; -import java.net.UnknownHostException; - -import ch.boye.httpclientandroidlib.HttpHost; -import ch.boye.httpclientandroidlib.conn.HttpHostConnectException; -import ch.boye.httpclientandroidlib.conn.OperatedClientConnection; -import ch.boye.httpclientandroidlib.conn.scheme.Scheme; -import ch.boye.httpclientandroidlib.conn.scheme.SchemeRegistry; -import ch.boye.httpclientandroidlib.conn.scheme.SchemeSocketFactory; -import ch.boye.httpclientandroidlib.conn.scheme.SocketFactory; -import ch.boye.httpclientandroidlib.conn.ssl.SSLSocketFactory; -import ch.boye.httpclientandroidlib.impl.conn.DefaultClientConnectionOperator; -import ch.boye.httpclientandroidlib.params.HttpParams; -import ch.boye.httpclientandroidlib.protocol.HttpContext; - -public class SocksAwareClientConnOperator extends DefaultClientConnectionOperator { - - private static final int CONNECT_TIMEOUT_MILLISECONDS = 60000; - private static final int READ_TIMEOUT_MILLISECONDS = 60000; - - private HttpHost mProxyHost; - private String mProxyType; - private SocksAwareProxyRoutePlanner mRoutePlanner; - - public SocksAwareClientConnOperator(SchemeRegistry registry, - HttpHost proxyHost, - String proxyType, - SocksAwareProxyRoutePlanner proxyRoutePlanner) { - super(registry); - - mProxyHost = proxyHost; - mProxyType = proxyType; - mRoutePlanner = proxyRoutePlanner; - } - - @Override - public void openConnection( - final OperatedClientConnection conn, - final HttpHost target, - final InetAddress local, - final HttpContext context, - final HttpParams params) throws IOException { - if (mProxyHost != null) { - if (mProxyType != null && mProxyType.equalsIgnoreCase("socks")) { - Log.d("StrongHTTPS", "proxying using SOCKS"); - openSocksConnection(mProxyHost, conn, target, local, context, params); - } else { - Log.d("StrongHTTPS", "proxying with: " + mProxyType); - openNonSocksConnection(conn, target, local, context, params); - } - } else if (mRoutePlanner != null) { - if (mRoutePlanner.isProxy(target)) { - // HTTP proxy, already handled by the route planner system - Log.d("StrongHTTPS", "proxying using non-SOCKS"); - openNonSocksConnection(conn, target, local, context, params); - } else { - // Either SOCKS or direct - HttpHost proxy = mRoutePlanner.determineRequiredProxy(target, null, context); - if (proxy == null) { - Log.d("StrongHTTPS", "not proxying"); - openNonSocksConnection(conn, target, local, context, params); - } else if (mRoutePlanner.isSocksProxy(proxy)) { - Log.d("StrongHTTPS", "proxying using SOCKS"); - openSocksConnection(proxy, conn, target, local, context, params); - } else { - throw new IllegalStateException("Non-SOCKS proxy returned"); - } - } - } else { - Log.d("StrongHTTPS", "not proxying"); - openNonSocksConnection(conn, target, local, context, params); - } - } - - private void openNonSocksConnection( - final OperatedClientConnection conn, - final HttpHost target, - final InetAddress local, - final HttpContext context, - final HttpParams params) throws IOException { - if (conn == null) { - throw new IllegalArgumentException("Connection must not be null."); - } - if (target == null) { - throw new IllegalArgumentException("Target host must not be null."); - } - // local address may be null - // @@@ is context allowed to be null? - if (params == null) { - throw new IllegalArgumentException("Parameters must not be null."); - } - if (conn.isOpen()) { - throw new IllegalArgumentException("Connection must not be open."); - } - - final Scheme schm = schemeRegistry.getScheme(target.getSchemeName()); - final SocketFactory sf = schm.getSocketFactory(); - - Socket sock = sf.createSocket(); - conn.opening(sock, target); - - try { - Socket connsock = sf.connectSocket(sock, target.getHostName(), - schm.resolvePort(target.getPort()), - local, 0, params); - - if (sock != connsock) { - sock = connsock; - conn.opening(sock, target); - } - } catch (ConnectException ex) { - throw new HttpHostConnectException(target, ex); - } - prepareSocket(sock, context, params); - conn.openCompleted(sf.isSecure(sock), params); - } - - // Derived from the original DefaultClientConnectionOperator.java in Apache HttpClient 4.2 - private void openSocksConnection( - final HttpHost proxy, - final OperatedClientConnection conn, - final HttpHost target, - final InetAddress local, - final HttpContext context, - final HttpParams params) throws IOException { - Socket socket = null; - Socket sslSocket = null; - try { - if (conn == null || target == null || params == null) { - throw new IllegalArgumentException("Required argument may not be null"); - } - if (conn.isOpen()) { - throw new IllegalStateException("Connection must not be open"); - } - - Scheme scheme = schemeRegistry.getScheme(target.getSchemeName()); - SchemeSocketFactory schemeSocketFactory = scheme.getSchemeSocketFactory(); - - int port = scheme.resolvePort(target.getPort()); - String host = target.getHostName(); - - // Perform explicit SOCKS4a connection request. SOCKS4a supports remote host name resolution - // (i.e., Tor resolves the hostname, which may be an onion address). - // The Android (Apache Harmony) Socket class appears to support only SOCKS4 and throws an - // exception on an address created using INetAddress.createUnresolved() -- so the typical - // technique for using Java SOCKS4a/5 doesn't appear to work on Android: - // https://android.googlesource.com/platform/libcore/+/master/luni/src/main/java/java/net/PlainSocketImpl.java - // See also: http://www.mit.edu/~foley/TinFoil/src/tinfoil/TorLib.java, for a similar implementation - - // From http://en.wikipedia.org/wiki/SOCKS#SOCKS4a: - // - // field 1: SOCKS version number, 1 byte, must be 0x04 for this version - // field 2: command code, 1 byte: - // 0x01 = establish a TCP/IP stream connection - // 0x02 = establish a TCP/IP port binding - // field 3: network byte order port number, 2 bytes - // field 4: deliberate invalid IP address, 4 bytes, first three must be 0x00 and the last one must not be 0x00 - // field 5: the user ID string, variable length, terminated with a null (0x00) - // field 6: the domain name of the host we want to contact, variable length, terminated with a null (0x00) - - - socket = new Socket(); - conn.opening(socket, target); - socket.setSoTimeout(READ_TIMEOUT_MILLISECONDS); - socket.connect(new InetSocketAddress(proxy.getHostName(), proxy.getPort()), CONNECT_TIMEOUT_MILLISECONDS); - - DataOutputStream outputStream = new DataOutputStream(socket.getOutputStream()); - outputStream.write((byte) 0x04); - outputStream.write((byte) 0x01); - outputStream.writeShort((short) port); - outputStream.writeInt(0x01); - outputStream.write((byte) 0x00); - outputStream.write(host.getBytes()); - outputStream.write((byte) 0x00); - - DataInputStream inputStream = new DataInputStream(socket.getInputStream()); - if (inputStream.readByte() != (byte) 0x00 || inputStream.readByte() != (byte) 0x5a) { - throw new IOException("SOCKS4a connect failed"); - } - inputStream.readShort(); - inputStream.readInt(); - - if (schemeSocketFactory instanceof SSLSocketFactory) { - sslSocket = ((SSLSocketFactory) schemeSocketFactory).createLayeredSocket(socket, host, port, params); - conn.opening(sslSocket, target); - sslSocket.setSoTimeout(READ_TIMEOUT_MILLISECONDS); - prepareSocket(sslSocket, context, params); - conn.openCompleted(schemeSocketFactory.isSecure(sslSocket), params); - } else { - conn.opening(socket, target); - socket.setSoTimeout(READ_TIMEOUT_MILLISECONDS); - prepareSocket(socket, context, params); - conn.openCompleted(schemeSocketFactory.isSecure(socket), params); - } - // TODO: clarify which connection throws java.net.SocketTimeoutException? - } catch (IOException e) { - try { - if (sslSocket != null) { - sslSocket.close(); - } - if (socket != null) { - socket.close(); - } - } catch (IOException ioe) { - } - throw e; - } - } - - @Override - public void updateSecureConnection( - final OperatedClientConnection conn, - final HttpHost target, - final HttpContext context, - final HttpParams params) throws IOException { - if (mProxyHost != null && mProxyType.equalsIgnoreCase("socks")) - throw new RuntimeException("operation not supported"); - else - super.updateSecureConnection(conn, target, context, params); - } - - @Override - protected InetAddress[] resolveHostname(final String host) throws UnknownHostException { - if (mProxyHost != null && mProxyType.equalsIgnoreCase("socks")) - throw new RuntimeException("operation not supported"); - else - return super.resolveHostname(host); - } -} +/* + * Copyright 2015 str4d + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.hiddenservices.genesissearchengine.production.libs.netcipher.client; + +import android.util.Log; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.net.ConnectException; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.Socket; +import java.net.UnknownHostException; + +import ch.boye.httpclientandroidlib.HttpHost; +import ch.boye.httpclientandroidlib.conn.HttpHostConnectException; +import ch.boye.httpclientandroidlib.conn.OperatedClientConnection; +import ch.boye.httpclientandroidlib.conn.scheme.Scheme; +import ch.boye.httpclientandroidlib.conn.scheme.SchemeRegistry; +import ch.boye.httpclientandroidlib.conn.scheme.SchemeSocketFactory; +import ch.boye.httpclientandroidlib.conn.scheme.SocketFactory; +import ch.boye.httpclientandroidlib.conn.ssl.SSLSocketFactory; +import ch.boye.httpclientandroidlib.impl.conn.DefaultClientConnectionOperator; +import ch.boye.httpclientandroidlib.params.HttpParams; +import ch.boye.httpclientandroidlib.protocol.HttpContext; + +public class SocksAwareClientConnOperator extends DefaultClientConnectionOperator { + + private static final int CONNECT_TIMEOUT_MILLISECONDS = 60000; + private static final int READ_TIMEOUT_MILLISECONDS = 60000; + + private HttpHost mProxyHost; + private String mProxyType; + private SocksAwareProxyRoutePlanner mRoutePlanner; + + public SocksAwareClientConnOperator(SchemeRegistry registry, + HttpHost proxyHost, + String proxyType, + SocksAwareProxyRoutePlanner proxyRoutePlanner) { + super(registry); + + mProxyHost = proxyHost; + mProxyType = proxyType; + mRoutePlanner = proxyRoutePlanner; + } + + @Override + public void openConnection( + final OperatedClientConnection conn, + final HttpHost target, + final InetAddress local, + final HttpContext context, + final HttpParams params) throws IOException { + if (mProxyHost != null) { + if (mProxyType != null && mProxyType.equalsIgnoreCase("socks")) { + Log.d("StrongHTTPS", "proxying using SOCKS"); + openSocksConnection(mProxyHost, conn, target, local, context, params); + } else { + Log.d("StrongHTTPS", "proxying with: " + mProxyType); + openNonSocksConnection(conn, target, local, context, params); + } + } else if (mRoutePlanner != null) { + if (mRoutePlanner.isProxy(target)) { + // HTTP proxy, already handled by the route planner system + Log.d("StrongHTTPS", "proxying using non-SOCKS"); + openNonSocksConnection(conn, target, local, context, params); + } else { + // Either SOCKS or direct + HttpHost proxy = mRoutePlanner.determineRequiredProxy(target, null, context); + if (proxy == null) { + Log.d("StrongHTTPS", "not proxying"); + openNonSocksConnection(conn, target, local, context, params); + } else if (mRoutePlanner.isSocksProxy(proxy)) { + Log.d("StrongHTTPS", "proxying using SOCKS"); + openSocksConnection(proxy, conn, target, local, context, params); + } else { + throw new IllegalStateException("Non-SOCKS proxy returned"); + } + } + } else { + Log.d("StrongHTTPS", "not proxying"); + openNonSocksConnection(conn, target, local, context, params); + } + } + + private void openNonSocksConnection( + final OperatedClientConnection conn, + final HttpHost target, + final InetAddress local, + final HttpContext context, + final HttpParams params) throws IOException { + if (conn == null) { + throw new IllegalArgumentException("Connection must not be null."); + } + if (target == null) { + throw new IllegalArgumentException("Target host must not be null."); + } + // local address may be null + // @@@ is context allowed to be null? + if (params == null) { + throw new IllegalArgumentException("Parameters must not be null."); + } + if (conn.isOpen()) { + throw new IllegalArgumentException("Connection must not be open."); + } + + final Scheme schm = schemeRegistry.getScheme(target.getSchemeName()); + final SocketFactory sf = schm.getSocketFactory(); + + Socket sock = sf.createSocket(); + conn.opening(sock, target); + + try { + Socket connsock = sf.connectSocket(sock, target.getHostName(), + schm.resolvePort(target.getPort()), + local, 0, params); + + if (sock != connsock) { + sock = connsock; + conn.opening(sock, target); + } + } catch (ConnectException ex) { + throw new HttpHostConnectException(target, ex); + } + prepareSocket(sock, context, params); + conn.openCompleted(sf.isSecure(sock), params); + } + + // Derived from the original DefaultClientConnectionOperator.java in Apache HttpClient 4.2 + private void openSocksConnection( + final HttpHost proxy, + final OperatedClientConnection conn, + final HttpHost target, + final InetAddress local, + final HttpContext context, + final HttpParams params) throws IOException { + Socket socket = null; + Socket sslSocket = null; + try { + if (conn == null || target == null || params == null) { + throw new IllegalArgumentException("Required argument may not be null"); + } + if (conn.isOpen()) { + throw new IllegalStateException("Connection must not be open"); + } + + Scheme scheme = schemeRegistry.getScheme(target.getSchemeName()); + SchemeSocketFactory schemeSocketFactory = scheme.getSchemeSocketFactory(); + + int port = scheme.resolvePort(target.getPort()); + String host = target.getHostName(); + + // Perform explicit SOCKS4a connection request. SOCKS4a supports remote host name resolution + // (i.e., Tor resolves the hostname, which may be an onion address). + // The Android (Apache Harmony) Socket class appears to support only SOCKS4 and throws an + // exception on an address created using INetAddress.createUnresolved() -- so the typical + // technique for using Java SOCKS4a/5 doesn't appear to work on Android: + // https://android.googlesource.com/platform/libcore/+/master/luni/src/main/java/java/net/PlainSocketImpl.java + // See also: http://www.mit.edu/~foley/TinFoil/src/tinfoil/TorLib.java, for a similar implementation + + // From http://en.wikipedia.org/wiki/SOCKS#SOCKS4a: + // + // field 1: SOCKS version number, 1 byte, must be 0x04 for this version + // field 2: command code, 1 byte: + // 0x01 = establish a TCP/IP stream connection + // 0x02 = establish a TCP/IP port binding + // field 3: network byte order port number, 2 bytes + // field 4: deliberate invalid IP address, 4 bytes, first three must be 0x00 and the last one must not be 0x00 + // field 5: the user ID string, variable length, terminated with a null (0x00) + // field 6: the domain name of the host we want to contact, variable length, terminated with a null (0x00) + + + socket = new Socket(); + conn.opening(socket, target); + socket.setSoTimeout(READ_TIMEOUT_MILLISECONDS); + socket.connect(new InetSocketAddress(proxy.getHostName(), proxy.getPort()), CONNECT_TIMEOUT_MILLISECONDS); + + DataOutputStream outputStream = new DataOutputStream(socket.getOutputStream()); + outputStream.write((byte) 0x04); + outputStream.write((byte) 0x01); + outputStream.writeShort((short) port); + outputStream.writeInt(0x01); + outputStream.write((byte) 0x00); + outputStream.write(host.getBytes()); + outputStream.write((byte) 0x00); + + DataInputStream inputStream = new DataInputStream(socket.getInputStream()); + if (inputStream.readByte() != (byte) 0x00 || inputStream.readByte() != (byte) 0x5a) { + throw new IOException("SOCKS4a connect failed"); + } + inputStream.readShort(); + inputStream.readInt(); + + if (schemeSocketFactory instanceof SSLSocketFactory) { + sslSocket = ((SSLSocketFactory) schemeSocketFactory).createLayeredSocket(socket, host, port, params); + conn.opening(sslSocket, target); + sslSocket.setSoTimeout(READ_TIMEOUT_MILLISECONDS); + prepareSocket(sslSocket, context, params); + conn.openCompleted(schemeSocketFactory.isSecure(sslSocket), params); + } else { + conn.opening(socket, target); + socket.setSoTimeout(READ_TIMEOUT_MILLISECONDS); + prepareSocket(socket, context, params); + conn.openCompleted(schemeSocketFactory.isSecure(socket), params); + } + // TODO: clarify which connection throws java.net.SocketTimeoutException? + } catch (IOException e) { + try { + if (sslSocket != null) { + sslSocket.close(); + } + if (socket != null) { + socket.close(); + } + } catch (IOException ioe) { + } + throw e; + } + } + + @Override + public void updateSecureConnection( + final OperatedClientConnection conn, + final HttpHost target, + final HttpContext context, + final HttpParams params) throws IOException { + if (mProxyHost != null && mProxyType.equalsIgnoreCase("socks")) + throw new RuntimeException("operation not supported"); + else + super.updateSecureConnection(conn, target, context, params); + } + + @Override + protected InetAddress[] resolveHostname(final String host) throws UnknownHostException { + if (mProxyHost != null && mProxyType.equalsIgnoreCase("socks")) + throw new RuntimeException("operation not supported"); + else + return super.resolveHostname(host); + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/SocksAwareProxyRoutePlanner.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/client/SocksAwareProxyRoutePlanner.java similarity index 94% rename from app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/SocksAwareProxyRoutePlanner.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/client/SocksAwareProxyRoutePlanner.java index eee2f216..2b7a26d2 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/SocksAwareProxyRoutePlanner.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/client/SocksAwareProxyRoutePlanner.java @@ -1,71 +1,71 @@ -/* - * Copyright 2015 str4d - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.darkweb.genesissearchengine.libs.netcipher.client; - -import ch.boye.httpclientandroidlib.HttpException; -import ch.boye.httpclientandroidlib.HttpHost; -import ch.boye.httpclientandroidlib.HttpRequest; -import ch.boye.httpclientandroidlib.conn.SchemePortResolver; -import ch.boye.httpclientandroidlib.impl.conn.DefaultRoutePlanner; -import ch.boye.httpclientandroidlib.protocol.HttpContext; - -public abstract class SocksAwareProxyRoutePlanner extends DefaultRoutePlanner { - public SocksAwareProxyRoutePlanner(SchemePortResolver schemePortResolver) { - super(schemePortResolver); - } - - @Override - protected HttpHost determineProxy( - HttpHost target, - HttpRequest request, - HttpContext context) throws HttpException { - HttpHost proxy = determineRequiredProxy(target, request, context); - if (isSocksProxy(proxy)) - proxy = null; - return proxy; - } - - /** - * Determine the proxy required for the provided target. - * - * @param target see {@link #determineProxy(HttpHost, HttpRequest, HttpContext) determineProxy()} - * @param request see {@link #determineProxy(HttpHost, HttpRequest, HttpContext) determineProxy()}. - * Will be null when called from {@link SocksAwareClientConnOperator} to - * determine if target requires a SOCKS proxy, so don't rely on it in this case. - * @param context see {@link #determineProxy(HttpHost, HttpRequest, HttpContext) determineProxy()} - * @return the proxy required for this target, or null if should connect directly. - */ - protected abstract HttpHost determineRequiredProxy( - HttpHost target, - HttpRequest request, - HttpContext context); - - /** - * Checks if the provided target is a proxy we define. - * - * @param target to check - * @return true if this is a proxy, false otherwise - */ - protected abstract boolean isProxy(HttpHost target); - - /** - * Checks if the provided target is a SOCKS proxy we define. - * - * @param target to check - * @return true if this target is a SOCKS proxy, false otherwise. - */ - protected abstract boolean isSocksProxy(HttpHost target); -} +/* + * Copyright 2015 str4d + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.hiddenservices.genesissearchengine.production.libs.netcipher.client; + +import ch.boye.httpclientandroidlib.HttpException; +import ch.boye.httpclientandroidlib.HttpHost; +import ch.boye.httpclientandroidlib.HttpRequest; +import ch.boye.httpclientandroidlib.conn.SchemePortResolver; +import ch.boye.httpclientandroidlib.impl.conn.DefaultRoutePlanner; +import ch.boye.httpclientandroidlib.protocol.HttpContext; + +public abstract class SocksAwareProxyRoutePlanner extends DefaultRoutePlanner { + public SocksAwareProxyRoutePlanner(SchemePortResolver schemePortResolver) { + super(schemePortResolver); + } + + @Override + protected HttpHost determineProxy( + HttpHost target, + HttpRequest request, + HttpContext context) throws HttpException { + HttpHost proxy = determineRequiredProxy(target, request, context); + if (isSocksProxy(proxy)) + proxy = null; + return proxy; + } + + /** + * Determine the proxy required for the provided target. + * + * @param target see {@link #determineProxy(HttpHost, HttpRequest, HttpContext) determineProxy()} + * @param request see {@link #determineProxy(HttpHost, HttpRequest, HttpContext) determineProxy()}. + * Will be null when called from {@link SocksAwareClientConnOperator} to + * determine if target requires a SOCKS proxy, so don't rely on it in this case. + * @param context see {@link #determineProxy(HttpHost, HttpRequest, HttpContext) determineProxy()} + * @return the proxy required for this target, or null if should connect directly. + */ + protected abstract HttpHost determineRequiredProxy( + HttpHost target, + HttpRequest request, + HttpContext context); + + /** + * Checks if the provided target is a proxy we define. + * + * @param target to check + * @return true if this is a proxy, false otherwise + */ + protected abstract boolean isProxy(HttpHost target); + + /** + * Checks if the provided target is a SOCKS proxy we define. + * + * @param target to check + * @return true if this target is a SOCKS proxy, false otherwise. + */ + protected abstract boolean isSocksProxy(HttpHost target); +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/StrongBuilder.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/client/StrongBuilder.java similarity index 94% rename from app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/StrongBuilder.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/client/StrongBuilder.java index 260ae966..9d777db2 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/StrongBuilder.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/client/StrongBuilder.java @@ -1,156 +1,156 @@ -/* - * Copyright (c) 2016 CommonsWare, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.darkweb.genesissearchengine.libs.netcipher.client; - -import android.content.Intent; -import java.io.IOException; -import java.security.KeyManagementException; -import java.security.NoSuchAlgorithmException; - -import javax.net.ssl.TrustManager; - -public interface StrongBuilder { - /** - * Callback to get a connection handed to you for use, - * already set up for NetCipher. - * - * @param the type of connection created by this builder - */ - interface Callback { - /** - * Called when the NetCipher-enhanced connection is ready - * for use. - * - * @param connection the connection - */ - void onConnected(C connection); - - /** - * Called if we tried to connect through to Orbot but failed - * for some reason - * - * @param e the reason - */ - void onConnectionException(Exception e); - - /** - * Called if our attempt to get a status from Orbot failed - * after a defined period of time. See statusTimeout() on - * OrbotInitializer. - */ - void onTimeout(); - - /** - * Called if you requested validation that we are connecting - * through Tor, and while we were able to connect to Orbot, that - * validation failed. - */ - void onInvalid(); - } - - /** - * Call this to configure the Tor proxy from the results - * returned by Orbot, using the best available proxy - * (SOCKS if possible, else HTTP) - * - * @return the builder - */ - T withBestProxy(); - - /** - * @return true if this builder supports HTTP proxies, false - * otherwise - */ - boolean supportsHttpProxy(); - - /** - * Call this to configure the Tor proxy from the results - * returned by Orbot, using the HTTP proxy. - * - * @return the builder - */ - T withHttpProxy(); - - /** - * @return true if this builder supports SOCKS proxies, false - * otherwise - */ - boolean supportsSocksProxy(); - - /** - * Call this to configure the Tor proxy from the results - * returned by Orbot, using the SOCKS proxy. - * - * @return the builder - */ - T withSocksProxy(); - - /** - * Applies your own custom TrustManagers, such as for - * replacing the stock keystore support with a custom - * keystore. - * - * @param trustManagers the TrustManagers to use - * @return the builder - */ - T withTrustManagers(TrustManager[] trustManagers) - throws NoSuchAlgorithmException, KeyManagementException; - - /** - * Call this if you want a weaker set of supported ciphers, - * because you are running into compatibility problems with - * some server due to a cipher mismatch. The better solution - * is to fix the server. - * - * @return the builder - */ - T withWeakCiphers(); - - /** - * Call this if you want the builder to confirm that we are - * communicating over Tor, by reaching out to a Tor test - * server and confirming our connection status. By default, - * this is skipped. Adding this check adds security, but it - * has the chance of false negatives (e.g., we cannot reach - * that Tor server for some reason). - * - * @return the builder - */ - T withTorValidation(); - - /** - * Builds a connection, applying the configuration already - * specified in the builder. - * - * @param status status Intent from OrbotInitializer - * @return the connection - * @throws IOException - */ - C build(Intent status) throws Exception; - - /** - * Asynchronous version of build(), one that uses OrbotInitializer - * internally to get the status and checks the validity of the Tor - * connection (if requested). Note that your callback methods may - * be invoked on any thread; do not assume that they will be called - * on any particular thread. - * - * @param callback Callback to get a connection handed to you - * for use, already set up for NetCipher - */ - void build(Callback callback); -} +/* + * Copyright (c) 2016 CommonsWare, LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.hiddenservices.genesissearchengine.production.libs.netcipher.client; + +import android.content.Intent; +import java.io.IOException; +import java.security.KeyManagementException; +import java.security.NoSuchAlgorithmException; + +import javax.net.ssl.TrustManager; + +public interface StrongBuilder { + /** + * Callback to get a connection handed to you for use, + * already set up for NetCipher. + * + * @param the type of connection created by this builder + */ + interface Callback { + /** + * Called when the NetCipher-enhanced connection is ready + * for use. + * + * @param connection the connection + */ + void onConnected(C connection); + + /** + * Called if we tried to connect through to Orbot but failed + * for some reason + * + * @param e the reason + */ + void onConnectionException(Exception e); + + /** + * Called if our attempt to get a status from Orbot failed + * after a defined period of time. See statusTimeout() on + * OrbotInitializer. + */ + void onTimeout(); + + /** + * Called if you requested validation that we are connecting + * through Tor, and while we were able to connect to Orbot, that + * validation failed. + */ + void onInvalid(); + } + + /** + * Call this to configure the Tor proxy from the results + * returned by Orbot, using the best available proxy + * (SOCKS if possible, else HTTP) + * + * @return the builder + */ + T withBestProxy(); + + /** + * @return true if this builder supports HTTP proxies, false + * otherwise + */ + boolean supportsHttpProxy(); + + /** + * Call this to configure the Tor proxy from the results + * returned by Orbot, using the HTTP proxy. + * + * @return the builder + */ + T withHttpProxy(); + + /** + * @return true if this builder supports SOCKS proxies, false + * otherwise + */ + boolean supportsSocksProxy(); + + /** + * Call this to configure the Tor proxy from the results + * returned by Orbot, using the SOCKS proxy. + * + * @return the builder + */ + T withSocksProxy(); + + /** + * Applies your own custom TrustManagers, such as for + * replacing the stock keystore support with a custom + * keystore. + * + * @param trustManagers the TrustManagers to use + * @return the builder + */ + T withTrustManagers(TrustManager[] trustManagers) + throws NoSuchAlgorithmException, KeyManagementException; + + /** + * Call this if you want a weaker set of supported ciphers, + * because you are running into compatibility problems with + * some server due to a cipher mismatch. The better solution + * is to fix the server. + * + * @return the builder + */ + T withWeakCiphers(); + + /** + * Call this if you want the builder to confirm that we are + * communicating over Tor, by reaching out to a Tor test + * server and confirming our connection status. By default, + * this is skipped. Adding this check adds security, but it + * has the chance of false negatives (e.g., we cannot reach + * that Tor server for some reason). + * + * @return the builder + */ + T withTorValidation(); + + /** + * Builds a connection, applying the configuration already + * specified in the builder. + * + * @param status status Intent from OrbotInitializer + * @return the connection + * @throws IOException + */ + C build(Intent status) throws Exception; + + /** + * Asynchronous version of build(), one that uses OrbotInitializer + * internally to get the status and checks the validity of the Tor + * connection (if requested). Note that your callback methods may + * be invoked on any thread; do not assume that they will be called + * on any particular thread. + * + * @param callback Callback to get a connection handed to you + * for use, already set up for NetCipher + */ + void build(Callback callback); +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/StrongBuilderBase.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/client/StrongBuilderBase.java similarity index 92% rename from app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/StrongBuilderBase.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/client/StrongBuilderBase.java index 50149cd9..de69cbda 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/StrongBuilderBase.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/client/StrongBuilderBase.java @@ -1,284 +1,284 @@ -/* - * Copyright 2012-2016 Nathan Freitas - * Copyright 2015 str4d - * Portions Copyright (c) 2016 CommonsWare, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.darkweb.genesissearchengine.libs.netcipher.client; - -import android.content.Context; -import android.content.Intent; - -import com.darkweb.genesissearchengine.libs.netcipher.proxy.OrbotHelper; - -import org.json.JSONObject; -import org.torproject.android.service.wrapper.orbotLocalConstants; - -import java.net.InetSocketAddress; -import java.net.Proxy; -import java.security.KeyManagementException; -import java.security.NoSuchAlgorithmException; -import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLSocketFactory; -import javax.net.ssl.TrustManager; - -/** - * Builds an HttpUrlConnection that connects via Tor through - * Orbot. - */ -abstract public class - StrongBuilderBase - implements StrongBuilder { - /** - * Performs an HTTP GET request using the supplied connection - * to a supplied URL, returning the String response or - * throws an Exception (e.g., cannot reach the server). - * This is used as part of validating the Tor connection. - * - * @param status the status Intent we got back from Orbot - * @param connection a connection of the type for the builder - * @param url an public Web page - * @return the String response from the GET request - */ - abstract protected String get(Intent status, C connection, String url) - throws Exception; - - final static String TOR_CHECK_URL="https://check.torproject.org/api/ip"; - private final static String PROXY_HOST="127.0.0.1"; - protected final Context ctxt; - protected Proxy.Type proxyType; - protected SSLContext sslContext=null; - protected boolean useWeakCiphers=false; - protected boolean validateTor=false; - - /** - * Standard constructor. - * - * @param ctxt any Context will do; the StrongBuilderBase - * will hold onto the Application singleton - */ - public StrongBuilderBase(Context ctxt) { - this.ctxt=ctxt.getApplicationContext(); - } - - /** - * Copy constructor. - * - * @param original builder to clone - */ - public StrongBuilderBase(StrongBuilderBase original) { - this.ctxt=original.ctxt; - this.proxyType=original.proxyType; - this.sslContext=original.sslContext; - this.useWeakCiphers=original.useWeakCiphers; - } - - /** - * {@inheritDoc} - */ - @Override - public T withBestProxy() { - if (supportsSocksProxy()) { - return(withSocksProxy()); - } - else { - return(withHttpProxy()); - } - } - - /** - * {@inheritDoc} - */ - @Override - public boolean supportsHttpProxy() { - return(true); - } - - /** - * {@inheritDoc} - */ - @Override - public T withHttpProxy() { - proxyType=Proxy.Type.HTTP; - - return((T)this); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean supportsSocksProxy() { - return(false); - } - - /** - * {@inheritDoc} - */ - @Override - public T withSocksProxy() { - proxyType=Proxy.Type.SOCKS; - - return((T)this); - } - - /** - * {@inheritDoc} - */ - @Override - public T withTrustManagers(TrustManager[] trustManagers) - throws NoSuchAlgorithmException, KeyManagementException { - - sslContext=SSLContext.getInstance("TLSv1"); - sslContext.init(null, trustManagers, null); - - return((T)this); - } - - /** - * {@inheritDoc} - */ - @Override - public T withWeakCiphers() { - useWeakCiphers=true; - - return((T)this); - } - - /** - * {@inheritDoc} - */ - @Override - public T withTorValidation() { - validateTor=true; - - return((T)this); - } - - public SSLContext getSSLContext() { - return(sslContext); - } - - public int getSocksPort(Intent status) { - if (status.getStringExtra(OrbotHelper.EXTRA_STATUS) - .equals(OrbotHelper.STATUS_ON)) { - return(status.getIntExtra(OrbotHelper.EXTRA_PROXY_PORT_SOCKS, - orbotLocalConstants.mSOCKSPort)); - } - - return(-1); - } - - public int getHttpPort(Intent status) { - if (status.getStringExtra(OrbotHelper.EXTRA_STATUS) - .equals(OrbotHelper.STATUS_ON)) { - return(status.getIntExtra(OrbotHelper.EXTRA_PROXY_PORT_HTTP, - orbotLocalConstants.mHTTPPort)); - } - - return(-1); - } - - protected SSLSocketFactory buildSocketFactory() { - if (sslContext==null) { - return(null); - } - - SSLSocketFactory result= - new TlsOnlySocketFactory(sslContext.getSocketFactory(), - useWeakCiphers); - - return(result); - } - - public Proxy buildProxy(Intent status) { - Proxy result=null; - - if (status.getStringExtra(OrbotHelper.EXTRA_STATUS) - .equals(OrbotHelper.STATUS_ON)) { - if (proxyType==Proxy.Type.SOCKS) { - result=new Proxy(Proxy.Type.SOCKS, - new InetSocketAddress(PROXY_HOST, getSocksPort(status))); - } - else if (proxyType==Proxy.Type.HTTP) { - result=new Proxy(Proxy.Type.HTTP, - new InetSocketAddress(PROXY_HOST, getHttpPort(status))); - } - } - - return(result); - } - - @Override - public void build(final Callback callback) { - OrbotHelper.get(ctxt).addStatusCallback( - new OrbotHelper.SimpleStatusCallback() { - @Override - public void onEnabled(Intent statusIntent) { - OrbotHelper.get(ctxt).removeStatusCallback(this); - - try { - C connection=build(statusIntent); - - if (validateTor) { - validateTor=false; - checkTor(callback, statusIntent, connection); - } - else { - callback.onConnected(connection); - } - } - catch (Exception e) { - callback.onConnectionException(e); - } - } - - @Override - public void onNotYetInstalled() { - OrbotHelper.get(ctxt).removeStatusCallback(this); - callback.onTimeout(); - } - - @Override - public void onStatusTimeout() { - OrbotHelper.get(ctxt).removeStatusCallback(this); - callback.onTimeout(); - } - }); - } - - protected void checkTor(final Callback callback, final Intent status, - final C connection) { - new Thread() { - @Override - public void run() { - try { - String result=get(status, connection, TOR_CHECK_URL); - JSONObject json=new JSONObject(result); - - if (json.optBoolean("IsTor", false)) { - callback.onConnected(connection); - } - else { - callback.onInvalid(); - } - } - catch (Exception e) { - callback.onConnectionException(e); - } - } - }.start(); - } -} +/* + * Copyright 2012-2016 Nathan Freitas + * Copyright 2015 str4d + * Portions Copyright (c) 2016 CommonsWare, LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.hiddenservices.genesissearchengine.production.libs.netcipher.client; + +import android.content.Context; +import android.content.Intent; + +import com.hiddenservices.genesissearchengine.production.libs.netcipher.proxy.OrbotHelper; + +import org.json.JSONObject; +import org.orbotproject.android.service.wrapper.orbotLocalConstants; + +import java.net.InetSocketAddress; +import java.net.Proxy; +import java.security.KeyManagementException; +import java.security.NoSuchAlgorithmException; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSocketFactory; +import javax.net.ssl.TrustManager; + +/** + * Builds an HttpUrlConnection that connects via Tor through + * Orbot. + */ +abstract public class + StrongBuilderBase + implements StrongBuilder { + /** + * Performs an HTTP GET request using the supplied connection + * to a supplied URL, returning the String response or + * throws an Exception (e.g., cannot reach the server). + * This is used as part of validating the Tor connection. + * + * @param status the status Intent we got back from Orbot + * @param connection a connection of the type for the builder + * @param url an public Web page + * @return the String response from the GET request + */ + abstract protected String get(Intent status, C connection, String url) + throws Exception; + + final static String TOR_CHECK_URL="https://check.torproject.org/api/ip"; + private final static String PROXY_HOST="127.0.0.1"; + protected final Context ctxt; + protected Proxy.Type proxyType; + protected SSLContext sslContext=null; + protected boolean useWeakCiphers=false; + protected boolean validateTor=false; + + /** + * Standard constructor. + * + * @param ctxt any Context will do; the StrongBuilderBase + * will hold onto the Application singleton + */ + public StrongBuilderBase(Context ctxt) { + this.ctxt=ctxt.getApplicationContext(); + } + + /** + * Copy constructor. + * + * @param original builder to clone + */ + public StrongBuilderBase(StrongBuilderBase original) { + this.ctxt=original.ctxt; + this.proxyType=original.proxyType; + this.sslContext=original.sslContext; + this.useWeakCiphers=original.useWeakCiphers; + } + + /** + * {@inheritDoc} + */ + @Override + public T withBestProxy() { + if (supportsSocksProxy()) { + return(withSocksProxy()); + } + else { + return(withHttpProxy()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public boolean supportsHttpProxy() { + return(true); + } + + /** + * {@inheritDoc} + */ + @Override + public T withHttpProxy() { + proxyType=Proxy.Type.HTTP; + + return((T)this); + } + + /** + * {@inheritDoc} + */ + @Override + public boolean supportsSocksProxy() { + return(false); + } + + /** + * {@inheritDoc} + */ + @Override + public T withSocksProxy() { + proxyType=Proxy.Type.SOCKS; + + return((T)this); + } + + /** + * {@inheritDoc} + */ + @Override + public T withTrustManagers(TrustManager[] trustManagers) + throws NoSuchAlgorithmException, KeyManagementException { + + sslContext=SSLContext.getInstance("TLSv1"); + sslContext.init(null, trustManagers, null); + + return((T)this); + } + + /** + * {@inheritDoc} + */ + @Override + public T withWeakCiphers() { + useWeakCiphers=true; + + return((T)this); + } + + /** + * {@inheritDoc} + */ + @Override + public T withTorValidation() { + validateTor=true; + + return((T)this); + } + + public SSLContext getSSLContext() { + return(sslContext); + } + + public int getSocksPort(Intent status) { + if (status.getStringExtra(OrbotHelper.EXTRA_STATUS) + .equals(OrbotHelper.STATUS_ON)) { + return(status.getIntExtra(OrbotHelper.EXTRA_PROXY_PORT_SOCKS, + orbotLocalConstants.mSOCKSPort)); + } + + return(-1); + } + + public int getHttpPort(Intent status) { + if (status.getStringExtra(OrbotHelper.EXTRA_STATUS) + .equals(OrbotHelper.STATUS_ON)) { + return(status.getIntExtra(OrbotHelper.EXTRA_PROXY_PORT_HTTP, + orbotLocalConstants.mHTTPPort)); + } + + return(-1); + } + + protected SSLSocketFactory buildSocketFactory() { + if (sslContext==null) { + return(null); + } + + SSLSocketFactory result= + new TlsOnlySocketFactory(sslContext.getSocketFactory(), + useWeakCiphers); + + return(result); + } + + public Proxy buildProxy(Intent status) { + Proxy result=null; + + if (status.getStringExtra(OrbotHelper.EXTRA_STATUS) + .equals(OrbotHelper.STATUS_ON)) { + if (proxyType==Proxy.Type.SOCKS) { + result=new Proxy(Proxy.Type.SOCKS, + new InetSocketAddress(PROXY_HOST, getSocksPort(status))); + } + else if (proxyType==Proxy.Type.HTTP) { + result=new Proxy(Proxy.Type.HTTP, + new InetSocketAddress(PROXY_HOST, getHttpPort(status))); + } + } + + return(result); + } + + @Override + public void build(final Callback callback) { + OrbotHelper.get(ctxt).addStatusCallback( + new OrbotHelper.SimpleStatusCallback() { + @Override + public void onEnabled(Intent statusIntent) { + OrbotHelper.get(ctxt).removeStatusCallback(this); + + try { + C connection=build(statusIntent); + + if (validateTor) { + validateTor=false; + checkTor(callback, statusIntent, connection); + } + else { + callback.onConnected(connection); + } + } + catch (Exception e) { + callback.onConnectionException(e); + } + } + + @Override + public void onNotYetInstalled() { + OrbotHelper.get(ctxt).removeStatusCallback(this); + callback.onTimeout(); + } + + @Override + public void onStatusTimeout() { + OrbotHelper.get(ctxt).removeStatusCallback(this); + callback.onTimeout(); + } + }); + } + + protected void checkTor(final Callback callback, final Intent status, + final C connection) { + new Thread() { + @Override + public void run() { + try { + String result=get(status, connection, TOR_CHECK_URL); + JSONObject json=new JSONObject(result); + + if (json.optBoolean("IsTor", false)) { + callback.onConnected(connection); + } + else { + callback.onInvalid(); + } + } + catch (Exception e) { + callback.onConnectionException(e); + } + } + }.start(); + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/StrongConnectionBuilder.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/client/StrongConnectionBuilder.java similarity index 94% rename from app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/StrongConnectionBuilder.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/client/StrongConnectionBuilder.java index 868c46cc..c457cc5e 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/StrongConnectionBuilder.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/client/StrongConnectionBuilder.java @@ -1,165 +1,165 @@ -/* - * Copyright (c) 2016 CommonsWare, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.darkweb.genesissearchengine.libs.netcipher.client; - -import android.content.Context; -import android.content.Intent; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; -import java.net.HttpURLConnection; -import java.net.MalformedURLException; -import java.net.Proxy; -import java.net.URL; -import java.net.URLConnection; -import javax.net.ssl.HttpsURLConnection; -import javax.net.ssl.SSLSocketFactory; - -/** - * Builds an HttpUrlConnection that connects via Tor through - * Orbot. - */ -public class StrongConnectionBuilder - extends StrongBuilderBase { - private URL url; - - /** - * Creates a StrongConnectionBuilder using the strongest set - * of options for security. Use this if the strongest set of - * options is what you want; otherwise, create a - * builder via the constructor and configure it as you see fit. - * - * @param ctxt any Context will do - * @return a configured StrongConnectionBuilder - * @throws Exception - */ - static public StrongConnectionBuilder forMaxSecurity(Context ctxt) - throws Exception { - return(new StrongConnectionBuilder(ctxt) - .withBestProxy()); - } - - /** - * Creates a builder instance. - * - * @param ctxt any Context will do; builder will hold onto - * Application context - */ - public StrongConnectionBuilder(Context ctxt) { - super(ctxt); - } - - /** - * Copy constructor. - * - * @param original builder to clone - */ - public StrongConnectionBuilder(StrongConnectionBuilder original) { - super(original); - this.url=original.url; - } -/* - public boolean supportsSocksProxy() { - return(false); - } -*/ - - /** - * Sets the URL to build a connection for. - * - * @param url the URL - * @return the builder - * @throws MalformedURLException - */ - public StrongConnectionBuilder connectTo(String url) - throws MalformedURLException { - connectTo(new URL(url)); - - return(this); - } - - /** - * Sets the URL to build a connection for. - * - * @param url the URL - * @return the builder - */ - public StrongConnectionBuilder connectTo(URL url) { - this.url=url; - - return(this); - } - - /** - * {@inheritDoc} - */ - @Override - public HttpURLConnection build(Intent status) throws IOException { - return(buildForUrl(status, url)); - } - - @Override - protected String get(Intent status, HttpURLConnection connection, - String url) throws Exception { - HttpURLConnection realConnection=buildForUrl(status, new URL(url)); - - return(slurp(realConnection.getInputStream())); - } - - private HttpURLConnection buildForUrl(Intent status, URL urlToUse) - throws IOException { - URLConnection result; - Proxy proxy=buildProxy(status); - - if (proxy==null) { - result=urlToUse.openConnection(); - } - else { - result=urlToUse.openConnection(proxy); - } - - if (result instanceof HttpsURLConnection && sslContext!=null) { - SSLSocketFactory tlsOnly=buildSocketFactory(); - HttpsURLConnection https=(HttpsURLConnection)result; - - https.setSSLSocketFactory(tlsOnly); - } - - return((HttpURLConnection)result); - } - - // based on http://stackoverflow.com/a/309718/115145 - - public static String slurp(final InputStream is) - throws IOException { - final char[] buffer = new char[128]; - final StringBuilder out = new StringBuilder(); - final Reader in = new InputStreamReader(is, "UTF-8"); - - for (;;) { - int rsz = in.read(buffer, 0, buffer.length); - if (rsz < 0) - break; - out.append(buffer, 0, rsz); - } - - in.close(); - - return out.toString(); - } -} +/* + * Copyright (c) 2016 CommonsWare, LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.hiddenservices.genesissearchengine.production.libs.netcipher.client; + +import android.content.Context; +import android.content.Intent; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.Proxy; +import java.net.URL; +import java.net.URLConnection; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLSocketFactory; + +/** + * Builds an HttpUrlConnection that connects via Tor through + * Orbot. + */ +public class StrongConnectionBuilder + extends StrongBuilderBase { + private URL url; + + /** + * Creates a StrongConnectionBuilder using the strongest set + * of options for security. Use this if the strongest set of + * options is what you want; otherwise, create a + * builder via the constructor and configure it as you see fit. + * + * @param ctxt any Context will do + * @return a configured StrongConnectionBuilder + * @throws Exception + */ + static public StrongConnectionBuilder forMaxSecurity(Context ctxt) + throws Exception { + return(new StrongConnectionBuilder(ctxt) + .withBestProxy()); + } + + /** + * Creates a builder instance. + * + * @param ctxt any Context will do; builder will hold onto + * Application context + */ + public StrongConnectionBuilder(Context ctxt) { + super(ctxt); + } + + /** + * Copy constructor. + * + * @param original builder to clone + */ + public StrongConnectionBuilder(StrongConnectionBuilder original) { + super(original); + this.url=original.url; + } +/* + public boolean supportsSocksProxy() { + return(false); + } +*/ + + /** + * Sets the URL to build a connection for. + * + * @param url the URL + * @return the builder + * @throws MalformedURLException + */ + public StrongConnectionBuilder connectTo(String url) + throws MalformedURLException { + connectTo(new URL(url)); + + return(this); + } + + /** + * Sets the URL to build a connection for. + * + * @param url the URL + * @return the builder + */ + public StrongConnectionBuilder connectTo(URL url) { + this.url=url; + + return(this); + } + + /** + * {@inheritDoc} + */ + @Override + public HttpURLConnection build(Intent status) throws IOException { + return(buildForUrl(status, url)); + } + + @Override + protected String get(Intent status, HttpURLConnection connection, + String url) throws Exception { + HttpURLConnection realConnection=buildForUrl(status, new URL(url)); + + return(slurp(realConnection.getInputStream())); + } + + private HttpURLConnection buildForUrl(Intent status, URL urlToUse) + throws IOException { + URLConnection result; + Proxy proxy=buildProxy(status); + + if (proxy==null) { + result=urlToUse.openConnection(); + } + else { + result=urlToUse.openConnection(proxy); + } + + if (result instanceof HttpsURLConnection && sslContext!=null) { + SSLSocketFactory tlsOnly=buildSocketFactory(); + HttpsURLConnection https=(HttpsURLConnection)result; + + https.setSSLSocketFactory(tlsOnly); + } + + return((HttpURLConnection)result); + } + + // based on http://stackoverflow.com/a/309718/115145 + + public static String slurp(final InputStream is) + throws IOException { + final char[] buffer = new char[128]; + final StringBuilder out = new StringBuilder(); + final Reader in = new InputStreamReader(is, "UTF-8"); + + for (;;) { + int rsz = in.read(buffer, 0, buffer.length); + if (rsz < 0) + break; + out.append(buffer, 0, rsz); + } + + in.close(); + + return out.toString(); + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/StrongConstants.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/client/StrongConstants.java similarity index 92% rename from app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/StrongConstants.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/client/StrongConstants.java index 76c3f601..335835b8 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/StrongConstants.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/client/StrongConstants.java @@ -1,44 +1,44 @@ -/* - * Copyright 2012-2016 Nathan Freitas - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.darkweb.genesissearchengine.libs.netcipher.client; - -public class StrongConstants { - - /** - * Ordered to prefer the stronger cipher suites as noted - * http://op-co.de/blog/posts/android_ssl_downgrade/ - */ - public static final String ENABLED_CIPHERS[] = { - "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA", - "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA", - "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA", - "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA", - "TLS_DHE_RSA_WITH_AES_128_CBC_SHA", - "TLS_DHE_RSA_WITH_AES_256_CBC_SHA", - "TLS_DHE_DSS_WITH_AES_128_CBC_SHA", - "TLS_ECDHE_RSA_WITH_RC4_128_SHA", - "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA", "TLS_RSA_WITH_AES_128_CBC_SHA", - "TLS_RSA_WITH_AES_256_CBC_SHA", "SSL_RSA_WITH_3DES_EDE_CBC_SHA", - "SSL_RSA_WITH_RC4_128_SHA", "SSL_RSA_WITH_RC4_128_MD5" }; - - /** - * Ordered to prefer the stronger/newer TLS versions as noted - * http://op-co.de/blog/posts/android_ssl_downgrade/ - */ - public static final String ENABLED_PROTOCOLS[] = { "TLSv1.2", "TLSv1.1", - "TLSv1" }; - -} +/* + * Copyright 2012-2016 Nathan Freitas + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.hiddenservices.genesissearchengine.production.libs.netcipher.client; + +public class StrongConstants { + + /** + * Ordered to prefer the stronger cipher suites as noted + * http://op-co.de/blog/posts/android_ssl_downgrade/ + */ + public static final String ENABLED_CIPHERS[] = { + "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA", + "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA", + "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA", + "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA", + "TLS_DHE_RSA_WITH_AES_128_CBC_SHA", + "TLS_DHE_RSA_WITH_AES_256_CBC_SHA", + "TLS_DHE_DSS_WITH_AES_128_CBC_SHA", + "TLS_ECDHE_RSA_WITH_RC4_128_SHA", + "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA", "TLS_RSA_WITH_AES_128_CBC_SHA", + "TLS_RSA_WITH_AES_256_CBC_SHA", "SSL_RSA_WITH_3DES_EDE_CBC_SHA", + "SSL_RSA_WITH_RC4_128_SHA", "SSL_RSA_WITH_RC4_128_MD5" }; + + /** + * Ordered to prefer the stronger/newer TLS versions as noted + * http://op-co.de/blog/posts/android_ssl_downgrade/ + */ + public static final String ENABLED_PROTOCOLS[] = { "TLSv1.2", "TLSv1.1", + "TLSv1" }; + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/StrongHttpsClient.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/client/StrongHttpsClient.java similarity index 95% rename from app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/StrongHttpsClient.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/client/StrongHttpsClient.java index a5b3e8ec..d94da475 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/StrongHttpsClient.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/client/StrongHttpsClient.java @@ -1,165 +1,165 @@ -/* - * Copyright 2012-2016 Nathan Freitas - * Copyright 2015 str4d - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.darkweb.genesissearchengine.libs.netcipher.client; - -import android.content.Context; - -import com.example.myapplication.R; - -import java.io.IOException; -import java.io.InputStream; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.cert.CertificateException; - -import javax.net.ssl.TrustManagerFactory; - -import ch.boye.httpclientandroidlib.HttpHost; -import ch.boye.httpclientandroidlib.conn.ClientConnectionOperator; -import ch.boye.httpclientandroidlib.conn.params.ConnRoutePNames; -import ch.boye.httpclientandroidlib.conn.scheme.PlainSocketFactory; -import ch.boye.httpclientandroidlib.conn.scheme.Scheme; -import ch.boye.httpclientandroidlib.conn.scheme.SchemeRegistry; -import ch.boye.httpclientandroidlib.impl.client.DefaultHttpClient; -import ch.boye.httpclientandroidlib.impl.conn.tsccm.ThreadSafeClientConnManager; - -public class StrongHttpsClient extends DefaultHttpClient { - - final Context context; - private HttpHost proxyHost; - private String proxyType; - private SocksAwareProxyRoutePlanner routePlanner; - - private StrongSSLSocketFactory sFactory; - private SchemeRegistry mRegistry; - - private final static String TRUSTSTORE_TYPE = "BKS"; - private final static String TRUSTSTORE_PASSWORD = "changeit"; - - public StrongHttpsClient(Context context) { - this.context = context; - - mRegistry = new SchemeRegistry(); - mRegistry.register( - new Scheme(TYPE_HTTP, 80, PlainSocketFactory.getSocketFactory())); - - - try { - KeyStore keyStore = loadKeyStore(); - TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); - trustManagerFactory.init(keyStore); - sFactory = new StrongSSLSocketFactory(context, trustManagerFactory.getTrustManagers(), keyStore, TRUSTSTORE_PASSWORD); - mRegistry.register(new Scheme("https", 443, sFactory)); - } catch (Exception e) { - throw new AssertionError(e); - } - } - - private KeyStore loadKeyStore () throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException - { - - KeyStore trustStore = KeyStore.getInstance(TRUSTSTORE_TYPE); - // load our bundled cacerts from raw assets - InputStream in = context.getResources().openRawResource(R.raw.debiancacerts); - trustStore.load(in, TRUSTSTORE_PASSWORD.toCharArray()); - - return trustStore; - } - - public StrongHttpsClient(Context context, KeyStore keystore) { - this.context = context; - - mRegistry = new SchemeRegistry(); - mRegistry.register( - new Scheme(TYPE_HTTP, 80, PlainSocketFactory.getSocketFactory())); - - try { - TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); - sFactory = new StrongSSLSocketFactory(context, trustManagerFactory.getTrustManagers(), keystore, TRUSTSTORE_PASSWORD); - mRegistry.register(new Scheme("https", 443, sFactory)); - } catch (Exception e) { - throw new AssertionError(e); - } - } - - @Override - protected ThreadSafeClientConnManager createClientConnectionManager() { - - return new ThreadSafeClientConnManager(getParams(), mRegistry) - { - @Override - protected ClientConnectionOperator createConnectionOperator( - SchemeRegistry schreg) { - - return new SocksAwareClientConnOperator(schreg, proxyHost, proxyType, - routePlanner); - } - }; - } - - public void useProxy(boolean enableTor, String type, String host, int port) - { - if (enableTor) - { - this.proxyType = type; - - if (type.equalsIgnoreCase(TYPE_SOCKS)) - { - proxyHost = new HttpHost(host, port); - } - else - { - proxyHost = new HttpHost(host, port, type); - getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxyHost); - } - } - else - { - getParams().removeParameter(ConnRoutePNames.DEFAULT_PROXY); - proxyHost = null; - } - - } - - public void disableProxy () - { - getParams().removeParameter(ConnRoutePNames.DEFAULT_PROXY); - proxyHost = null; - } - - public void useProxyRoutePlanner(SocksAwareProxyRoutePlanner proxyRoutePlanner) - { - routePlanner = proxyRoutePlanner; - setRoutePlanner(proxyRoutePlanner); - } - - /** - * NOT ADVISED, but some sites don't yet have latest protocols and ciphers available, and some - * apps still need to support them - * https://dev.guardianproject.info/issues/5644 - */ - public void enableSSLCompatibilityMode() { - sFactory.setEnableStongerDefaultProtocalVersion(false); - sFactory.setEnableStongerDefaultSSLCipherSuite(false); - } - - public final static String TYPE_SOCKS = "socks"; - public final static String TYPE_HTTP = "http"; - -} +/* + * Copyright 2012-2016 Nathan Freitas + * Copyright 2015 str4d + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.hiddenservices.genesissearchengine.production.libs.netcipher.client; + +import android.content.Context; + +import com.example.myapplication.R; + +import java.io.IOException; +import java.io.InputStream; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.cert.CertificateException; + +import javax.net.ssl.TrustManagerFactory; + +import ch.boye.httpclientandroidlib.HttpHost; +import ch.boye.httpclientandroidlib.conn.ClientConnectionOperator; +import ch.boye.httpclientandroidlib.conn.params.ConnRoutePNames; +import ch.boye.httpclientandroidlib.conn.scheme.PlainSocketFactory; +import ch.boye.httpclientandroidlib.conn.scheme.Scheme; +import ch.boye.httpclientandroidlib.conn.scheme.SchemeRegistry; +import ch.boye.httpclientandroidlib.impl.client.DefaultHttpClient; +import ch.boye.httpclientandroidlib.impl.conn.tsccm.ThreadSafeClientConnManager; + +public class StrongHttpsClient extends DefaultHttpClient { + + final Context context; + private HttpHost proxyHost; + private String proxyType; + private SocksAwareProxyRoutePlanner routePlanner; + + private StrongSSLSocketFactory sFactory; + private SchemeRegistry mRegistry; + + private final static String TRUSTSTORE_TYPE = "BKS"; + private final static String TRUSTSTORE_PASSWORD = "changeit"; + + public StrongHttpsClient(Context context) { + this.context = context; + + mRegistry = new SchemeRegistry(); + mRegistry.register( + new Scheme(TYPE_HTTP, 80, PlainSocketFactory.getSocketFactory())); + + + try { + KeyStore keyStore = loadKeyStore(); + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + trustManagerFactory.init(keyStore); + sFactory = new StrongSSLSocketFactory(context, trustManagerFactory.getTrustManagers(), keyStore, TRUSTSTORE_PASSWORD); + mRegistry.register(new Scheme("https", 443, sFactory)); + } catch (Exception e) { + throw new AssertionError(e); + } + } + + private KeyStore loadKeyStore () throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException + { + + KeyStore trustStore = KeyStore.getInstance(TRUSTSTORE_TYPE); + // load our bundled cacerts from raw assets + InputStream in = context.getResources().openRawResource(R.raw.debiancacerts); + trustStore.load(in, TRUSTSTORE_PASSWORD.toCharArray()); + + return trustStore; + } + + public StrongHttpsClient(Context context, KeyStore keystore) { + this.context = context; + + mRegistry = new SchemeRegistry(); + mRegistry.register( + new Scheme(TYPE_HTTP, 80, PlainSocketFactory.getSocketFactory())); + + try { + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + sFactory = new StrongSSLSocketFactory(context, trustManagerFactory.getTrustManagers(), keystore, TRUSTSTORE_PASSWORD); + mRegistry.register(new Scheme("https", 443, sFactory)); + } catch (Exception e) { + throw new AssertionError(e); + } + } + + @Override + protected ThreadSafeClientConnManager createClientConnectionManager() { + + return new ThreadSafeClientConnManager(getParams(), mRegistry) + { + @Override + protected ClientConnectionOperator createConnectionOperator( + SchemeRegistry schreg) { + + return new SocksAwareClientConnOperator(schreg, proxyHost, proxyType, + routePlanner); + } + }; + } + + public void useProxy(boolean enableTor, String type, String host, int port) + { + if (enableTor) + { + this.proxyType = type; + + if (type.equalsIgnoreCase(TYPE_SOCKS)) + { + proxyHost = new HttpHost(host, port); + } + else + { + proxyHost = new HttpHost(host, port, type); + getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxyHost); + } + } + else + { + getParams().removeParameter(ConnRoutePNames.DEFAULT_PROXY); + proxyHost = null; + } + + } + + public void disableProxy () + { + getParams().removeParameter(ConnRoutePNames.DEFAULT_PROXY); + proxyHost = null; + } + + public void useProxyRoutePlanner(SocksAwareProxyRoutePlanner proxyRoutePlanner) + { + routePlanner = proxyRoutePlanner; + setRoutePlanner(proxyRoutePlanner); + } + + /** + * NOT ADVISED, but some sites don't yet have latest protocols and ciphers available, and some + * apps still need to support them + * https://dev.guardianproject.info/issues/5644 + */ + public void enableSSLCompatibilityMode() { + sFactory.setEnableStongerDefaultProtocalVersion(false); + sFactory.setEnableStongerDefaultSSLCipherSuite(false); + } + + public final static String TYPE_SOCKS = "socks"; + public final static String TYPE_HTTP = "http"; + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/StrongSSLSocketFactory.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/client/StrongSSLSocketFactory.java similarity index 95% rename from app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/StrongSSLSocketFactory.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/client/StrongSSLSocketFactory.java index c782b29b..e7a58c16 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/StrongSSLSocketFactory.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/client/StrongSSLSocketFactory.java @@ -1,202 +1,202 @@ -/* - * Copyright 2012-2016 Nathan Freitas - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.darkweb.genesissearchengine.libs.netcipher.client; - -import android.content.Context; - -import ch.boye.httpclientandroidlib.conn.scheme.LayeredSchemeSocketFactory; -import ch.boye.httpclientandroidlib.params.HttpParams; - -import java.io.IOException; -import java.net.Proxy; -import java.net.Socket; -import java.net.UnknownHostException; -import java.security.KeyManagementException; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.SecureRandom; -import java.security.UnrecoverableKeyException; -import java.security.cert.CertificateException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import javax.net.ssl.KeyManager; -import javax.net.ssl.KeyManagerFactory; -import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLSocket; -import javax.net.ssl.SSLSocketFactory; -import javax.net.ssl.TrustManager; - -public class StrongSSLSocketFactory extends - ch.boye.httpclientandroidlib.conn.ssl.SSLSocketFactory implements - LayeredSchemeSocketFactory { - - private SSLSocketFactory mFactory = null; - - private Proxy mProxy = null; - - public static final String TLS = "TLS"; - public static final String SSL = "SSL"; - public static final String SSLV2 = "SSLv2"; - - // private X509HostnameVerifier mHostnameVerifier = new - // StrictHostnameVerifier(); - // private final HostNameResolver mNameResolver = new - // StrongHostNameResolver(); - - private boolean mEnableStongerDefaultSSLCipherSuite = true; - private boolean mEnableStongerDefaultProtocalVersion = true; - - private String[] mProtocols; - private String[] mCipherSuites; - - public StrongSSLSocketFactory(Context context, - TrustManager[] trustManagers, KeyStore keyStore, String keyStorePassword) - throws KeyManagementException, UnrecoverableKeyException, - NoSuchAlgorithmException, KeyStoreException, CertificateException, - IOException { - super(keyStore); - - SSLContext sslContext = SSLContext.getInstance("TLS"); - KeyManager[] km = createKeyManagers( - keyStore, - keyStorePassword); - sslContext.init(km, trustManagers, new SecureRandom()); - - mFactory = sslContext.getSocketFactory(); - - } - - private void readSSLParameters(SSLSocket sslSocket) { - List protocolsToEnable = new ArrayList(); - List supportedProtocols = Arrays.asList(sslSocket.getSupportedProtocols()); - for(String enabledProtocol : StrongConstants.ENABLED_PROTOCOLS) { - if(supportedProtocols.contains(enabledProtocol)) { - protocolsToEnable.add(enabledProtocol); - } - } - this.mProtocols = protocolsToEnable.toArray(new String[protocolsToEnable.size()]); - - List cipherSuitesToEnable = new ArrayList(); - List supportedCipherSuites = Arrays.asList(sslSocket.getSupportedCipherSuites()); - for(String enabledCipherSuite : StrongConstants.ENABLED_CIPHERS) { - if(supportedCipherSuites.contains(enabledCipherSuite)) { - cipherSuitesToEnable.add(enabledCipherSuite); - } - } - this.mCipherSuites = cipherSuitesToEnable.toArray(new String[cipherSuitesToEnable.size()]); - } - - private KeyManager[] createKeyManagers(final KeyStore keystore, - final String password) throws KeyStoreException, - NoSuchAlgorithmException, UnrecoverableKeyException { - if (keystore == null) { - throw new IllegalArgumentException("Keystore may not be null"); - } - KeyManagerFactory kmfactory = KeyManagerFactory - .getInstance(KeyManagerFactory.getDefaultAlgorithm()); - kmfactory.init(keystore, password != null ? password.toCharArray() - : null); - return kmfactory.getKeyManagers(); - } - - @Override - public Socket createSocket() throws IOException { - Socket newSocket = mFactory.createSocket(); - enableStrongerDefaults(newSocket); - return newSocket; - } - - @Override - public Socket createSocket(Socket socket, String host, int port, - boolean autoClose) throws IOException, UnknownHostException { - - Socket newSocket = mFactory.createSocket(socket, host, port, autoClose); - - enableStrongerDefaults(newSocket); - - return newSocket; - } - - /** - * Defaults the SSL connection to use a strong cipher suite and TLS version - * - * @param socket - */ - private void enableStrongerDefaults(Socket socket) { - if (isSecure(socket)) { - SSLSocket sslSocket = (SSLSocket) socket; - readSSLParameters(sslSocket); - - if (mEnableStongerDefaultProtocalVersion && mProtocols != null) { - sslSocket.setEnabledProtocols(mProtocols); - } - - if (mEnableStongerDefaultSSLCipherSuite && mCipherSuites != null) { - sslSocket.setEnabledCipherSuites(mCipherSuites); - } - } - } - - @Override - public boolean isSecure(Socket sock) throws IllegalArgumentException { - return (sock instanceof SSLSocket); - } - - public void setProxy(Proxy proxy) { - mProxy = proxy; - } - - public Proxy getProxy() { - return mProxy; - } - - public boolean isEnableStongerDefaultSSLCipherSuite() { - return mEnableStongerDefaultSSLCipherSuite; - } - - public void setEnableStongerDefaultSSLCipherSuite(boolean enable) { - this.mEnableStongerDefaultSSLCipherSuite = enable; - } - - public boolean isEnableStongerDefaultProtocalVersion() { - return mEnableStongerDefaultProtocalVersion; - } - - public void setEnableStongerDefaultProtocalVersion(boolean enable) { - this.mEnableStongerDefaultProtocalVersion = enable; - } - - @Override - public Socket createSocket(HttpParams httpParams) throws IOException { - Socket newSocket = mFactory.createSocket(); - - enableStrongerDefaults(newSocket); - - return newSocket; - - } - - @Override - public Socket createLayeredSocket(Socket arg0, String arg1, int arg2, - boolean arg3) throws IOException, UnknownHostException { - return ((LayeredSchemeSocketFactory) mFactory).createLayeredSocket( - arg0, arg1, arg2, arg3); - } - -} +/* + * Copyright 2012-2016 Nathan Freitas + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.hiddenservices.genesissearchengine.production.libs.netcipher.client; + +import android.content.Context; + +import ch.boye.httpclientandroidlib.conn.scheme.LayeredSchemeSocketFactory; +import ch.boye.httpclientandroidlib.params.HttpParams; + +import java.io.IOException; +import java.net.Proxy; +import java.net.Socket; +import java.net.UnknownHostException; +import java.security.KeyManagementException; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; +import java.security.UnrecoverableKeyException; +import java.security.cert.CertificateException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import javax.net.ssl.KeyManager; +import javax.net.ssl.KeyManagerFactory; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSocket; +import javax.net.ssl.SSLSocketFactory; +import javax.net.ssl.TrustManager; + +public class StrongSSLSocketFactory extends + ch.boye.httpclientandroidlib.conn.ssl.SSLSocketFactory implements + LayeredSchemeSocketFactory { + + private SSLSocketFactory mFactory = null; + + private Proxy mProxy = null; + + public static final String TLS = "TLS"; + public static final String SSL = "SSL"; + public static final String SSLV2 = "SSLv2"; + + // private X509HostnameVerifier mHostnameVerifier = new + // StrictHostnameVerifier(); + // private final HostNameResolver mNameResolver = new + // StrongHostNameResolver(); + + private boolean mEnableStongerDefaultSSLCipherSuite = true; + private boolean mEnableStongerDefaultProtocalVersion = true; + + private String[] mProtocols; + private String[] mCipherSuites; + + public StrongSSLSocketFactory(Context context, + TrustManager[] trustManagers, KeyStore keyStore, String keyStorePassword) + throws KeyManagementException, UnrecoverableKeyException, + NoSuchAlgorithmException, KeyStoreException, CertificateException, + IOException { + super(keyStore); + + SSLContext sslContext = SSLContext.getInstance("TLS"); + KeyManager[] km = createKeyManagers( + keyStore, + keyStorePassword); + sslContext.init(km, trustManagers, new SecureRandom()); + + mFactory = sslContext.getSocketFactory(); + + } + + private void readSSLParameters(SSLSocket sslSocket) { + List protocolsToEnable = new ArrayList(); + List supportedProtocols = Arrays.asList(sslSocket.getSupportedProtocols()); + for(String enabledProtocol : StrongConstants.ENABLED_PROTOCOLS) { + if(supportedProtocols.contains(enabledProtocol)) { + protocolsToEnable.add(enabledProtocol); + } + } + this.mProtocols = protocolsToEnable.toArray(new String[protocolsToEnable.size()]); + + List cipherSuitesToEnable = new ArrayList(); + List supportedCipherSuites = Arrays.asList(sslSocket.getSupportedCipherSuites()); + for(String enabledCipherSuite : StrongConstants.ENABLED_CIPHERS) { + if(supportedCipherSuites.contains(enabledCipherSuite)) { + cipherSuitesToEnable.add(enabledCipherSuite); + } + } + this.mCipherSuites = cipherSuitesToEnable.toArray(new String[cipherSuitesToEnable.size()]); + } + + private KeyManager[] createKeyManagers(final KeyStore keystore, + final String password) throws KeyStoreException, + NoSuchAlgorithmException, UnrecoverableKeyException { + if (keystore == null) { + throw new IllegalArgumentException("Keystore may not be null"); + } + KeyManagerFactory kmfactory = KeyManagerFactory + .getInstance(KeyManagerFactory.getDefaultAlgorithm()); + kmfactory.init(keystore, password != null ? password.toCharArray() + : null); + return kmfactory.getKeyManagers(); + } + + @Override + public Socket createSocket() throws IOException { + Socket newSocket = mFactory.createSocket(); + enableStrongerDefaults(newSocket); + return newSocket; + } + + @Override + public Socket createSocket(Socket socket, String host, int port, + boolean autoClose) throws IOException, UnknownHostException { + + Socket newSocket = mFactory.createSocket(socket, host, port, autoClose); + + enableStrongerDefaults(newSocket); + + return newSocket; + } + + /** + * Defaults the SSL connection to use a strong cipher suite and TLS version + * + * @param socket + */ + private void enableStrongerDefaults(Socket socket) { + if (isSecure(socket)) { + SSLSocket sslSocket = (SSLSocket) socket; + readSSLParameters(sslSocket); + + if (mEnableStongerDefaultProtocalVersion && mProtocols != null) { + sslSocket.setEnabledProtocols(mProtocols); + } + + if (mEnableStongerDefaultSSLCipherSuite && mCipherSuites != null) { + sslSocket.setEnabledCipherSuites(mCipherSuites); + } + } + } + + @Override + public boolean isSecure(Socket sock) throws IllegalArgumentException { + return (sock instanceof SSLSocket); + } + + public void setProxy(Proxy proxy) { + mProxy = proxy; + } + + public Proxy getProxy() { + return mProxy; + } + + public boolean isEnableStongerDefaultSSLCipherSuite() { + return mEnableStongerDefaultSSLCipherSuite; + } + + public void setEnableStongerDefaultSSLCipherSuite(boolean enable) { + this.mEnableStongerDefaultSSLCipherSuite = enable; + } + + public boolean isEnableStongerDefaultProtocalVersion() { + return mEnableStongerDefaultProtocalVersion; + } + + public void setEnableStongerDefaultProtocalVersion(boolean enable) { + this.mEnableStongerDefaultProtocalVersion = enable; + } + + @Override + public Socket createSocket(HttpParams httpParams) throws IOException { + Socket newSocket = mFactory.createSocket(); + + enableStrongerDefaults(newSocket); + + return newSocket; + + } + + @Override + public Socket createLayeredSocket(Socket arg0, String arg1, int arg2, + boolean arg3) throws IOException, UnknownHostException { + return ((LayeredSchemeSocketFactory) mFactory).createLayeredSocket( + arg0, arg1, arg2, arg3); + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/TlsOnlySocketFactory.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/client/TlsOnlySocketFactory.java similarity index 96% rename from app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/TlsOnlySocketFactory.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/client/TlsOnlySocketFactory.java index 384cf85a..ab7b2b03 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/TlsOnlySocketFactory.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/client/TlsOnlySocketFactory.java @@ -1,544 +1,544 @@ -/* - * Copyright 2015 Bhavit Singh Sengar - * Copyright 2015-2016 Hans-Christoph Steiner - * Copyright 2015-2016 Nathan Freitas - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * From https://stackoverflow.com/a/29946540 - */ - -package com.darkweb.genesissearchengine.libs.netcipher.client; - -import android.net.SSLCertificateSocketFactory; -import android.os.Build; -import android.util.Log; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.InetAddress; -import java.net.Socket; -import java.net.SocketAddress; -import java.net.SocketException; -import java.nio.channels.SocketChannel; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.regex.Pattern; - -import javax.net.ssl.HandshakeCompletedListener; -import javax.net.ssl.HttpsURLConnection; -import javax.net.ssl.SSLSession; -import javax.net.ssl.SSLSocket; -import javax.net.ssl.SSLSocketFactory; - -/** - * While making a secure connection, Android's {@link HttpsURLConnection} falls - * back to SSLv3 from TLSv1. This is a bug in android versions < 4.4. It can be - * fixed by removing the SSLv3 protocol from Enabled Protocols list. Use this as - * the {@link SSLSocketFactory} for - * {@link HttpsURLConnection#setDefaultSSLSocketFactory(SSLSocketFactory)} - * - * @author Bhavit S. Sengar - * @author Hans-Christoph Steiner - */ -public class TlsOnlySocketFactory extends SSLSocketFactory { - private static final int HANDSHAKE_TIMEOUT=0; - private static final String TAG = "TlsOnlySocketFactory"; - private final SSLSocketFactory delegate; - private final boolean compatible; - - public TlsOnlySocketFactory() { - this.delegate =SSLCertificateSocketFactory.getDefault(HANDSHAKE_TIMEOUT, null); - this.compatible = false; - } - - public TlsOnlySocketFactory(SSLSocketFactory delegate) { - this.delegate = delegate; - this.compatible = false; - } - - /** - * Make {@link SSLSocket}s that are compatible with outdated servers. - * - * @param delegate - * @param compatible - */ - public TlsOnlySocketFactory(SSLSocketFactory delegate, boolean compatible) { - this.delegate = delegate; - this.compatible = compatible; - } - - @Override - public String[] getDefaultCipherSuites() { - return delegate.getDefaultCipherSuites(); - } - - @Override - public String[] getSupportedCipherSuites() { - return delegate.getSupportedCipherSuites(); - } - - private Socket makeSocketSafe(Socket socket, String host) { - if (socket instanceof SSLSocket) { - TlsOnlySSLSocket tempSocket= - new TlsOnlySSLSocket((SSLSocket) socket, compatible); - - if (delegate instanceof SSLCertificateSocketFactory && - Build.VERSION.SDK_INT>=Build.VERSION_CODES.JELLY_BEAN_MR1) { - ((android.net.SSLCertificateSocketFactory)delegate) - .setHostname(socket, host); - } - else { - tempSocket.setHostname(host); - } - - socket = tempSocket; - } - return socket; - } - - @Override - public Socket createSocket(Socket s, String host, int port, boolean autoClose) - throws IOException { - return makeSocketSafe(delegate.createSocket(s, host, port, autoClose), host); - } - - @Override - public Socket createSocket(String host, int port) throws IOException { - return makeSocketSafe(delegate.createSocket(host, port), host); - } - - @Override - public Socket createSocket(String host, int port, InetAddress localHost, int localPort) - throws IOException { - return makeSocketSafe(delegate.createSocket(host, port, localHost, localPort), host); - } - - @Override - public Socket createSocket(InetAddress host, int port) throws IOException { - return makeSocketSafe(delegate.createSocket(host, port), host.getHostName()); - } - - @Override - public Socket createSocket(InetAddress address, int port, InetAddress localAddress, - int localPort) throws IOException { - return makeSocketSafe(delegate.createSocket(address, port, localAddress, localPort), - address.getHostName()); - } - - private class TlsOnlySSLSocket extends DelegateSSLSocket { - - final boolean compatible; - - private TlsOnlySSLSocket(SSLSocket delegate, boolean compatible) { - super(delegate); - this.compatible = compatible; - - // badly configured servers can't handle a good config - if (compatible) { - ArrayList protocols = new ArrayList(Arrays.asList(delegate - .getEnabledProtocols())); - protocols.remove("SSLv2"); - protocols.remove("SSLv3"); - super.setEnabledProtocols(protocols.toArray(new String[protocols.size()])); - - /* - * Exclude extremely weak EXPORT ciphers. NULL ciphers should - * never even have been an option in TLS. - */ - ArrayList enabled = new ArrayList(10); - Pattern exclude = Pattern.compile(".*(EXPORT|NULL).*"); - for (String cipher : delegate.getEnabledCipherSuites()) { - if (!exclude.matcher(cipher).matches()) { - enabled.add(cipher); - } - } - super.setEnabledCipherSuites(enabled.toArray(new String[enabled.size()])); - return; - } // else - - // 16-19 support v1.1 and v1.2 but only by default starting in 20+ - // https://developer.android.com/reference/javax/net/ssl/SSLSocket.html - ArrayList protocols = new ArrayList(Arrays.asList(delegate - .getSupportedProtocols())); - protocols.remove("SSLv2"); - protocols.remove("SSLv3"); - super.setEnabledProtocols(protocols.toArray(new String[protocols.size()])); - - /* - * Exclude weak ciphers, like EXPORT, MD5, DES, and DH. NULL ciphers - * should never even have been an option in TLS. - */ - ArrayList enabledCiphers = new ArrayList(10); - Pattern exclude = Pattern.compile(".*(_DES|DH_|DSS|EXPORT|MD5|NULL|RC4).*"); - for (String cipher : delegate.getSupportedCipherSuites()) { - if (!exclude.matcher(cipher).matches()) { - enabledCiphers.add(cipher); - } - } - super.setEnabledCipherSuites(enabledCiphers.toArray(new String[enabledCiphers.size()])); - } - - /** - * This works around a bug in Android < 19 where SSLv3 is forced - */ - @Override - public void setEnabledProtocols(String[] protocols) { - if (protocols != null && protocols.length == 1 && "SSLv3".equals(protocols[0])) { - List systemProtocols; - if (this.compatible) { - systemProtocols = Arrays.asList(delegate.getEnabledProtocols()); - } else { - systemProtocols = Arrays.asList(delegate.getSupportedProtocols()); - } - List enabledProtocols = new ArrayList(systemProtocols); - if (enabledProtocols.size() > 1) { - enabledProtocols.remove("SSLv2"); - enabledProtocols.remove("SSLv3"); - } else { - Log.w(TAG, "SSL stuck with protocol available for " - + String.valueOf(enabledProtocols)); - } - protocols = enabledProtocols.toArray(new String[enabledProtocols.size()]); - } - super.setEnabledProtocols(protocols); - } - } - - public class DelegateSSLSocket extends SSLSocket { - - protected final SSLSocket delegate; - - DelegateSSLSocket(SSLSocket delegate) { - this.delegate = delegate; - } - - @Override - public String[] getSupportedCipherSuites() { - return delegate.getSupportedCipherSuites(); - } - - @Override - public String[] getEnabledCipherSuites() { - return delegate.getEnabledCipherSuites(); - } - - @Override - public void setEnabledCipherSuites(String[] suites) { - delegate.setEnabledCipherSuites(suites); - } - - @Override - public String[] getSupportedProtocols() { - return delegate.getSupportedProtocols(); - } - - @Override - public String[] getEnabledProtocols() { - return delegate.getEnabledProtocols(); - } - - @Override - public void setEnabledProtocols(String[] protocols) { - delegate.setEnabledProtocols(protocols); - } - - @Override - public SSLSession getSession() { - return delegate.getSession(); - } - - @Override - public void addHandshakeCompletedListener(HandshakeCompletedListener listener) { - delegate.addHandshakeCompletedListener(listener); - } - - @Override - public void removeHandshakeCompletedListener(HandshakeCompletedListener listener) { - delegate.removeHandshakeCompletedListener(listener); - } - - @Override - public void startHandshake() throws IOException { - delegate.startHandshake(); - } - - @Override - public void setUseClientMode(boolean mode) { - delegate.setUseClientMode(mode); - } - - @Override - public boolean getUseClientMode() { - return delegate.getUseClientMode(); - } - - @Override - public void setNeedClientAuth(boolean need) { - delegate.setNeedClientAuth(need); - } - - @Override - public void setWantClientAuth(boolean want) { - delegate.setWantClientAuth(want); - } - - @Override - public boolean getNeedClientAuth() { - return delegate.getNeedClientAuth(); - } - - @Override - public boolean getWantClientAuth() { - return delegate.getWantClientAuth(); - } - - @Override - public void setEnableSessionCreation(boolean flag) { - delegate.setEnableSessionCreation(flag); - } - - @Override - public boolean getEnableSessionCreation() { - return delegate.getEnableSessionCreation(); - } - - @Override - public void bind(SocketAddress localAddr) throws IOException { - delegate.bind(localAddr); - } - - @Override - public synchronized void close() throws IOException { - delegate.close(); - } - - @Override - public void connect(SocketAddress remoteAddr) throws IOException { - delegate.connect(remoteAddr); - } - - @Override - public void connect(SocketAddress remoteAddr, int timeout) throws IOException { - delegate.connect(remoteAddr, timeout); - } - - @Override - public SocketChannel getChannel() { - return delegate.getChannel(); - } - - @Override - public InetAddress getInetAddress() { - return delegate.getInetAddress(); - } - - @Override - public InputStream getInputStream() throws IOException { - return delegate.getInputStream(); - } - - @Override - public boolean getKeepAlive() throws SocketException { - return delegate.getKeepAlive(); - } - - @Override - public InetAddress getLocalAddress() { - return delegate.getLocalAddress(); - } - - @Override - public int getLocalPort() { - return delegate.getLocalPort(); - } - - @Override - public SocketAddress getLocalSocketAddress() { - return delegate.getLocalSocketAddress(); - } - - @Override - public boolean getOOBInline() throws SocketException { - return delegate.getOOBInline(); - } - - @Override - public OutputStream getOutputStream() throws IOException { - return delegate.getOutputStream(); - } - - @Override - public int getPort() { - return delegate.getPort(); - } - - @Override - public synchronized int getReceiveBufferSize() throws SocketException { - return delegate.getReceiveBufferSize(); - } - - @Override - public SocketAddress getRemoteSocketAddress() { - return delegate.getRemoteSocketAddress(); - } - - @Override - public boolean getReuseAddress() throws SocketException { - return delegate.getReuseAddress(); - } - - @Override - public synchronized int getSendBufferSize() throws SocketException { - return delegate.getSendBufferSize(); - } - - @Override - public int getSoLinger() throws SocketException { - return delegate.getSoLinger(); - } - - @Override - public synchronized int getSoTimeout() throws SocketException { - return delegate.getSoTimeout(); - } - - @Override - public boolean getTcpNoDelay() throws SocketException { - return delegate.getTcpNoDelay(); - } - - @Override - public int getTrafficClass() throws SocketException { - return delegate.getTrafficClass(); - } - - @Override - public boolean isBound() { - return delegate.isBound(); - } - - @Override - public boolean isClosed() { - return delegate.isClosed(); - } - - @Override - public boolean isConnected() { - return delegate.isConnected(); - } - - @Override - public boolean isInputShutdown() { - return delegate.isInputShutdown(); - } - - @Override - public boolean isOutputShutdown() { - return delegate.isOutputShutdown(); - } - - @Override - public void sendUrgentData(int value) throws IOException { - delegate.sendUrgentData(value); - } - - @Override - public void setKeepAlive(boolean keepAlive) throws SocketException { - delegate.setKeepAlive(keepAlive); - } - - @Override - public void setOOBInline(boolean oobinline) throws SocketException { - delegate.setOOBInline(oobinline); - } - - @Override - public void setPerformancePreferences(int connectionTime, int latency, int bandwidth) { - delegate.setPerformancePreferences(connectionTime, - latency, bandwidth); - } - - @Override - public synchronized void setReceiveBufferSize(int size) throws SocketException { - delegate.setReceiveBufferSize(size); - } - - @Override - public void setReuseAddress(boolean reuse) throws SocketException { - delegate.setReuseAddress(reuse); - } - - @Override - public synchronized void setSendBufferSize(int size) throws SocketException { - delegate.setSendBufferSize(size); - } - - @Override - public void setSoLinger(boolean on, int timeout) throws SocketException { - delegate.setSoLinger(on, timeout); - } - - @Override - public synchronized void setSoTimeout(int timeout) throws SocketException { - delegate.setSoTimeout(timeout); - } - - @Override - public void setTcpNoDelay(boolean on) throws SocketException { - delegate.setTcpNoDelay(on); - } - - @Override - public void setTrafficClass(int value) throws SocketException { - delegate.setTrafficClass(value); - } - - @Override - public void shutdownInput() throws IOException { - delegate.shutdownInput(); - } - - @Override - public void shutdownOutput() throws IOException { - delegate.shutdownOutput(); - } - - // inspired by https://github.com/k9mail/k-9/commit/54f9fd36a77423a55f63fbf9b1bcea055a239768 - - public DelegateSSLSocket setHostname(String host) { - try { - delegate - .getClass() - .getMethod("setHostname", String.class) - .invoke(delegate, host); - } - catch (Exception e) { - throw new IllegalStateException("Could not enable SNI", e); - } - - return(this); - } - - @Override - public String toString() { - return delegate.toString(); - } - - @Override - public boolean equals(Object o) { - return delegate.equals(o); - } - } -} +/* + * Copyright 2015 Bhavit Singh Sengar + * Copyright 2015-2016 Hans-Christoph Steiner + * Copyright 2015-2016 Nathan Freitas + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * From https://stackoverflow.com/a/29946540 + */ + +package com.hiddenservices.genesissearchengine.production.libs.netcipher.client; + +import android.net.SSLCertificateSocketFactory; +import android.os.Build; +import android.util.Log; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.InetAddress; +import java.net.Socket; +import java.net.SocketAddress; +import java.net.SocketException; +import java.nio.channels.SocketChannel; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.regex.Pattern; + +import javax.net.ssl.HandshakeCompletedListener; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLSession; +import javax.net.ssl.SSLSocket; +import javax.net.ssl.SSLSocketFactory; + +/** + * While making a secure connection, Android's {@link HttpsURLConnection} falls + * back to SSLv3 from TLSv1. This is a bug in android versions < 4.4. It can be + * fixed by removing the SSLv3 protocol from Enabled Protocols list. Use this as + * the {@link SSLSocketFactory} for + * {@link HttpsURLConnection#setDefaultSSLSocketFactory(SSLSocketFactory)} + * + * @author Bhavit S. Sengar + * @author Hans-Christoph Steiner + */ +public class TlsOnlySocketFactory extends SSLSocketFactory { + private static final int HANDSHAKE_TIMEOUT=0; + private static final String TAG = "TlsOnlySocketFactory"; + private final SSLSocketFactory delegate; + private final boolean compatible; + + public TlsOnlySocketFactory() { + this.delegate =SSLCertificateSocketFactory.getDefault(HANDSHAKE_TIMEOUT, null); + this.compatible = false; + } + + public TlsOnlySocketFactory(SSLSocketFactory delegate) { + this.delegate = delegate; + this.compatible = false; + } + + /** + * Make {@link SSLSocket}s that are compatible with outdated servers. + * + * @param delegate + * @param compatible + */ + public TlsOnlySocketFactory(SSLSocketFactory delegate, boolean compatible) { + this.delegate = delegate; + this.compatible = compatible; + } + + @Override + public String[] getDefaultCipherSuites() { + return delegate.getDefaultCipherSuites(); + } + + @Override + public String[] getSupportedCipherSuites() { + return delegate.getSupportedCipherSuites(); + } + + private Socket makeSocketSafe(Socket socket, String host) { + if (socket instanceof SSLSocket) { + TlsOnlySSLSocket tempSocket= + new TlsOnlySSLSocket((SSLSocket) socket, compatible); + + if (delegate instanceof SSLCertificateSocketFactory && + Build.VERSION.SDK_INT>=Build.VERSION_CODES.JELLY_BEAN_MR1) { + ((android.net.SSLCertificateSocketFactory)delegate) + .setHostname(socket, host); + } + else { + tempSocket.setHostname(host); + } + + socket = tempSocket; + } + return socket; + } + + @Override + public Socket createSocket(Socket s, String host, int port, boolean autoClose) + throws IOException { + return makeSocketSafe(delegate.createSocket(s, host, port, autoClose), host); + } + + @Override + public Socket createSocket(String host, int port) throws IOException { + return makeSocketSafe(delegate.createSocket(host, port), host); + } + + @Override + public Socket createSocket(String host, int port, InetAddress localHost, int localPort) + throws IOException { + return makeSocketSafe(delegate.createSocket(host, port, localHost, localPort), host); + } + + @Override + public Socket createSocket(InetAddress host, int port) throws IOException { + return makeSocketSafe(delegate.createSocket(host, port), host.getHostName()); + } + + @Override + public Socket createSocket(InetAddress address, int port, InetAddress localAddress, + int localPort) throws IOException { + return makeSocketSafe(delegate.createSocket(address, port, localAddress, localPort), + address.getHostName()); + } + + private class TlsOnlySSLSocket extends DelegateSSLSocket { + + final boolean compatible; + + private TlsOnlySSLSocket(SSLSocket delegate, boolean compatible) { + super(delegate); + this.compatible = compatible; + + // badly configured servers can't handle a good config + if (compatible) { + ArrayList protocols = new ArrayList(Arrays.asList(delegate + .getEnabledProtocols())); + protocols.remove("SSLv2"); + protocols.remove("SSLv3"); + super.setEnabledProtocols(protocols.toArray(new String[protocols.size()])); + + /* + * Exclude extremely weak EXPORT ciphers. NULL ciphers should + * never even have been an option in TLS. + */ + ArrayList enabled = new ArrayList(10); + Pattern exclude = Pattern.compile(".*(EXPORT|NULL).*"); + for (String cipher : delegate.getEnabledCipherSuites()) { + if (!exclude.matcher(cipher).matches()) { + enabled.add(cipher); + } + } + super.setEnabledCipherSuites(enabled.toArray(new String[enabled.size()])); + return; + } // else + + // 16-19 support v1.1 and v1.2 but only by default starting in 20+ + // https://developer.android.com/reference/javax/net/ssl/SSLSocket.html + ArrayList protocols = new ArrayList(Arrays.asList(delegate + .getSupportedProtocols())); + protocols.remove("SSLv2"); + protocols.remove("SSLv3"); + super.setEnabledProtocols(protocols.toArray(new String[protocols.size()])); + + /* + * Exclude weak ciphers, like EXPORT, MD5, DES, and DH. NULL ciphers + * should never even have been an option in TLS. + */ + ArrayList enabledCiphers = new ArrayList(10); + Pattern exclude = Pattern.compile(".*(_DES|DH_|DSS|EXPORT|MD5|NULL|RC4).*"); + for (String cipher : delegate.getSupportedCipherSuites()) { + if (!exclude.matcher(cipher).matches()) { + enabledCiphers.add(cipher); + } + } + super.setEnabledCipherSuites(enabledCiphers.toArray(new String[enabledCiphers.size()])); + } + + /** + * This works around a bug in Android < 19 where SSLv3 is forced + */ + @Override + public void setEnabledProtocols(String[] protocols) { + if (protocols != null && protocols.length == 1 && "SSLv3".equals(protocols[0])) { + List systemProtocols; + if (this.compatible) { + systemProtocols = Arrays.asList(delegate.getEnabledProtocols()); + } else { + systemProtocols = Arrays.asList(delegate.getSupportedProtocols()); + } + List enabledProtocols = new ArrayList(systemProtocols); + if (enabledProtocols.size() > 1) { + enabledProtocols.remove("SSLv2"); + enabledProtocols.remove("SSLv3"); + } else { + Log.w(TAG, "SSL stuck with protocol available for " + + String.valueOf(enabledProtocols)); + } + protocols = enabledProtocols.toArray(new String[enabledProtocols.size()]); + } + super.setEnabledProtocols(protocols); + } + } + + public class DelegateSSLSocket extends SSLSocket { + + protected final SSLSocket delegate; + + DelegateSSLSocket(SSLSocket delegate) { + this.delegate = delegate; + } + + @Override + public String[] getSupportedCipherSuites() { + return delegate.getSupportedCipherSuites(); + } + + @Override + public String[] getEnabledCipherSuites() { + return delegate.getEnabledCipherSuites(); + } + + @Override + public void setEnabledCipherSuites(String[] suites) { + delegate.setEnabledCipherSuites(suites); + } + + @Override + public String[] getSupportedProtocols() { + return delegate.getSupportedProtocols(); + } + + @Override + public String[] getEnabledProtocols() { + return delegate.getEnabledProtocols(); + } + + @Override + public void setEnabledProtocols(String[] protocols) { + delegate.setEnabledProtocols(protocols); + } + + @Override + public SSLSession getSession() { + return delegate.getSession(); + } + + @Override + public void addHandshakeCompletedListener(HandshakeCompletedListener listener) { + delegate.addHandshakeCompletedListener(listener); + } + + @Override + public void removeHandshakeCompletedListener(HandshakeCompletedListener listener) { + delegate.removeHandshakeCompletedListener(listener); + } + + @Override + public void startHandshake() throws IOException { + delegate.startHandshake(); + } + + @Override + public void setUseClientMode(boolean mode) { + delegate.setUseClientMode(mode); + } + + @Override + public boolean getUseClientMode() { + return delegate.getUseClientMode(); + } + + @Override + public void setNeedClientAuth(boolean need) { + delegate.setNeedClientAuth(need); + } + + @Override + public void setWantClientAuth(boolean want) { + delegate.setWantClientAuth(want); + } + + @Override + public boolean getNeedClientAuth() { + return delegate.getNeedClientAuth(); + } + + @Override + public boolean getWantClientAuth() { + return delegate.getWantClientAuth(); + } + + @Override + public void setEnableSessionCreation(boolean flag) { + delegate.setEnableSessionCreation(flag); + } + + @Override + public boolean getEnableSessionCreation() { + return delegate.getEnableSessionCreation(); + } + + @Override + public void bind(SocketAddress localAddr) throws IOException { + delegate.bind(localAddr); + } + + @Override + public synchronized void close() throws IOException { + delegate.close(); + } + + @Override + public void connect(SocketAddress remoteAddr) throws IOException { + delegate.connect(remoteAddr); + } + + @Override + public void connect(SocketAddress remoteAddr, int timeout) throws IOException { + delegate.connect(remoteAddr, timeout); + } + + @Override + public SocketChannel getChannel() { + return delegate.getChannel(); + } + + @Override + public InetAddress getInetAddress() { + return delegate.getInetAddress(); + } + + @Override + public InputStream getInputStream() throws IOException { + return delegate.getInputStream(); + } + + @Override + public boolean getKeepAlive() throws SocketException { + return delegate.getKeepAlive(); + } + + @Override + public InetAddress getLocalAddress() { + return delegate.getLocalAddress(); + } + + @Override + public int getLocalPort() { + return delegate.getLocalPort(); + } + + @Override + public SocketAddress getLocalSocketAddress() { + return delegate.getLocalSocketAddress(); + } + + @Override + public boolean getOOBInline() throws SocketException { + return delegate.getOOBInline(); + } + + @Override + public OutputStream getOutputStream() throws IOException { + return delegate.getOutputStream(); + } + + @Override + public int getPort() { + return delegate.getPort(); + } + + @Override + public synchronized int getReceiveBufferSize() throws SocketException { + return delegate.getReceiveBufferSize(); + } + + @Override + public SocketAddress getRemoteSocketAddress() { + return delegate.getRemoteSocketAddress(); + } + + @Override + public boolean getReuseAddress() throws SocketException { + return delegate.getReuseAddress(); + } + + @Override + public synchronized int getSendBufferSize() throws SocketException { + return delegate.getSendBufferSize(); + } + + @Override + public int getSoLinger() throws SocketException { + return delegate.getSoLinger(); + } + + @Override + public synchronized int getSoTimeout() throws SocketException { + return delegate.getSoTimeout(); + } + + @Override + public boolean getTcpNoDelay() throws SocketException { + return delegate.getTcpNoDelay(); + } + + @Override + public int getTrafficClass() throws SocketException { + return delegate.getTrafficClass(); + } + + @Override + public boolean isBound() { + return delegate.isBound(); + } + + @Override + public boolean isClosed() { + return delegate.isClosed(); + } + + @Override + public boolean isConnected() { + return delegate.isConnected(); + } + + @Override + public boolean isInputShutdown() { + return delegate.isInputShutdown(); + } + + @Override + public boolean isOutputShutdown() { + return delegate.isOutputShutdown(); + } + + @Override + public void sendUrgentData(int value) throws IOException { + delegate.sendUrgentData(value); + } + + @Override + public void setKeepAlive(boolean keepAlive) throws SocketException { + delegate.setKeepAlive(keepAlive); + } + + @Override + public void setOOBInline(boolean oobinline) throws SocketException { + delegate.setOOBInline(oobinline); + } + + @Override + public void setPerformancePreferences(int connectionTime, int latency, int bandwidth) { + delegate.setPerformancePreferences(connectionTime, + latency, bandwidth); + } + + @Override + public synchronized void setReceiveBufferSize(int size) throws SocketException { + delegate.setReceiveBufferSize(size); + } + + @Override + public void setReuseAddress(boolean reuse) throws SocketException { + delegate.setReuseAddress(reuse); + } + + @Override + public synchronized void setSendBufferSize(int size) throws SocketException { + delegate.setSendBufferSize(size); + } + + @Override + public void setSoLinger(boolean on, int timeout) throws SocketException { + delegate.setSoLinger(on, timeout); + } + + @Override + public synchronized void setSoTimeout(int timeout) throws SocketException { + delegate.setSoTimeout(timeout); + } + + @Override + public void setTcpNoDelay(boolean on) throws SocketException { + delegate.setTcpNoDelay(on); + } + + @Override + public void setTrafficClass(int value) throws SocketException { + delegate.setTrafficClass(value); + } + + @Override + public void shutdownInput() throws IOException { + delegate.shutdownInput(); + } + + @Override + public void shutdownOutput() throws IOException { + delegate.shutdownOutput(); + } + + // inspired by https://github.com/k9mail/k-9/commit/54f9fd36a77423a55f63fbf9b1bcea055a239768 + + public DelegateSSLSocket setHostname(String host) { + try { + delegate + .getClass() + .getMethod("setHostname", String.class) + .invoke(delegate, host); + } + catch (Exception e) { + throw new IllegalStateException("Could not enable SNI", e); + } + + return(this); + } + + @Override + public String toString() { + return delegate.toString(); + } + + @Override + public boolean equals(Object o) { + return delegate.equals(o); + } + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/OrbotHelper.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/proxy/OrbotHelper.java similarity index 96% rename from app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/OrbotHelper.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/proxy/OrbotHelper.java index 6a191375..ace9ed05 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/OrbotHelper.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/proxy/OrbotHelper.java @@ -1,700 +1,700 @@ -/* - * Copyright 2014-2016 Hans-Christoph Steiner - * Copyright 2012-2016 Nathan Freitas - * Portions Copyright (c) 2016 CommonsWare, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.darkweb.genesissearchengine.libs.netcipher.proxy; - -import android.app.Activity; -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.content.pm.PackageManager; -import android.content.pm.ResolveInfo; -import android.net.Uri; -import android.os.Handler; -import android.os.Looper; -import android.text.TextUtils; -import android.util.Log; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.WeakHashMap; - -/** - * Utility class to simplify setting up a proxy connection - * to Orbot. - * - * If you are using classes in the info.guardianproject.netcipher.client - * package, call OrbotHelper.get(this).init(); from onCreate() - * of a custom Application subclass, or from some other guaranteed - * entry point to your app. At that point, the - * info.guardianproject.netcipher.client classes will be ready - * for use. - */ -public class OrbotHelper implements ProxyHelper { - - private final static int REQUEST_CODE_STATUS = 100; - - public final static String ORBOT_PACKAGE_NAME = "org.torproject.android"; - public final static String ORBOT_MARKET_URI = "market://details?id=" + ORBOT_PACKAGE_NAME; - public final static String ORBOT_FDROID_URI = "https://f-droid.org/repository/browse/?fdid=" - + ORBOT_PACKAGE_NAME; - public final static String ORBOT_PLAY_URI = "https://play.google.com/store/apps/details?id=" - + ORBOT_PACKAGE_NAME; - - /** - * A request to Orbot to transparently start Tor services - */ - public final static String ACTION_START = "org.torproject.android.intent.action.START"; - - /** - * {@link Intent} send by Orbot with {@code ON/OFF/STARTING/STOPPING} status - * included as an {@link #EXTRA_STATUS} {@code String}. Your app should - * always receive {@code ACTION_STATUS Intent}s since any other app could - * start Orbot. Also, user-triggered starts and stops will also cause - * {@code ACTION_STATUS Intent}s to be broadcast. - */ - public final static String ACTION_STATUS = "org.torproject.android.intent.action.STATUS"; - - /** - * {@code String} that contains a status constant: {@link #STATUS_ON}, - * {@link #STATUS_OFF}, {@link #STATUS_STARTING}, or - * {@link #STATUS_STOPPING} - */ - public final static String EXTRA_STATUS = "org.torproject.android.intent.extra.STATUS"; - /** - * A {@link String} {@code packageName} for Orbot to direct its status reply - * to, used in {@link #ACTION_START} {@link Intent}s sent to Orbot - */ - public final static String EXTRA_PACKAGE_NAME = "org.torproject.android.intent.extra.PACKAGE_NAME"; - - public final static String EXTRA_PROXY_PORT_HTTP = "org.torproject.android.intent.extra.HTTP_PROXY_PORT"; - public final static String EXTRA_PROXY_PORT_SOCKS = "org.torproject.android.intent.extra.SOCKS_PROXY_PORT"; - - - /** - * All tor-related services and daemons are stopped - */ - public final static String STATUS_OFF = "OFF"; - /** - * All tor-related services and daemons have completed starting - */ - public final static String STATUS_ON = "ON"; - public final static String STATUS_STARTING = "STARTING"; - public final static String STATUS_STOPPING = "STOPPING"; - /** - * The user has disabled the ability for background starts triggered by - * apps. Fallback to the old Intent that brings up Orbot. - */ - public final static String STATUS_STARTS_DISABLED = "STARTS_DISABLED"; - - public final static String ACTION_START_TOR = "org.torproject.android.START_TOR"; - public final static String ACTION_REQUEST_HS = "org.torproject.android.REQUEST_HS_PORT"; - public final static int START_TOR_RESULT = 0x9234; - public final static int HS_REQUEST_CODE = 9999; - - -/* - private OrbotHelper() { - // only static utility methods, do not instantiate - } -*/ - - /** - * Test whether a {@link URL} is a Tor Hidden Service host name, also known - * as an ".onion address". - * - * @return whether the host name is a Tor .onion address - */ - public static boolean isOnionAddress(URL url) { - return url.getHost().endsWith(".onion"); - } - - /** - * Test whether a URL {@link String} is a Tor Hidden Service host name, also known - * as an ".onion address". - * - * @return whether the host name is a Tor .onion address - */ - public static boolean isOnionAddress(String urlString) { - try { - return isOnionAddress(new URL(urlString)); - } catch (MalformedURLException e) { - return false; - } - } - - /** - * Test whether a {@link Uri} is a Tor Hidden Service host name, also known - * as an ".onion address". - * - * @return whether the host name is a Tor .onion address - */ - public static boolean isOnionAddress(Uri uri) { - return uri.getHost().endsWith(".onion"); - } - - /** - * Check if the tor process is running. This method is very - * brittle, and is therefore deprecated in favor of using the - * {@link #ACTION_STATUS} {@code Intent} along with the - * {@link #requestStartTor(Context)} method. - */ - @Deprecated - public static boolean isOrbotRunning(Context context) { - int procId = TorServiceUtils.findProcessId(context); - - return (procId != -1); - } - - public static boolean isOrbotInstalled(Context context) { - return isAppInstalled(context, ORBOT_PACKAGE_NAME); - } - - private static boolean isAppInstalled(Context context, String uri) { - try { - PackageManager pm = context.getPackageManager(); - pm.getPackageInfo(uri, PackageManager.GET_ACTIVITIES); - return true; - } catch (PackageManager.NameNotFoundException e) { - return false; - } - } - - public static void requestHiddenServiceOnPort(Activity activity, int port) { - Intent intent = new Intent(ACTION_REQUEST_HS); - intent.setPackage(ORBOT_PACKAGE_NAME); - intent.putExtra("hs_port", port); - - activity.startActivityForResult(intent, HS_REQUEST_CODE); - } - - /** - * First, checks whether Orbot is installed. If Orbot is installed, then a - * broadcast {@link Intent} is sent to request Orbot to start - * transparently in the background. When Orbot receives this {@code - * Intent}, it will immediately reply to the app that called this method - * with an {@link #ACTION_STATUS} {@code Intent} that is broadcast to the - * {@code packageName} of the provided {@link Context} (i.e. {@link - * Context#getPackageName()}. - *

- * That reply {@link #ACTION_STATUS} {@code Intent} could say that the user - * has disabled background starts with the status - * {@link #STATUS_STARTS_DISABLED}. That means that Orbot ignored this - * request. To directly prompt the user to start Tor, use - * {@link #requestShowOrbotStart(Activity)}, which will bring up - * Orbot itself for the user to manually start Tor. Orbot always broadcasts - * it's status, so your app will receive those no matter how Tor gets - * started. - * - * @param context the app {@link Context} will receive the reply - * @return whether the start request was sent to Orbot - * @see #requestShowOrbotStart(Activity activity) - */ - public static boolean requestStartTor(Context context) { - if (OrbotHelper.isOrbotInstalled(context)) { - Log.i("OrbotHelper", "requestStartTor " + context.getPackageName()); - Intent intent = getOrbotStartIntent(context); - context.sendBroadcast(intent); - return true; - } - return false; - } - - /** - * Gets an {@link Intent} for starting Orbot. Orbot will reply with the - * current status to the {@code packageName} of the app in the provided - * {@link Context} (i.e. {@link Context#getPackageName()}. - */ - public static Intent getOrbotStartIntent(Context context) { - Intent intent = new Intent(ACTION_START); - intent.setPackage(ORBOT_PACKAGE_NAME); - intent.putExtra(EXTRA_PACKAGE_NAME, context.getPackageName()); - return intent; - } - - /** - * Gets a barebones {@link Intent} for starting Orbot. This is deprecated - * in favor of {@link #getOrbotStartIntent(Context)}. - */ - @Deprecated - public static Intent getOrbotStartIntent() { - Intent intent = new Intent(ACTION_START); - intent.setPackage(ORBOT_PACKAGE_NAME); - return intent; - } - - /** - * First, checks whether Orbot is installed, then checks whether Orbot is - * running. If Orbot is installed and not running, then an {@link Intent} is - * sent to request the user to start Orbot, which will show the main Orbot screen. - * The result will be returned in - * {@link Activity#onActivityResult(int requestCode, int resultCode, Intent data)} - * with a {@code requestCode} of {@code START_TOR_RESULT} - *

- * Orbot will also always broadcast the status of starting Tor via the - * {@link #ACTION_STATUS} Intent, no matter how it is started. - * - * @param activity the {@code Activity} that gets the result of the - * {@link #START_TOR_RESULT} request - * @return whether the start request was sent to Orbot - * @see #requestStartTor(Context context) - */ - public static boolean requestShowOrbotStart(Activity activity) { - if (OrbotHelper.isOrbotInstalled(activity)) { - if (!OrbotHelper.isOrbotRunning(activity)) { - Intent intent = getShowOrbotStartIntent(); - activity.startActivityForResult(intent, START_TOR_RESULT); - return true; - } - } - return false; - } - - public static Intent getShowOrbotStartIntent() { - Intent intent = new Intent(ACTION_START_TOR); - intent.setPackage(ORBOT_PACKAGE_NAME); - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - return intent; - } - - public static Intent getOrbotInstallIntent(Context context) { - final Intent intent = new Intent(Intent.ACTION_VIEW); - intent.setData(Uri.parse(ORBOT_MARKET_URI)); - - PackageManager pm = context.getPackageManager(); - List resInfos = pm.queryIntentActivities(intent, 0); - - String foundPackageName = null; - for (ResolveInfo r : resInfos) { - Log.i("OrbotHelper", "market: " + r.activityInfo.packageName); - if (TextUtils.equals(r.activityInfo.packageName, FDROID_PACKAGE_NAME) - || TextUtils.equals(r.activityInfo.packageName, PLAY_PACKAGE_NAME)) { - foundPackageName = r.activityInfo.packageName; - break; - } - } - - if (foundPackageName == null) { - intent.setData(Uri.parse(ORBOT_FDROID_URI)); - } else { - intent.setPackage(foundPackageName); - } - return intent; - } - - @Override - public boolean isInstalled(Context context) { - return isOrbotInstalled(context); - } - - @Override - public void requestStatus(Context context) { - isOrbotRunning(context); - } - - @Override - public boolean requestStart(Context context) { - return requestStartTor(context); - } - - @Override - public Intent getInstallIntent(Context context) { - return getOrbotInstallIntent(context); - } - - @Override - public Intent getStartIntent(Context context) { - return getOrbotStartIntent(); - } - - @Override - public String getName() { - return "Orbot"; - } - - /* MLM additions */ - - private final Context ctxt; - private final Handler handler; - private boolean isInstalled=false; - private Intent lastStatusIntent=null; - private Set statusCallbacks= - newSetFromMap(new WeakHashMap()); - private Set installCallbacks= - newSetFromMap(new WeakHashMap()); - private long statusTimeoutMs=30000L; - private long installTimeoutMs=60000L; - private boolean validateOrbot=true; - - abstract public static class SimpleStatusCallback - implements StatusCallback { - @Override - public void onEnabled(Intent statusIntent) { - // no-op; extend and override if needed - } - - @Override - public void onStarting() { - // no-op; extend and override if needed - } - - @Override - public void onStopping() { - // no-op; extend and override if needed - } - - @Override - public void onDisabled() { - // no-op; extend and override if needed - } - - @Override - public void onNotYetInstalled() { - // no-op; extend and override if needed - } - } - - /** - * Callback interface used for reporting the results of an - * attempt to install Orbot - */ - public interface InstallCallback { - void onInstalled(); - void onInstallTimeout(); - } - - private static volatile OrbotHelper INSTANCE; - - /** - * Retrieves the singleton, initializing if if needed - * - * @param ctxt any Context will do, as we will hold onto - * the Application - * @return the singleton - */ - synchronized public static OrbotHelper get(Context ctxt) { - if (INSTANCE==null) { - INSTANCE=new OrbotHelper(ctxt); - } - - return(INSTANCE); - } - - /** - * Standard constructor - * - * @param ctxt any Context will do; OrbotInitializer will hold - * onto the Application context - */ - private OrbotHelper(Context ctxt) { - this.ctxt=ctxt.getApplicationContext(); - this.handler=new Handler(Looper.getMainLooper()); - } - - /** - * Adds a StatusCallback to be called when we find out that - * Orbot is ready. If Orbot is ready for use, your callback - * will be called with onEnabled() immediately, before this - * method returns. - * - * @param cb a callback - * @return the singleton, for chaining - */ - public OrbotHelper addStatusCallback(StatusCallback cb) { - statusCallbacks.add(cb); - - if (lastStatusIntent!=null) { - String status= - lastStatusIntent.getStringExtra(OrbotHelper.EXTRA_STATUS); - - if (status.equals(OrbotHelper.STATUS_ON)) { - cb.onEnabled(lastStatusIntent); - } - } - - return(this); - } - - /** - * Removes an existing registered StatusCallback. - * - * @param cb the callback to remove - * @return the singleton, for chaining - */ - public OrbotHelper removeStatusCallback(StatusCallback cb) { - statusCallbacks.remove(cb); - - return(this); - } - - - /** - * Adds an InstallCallback to be called when we find out that - * Orbot is installed - * - * @param cb a callback - * @return the singleton, for chaining - */ - public OrbotHelper addInstallCallback(InstallCallback cb) { - installCallbacks.add(cb); - - return(this); - } - - /** - * Removes an existing registered InstallCallback. - * - * @param cb the callback to remove - * @return the singleton, for chaining - */ - public OrbotHelper removeInstallCallback(InstallCallback cb) { - installCallbacks.remove(cb); - - return(this); - } - - /** - * Sets how long of a delay, in milliseconds, after trying - * to get a status from Orbot before we give up. - * Defaults to 30000ms = 30 seconds = 0.000347222 days - * - * @param timeoutMs delay period in milliseconds - * @return the singleton, for chaining - */ - public OrbotHelper statusTimeout(long timeoutMs) { - statusTimeoutMs=timeoutMs; - - return(this); - } - - /** - * Sets how long of a delay, in milliseconds, after trying - * to install Orbot do we assume that it's not happening. - * Defaults to 60000ms = 60 seconds = 1 minute = 1.90259e-6 years - * - * @param timeoutMs delay period in milliseconds - * @return the singleton, for chaining - */ - public OrbotHelper installTimeout(long timeoutMs) { - installTimeoutMs=timeoutMs; - - return(this); - } - - /** - * By default, NetCipher ensures that the Orbot on the - * device is one of the official builds. Call this method - * to skip that validation. Mostly, this is for developers - * who have their own custom Orbot builds (e.g., for - * dedicated hardware). - * - * @return the singleton, for chaining - */ - public OrbotHelper skipOrbotValidation() { - validateOrbot=false; - - return(this); - } - - /** - * @return true if Orbot is installed (the last time we checked), - * false otherwise - */ - public boolean isInstalled() { - return(isInstalled); - } - - /** - * Initializes the connection to Orbot, revalidating that it - * is installed and requesting fresh status broadcasts. - * - * @return true if initialization is proceeding, false if - * Orbot is not installed - */ - public boolean init() { - Intent orbot=OrbotHelper.getOrbotStartIntent(ctxt); - - if (validateOrbot) { - ArrayList hashes=new ArrayList(); - - hashes.add("A4:54:B8:7A:18:47:A8:9E:D7:F5:E7:0F:BA:6B:BA:96:F3:EF:29:C2:6E:09:81:20:4F:E3:47:BF:23:1D:FD:5B"); - hashes.add("A7:02:07:92:4F:61:FF:09:37:1D:54:84:14:5C:4B:EE:77:2C:55:C1:9E:EE:23:2F:57:70:E1:82:71:F7:CB:AE"); - - orbot= - SignatureUtils.validateBroadcastIntent(ctxt, orbot, - hashes, false); - } - - if (orbot!=null) { - isInstalled=true; - handler.postDelayed(onStatusTimeout, statusTimeoutMs); - ctxt.registerReceiver(orbotStatusReceiver, - new IntentFilter(OrbotHelper.ACTION_STATUS)); - ctxt.sendBroadcast(orbot); - } - else { - isInstalled=false; - - for (StatusCallback cb : statusCallbacks) { - cb.onNotYetInstalled(); - } - } - - return(isInstalled); - } - - /** - * Given that init() returned false, calling installOrbot() - * will trigger an attempt to install Orbot from an available - * distribution channel (e.g., the Play Store). Only call this - * if the user is expecting it, such as in response to tapping - * a dialog button or an action bar item. - * - * Note that installation may take a long time, even if - * the user is proceeding with the installation, due to network - * speeds, waiting for user input, and so on. Either specify - * a long timeout, or consider the timeout to be merely advisory - * and use some other user input to cause you to try - * init() again after, presumably, Orbot has been installed - * and configured by the user. - * - * If the user does install Orbot, we will attempt init() - * again automatically. Hence, you will probably need user input - * to tell you when the user has gotten Orbot up and going. - * - * @param host the Activity that is triggering this work - */ - public void installOrbot(Activity host) { - handler.postDelayed(onInstallTimeout, installTimeoutMs); - - IntentFilter filter= - new IntentFilter(Intent.ACTION_PACKAGE_ADDED); - - filter.addDataScheme("package"); - - ctxt.registerReceiver(orbotInstallReceiver, filter); - host.startActivity(OrbotHelper.getOrbotInstallIntent(ctxt)); - } - - private BroadcastReceiver orbotStatusReceiver=new BroadcastReceiver() { - @Override - public void onReceive(Context ctxt, Intent intent) { - if (TextUtils.equals(intent.getAction(), - OrbotHelper.ACTION_STATUS)) { - String status=intent.getStringExtra(OrbotHelper.EXTRA_STATUS); - - if (status.equals(OrbotHelper.STATUS_ON)) { - lastStatusIntent=intent; - handler.removeCallbacks(onStatusTimeout); - - for (StatusCallback cb : statusCallbacks) { - cb.onEnabled(intent); - } - } - else if (status.equals(OrbotHelper.STATUS_OFF)) { - for (StatusCallback cb : statusCallbacks) { - cb.onDisabled(); - } - } - else if (status.equals(OrbotHelper.STATUS_STARTING)) { - for (StatusCallback cb : statusCallbacks) { - cb.onStarting(); - } - } - else if (status.equals(OrbotHelper.STATUS_STOPPING)) { - for (StatusCallback cb : statusCallbacks) { - cb.onStopping(); - } - } - } - } - }; - - private Runnable onStatusTimeout=new Runnable() { - @Override - public void run() { - ctxt.unregisterReceiver(orbotStatusReceiver); - - for (StatusCallback cb : statusCallbacks) { - cb.onStatusTimeout(); - } - } - }; - - private BroadcastReceiver orbotInstallReceiver=new BroadcastReceiver() { - @Override - public void onReceive(Context ctxt, Intent intent) { - if (TextUtils.equals(intent.getAction(), - Intent.ACTION_PACKAGE_ADDED)) { - String pkgName=intent.getData().getEncodedSchemeSpecificPart(); - - if (OrbotHelper.ORBOT_PACKAGE_NAME.equals(pkgName)) { - isInstalled=true; - handler.removeCallbacks(onInstallTimeout); - ctxt.unregisterReceiver(orbotInstallReceiver); - - for (InstallCallback cb : installCallbacks) { - cb.onInstalled(); - } - - init(); - } - } - } - }; - - private Runnable onInstallTimeout=new Runnable() { - @Override - public void run() { - ctxt.unregisterReceiver(orbotInstallReceiver); - - for (InstallCallback cb : installCallbacks) { - cb.onInstallTimeout(); - } - } - }; - - /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - static Set newSetFromMap(Map map) { - if (map.isEmpty()) { - return new SetFromMap(map); - } - throw new IllegalArgumentException("map not empty"); - } -} +/* + * Copyright 2014-2016 Hans-Christoph Steiner + * Copyright 2012-2016 Nathan Freitas + * Portions Copyright (c) 2016 CommonsWare, LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.hiddenservices.genesissearchengine.production.libs.netcipher.proxy; + +import android.app.Activity; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.content.pm.PackageManager; +import android.content.pm.ResolveInfo; +import android.net.Uri; +import android.os.Handler; +import android.os.Looper; +import android.text.TextUtils; +import android.util.Log; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.WeakHashMap; + +/** + * Utility class to simplify setting up a proxy connection + * to Orbot. + * + * If you are using classes in the info.guardianproject.netcipher.client + * package, call OrbotHelper.get(this).init(); from onCreate() + * of a custom Application subclass, or from some other guaranteed + * entry point to your app. At that point, the + * info.guardianproject.netcipher.client classes will be ready + * for use. + */ +public class OrbotHelper implements ProxyHelper { + + private final static int REQUEST_CODE_STATUS = 100; + + public final static String ORBOT_PACKAGE_NAME = "org.torproject.android"; + public final static String ORBOT_MARKET_URI = "market://details?id=" + ORBOT_PACKAGE_NAME; + public final static String ORBOT_FDROID_URI = "https://f-droid.org/repository/browse/?fdid=" + + ORBOT_PACKAGE_NAME; + public final static String ORBOT_PLAY_URI = "https://play.google.com/store/apps/details?id=" + + ORBOT_PACKAGE_NAME; + + /** + * A request to Orbot to transparently start Tor services + */ + public final static String ACTION_START = "org.torproject.android.intent.action.START"; + + /** + * {@link Intent} send by Orbot with {@code ON/OFF/STARTING/STOPPING} status + * included as an {@link #EXTRA_STATUS} {@code String}. Your app should + * always receive {@code ACTION_STATUS Intent}s since any other app could + * start Orbot. Also, user-triggered starts and stops will also cause + * {@code ACTION_STATUS Intent}s to be broadcast. + */ + public final static String ACTION_STATUS = "org.torproject.android.intent.action.STATUS"; + + /** + * {@code String} that contains a status constant: {@link #STATUS_ON}, + * {@link #STATUS_OFF}, {@link #STATUS_STARTING}, or + * {@link #STATUS_STOPPING} + */ + public final static String EXTRA_STATUS = "org.torproject.android.intent.extra.STATUS"; + /** + * A {@link String} {@code packageName} for Orbot to direct its status reply + * to, used in {@link #ACTION_START} {@link Intent}s sent to Orbot + */ + public final static String EXTRA_PACKAGE_NAME = "org.torproject.android.intent.extra.PACKAGE_NAME"; + + public final static String EXTRA_PROXY_PORT_HTTP = "org.torproject.android.intent.extra.HTTP_PROXY_PORT"; + public final static String EXTRA_PROXY_PORT_SOCKS = "org.torproject.android.intent.extra.SOCKS_PROXY_PORT"; + + + /** + * All tor-related services and daemons are stopped + */ + public final static String STATUS_OFF = "OFF"; + /** + * All tor-related services and daemons have completed starting + */ + public final static String STATUS_ON = "ON"; + public final static String STATUS_STARTING = "STARTING"; + public final static String STATUS_STOPPING = "STOPPING"; + /** + * The user has disabled the ability for background starts triggered by + * apps. Fallback to the old Intent that brings up Orbot. + */ + public final static String STATUS_STARTS_DISABLED = "STARTS_DISABLED"; + + public final static String ACTION_START_TOR = "org.torproject.android.START_TOR"; + public final static String ACTION_REQUEST_HS = "org.torproject.android.REQUEST_HS_PORT"; + public final static int START_TOR_RESULT = 0x9234; + public final static int HS_REQUEST_CODE = 9999; + + +/* + private OrbotHelper() { + // only static utility methods, do not instantiate + } +*/ + + /** + * Test whether a {@link URL} is a Tor Hidden Service host name, also known + * as an ".onion address". + * + * @return whether the host name is a Tor .onion address + */ + public static boolean isOnionAddress(URL url) { + return url.getHost().endsWith(".onion"); + } + + /** + * Test whether a URL {@link String} is a Tor Hidden Service host name, also known + * as an ".onion address". + * + * @return whether the host name is a Tor .onion address + */ + public static boolean isOnionAddress(String urlString) { + try { + return isOnionAddress(new URL(urlString)); + } catch (MalformedURLException e) { + return false; + } + } + + /** + * Test whether a {@link Uri} is a Tor Hidden Service host name, also known + * as an ".onion address". + * + * @return whether the host name is a Tor .onion address + */ + public static boolean isOnionAddress(Uri uri) { + return uri.getHost().endsWith(".onion"); + } + + /** + * Check if the tor process is running. This method is very + * brittle, and is therefore deprecated in favor of using the + * {@link #ACTION_STATUS} {@code Intent} along with the + * {@link #requestStartTor(Context)} method. + */ + @Deprecated + public static boolean isOrbotRunning(Context context) { + int procId = TorServiceUtils.findProcessId(context); + + return (procId != -1); + } + + public static boolean isOrbotInstalled(Context context) { + return isAppInstalled(context, ORBOT_PACKAGE_NAME); + } + + private static boolean isAppInstalled(Context context, String uri) { + try { + PackageManager pm = context.getPackageManager(); + pm.getPackageInfo(uri, PackageManager.GET_ACTIVITIES); + return true; + } catch (PackageManager.NameNotFoundException e) { + return false; + } + } + + public static void requestHiddenServiceOnPort(Activity activity, int port) { + Intent intent = new Intent(ACTION_REQUEST_HS); + intent.setPackage(ORBOT_PACKAGE_NAME); + intent.putExtra("hs_port", port); + + activity.startActivityForResult(intent, HS_REQUEST_CODE); + } + + /** + * First, checks whether Orbot is installed. If Orbot is installed, then a + * broadcast {@link Intent} is sent to request Orbot to start + * transparently in the background. When Orbot receives this {@code + * Intent}, it will immediately reply to the app that called this method + * with an {@link #ACTION_STATUS} {@code Intent} that is broadcast to the + * {@code packageName} of the provided {@link Context} (i.e. {@link + * Context#getPackageName()}. + *

+ * That reply {@link #ACTION_STATUS} {@code Intent} could say that the user + * has disabled background starts with the status + * {@link #STATUS_STARTS_DISABLED}. That means that Orbot ignored this + * request. To directly prompt the user to start Tor, use + * {@link #requestShowOrbotStart(Activity)}, which will bring up + * Orbot itself for the user to manually start Tor. Orbot always broadcasts + * it's status, so your app will receive those no matter how Tor gets + * started. + * + * @param context the app {@link Context} will receive the reply + * @return whether the start request was sent to Orbot + * @see #requestShowOrbotStart(Activity activity) + */ + public static boolean requestStartTor(Context context) { + if (OrbotHelper.isOrbotInstalled(context)) { + Log.i("OrbotHelper", "requestStartTor " + context.getPackageName()); + Intent intent = getOrbotStartIntent(context); + context.sendBroadcast(intent); + return true; + } + return false; + } + + /** + * Gets an {@link Intent} for starting Orbot. Orbot will reply with the + * current status to the {@code packageName} of the app in the provided + * {@link Context} (i.e. {@link Context#getPackageName()}. + */ + public static Intent getOrbotStartIntent(Context context) { + Intent intent = new Intent(ACTION_START); + intent.setPackage(ORBOT_PACKAGE_NAME); + intent.putExtra(EXTRA_PACKAGE_NAME, context.getPackageName()); + return intent; + } + + /** + * Gets a barebones {@link Intent} for starting Orbot. This is deprecated + * in favor of {@link #getOrbotStartIntent(Context)}. + */ + @Deprecated + public static Intent getOrbotStartIntent() { + Intent intent = new Intent(ACTION_START); + intent.setPackage(ORBOT_PACKAGE_NAME); + return intent; + } + + /** + * First, checks whether Orbot is installed, then checks whether Orbot is + * running. If Orbot is installed and not running, then an {@link Intent} is + * sent to request the user to start Orbot, which will show the main Orbot screen. + * The result will be returned in + * {@link Activity#onActivityResult(int requestCode, int resultCode, Intent data)} + * with a {@code requestCode} of {@code START_TOR_RESULT} + *

+ * Orbot will also always broadcast the status of starting Tor via the + * {@link #ACTION_STATUS} Intent, no matter how it is started. + * + * @param activity the {@code Activity} that gets the result of the + * {@link #START_TOR_RESULT} request + * @return whether the start request was sent to Orbot + * @see #requestStartTor(Context context) + */ + public static boolean requestShowOrbotStart(Activity activity) { + if (OrbotHelper.isOrbotInstalled(activity)) { + if (!OrbotHelper.isOrbotRunning(activity)) { + Intent intent = getShowOrbotStartIntent(); + activity.startActivityForResult(intent, START_TOR_RESULT); + return true; + } + } + return false; + } + + public static Intent getShowOrbotStartIntent() { + Intent intent = new Intent(ACTION_START_TOR); + intent.setPackage(ORBOT_PACKAGE_NAME); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + return intent; + } + + public static Intent getOrbotInstallIntent(Context context) { + final Intent intent = new Intent(Intent.ACTION_VIEW); + intent.setData(Uri.parse(ORBOT_MARKET_URI)); + + PackageManager pm = context.getPackageManager(); + List resInfos = pm.queryIntentActivities(intent, 0); + + String foundPackageName = null; + for (ResolveInfo r : resInfos) { + Log.i("OrbotHelper", "market: " + r.activityInfo.packageName); + if (TextUtils.equals(r.activityInfo.packageName, FDROID_PACKAGE_NAME) + || TextUtils.equals(r.activityInfo.packageName, PLAY_PACKAGE_NAME)) { + foundPackageName = r.activityInfo.packageName; + break; + } + } + + if (foundPackageName == null) { + intent.setData(Uri.parse(ORBOT_FDROID_URI)); + } else { + intent.setPackage(foundPackageName); + } + return intent; + } + + @Override + public boolean isInstalled(Context context) { + return isOrbotInstalled(context); + } + + @Override + public void requestStatus(Context context) { + isOrbotRunning(context); + } + + @Override + public boolean requestStart(Context context) { + return requestStartTor(context); + } + + @Override + public Intent getInstallIntent(Context context) { + return getOrbotInstallIntent(context); + } + + @Override + public Intent getStartIntent(Context context) { + return getOrbotStartIntent(); + } + + @Override + public String getName() { + return "Orbot"; + } + + /* MLM additions */ + + private final Context ctxt; + private final Handler handler; + private boolean isInstalled=false; + private Intent lastStatusIntent=null; + private Set statusCallbacks= + newSetFromMap(new WeakHashMap()); + private Set installCallbacks= + newSetFromMap(new WeakHashMap()); + private long statusTimeoutMs=30000L; + private long installTimeoutMs=60000L; + private boolean validateOrbot=true; + + abstract public static class SimpleStatusCallback + implements StatusCallback { + @Override + public void onEnabled(Intent statusIntent) { + // no-op; extend and override if needed + } + + @Override + public void onStarting() { + // no-op; extend and override if needed + } + + @Override + public void onStopping() { + // no-op; extend and override if needed + } + + @Override + public void onDisabled() { + // no-op; extend and override if needed + } + + @Override + public void onNotYetInstalled() { + // no-op; extend and override if needed + } + } + + /** + * Callback interface used for reporting the results of an + * attempt to install Orbot + */ + public interface InstallCallback { + void onInstalled(); + void onInstallTimeout(); + } + + private static volatile OrbotHelper INSTANCE; + + /** + * Retrieves the singleton, initializing if if needed + * + * @param ctxt any Context will do, as we will hold onto + * the Application + * @return the singleton + */ + synchronized public static OrbotHelper get(Context ctxt) { + if (INSTANCE==null) { + INSTANCE=new OrbotHelper(ctxt); + } + + return(INSTANCE); + } + + /** + * Standard constructor + * + * @param ctxt any Context will do; OrbotInitializer will hold + * onto the Application context + */ + private OrbotHelper(Context ctxt) { + this.ctxt=ctxt.getApplicationContext(); + this.handler=new Handler(Looper.getMainLooper()); + } + + /** + * Adds a StatusCallback to be called when we find out that + * Orbot is ready. If Orbot is ready for use, your callback + * will be called with onEnabled() immediately, before this + * method returns. + * + * @param cb a callback + * @return the singleton, for chaining + */ + public OrbotHelper addStatusCallback(StatusCallback cb) { + statusCallbacks.add(cb); + + if (lastStatusIntent!=null) { + String status= + lastStatusIntent.getStringExtra(OrbotHelper.EXTRA_STATUS); + + if (status.equals(OrbotHelper.STATUS_ON)) { + cb.onEnabled(lastStatusIntent); + } + } + + return(this); + } + + /** + * Removes an existing registered StatusCallback. + * + * @param cb the callback to remove + * @return the singleton, for chaining + */ + public OrbotHelper removeStatusCallback(StatusCallback cb) { + statusCallbacks.remove(cb); + + return(this); + } + + + /** + * Adds an InstallCallback to be called when we find out that + * Orbot is installed + * + * @param cb a callback + * @return the singleton, for chaining + */ + public OrbotHelper addInstallCallback(InstallCallback cb) { + installCallbacks.add(cb); + + return(this); + } + + /** + * Removes an existing registered InstallCallback. + * + * @param cb the callback to remove + * @return the singleton, for chaining + */ + public OrbotHelper removeInstallCallback(InstallCallback cb) { + installCallbacks.remove(cb); + + return(this); + } + + /** + * Sets how long of a delay, in milliseconds, after trying + * to get a status from Orbot before we give up. + * Defaults to 30000ms = 30 seconds = 0.000347222 days + * + * @param timeoutMs delay period in milliseconds + * @return the singleton, for chaining + */ + public OrbotHelper statusTimeout(long timeoutMs) { + statusTimeoutMs=timeoutMs; + + return(this); + } + + /** + * Sets how long of a delay, in milliseconds, after trying + * to install Orbot do we assume that it's not happening. + * Defaults to 60000ms = 60 seconds = 1 minute = 1.90259e-6 years + * + * @param timeoutMs delay period in milliseconds + * @return the singleton, for chaining + */ + public OrbotHelper installTimeout(long timeoutMs) { + installTimeoutMs=timeoutMs; + + return(this); + } + + /** + * By default, NetCipher ensures that the Orbot on the + * device is one of the official builds. Call this method + * to skip that validation. Mostly, this is for developers + * who have their own custom Orbot builds (e.g., for + * dedicated hardware). + * + * @return the singleton, for chaining + */ + public OrbotHelper skipOrbotValidation() { + validateOrbot=false; + + return(this); + } + + /** + * @return true if Orbot is installed (the last time we checked), + * false otherwise + */ + public boolean isInstalled() { + return(isInstalled); + } + + /** + * Initializes the connection to Orbot, revalidating that it + * is installed and requesting fresh status broadcasts. + * + * @return true if initialization is proceeding, false if + * Orbot is not installed + */ + public boolean init() { + Intent orbot=OrbotHelper.getOrbotStartIntent(ctxt); + + if (validateOrbot) { + ArrayList hashes=new ArrayList(); + + hashes.add("A4:54:B8:7A:18:47:A8:9E:D7:F5:E7:0F:BA:6B:BA:96:F3:EF:29:C2:6E:09:81:20:4F:E3:47:BF:23:1D:FD:5B"); + hashes.add("A7:02:07:92:4F:61:FF:09:37:1D:54:84:14:5C:4B:EE:77:2C:55:C1:9E:EE:23:2F:57:70:E1:82:71:F7:CB:AE"); + + orbot= + SignatureUtils.validateBroadcastIntent(ctxt, orbot, + hashes, false); + } + + if (orbot!=null) { + isInstalled=true; + handler.postDelayed(onStatusTimeout, statusTimeoutMs); + ctxt.registerReceiver(orbotStatusReceiver, + new IntentFilter(OrbotHelper.ACTION_STATUS)); + ctxt.sendBroadcast(orbot); + } + else { + isInstalled=false; + + for (StatusCallback cb : statusCallbacks) { + cb.onNotYetInstalled(); + } + } + + return(isInstalled); + } + + /** + * Given that init() returned false, calling installOrbot() + * will trigger an attempt to install Orbot from an available + * distribution channel (e.g., the Play Store). Only call this + * if the user is expecting it, such as in response to tapping + * a dialog button or an action bar item. + * + * Note that installation may take a long time, even if + * the user is proceeding with the installation, due to network + * speeds, waiting for user input, and so on. Either specify + * a long timeout, or consider the timeout to be merely advisory + * and use some other user input to cause you to try + * init() again after, presumably, Orbot has been installed + * and configured by the user. + * + * If the user does install Orbot, we will attempt init() + * again automatically. Hence, you will probably need user input + * to tell you when the user has gotten Orbot up and going. + * + * @param host the Activity that is triggering this work + */ + public void installOrbot(Activity host) { + handler.postDelayed(onInstallTimeout, installTimeoutMs); + + IntentFilter filter= + new IntentFilter(Intent.ACTION_PACKAGE_ADDED); + + filter.addDataScheme("package"); + + ctxt.registerReceiver(orbotInstallReceiver, filter); + host.startActivity(OrbotHelper.getOrbotInstallIntent(ctxt)); + } + + private BroadcastReceiver orbotStatusReceiver=new BroadcastReceiver() { + @Override + public void onReceive(Context ctxt, Intent intent) { + if (TextUtils.equals(intent.getAction(), + OrbotHelper.ACTION_STATUS)) { + String status=intent.getStringExtra(OrbotHelper.EXTRA_STATUS); + + if (status.equals(OrbotHelper.STATUS_ON)) { + lastStatusIntent=intent; + handler.removeCallbacks(onStatusTimeout); + + for (StatusCallback cb : statusCallbacks) { + cb.onEnabled(intent); + } + } + else if (status.equals(OrbotHelper.STATUS_OFF)) { + for (StatusCallback cb : statusCallbacks) { + cb.onDisabled(); + } + } + else if (status.equals(OrbotHelper.STATUS_STARTING)) { + for (StatusCallback cb : statusCallbacks) { + cb.onStarting(); + } + } + else if (status.equals(OrbotHelper.STATUS_STOPPING)) { + for (StatusCallback cb : statusCallbacks) { + cb.onStopping(); + } + } + } + } + }; + + private Runnable onStatusTimeout=new Runnable() { + @Override + public void run() { + ctxt.unregisterReceiver(orbotStatusReceiver); + + for (StatusCallback cb : statusCallbacks) { + cb.onStatusTimeout(); + } + } + }; + + private BroadcastReceiver orbotInstallReceiver=new BroadcastReceiver() { + @Override + public void onReceive(Context ctxt, Intent intent) { + if (TextUtils.equals(intent.getAction(), + Intent.ACTION_PACKAGE_ADDED)) { + String pkgName=intent.getData().getEncodedSchemeSpecificPart(); + + if (OrbotHelper.ORBOT_PACKAGE_NAME.equals(pkgName)) { + isInstalled=true; + handler.removeCallbacks(onInstallTimeout); + ctxt.unregisterReceiver(orbotInstallReceiver); + + for (InstallCallback cb : installCallbacks) { + cb.onInstalled(); + } + + init(); + } + } + } + }; + + private Runnable onInstallTimeout=new Runnable() { + @Override + public void run() { + ctxt.unregisterReceiver(orbotInstallReceiver); + + for (InstallCallback cb : installCallbacks) { + cb.onInstallTimeout(); + } + } + }; + + /* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + static Set newSetFromMap(Map map) { + if (map.isEmpty()) { + return new SetFromMap(map); + } + throw new IllegalArgumentException("map not empty"); + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/ProxyHelper.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/proxy/ProxyHelper.java similarity index 94% rename from app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/ProxyHelper.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/proxy/ProxyHelper.java index c8a0a594..7d716e83 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/ProxyHelper.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/proxy/ProxyHelper.java @@ -1,74 +1,74 @@ -/* - * Copyright 2012-2016 Nathan Freitas - - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.darkweb.genesissearchengine.libs.netcipher.proxy; - -import android.content.Context; -import android.content.Intent; - -public interface ProxyHelper { - - public boolean isInstalled (Context context); - public void requestStatus (Context context); - public boolean requestStart (Context context); - public Intent getInstallIntent (Context context); - public Intent getStartIntent (Context context); - public String getName (); - - public final static String FDROID_PACKAGE_NAME = "org.fdroid.fdroid"; - public final static String PLAY_PACKAGE_NAME = "com.android.vending"; - - /** - * A request to Orbot to transparently start Tor services - */ - public final static String ACTION_START = "android.intent.action.PROXY_START"; - /** - * {@link Intent} send by Orbot with {@code ON/OFF/STARTING/STOPPING} status - */ - public final static String ACTION_STATUS = "android.intent.action.PROXY_STATUS"; - /** - * {@code String} that contains a status constant: {@link #STATUS_ON}, - * {@link #STATUS_OFF}, {@link #STATUS_STARTING}, or - * {@link #STATUS_STOPPING} - */ - public final static String EXTRA_STATUS = "android.intent.extra.PROXY_STATUS"; - - public final static String EXTRA_PROXY_PORT_HTTP = "android.intent.extra.PROXY_PORT_HTTP"; - public final static String EXTRA_PROXY_PORT_SOCKS = "android.intent.extra.PROXY_PORT_SOCKS"; - - /** - * A {@link String} {@code packageName} for Orbot to direct its status reply - * to, used in {@link #ACTION_START} {@link Intent}s sent to Orbot - */ - public final static String EXTRA_PACKAGE_NAME = "android.intent.extra.PROXY_PACKAGE_NAME"; - - /** - * All tor-related services and daemons are stopped - */ - public final static String STATUS_OFF = "OFF"; - /** - * All tor-related services and daemons have completed starting - */ - public final static String STATUS_ON = "ON"; - public final static String STATUS_STARTING = "STARTING"; - public final static String STATUS_STOPPING = "STOPPING"; - /** - * The user has disabled the ability for background starts triggered by - * apps. Fallback to the old Intent that brings up Orbot. - */ - public final static String STATUS_STARTS_DISABLED = "STARTS_DISABLED"; -} - +/* + * Copyright 2012-2016 Nathan Freitas + + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.hiddenservices.genesissearchengine.production.libs.netcipher.proxy; + +import android.content.Context; +import android.content.Intent; + +public interface ProxyHelper { + + public boolean isInstalled (Context context); + public void requestStatus (Context context); + public boolean requestStart (Context context); + public Intent getInstallIntent (Context context); + public Intent getStartIntent (Context context); + public String getName (); + + public final static String FDROID_PACKAGE_NAME = "org.fdroid.fdroid"; + public final static String PLAY_PACKAGE_NAME = "com.android.vending"; + + /** + * A request to Orbot to transparently start Tor services + */ + public final static String ACTION_START = "android.intent.action.PROXY_START"; + /** + * {@link Intent} send by Orbot with {@code ON/OFF/STARTING/STOPPING} status + */ + public final static String ACTION_STATUS = "android.intent.action.PROXY_STATUS"; + /** + * {@code String} that contains a status constant: {@link #STATUS_ON}, + * {@link #STATUS_OFF}, {@link #STATUS_STARTING}, or + * {@link #STATUS_STOPPING} + */ + public final static String EXTRA_STATUS = "android.intent.extra.PROXY_STATUS"; + + public final static String EXTRA_PROXY_PORT_HTTP = "android.intent.extra.PROXY_PORT_HTTP"; + public final static String EXTRA_PROXY_PORT_SOCKS = "android.intent.extra.PROXY_PORT_SOCKS"; + + /** + * A {@link String} {@code packageName} for Orbot to direct its status reply + * to, used in {@link #ACTION_START} {@link Intent}s sent to Orbot + */ + public final static String EXTRA_PACKAGE_NAME = "android.intent.extra.PROXY_PACKAGE_NAME"; + + /** + * All tor-related services and daemons are stopped + */ + public final static String STATUS_OFF = "OFF"; + /** + * All tor-related services and daemons have completed starting + */ + public final static String STATUS_ON = "ON"; + public final static String STATUS_STARTING = "STARTING"; + public final static String STATUS_STOPPING = "STOPPING"; + /** + * The user has disabled the ability for background starts triggered by + * apps. Fallback to the old Intent that brings up Orbot. + */ + public final static String STATUS_STARTS_DISABLED = "STARTS_DISABLED"; +} + diff --git a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/ProxySelector.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/proxy/ProxySelector.java similarity index 91% rename from app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/ProxySelector.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/proxy/ProxySelector.java index a0e15ef5..143b86ea 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/ProxySelector.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/proxy/ProxySelector.java @@ -1,59 +1,59 @@ -/* - * Copyright 2012-2016 Nathan Freitas - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.darkweb.genesissearchengine.libs.netcipher.proxy; - -import java.io.IOException; -import java.net.InetSocketAddress; -import java.net.Proxy; -import java.net.SocketAddress; -import java.net.URI; -import java.util.ArrayList; -import java.util.List; - -import android.util.Log; - -public class ProxySelector extends java.net.ProxySelector { - - private ArrayList listProxies; - - public ProxySelector () - { - super (); - - listProxies = new ArrayList(); - - - } - - public void addProxy (Proxy.Type type,String host, int port) - { - Proxy proxy = new Proxy(type,new InetSocketAddress(host, port)); - listProxies.add(proxy); - } - - @Override - public void connectFailed(URI uri, SocketAddress address, - IOException failure) { - Log.w("ProxySelector","could not connect to " + address.toString() + ": " + failure.getMessage()); - } - - @Override - public List select(URI uri) { - - return listProxies; - } - -} +/* + * Copyright 2012-2016 Nathan Freitas + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.hiddenservices.genesissearchengine.production.libs.netcipher.proxy; + +import java.io.IOException; +import java.net.InetSocketAddress; +import java.net.Proxy; +import java.net.SocketAddress; +import java.net.URI; +import java.util.ArrayList; +import java.util.List; + +import android.util.Log; + +public class ProxySelector extends java.net.ProxySelector { + + private ArrayList listProxies; + + public ProxySelector () + { + super (); + + listProxies = new ArrayList(); + + + } + + public void addProxy (Proxy.Type type,String host, int port) + { + Proxy proxy = new Proxy(type,new InetSocketAddress(host, port)); + listProxies.add(proxy); + } + + @Override + public void connectFailed(URI uri, SocketAddress address, + IOException failure) { + Log.w("ProxySelector","could not connect to " + address.toString() + ": " + failure.getMessage()); + } + + @Override + public List select(URI uri) { + + return listProxies; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/PsiphonHelper.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/proxy/PsiphonHelper.java similarity index 95% rename from app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/PsiphonHelper.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/proxy/PsiphonHelper.java index 8bbf26de..a2b29d36 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/PsiphonHelper.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/proxy/PsiphonHelper.java @@ -1,177 +1,177 @@ -/* - * Copyright 2012-2016 Nathan Freitas - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.darkweb.genesissearchengine.libs.netcipher.proxy; - -import java.net.ConnectException; -import java.net.InetSocketAddress; -import java.net.Socket; -import java.util.List; - -import android.content.ComponentName; -import android.content.Context; -import android.content.Intent; -import android.content.pm.PackageManager; -import android.content.pm.ResolveInfo; -import android.net.Uri; -import android.text.TextUtils; - -public class PsiphonHelper implements ProxyHelper { - - public final static String PACKAGE_NAME = "com.psiphon3"; - public final static String COMPONENT_NAME = "com.psiphon3.StatusActivity"; - - - public final static String MARKET_URI = "market://details?id=" + PACKAGE_NAME; - public final static String FDROID_URI = "https://f-droid.org/repository/browse/?fdid=" - + PACKAGE_NAME; - public final static String ORBOT_PLAY_URI = "https://play.google.com/store/apps/details?id=" - + PACKAGE_NAME; - - public final static int DEFAULT_SOCKS_PORT = 1080; - public final static int DEFAULT_HTTP_PORT = 8080; - - @Override - public boolean isInstalled(Context context) { - return isAppInstalled(context, PACKAGE_NAME); - } - - - private static boolean isAppInstalled(Context context, String uri) { - try { - PackageManager pm = context.getPackageManager(); - pm.getPackageInfo(uri, PackageManager.GET_ACTIVITIES); - return true; - } catch (PackageManager.NameNotFoundException e) { - return false; - } - } - - @Override - public void requestStatus(final Context context) { - - Thread thread = new Thread () - { - public void run () - { - //can connect to default HTTP proxy port? - boolean isSocksOpen = false; - boolean isHttpOpen = false; - - int socksPort = DEFAULT_SOCKS_PORT; - int httpPort = DEFAULT_HTTP_PORT; - - for (int i = 0; i < 10 && (!isSocksOpen); i++) - isSocksOpen = isPortOpen("127.0.0.1",socksPort++,100); - - for (int i = 0; i < 10 && (!isHttpOpen); i++) - isHttpOpen = isPortOpen("127.0.0.1",httpPort++,100); - - //any other check? - - Intent intent = new Intent(ProxyHelper.ACTION_STATUS); - intent.putExtra(EXTRA_PACKAGE_NAME, PACKAGE_NAME); - - if (isSocksOpen && isHttpOpen) - { - intent.putExtra(EXTRA_STATUS, STATUS_ON); - - intent.putExtra(EXTRA_PROXY_PORT_HTTP, httpPort-1); - intent.putExtra(EXTRA_PROXY_PORT_SOCKS, socksPort-1); - - - } - else - { - intent.putExtra(EXTRA_STATUS, STATUS_OFF); - } - - context.sendBroadcast(intent); - } - }; - - thread.start(); - - } - - @Override - public boolean requestStart(Context context) { - - Intent intent = getStartIntent(context); - // intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - context.startActivity(intent); - - return true; - } - - @Override - public Intent getInstallIntent(Context context) { - final Intent intent = new Intent(Intent.ACTION_VIEW); - intent.setData(Uri.parse(MARKET_URI)); - - PackageManager pm = context.getPackageManager(); - List resInfos = pm.queryIntentActivities(intent, 0); - - String foundPackageName = null; - for (ResolveInfo r : resInfos) { - if (TextUtils.equals(r.activityInfo.packageName, FDROID_PACKAGE_NAME) - || TextUtils.equals(r.activityInfo.packageName, PLAY_PACKAGE_NAME)) { - foundPackageName = r.activityInfo.packageName; - break; - } - } - - if (foundPackageName == null) { - intent.setData(Uri.parse(FDROID_URI)); - } else { - intent.setPackage(foundPackageName); - } - return intent; - } - - @Override - public Intent getStartIntent(Context context) { - Intent intent = new Intent(); - intent.setComponent(new ComponentName(PACKAGE_NAME, COMPONENT_NAME)); - - return intent; - } - - public static boolean isPortOpen(final String ip, final int port, final int timeout) { - try { - Socket socket = new Socket(); - socket.connect(new InetSocketAddress(ip, port), timeout); - socket.close(); - return true; - } - - catch(ConnectException ce){ - ce.printStackTrace(); - return false; - } - - catch (Exception ex) { - ex.printStackTrace(); - return false; - } - } - - - @Override - public String getName() { - return PACKAGE_NAME; - } - -} +/* + * Copyright 2012-2016 Nathan Freitas + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.hiddenservices.genesissearchengine.production.libs.netcipher.proxy; + +import java.net.ConnectException; +import java.net.InetSocketAddress; +import java.net.Socket; +import java.util.List; + +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.content.pm.PackageManager; +import android.content.pm.ResolveInfo; +import android.net.Uri; +import android.text.TextUtils; + +public class PsiphonHelper implements ProxyHelper { + + public final static String PACKAGE_NAME = "com.psiphon3"; + public final static String COMPONENT_NAME = "com.psiphon3.StatusActivity"; + + + public final static String MARKET_URI = "market://details?id=" + PACKAGE_NAME; + public final static String FDROID_URI = "https://f-droid.org/repository/browse/?fdid=" + + PACKAGE_NAME; + public final static String ORBOT_PLAY_URI = "https://play.google.com/store/apps/details?id=" + + PACKAGE_NAME; + + public final static int DEFAULT_SOCKS_PORT = 1080; + public final static int DEFAULT_HTTP_PORT = 8080; + + @Override + public boolean isInstalled(Context context) { + return isAppInstalled(context, PACKAGE_NAME); + } + + + private static boolean isAppInstalled(Context context, String uri) { + try { + PackageManager pm = context.getPackageManager(); + pm.getPackageInfo(uri, PackageManager.GET_ACTIVITIES); + return true; + } catch (PackageManager.NameNotFoundException e) { + return false; + } + } + + @Override + public void requestStatus(final Context context) { + + Thread thread = new Thread () + { + public void run () + { + //can connect to default HTTP proxy port? + boolean isSocksOpen = false; + boolean isHttpOpen = false; + + int socksPort = DEFAULT_SOCKS_PORT; + int httpPort = DEFAULT_HTTP_PORT; + + for (int i = 0; i < 10 && (!isSocksOpen); i++) + isSocksOpen = isPortOpen("127.0.0.1",socksPort++,100); + + for (int i = 0; i < 10 && (!isHttpOpen); i++) + isHttpOpen = isPortOpen("127.0.0.1",httpPort++,100); + + //any other check? + + Intent intent = new Intent(ProxyHelper.ACTION_STATUS); + intent.putExtra(EXTRA_PACKAGE_NAME, PACKAGE_NAME); + + if (isSocksOpen && isHttpOpen) + { + intent.putExtra(EXTRA_STATUS, STATUS_ON); + + intent.putExtra(EXTRA_PROXY_PORT_HTTP, httpPort-1); + intent.putExtra(EXTRA_PROXY_PORT_SOCKS, socksPort-1); + + + } + else + { + intent.putExtra(EXTRA_STATUS, STATUS_OFF); + } + + context.sendBroadcast(intent); + } + }; + + thread.start(); + + } + + @Override + public boolean requestStart(Context context) { + + Intent intent = getStartIntent(context); + // intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + context.startActivity(intent); + + return true; + } + + @Override + public Intent getInstallIntent(Context context) { + final Intent intent = new Intent(Intent.ACTION_VIEW); + intent.setData(Uri.parse(MARKET_URI)); + + PackageManager pm = context.getPackageManager(); + List resInfos = pm.queryIntentActivities(intent, 0); + + String foundPackageName = null; + for (ResolveInfo r : resInfos) { + if (TextUtils.equals(r.activityInfo.packageName, FDROID_PACKAGE_NAME) + || TextUtils.equals(r.activityInfo.packageName, PLAY_PACKAGE_NAME)) { + foundPackageName = r.activityInfo.packageName; + break; + } + } + + if (foundPackageName == null) { + intent.setData(Uri.parse(FDROID_URI)); + } else { + intent.setPackage(foundPackageName); + } + return intent; + } + + @Override + public Intent getStartIntent(Context context) { + Intent intent = new Intent(); + intent.setComponent(new ComponentName(PACKAGE_NAME, COMPONENT_NAME)); + + return intent; + } + + public static boolean isPortOpen(final String ip, final int port, final int timeout) { + try { + Socket socket = new Socket(); + socket.connect(new InetSocketAddress(ip, port), timeout); + socket.close(); + return true; + } + + catch(ConnectException ce){ + ce.printStackTrace(); + return false; + } + + catch (Exception ex) { + ex.printStackTrace(); + return false; + } + } + + + @Override + public String getName() { + return PACKAGE_NAME; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/SetFromMap.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/proxy/SetFromMap.java similarity index 94% rename from app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/SetFromMap.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/proxy/SetFromMap.java index b24caf2f..790255e3 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/SetFromMap.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/proxy/SetFromMap.java @@ -1,88 +1,88 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.darkweb.genesissearchengine.libs.netcipher.proxy; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; -import java.util.AbstractSet; -import java.util.Collection; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; - -class SetFromMap extends AbstractSet - implements Serializable { - private static final long serialVersionUID = 2454657854757543876L; - // Must be named as is, to pass serialization compatibility test. - private final Map m; - private transient Set backingSet; - SetFromMap(final Map map) { - m = map; - backingSet = map.keySet(); - } - @Override public boolean equals(Object object) { - return backingSet.equals(object); - } - @Override public int hashCode() { - return backingSet.hashCode(); - } - @Override public boolean add(E object) { - return m.put(object, Boolean.TRUE) == null; - } - @Override public void clear() { - m.clear(); - } - @Override public String toString() { - return backingSet.toString(); - } - @Override public boolean contains(Object object) { - return backingSet.contains(object); - } - @Override public boolean containsAll(Collection collection) { - return backingSet.containsAll(collection); - } - @Override public boolean isEmpty() { - return m.isEmpty(); - } - @Override public boolean remove(Object object) { - return m.remove(object) != null; - } - @Override public boolean retainAll(Collection collection) { - return backingSet.retainAll(collection); - } - @Override public Object[] toArray() { - return backingSet.toArray(); - } - @Override - public T[] toArray(T[] contents) { - return backingSet.toArray(contents); - } - @Override public Iterator iterator() { - return backingSet.iterator(); - } - @Override public int size() { - return m.size(); - } - @SuppressWarnings("unchecked") - private void readObject(ObjectInputStream stream) - throws IOException, ClassNotFoundException { - stream.defaultReadObject(); - backingSet = m.keySet(); - } +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.hiddenservices.genesissearchengine.production.libs.netcipher.proxy; + +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.Serializable; +import java.util.AbstractSet; +import java.util.Collection; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; + +class SetFromMap extends AbstractSet + implements Serializable { + private static final long serialVersionUID = 2454657854757543876L; + // Must be named as is, to pass serialization compatibility test. + private final Map m; + private transient Set backingSet; + SetFromMap(final Map map) { + m = map; + backingSet = map.keySet(); + } + @Override public boolean equals(Object object) { + return backingSet.equals(object); + } + @Override public int hashCode() { + return backingSet.hashCode(); + } + @Override public boolean add(E object) { + return m.put(object, Boolean.TRUE) == null; + } + @Override public void clear() { + m.clear(); + } + @Override public String toString() { + return backingSet.toString(); + } + @Override public boolean contains(Object object) { + return backingSet.contains(object); + } + @Override public boolean containsAll(Collection collection) { + return backingSet.containsAll(collection); + } + @Override public boolean isEmpty() { + return m.isEmpty(); + } + @Override public boolean remove(Object object) { + return m.remove(object) != null; + } + @Override public boolean retainAll(Collection collection) { + return backingSet.retainAll(collection); + } + @Override public Object[] toArray() { + return backingSet.toArray(); + } + @Override + public T[] toArray(T[] contents) { + return backingSet.toArray(contents); + } + @Override public Iterator iterator() { + return backingSet.iterator(); + } + @Override public int size() { + return m.size(); + } + @SuppressWarnings("unchecked") + private void readObject(ObjectInputStream stream) + throws IOException, ClassNotFoundException { + stream.defaultReadObject(); + backingSet = m.keySet(); + } } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/SignatureUtils.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/proxy/SignatureUtils.java similarity index 97% rename from app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/SignatureUtils.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/proxy/SignatureUtils.java index e282e77d..bb9972c7 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/SignatureUtils.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/proxy/SignatureUtils.java @@ -1,476 +1,476 @@ -/*** - Copyright (c) 2014 CommonsWare, LLC - - Licensed under the Apache License, Version 2.0 (the "License"); you may - not use this file except in compliance with the License. You may obtain - a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ - -package com.darkweb.genesissearchengine.libs.netcipher.proxy; - -import android.content.ComponentName; -import android.content.Context; -import android.content.Intent; -import android.content.pm.PackageManager; -import android.content.pm.PackageManager.NameNotFoundException; -import android.content.pm.ResolveInfo; -import android.content.pm.Signature; -import android.util.Log; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.util.ArrayList; -import java.util.List; - -public class SignatureUtils { - public static String getOwnSignatureHash(Context ctxt) - throws - NameNotFoundException, - NoSuchAlgorithmException { - return(getSignatureHash(ctxt, ctxt.getPackageName())); - } - - public static String getSignatureHash(Context ctxt, String packageName) - throws - NameNotFoundException, - NoSuchAlgorithmException { - MessageDigest md=MessageDigest.getInstance("SHA-256"); - Signature sig= - ctxt.getPackageManager() - .getPackageInfo(packageName, PackageManager.GET_SIGNATURES).signatures[0]; - - return(toHexStringWithColons(md.digest(sig.toByteArray()))); - } - - // based on https://stackoverflow.com/a/2197650/115145 - - public static String toHexStringWithColons(byte[] bytes) { - char[] hexArray= - { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', - 'C', 'D', 'E', 'F' }; - char[] hexChars=new char[(bytes.length * 3) - 1]; - int v; - - for (int j=0; j < bytes.length; j++) { - v=bytes[j] & 0xFF; - hexChars[j * 3]=hexArray[v / 16]; - hexChars[j * 3 + 1]=hexArray[v % 16]; - - if (j < bytes.length - 1) { - hexChars[j * 3 + 2]=':'; - } - } - - return new String(hexChars); - } - - /** - * Confirms that the broadcast receiver for a given Intent - * has the desired signature hash. - * - * If you know the package name of the receiver, call - * setPackage() on the Intent before passing into this method. - * That will validate whether the package is installed and whether - * it has the proper signature hash. You can distinguish between - * these cases by passing true for the failIfHack parameter. - * - * In general, there are three possible outcomes of calling - * this method: - * - * 1. You get a SecurityException, because failIfHack is true, - * and we found some receiver whose app does not match the - * desired hash. The user may have installed a repackaged - * version of this app that is signed by the wrong key. - * - * 2. You get null. If failIfHack is true, this means that no - * receiver was found that matches the Intent. If failIfHack - * is false, this means that no receiver was found that matches - * the Intent and has a valid matching signature. - * - * 3. You get an Intent. This means we found a matching receiver - * that has a matching signature. The Intent will be a copy of - * the passed-in Intent, with the component name set to the - * matching receiver, so the "broadcast" will only go to this - * one component. - * - * @param ctxt any Context will do; the value is not retained - * @param toValidate the Intent that you intend to broadcast - * @param sigHash the signature hash of the app that you expect - * to handle this broadcast - * @param failIfHack true if you want a SecurityException if - * a matching receiver is found but it has - * the wrong signature hash, false otherwise - * @return null if there is no matching receiver with the correct - * hash, or a copy of the toValidate parameter with the full component - * name of the target receiver added to the Intent - */ - public static Intent validateBroadcastIntent(Context ctxt, - Intent toValidate, - String sigHash, - boolean failIfHack) { - ArrayList sigHashes=new ArrayList(); - - sigHashes.add(sigHash); - - return(validateBroadcastIntent(ctxt, toValidate, sigHashes, - failIfHack)); - } - - /** - * Confirms that the broadcast receiver for a given Intent - * has a desired signature hash. - * - * If you know the package name of the receiver, call - * setPackage() on the Intent before passing into this method. - * That will validate whether the package is installed and whether - * it has a proper signature hash. You can distinguish between - * these cases by passing true for the failIfHack parameter. - * - * In general, there are three possible outcomes of calling - * this method: - * - * 1. You get a SecurityException, because failIfHack is true, - * and we found some receiver whose app does not match the - * desired hash. The user may have installed a repackaged - * version of this app that is signed by the wrong key. - * - * 2. You get null. If failIfHack is true, this means that no - * receiver was found that matches the Intent. If failIfHack - * is false, this means that no receiver was found that matches - * the Intent and has a valid matching signature. - * - * 3. You get an Intent. This means we found a matching receiver - * that has a matching signature. The Intent will be a copy of - * the passed-in Intent, with the component name set to the - * matching receiver, so the "broadcast" will only go to this - * one component. - * - * @param ctxt any Context will do; the value is not retained - * @param toValidate the Intent that you intend to broadcast - * @param sigHashes the possible signature hashes of the app - * that you expect to handle this broadcast - * @param failIfHack true if you want a SecurityException if - * a matching receiver is found but it has - * the wrong signature hash, false otherwise - * @return null if there is no matching receiver with the correct - * hash, or a copy of the toValidate parameter with the full component - * name of the target receiver added to the Intent - */ - public static Intent validateBroadcastIntent(Context ctxt, - Intent toValidate, - List sigHashes, - boolean failIfHack) { - PackageManager pm=ctxt.getPackageManager(); - Intent result=null; - List receivers= - pm.queryBroadcastReceivers(toValidate, 0); - - if (receivers!=null) { - for (ResolveInfo info : receivers) { - try { - if (sigHashes.contains(getSignatureHash(ctxt, - info.activityInfo.packageName))) { - ComponentName cn= - new ComponentName(info.activityInfo.packageName, - info.activityInfo.name); - - result=new Intent(toValidate).setComponent(cn); - break; - } - else if (failIfHack) { - throw new SecurityException( - "Package has signature hash mismatch: "+ - info.activityInfo.packageName); - } - } - catch (NoSuchAlgorithmException e) { - Log.w("SignatureUtils", - "Exception when computing signature hash", e); - } - catch (NameNotFoundException e) { - Log.w("SignatureUtils", - "Exception when computing signature hash", e); - } - } - } - - return(result); - } - - /** - * Confirms that the activity for a given Intent has the - * desired signature hash. - * - * If you know the package name of the activity, call - * setPackage() on the Intent before passing into this method. - * That will validate whether the package is installed and whether - * it has the proper signature hash. You can distinguish between - * these cases by passing true for the failIfHack parameter. - * - * In general, there are three possible outcomes of calling - * this method: - * - * 1. You get a SecurityException, because failIfHack is true, - * and we found some activity whose app does not match the - * desired hash. The user may have installed a repackaged - * version of this app that is signed by the wrong key. - * - * 2. You get null. If failIfHack is true, this means that no - * activity was found that matches the Intent. If failIfHack - * is false, this means that no activity was found that matches - * the Intent and has a valid matching signature. - * - * 3. You get an Intent. This means we found a matching activity - * that has a matching signature. The Intent will be a copy of - * the passed-in Intent, with the component name set to the - * matching activity, so a call to startActivity() for this - * Intent is guaranteed to go to this specific activity. - * - * @param ctxt any Context will do; the value is not retained - * @param toValidate the Intent that you intend to use with - * startActivity() - * @param sigHash the signature hash of the app that you expect - * to handle this activity - * @param failIfHack true if you want a SecurityException if - * a matching activity is found but it has - * the wrong signature hash, false otherwise - * @return null if there is no matching activity with the correct - * hash, or a copy of the toValidate parameter with the full component - * name of the target activity added to the Intent - */ - public static Intent validateActivityIntent(Context ctxt, - Intent toValidate, - String sigHash, - boolean failIfHack) { - ArrayList sigHashes=new ArrayList(); - - sigHashes.add(sigHash); - - return(validateActivityIntent(ctxt, toValidate, sigHashes, - failIfHack)); - } - - /** - * Confirms that the activity for a given Intent has the - * desired signature hash. - * - * If you know the package name of the activity, call - * setPackage() on the Intent before passing into this method. - * That will validate whether the package is installed and whether - * it has the proper signature hash. You can distinguish between - * these cases by passing true for the failIfHack parameter. - * - * In general, there are three possible outcomes of calling - * this method: - * - * 1. You get a SecurityException, because failIfHack is true, - * and we found some activity whose app does not match the - * desired hash. The user may have installed a repackaged - * version of this app that is signed by the wrong key. - * - * 2. You get null. If failIfHack is true, this means that no - * activity was found that matches the Intent. If failIfHack - * is false, this means that no activity was found that matches - * the Intent and has a valid matching signature. - * - * 3. You get an Intent. This means we found a matching activity - * that has a matching signature. The Intent will be a copy of - * the passed-in Intent, with the component name set to the - * matching activity, so a call to startActivity() for this - * Intent is guaranteed to go to this specific activity. - * - * @param ctxt any Context will do; the value is not retained - * @param toValidate the Intent that you intend to use with - * startActivity() - * @param sigHashes the signature hashes of the app that you expect - * to handle this activity - * @param failIfHack true if you want a SecurityException if - * a matching activity is found but it has - * the wrong signature hash, false otherwise - * @return null if there is no matching activity with the correct - * hash, or a copy of the toValidate parameter with the full component - * name of the target activity added to the Intent - */ - public static Intent validateActivityIntent(Context ctxt, - Intent toValidate, - List sigHashes, - boolean failIfHack) { - PackageManager pm=ctxt.getPackageManager(); - Intent result=null; - List activities= - pm.queryIntentActivities(toValidate, 0); - - if (activities!=null) { - for (ResolveInfo info : activities) { - try { - if (sigHashes.contains(getSignatureHash(ctxt, - info.activityInfo.packageName))) { - ComponentName cn= - new ComponentName(info.activityInfo.packageName, - info.activityInfo.name); - - result=new Intent(toValidate).setComponent(cn); - break; - } - else if (failIfHack) { - throw new SecurityException( - "Package has signature hash mismatch: "+ - info.activityInfo.packageName); - } - } - catch (NoSuchAlgorithmException e) { - Log.w("SignatureUtils", - "Exception when computing signature hash", e); - } - catch (NameNotFoundException e) { - Log.w("SignatureUtils", - "Exception when computing signature hash", e); - } - } - } - - return(result); - } - - /** - * Confirms that the service for a given Intent has the - * desired signature hash. - * - * If you know the package name of the service, call - * setPackage() on the Intent before passing into this method. - * That will validate whether the package is installed and whether - * it has the proper signature hash. You can distinguish between - * these cases by passing true for the failIfHack parameter. - * - * In general, there are three possible outcomes of calling - * this method: - * - * 1. You get a SecurityException, because failIfHack is true, - * and we found some service whose app does not match the - * desired hash. The user may have installed a repackaged - * version of this app that is signed by the wrong key. - * - * 2. You get null. If failIfHack is true, this means that no - * service was found that matches the Intent. If failIfHack - * is false, this means that no service was found that matches - * the Intent and has a valid matching signature. - * - * 3. You get an Intent. This means we found a matching service - * that has a matching signature. The Intent will be a copy of - * the passed-in Intent, with the component name set to the - * matching service, so a call to startService() or - * bindService() for this Intent is guaranteed to go to this - * specific service. - * - * @param ctxt any Context will do; the value is not retained - * @param toValidate the Intent that you intend to use with - * startService() or bindService() - * @param sigHash the signature hash of the app that you expect - * to handle this service - * @param failIfHack true if you want a SecurityException if - * a matching service is found but it has - * the wrong signature hash, false otherwise - * @return null if there is no matching service with the correct - * hash, or a copy of the toValidate parameter with the full component - * name of the target service added to the Intent - */ - public static Intent validateServiceIntent(Context ctxt, - Intent toValidate, - String sigHash, - boolean failIfHack) { - ArrayList sigHashes=new ArrayList(); - - sigHashes.add(sigHash); - - return(validateServiceIntent(ctxt, toValidate, sigHashes, - failIfHack)); - } - - /** - * Confirms that the service for a given Intent has the - * desired signature hash. - * - * If you know the package name of the service, call - * setPackage() on the Intent before passing into this method. - * That will validate whether the package is installed and whether - * it has the proper signature hash. You can distinguish between - * these cases by passing true for the failIfHack parameter. - * - * In general, there are three possible outcomes of calling - * this method: - * - * 1. You get a SecurityException, because failIfHack is true, - * and we found some service whose app does not match the - * desired hash. The user may have installed a repackaged - * version of this app that is signed by the wrong key. - * - * 2. You get null. If failIfHack is true, this means that no - * service was found that matches the Intent. If failIfHack - * is false, this means that no service was found that matches - * the Intent and has a valid matching signature. - * - * 3. You get an Intent. This means we found a matching service - * that has a matching signature. The Intent will be a copy of - * the passed-in Intent, with the component name set to the - * matching service, so a call to startService() or - * bindService() for this Intent is guaranteed to go to this - * specific service. - * - * @param ctxt any Context will do; the value is not retained - * @param toValidate the Intent that you intend to use with - * startService() or bindService() - * @param sigHashes the signature hash of the app that you expect - * to handle this service - * @param failIfHack true if you want a SecurityException if - * a matching service is found but it has - * the wrong signature hash, false otherwise - * @return null if there is no matching service with the correct - * hash, or a copy of the toValidate parameter with the full component - * name of the target service added to the Intent - */ - public static Intent validateServiceIntent(Context ctxt, - Intent toValidate, - List sigHashes, - boolean failIfHack) { - PackageManager pm=ctxt.getPackageManager(); - Intent result=null; - List services= - pm.queryIntentServices(toValidate, 0); - - if (services!=null) { - for (ResolveInfo info : services) { - try { - if (sigHashes.contains(getSignatureHash(ctxt, - info.serviceInfo.packageName))) { - ComponentName cn= - new ComponentName(info.serviceInfo.packageName, - info.serviceInfo.name); - - result=new Intent(toValidate).setComponent(cn); - break; - } - else if (failIfHack) { - throw new SecurityException( - "Package has signature hash mismatch: "+ - info.activityInfo.packageName); - } - } - catch (NoSuchAlgorithmException e) { - Log.w("SignatureUtils", - "Exception when computing signature hash", e); - } - catch (NameNotFoundException e) { - Log.w("SignatureUtils", - "Exception when computing signature hash", e); - } - } - } - - return(result); - } -} +/*** + Copyright (c) 2014 CommonsWare, LLC + + Licensed under the Apache License, Version 2.0 (the "License"); you may + not use this file except in compliance with the License. You may obtain + a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +package com.hiddenservices.genesissearchengine.production.libs.netcipher.proxy; + +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.content.pm.PackageManager; +import android.content.pm.PackageManager.NameNotFoundException; +import android.content.pm.ResolveInfo; +import android.content.pm.Signature; +import android.util.Log; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.ArrayList; +import java.util.List; + +public class SignatureUtils { + public static String getOwnSignatureHash(Context ctxt) + throws + NameNotFoundException, + NoSuchAlgorithmException { + return(getSignatureHash(ctxt, ctxt.getPackageName())); + } + + public static String getSignatureHash(Context ctxt, String packageName) + throws + NameNotFoundException, + NoSuchAlgorithmException { + MessageDigest md=MessageDigest.getInstance("SHA-256"); + Signature sig= + ctxt.getPackageManager() + .getPackageInfo(packageName, PackageManager.GET_SIGNATURES).signatures[0]; + + return(toHexStringWithColons(md.digest(sig.toByteArray()))); + } + + // based on https://stackoverflow.com/a/2197650/115145 + + public static String toHexStringWithColons(byte[] bytes) { + char[] hexArray= + { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', + 'C', 'D', 'E', 'F' }; + char[] hexChars=new char[(bytes.length * 3) - 1]; + int v; + + for (int j=0; j < bytes.length; j++) { + v=bytes[j] & 0xFF; + hexChars[j * 3]=hexArray[v / 16]; + hexChars[j * 3 + 1]=hexArray[v % 16]; + + if (j < bytes.length - 1) { + hexChars[j * 3 + 2]=':'; + } + } + + return new String(hexChars); + } + + /** + * Confirms that the broadcast receiver for a given Intent + * has the desired signature hash. + * + * If you know the package name of the receiver, call + * setPackage() on the Intent before passing into this method. + * That will validate whether the package is installed and whether + * it has the proper signature hash. You can distinguish between + * these cases by passing true for the failIfHack parameter. + * + * In general, there are three possible outcomes of calling + * this method: + * + * 1. You get a SecurityException, because failIfHack is true, + * and we found some receiver whose app does not match the + * desired hash. The user may have installed a repackaged + * version of this app that is signed by the wrong key. + * + * 2. You get null. If failIfHack is true, this means that no + * receiver was found that matches the Intent. If failIfHack + * is false, this means that no receiver was found that matches + * the Intent and has a valid matching signature. + * + * 3. You get an Intent. This means we found a matching receiver + * that has a matching signature. The Intent will be a copy of + * the passed-in Intent, with the component name set to the + * matching receiver, so the "broadcast" will only go to this + * one component. + * + * @param ctxt any Context will do; the value is not retained + * @param toValidate the Intent that you intend to broadcast + * @param sigHash the signature hash of the app that you expect + * to handle this broadcast + * @param failIfHack true if you want a SecurityException if + * a matching receiver is found but it has + * the wrong signature hash, false otherwise + * @return null if there is no matching receiver with the correct + * hash, or a copy of the toValidate parameter with the full component + * name of the target receiver added to the Intent + */ + public static Intent validateBroadcastIntent(Context ctxt, + Intent toValidate, + String sigHash, + boolean failIfHack) { + ArrayList sigHashes=new ArrayList(); + + sigHashes.add(sigHash); + + return(validateBroadcastIntent(ctxt, toValidate, sigHashes, + failIfHack)); + } + + /** + * Confirms that the broadcast receiver for a given Intent + * has a desired signature hash. + * + * If you know the package name of the receiver, call + * setPackage() on the Intent before passing into this method. + * That will validate whether the package is installed and whether + * it has a proper signature hash. You can distinguish between + * these cases by passing true for the failIfHack parameter. + * + * In general, there are three possible outcomes of calling + * this method: + * + * 1. You get a SecurityException, because failIfHack is true, + * and we found some receiver whose app does not match the + * desired hash. The user may have installed a repackaged + * version of this app that is signed by the wrong key. + * + * 2. You get null. If failIfHack is true, this means that no + * receiver was found that matches the Intent. If failIfHack + * is false, this means that no receiver was found that matches + * the Intent and has a valid matching signature. + * + * 3. You get an Intent. This means we found a matching receiver + * that has a matching signature. The Intent will be a copy of + * the passed-in Intent, with the component name set to the + * matching receiver, so the "broadcast" will only go to this + * one component. + * + * @param ctxt any Context will do; the value is not retained + * @param toValidate the Intent that you intend to broadcast + * @param sigHashes the possible signature hashes of the app + * that you expect to handle this broadcast + * @param failIfHack true if you want a SecurityException if + * a matching receiver is found but it has + * the wrong signature hash, false otherwise + * @return null if there is no matching receiver with the correct + * hash, or a copy of the toValidate parameter with the full component + * name of the target receiver added to the Intent + */ + public static Intent validateBroadcastIntent(Context ctxt, + Intent toValidate, + List sigHashes, + boolean failIfHack) { + PackageManager pm=ctxt.getPackageManager(); + Intent result=null; + List receivers= + pm.queryBroadcastReceivers(toValidate, 0); + + if (receivers!=null) { + for (ResolveInfo info : receivers) { + try { + if (sigHashes.contains(getSignatureHash(ctxt, + info.activityInfo.packageName))) { + ComponentName cn= + new ComponentName(info.activityInfo.packageName, + info.activityInfo.name); + + result=new Intent(toValidate).setComponent(cn); + break; + } + else if (failIfHack) { + throw new SecurityException( + "Package has signature hash mismatch: "+ + info.activityInfo.packageName); + } + } + catch (NoSuchAlgorithmException e) { + Log.w("SignatureUtils", + "Exception when computing signature hash", e); + } + catch (NameNotFoundException e) { + Log.w("SignatureUtils", + "Exception when computing signature hash", e); + } + } + } + + return(result); + } + + /** + * Confirms that the activity for a given Intent has the + * desired signature hash. + * + * If you know the package name of the activity, call + * setPackage() on the Intent before passing into this method. + * That will validate whether the package is installed and whether + * it has the proper signature hash. You can distinguish between + * these cases by passing true for the failIfHack parameter. + * + * In general, there are three possible outcomes of calling + * this method: + * + * 1. You get a SecurityException, because failIfHack is true, + * and we found some activity whose app does not match the + * desired hash. The user may have installed a repackaged + * version of this app that is signed by the wrong key. + * + * 2. You get null. If failIfHack is true, this means that no + * activity was found that matches the Intent. If failIfHack + * is false, this means that no activity was found that matches + * the Intent and has a valid matching signature. + * + * 3. You get an Intent. This means we found a matching activity + * that has a matching signature. The Intent will be a copy of + * the passed-in Intent, with the component name set to the + * matching activity, so a call to startActivity() for this + * Intent is guaranteed to go to this specific activity. + * + * @param ctxt any Context will do; the value is not retained + * @param toValidate the Intent that you intend to use with + * startActivity() + * @param sigHash the signature hash of the app that you expect + * to handle this activity + * @param failIfHack true if you want a SecurityException if + * a matching activity is found but it has + * the wrong signature hash, false otherwise + * @return null if there is no matching activity with the correct + * hash, or a copy of the toValidate parameter with the full component + * name of the target activity added to the Intent + */ + public static Intent validateActivityIntent(Context ctxt, + Intent toValidate, + String sigHash, + boolean failIfHack) { + ArrayList sigHashes=new ArrayList(); + + sigHashes.add(sigHash); + + return(validateActivityIntent(ctxt, toValidate, sigHashes, + failIfHack)); + } + + /** + * Confirms that the activity for a given Intent has the + * desired signature hash. + * + * If you know the package name of the activity, call + * setPackage() on the Intent before passing into this method. + * That will validate whether the package is installed and whether + * it has the proper signature hash. You can distinguish between + * these cases by passing true for the failIfHack parameter. + * + * In general, there are three possible outcomes of calling + * this method: + * + * 1. You get a SecurityException, because failIfHack is true, + * and we found some activity whose app does not match the + * desired hash. The user may have installed a repackaged + * version of this app that is signed by the wrong key. + * + * 2. You get null. If failIfHack is true, this means that no + * activity was found that matches the Intent. If failIfHack + * is false, this means that no activity was found that matches + * the Intent and has a valid matching signature. + * + * 3. You get an Intent. This means we found a matching activity + * that has a matching signature. The Intent will be a copy of + * the passed-in Intent, with the component name set to the + * matching activity, so a call to startActivity() for this + * Intent is guaranteed to go to this specific activity. + * + * @param ctxt any Context will do; the value is not retained + * @param toValidate the Intent that you intend to use with + * startActivity() + * @param sigHashes the signature hashes of the app that you expect + * to handle this activity + * @param failIfHack true if you want a SecurityException if + * a matching activity is found but it has + * the wrong signature hash, false otherwise + * @return null if there is no matching activity with the correct + * hash, or a copy of the toValidate parameter with the full component + * name of the target activity added to the Intent + */ + public static Intent validateActivityIntent(Context ctxt, + Intent toValidate, + List sigHashes, + boolean failIfHack) { + PackageManager pm=ctxt.getPackageManager(); + Intent result=null; + List activities= + pm.queryIntentActivities(toValidate, 0); + + if (activities!=null) { + for (ResolveInfo info : activities) { + try { + if (sigHashes.contains(getSignatureHash(ctxt, + info.activityInfo.packageName))) { + ComponentName cn= + new ComponentName(info.activityInfo.packageName, + info.activityInfo.name); + + result=new Intent(toValidate).setComponent(cn); + break; + } + else if (failIfHack) { + throw new SecurityException( + "Package has signature hash mismatch: "+ + info.activityInfo.packageName); + } + } + catch (NoSuchAlgorithmException e) { + Log.w("SignatureUtils", + "Exception when computing signature hash", e); + } + catch (NameNotFoundException e) { + Log.w("SignatureUtils", + "Exception when computing signature hash", e); + } + } + } + + return(result); + } + + /** + * Confirms that the service for a given Intent has the + * desired signature hash. + * + * If you know the package name of the service, call + * setPackage() on the Intent before passing into this method. + * That will validate whether the package is installed and whether + * it has the proper signature hash. You can distinguish between + * these cases by passing true for the failIfHack parameter. + * + * In general, there are three possible outcomes of calling + * this method: + * + * 1. You get a SecurityException, because failIfHack is true, + * and we found some service whose app does not match the + * desired hash. The user may have installed a repackaged + * version of this app that is signed by the wrong key. + * + * 2. You get null. If failIfHack is true, this means that no + * service was found that matches the Intent. If failIfHack + * is false, this means that no service was found that matches + * the Intent and has a valid matching signature. + * + * 3. You get an Intent. This means we found a matching service + * that has a matching signature. The Intent will be a copy of + * the passed-in Intent, with the component name set to the + * matching service, so a call to startService() or + * bindService() for this Intent is guaranteed to go to this + * specific service. + * + * @param ctxt any Context will do; the value is not retained + * @param toValidate the Intent that you intend to use with + * startService() or bindService() + * @param sigHash the signature hash of the app that you expect + * to handle this service + * @param failIfHack true if you want a SecurityException if + * a matching service is found but it has + * the wrong signature hash, false otherwise + * @return null if there is no matching service with the correct + * hash, or a copy of the toValidate parameter with the full component + * name of the target service added to the Intent + */ + public static Intent validateServiceIntent(Context ctxt, + Intent toValidate, + String sigHash, + boolean failIfHack) { + ArrayList sigHashes=new ArrayList(); + + sigHashes.add(sigHash); + + return(validateServiceIntent(ctxt, toValidate, sigHashes, + failIfHack)); + } + + /** + * Confirms that the service for a given Intent has the + * desired signature hash. + * + * If you know the package name of the service, call + * setPackage() on the Intent before passing into this method. + * That will validate whether the package is installed and whether + * it has the proper signature hash. You can distinguish between + * these cases by passing true for the failIfHack parameter. + * + * In general, there are three possible outcomes of calling + * this method: + * + * 1. You get a SecurityException, because failIfHack is true, + * and we found some service whose app does not match the + * desired hash. The user may have installed a repackaged + * version of this app that is signed by the wrong key. + * + * 2. You get null. If failIfHack is true, this means that no + * service was found that matches the Intent. If failIfHack + * is false, this means that no service was found that matches + * the Intent and has a valid matching signature. + * + * 3. You get an Intent. This means we found a matching service + * that has a matching signature. The Intent will be a copy of + * the passed-in Intent, with the component name set to the + * matching service, so a call to startService() or + * bindService() for this Intent is guaranteed to go to this + * specific service. + * + * @param ctxt any Context will do; the value is not retained + * @param toValidate the Intent that you intend to use with + * startService() or bindService() + * @param sigHashes the signature hash of the app that you expect + * to handle this service + * @param failIfHack true if you want a SecurityException if + * a matching service is found but it has + * the wrong signature hash, false otherwise + * @return null if there is no matching service with the correct + * hash, or a copy of the toValidate parameter with the full component + * name of the target service added to the Intent + */ + public static Intent validateServiceIntent(Context ctxt, + Intent toValidate, + List sigHashes, + boolean failIfHack) { + PackageManager pm=ctxt.getPackageManager(); + Intent result=null; + List services= + pm.queryIntentServices(toValidate, 0); + + if (services!=null) { + for (ResolveInfo info : services) { + try { + if (sigHashes.contains(getSignatureHash(ctxt, + info.serviceInfo.packageName))) { + ComponentName cn= + new ComponentName(info.serviceInfo.packageName, + info.serviceInfo.name); + + result=new Intent(toValidate).setComponent(cn); + break; + } + else if (failIfHack) { + throw new SecurityException( + "Package has signature hash mismatch: "+ + info.activityInfo.packageName); + } + } + catch (NoSuchAlgorithmException e) { + Log.w("SignatureUtils", + "Exception when computing signature hash", e); + } + catch (NameNotFoundException e) { + Log.w("SignatureUtils", + "Exception when computing signature hash", e); + } + } + } + + return(result); + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/StatusCallback.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/proxy/StatusCallback.java similarity index 92% rename from app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/StatusCallback.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/proxy/StatusCallback.java index 8540b1cc..509cb9bb 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/StatusCallback.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/proxy/StatusCallback.java @@ -1,64 +1,64 @@ -/* - * Copyright (c) 2016 CommonsWare, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.darkweb.genesissearchengine.libs.netcipher.proxy; - -import android.content.Intent; - -/** - * Callback interface used for reporting Orbot status - */ -public interface StatusCallback { - /** - * Called when Orbot is operational - * - * @param statusIntent an Intent containing information about - * Orbot, including proxy ports - */ - void onEnabled(Intent statusIntent); - - /** - * Called when Orbot reports that it is starting up - */ - void onStarting(); - - /** - * Called when Orbot reports that it is shutting down - */ - void onStopping(); - - /** - * Called when Orbot reports that it is no longer running - */ - void onDisabled(); - - /** - * Called if our attempt to get a status from Orbot failed - * after a defined period of time. See statusTimeout() on - * OrbotInitializer. - */ - void onStatusTimeout(); - - /** - * Called if Orbot is not yet installed. Usually, you handle - * this by checking the return value from init() on OrbotInitializer - * or calling isInstalled() on OrbotInitializer. However, if - * you have need for it, if a callback is registered before - * an init() call determines that Orbot is not installed, your - * callback will be called with onNotYetInstalled(). - */ - void onNotYetInstalled(); -} +/* + * Copyright (c) 2016 CommonsWare, LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.hiddenservices.genesissearchengine.production.libs.netcipher.proxy; + +import android.content.Intent; + +/** + * Callback interface used for reporting Orbot status + */ +public interface StatusCallback { + /** + * Called when Orbot is operational + * + * @param statusIntent an Intent containing information about + * Orbot, including proxy ports + */ + void onEnabled(Intent statusIntent); + + /** + * Called when Orbot reports that it is starting up + */ + void onStarting(); + + /** + * Called when Orbot reports that it is shutting down + */ + void onStopping(); + + /** + * Called when Orbot reports that it is no longer running + */ + void onDisabled(); + + /** + * Called if our attempt to get a status from Orbot failed + * after a defined period of time. See statusTimeout() on + * OrbotInitializer. + */ + void onStatusTimeout(); + + /** + * Called if Orbot is not yet installed. Usually, you handle + * this by checking the return value from init() on OrbotInitializer + * or calling isInstalled() on OrbotInitializer. However, if + * you have need for it, if a callback is registered before + * an init() call determines that Orbot is not installed, your + * callback will be called with onNotYetInstalled(). + */ + void onNotYetInstalled(); +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/TorServiceUtils.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/proxy/TorServiceUtils.java similarity index 95% rename from app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/TorServiceUtils.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/proxy/TorServiceUtils.java index f8ee2d6c..d9e124c0 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/TorServiceUtils.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/proxy/TorServiceUtils.java @@ -1,246 +1,246 @@ -/* - * Copyright 2009-2016 Nathan Freitas - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.darkweb.genesissearchengine.libs.netcipher.proxy; - -import android.content.Context; -import android.util.Log; - - -import java.io.BufferedReader; -import java.io.File; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; -import java.net.URLEncoder; -import java.util.StringTokenizer; - -public class TorServiceUtils { - - private final static String TAG = "TorUtils"; - // various console cmds - public final static String SHELL_CMD_CHMOD = "chmod"; - public final static String SHELL_CMD_KILL = "kill -9"; - public final static String SHELL_CMD_RM = "rm"; - public final static String SHELL_CMD_PS = "ps"; - public final static String SHELL_CMD_PIDOF = "pidof"; - - public final static String CHMOD_EXE_VALUE = "700"; - - public static boolean isRootPossible() - { - - StringBuilder log = new StringBuilder(); - - try { - - // Check if Superuser.apk exists - File fileSU = new File("/system/app/Superuser.apk"); - if (fileSU.exists()) - return true; - - fileSU = new File("/system/app/superuser.apk"); - if (fileSU.exists()) - return true; - - fileSU = new File("/system/bin/su"); - if (fileSU.exists()) - { - String[] cmd = { - "su" - }; - int exitCode = TorServiceUtils.doShellCommand(cmd, log, false, true); - if (exitCode != 0) - return false; - else - return true; - } - - // Check for 'su' binary - String[] cmd = { - "which su" - }; - int exitCode = TorServiceUtils.doShellCommand(cmd, log, false, true); - - if (exitCode == 0) { - Log.d(TAG, "root exists, but not sure about permissions"); - return true; - - } - - } catch (IOException e) { - // this means that there is no root to be had (normally) so we won't - // log anything - Log.e(TAG, "Error checking for root access", e); - - } catch (Exception e) { - Log.e(TAG, "Error checking for root access", e); - // this means that there is no root to be had (normally) - } - - Log.e(TAG, "Could not acquire root permissions"); - - return false; - } - - public static int findProcessId(Context context) { - String dataPath = context.getFilesDir().getParentFile().getParentFile().getAbsolutePath(); - String command = dataPath + "/" + OrbotHelper.ORBOT_PACKAGE_NAME + "/app_bin/tor"; - int procId = -1; - - try { - procId = findProcessIdWithPidOf(command); - - if (procId == -1) - procId = findProcessIdWithPS(command); - } catch (Exception e) { - try { - procId = findProcessIdWithPS(command); - } catch (Exception e2) { - Log.e(TAG, "Unable to get proc id for command: " + URLEncoder.encode(command), e2); - } - } - - return procId; - } - - // use 'pidof' command - public static int findProcessIdWithPidOf(String command) throws Exception - { - - int procId = -1; - - Runtime r = Runtime.getRuntime(); - - Process procPs = null; - - String baseName = new File(command).getName(); - // fix contributed my mikos on 2010.12.10 - procPs = r.exec(new String[] { - SHELL_CMD_PIDOF, baseName - }); - // procPs = r.exec(SHELL_CMD_PIDOF); - - BufferedReader reader = new BufferedReader(new InputStreamReader(procPs.getInputStream())); - String line = null; - - while ((line = reader.readLine()) != null) - { - - try - { - // this line should just be the process id - procId = Integer.parseInt(line.trim()); - break; - } catch (NumberFormatException e) - { - Log.e("TorServiceUtils", "unable to parse process pid: " + line, e); - } - } - - return procId; - - } - - // use 'ps' command - public static int findProcessIdWithPS(String command) throws Exception - { - - int procId = -1; - - Runtime r = Runtime.getRuntime(); - - Process procPs = null; - - procPs = r.exec(SHELL_CMD_PS); - - BufferedReader reader = new BufferedReader(new InputStreamReader(procPs.getInputStream())); - String line = null; - - while ((line = reader.readLine()) != null) - { - if (line.indexOf(' ' + command) != -1) - { - - StringTokenizer st = new StringTokenizer(line, " "); - st.nextToken(); // proc owner - - procId = Integer.parseInt(st.nextToken().trim()); - - break; - } - } - - return procId; - - } - - public static int doShellCommand(String[] cmds, StringBuilder log, boolean runAsRoot, - boolean waitFor) throws Exception - { - - Process proc = null; - int exitCode = -1; - - if (runAsRoot) - proc = Runtime.getRuntime().exec("su"); - else - proc = Runtime.getRuntime().exec("sh"); - - OutputStreamWriter out = new OutputStreamWriter(proc.getOutputStream()); - - for (int i = 0; i < cmds.length; i++) - { - // TorService.logMessage("executing shell cmd: " + cmds[i] + - // "; runAsRoot=" + runAsRoot + ";waitFor=" + waitFor); - - out.write(cmds[i]); - out.write("\n"); - } - - out.flush(); - out.write("exit\n"); - out.flush(); - - if (waitFor) - { - - final char buf[] = new char[10]; - - // Consume the "stdout" - InputStreamReader reader = new InputStreamReader(proc.getInputStream()); - int read = 0; - while ((read = reader.read(buf)) != -1) { - if (log != null) - log.append(buf, 0, read); - } - - // Consume the "stderr" - reader = new InputStreamReader(proc.getErrorStream()); - read = 0; - while ((read = reader.read(buf)) != -1) { - if (log != null) - log.append(buf, 0, read); - } - - exitCode = proc.waitFor(); - - } - - return exitCode; - - } -} +/* + * Copyright 2009-2016 Nathan Freitas + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.hiddenservices.genesissearchengine.production.libs.netcipher.proxy; + +import android.content.Context; +import android.util.Log; + + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.net.URLEncoder; +import java.util.StringTokenizer; + +public class TorServiceUtils { + + private final static String TAG = "TorUtils"; + // various console cmds + public final static String SHELL_CMD_CHMOD = "chmod"; + public final static String SHELL_CMD_KILL = "kill -9"; + public final static String SHELL_CMD_RM = "rm"; + public final static String SHELL_CMD_PS = "ps"; + public final static String SHELL_CMD_PIDOF = "pidof"; + + public final static String CHMOD_EXE_VALUE = "700"; + + public static boolean isRootPossible() + { + + StringBuilder log = new StringBuilder(); + + try { + + // Check if Superuser.apk exists + File fileSU = new File("/system/app/Superuser.apk"); + if (fileSU.exists()) + return true; + + fileSU = new File("/system/app/superuser.apk"); + if (fileSU.exists()) + return true; + + fileSU = new File("/system/bin/su"); + if (fileSU.exists()) + { + String[] cmd = { + "su" + }; + int exitCode = TorServiceUtils.doShellCommand(cmd, log, false, true); + if (exitCode != 0) + return false; + else + return true; + } + + // Check for 'su' binary + String[] cmd = { + "which su" + }; + int exitCode = TorServiceUtils.doShellCommand(cmd, log, false, true); + + if (exitCode == 0) { + Log.d(TAG, "root exists, but not sure about permissions"); + return true; + + } + + } catch (IOException e) { + // this means that there is no root to be had (normally) so we won't + // log anything + Log.e(TAG, "Error checking for root access", e); + + } catch (Exception e) { + Log.e(TAG, "Error checking for root access", e); + // this means that there is no root to be had (normally) + } + + Log.e(TAG, "Could not acquire root permissions"); + + return false; + } + + public static int findProcessId(Context context) { + String dataPath = context.getFilesDir().getParentFile().getParentFile().getAbsolutePath(); + String command = dataPath + "/" + OrbotHelper.ORBOT_PACKAGE_NAME + "/app_bin/tor"; + int procId = -1; + + try { + procId = findProcessIdWithPidOf(command); + + if (procId == -1) + procId = findProcessIdWithPS(command); + } catch (Exception e) { + try { + procId = findProcessIdWithPS(command); + } catch (Exception e2) { + Log.e(TAG, "Unable to get proc id for command: " + URLEncoder.encode(command), e2); + } + } + + return procId; + } + + // use 'pidof' command + public static int findProcessIdWithPidOf(String command) throws Exception + { + + int procId = -1; + + Runtime r = Runtime.getRuntime(); + + Process procPs = null; + + String baseName = new File(command).getName(); + // fix contributed my mikos on 2010.12.10 + procPs = r.exec(new String[] { + SHELL_CMD_PIDOF, baseName + }); + // procPs = r.exec(SHELL_CMD_PIDOF); + + BufferedReader reader = new BufferedReader(new InputStreamReader(procPs.getInputStream())); + String line = null; + + while ((line = reader.readLine()) != null) + { + + try + { + // this line should just be the process id + procId = Integer.parseInt(line.trim()); + break; + } catch (NumberFormatException e) + { + Log.e("TorServiceUtils", "unable to parse process pid: " + line, e); + } + } + + return procId; + + } + + // use 'ps' command + public static int findProcessIdWithPS(String command) throws Exception + { + + int procId = -1; + + Runtime r = Runtime.getRuntime(); + + Process procPs = null; + + procPs = r.exec(SHELL_CMD_PS); + + BufferedReader reader = new BufferedReader(new InputStreamReader(procPs.getInputStream())); + String line = null; + + while ((line = reader.readLine()) != null) + { + if (line.indexOf(' ' + command) != -1) + { + + StringTokenizer st = new StringTokenizer(line, " "); + st.nextToken(); // proc owner + + procId = Integer.parseInt(st.nextToken().trim()); + + break; + } + } + + return procId; + + } + + public static int doShellCommand(String[] cmds, StringBuilder log, boolean runAsRoot, + boolean waitFor) throws Exception + { + + Process proc = null; + int exitCode = -1; + + if (runAsRoot) + proc = Runtime.getRuntime().exec("su"); + else + proc = Runtime.getRuntime().exec("sh"); + + OutputStreamWriter out = new OutputStreamWriter(proc.getOutputStream()); + + for (int i = 0; i < cmds.length; i++) + { + // TorService.logMessage("executing shell cmd: " + cmds[i] + + // "; runAsRoot=" + runAsRoot + ";waitFor=" + waitFor); + + out.write(cmds[i]); + out.write("\n"); + } + + out.flush(); + out.write("exit\n"); + out.flush(); + + if (waitFor) + { + + final char buf[] = new char[10]; + + // Consume the "stdout" + InputStreamReader reader = new InputStreamReader(proc.getInputStream()); + int read = 0; + while ((read = reader.read(buf)) != -1) { + if (log != null) + log.append(buf, 0, read); + } + + // Consume the "stderr" + reader = new InputStreamReader(proc.getErrorStream()); + read = 0; + while ((read = reader.read(buf)) != -1) { + if (log != null) + log.append(buf, 0, read); + } + + exitCode = proc.waitFor(); + + } + + return exitCode; + + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/web/WebkitProxy.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/web/WebkitProxy.java similarity index 96% rename from app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/web/WebkitProxy.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/web/WebkitProxy.java index 8bb0e1b0..b4d0aa53 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/web/WebkitProxy.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/netcipher/web/WebkitProxy.java @@ -1,834 +1,834 @@ -/* - * Copyright 2015 Anthony Restaino - * Copyright 2012-2016 Nathan Freitas - - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.darkweb.genesissearchengine.libs.netcipher.web; - -import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.net.InetSocketAddress; -import java.net.Socket; -import android.annotation.TargetApi; -import android.app.Activity; -import android.app.AlertDialog; -import android.content.ActivityNotFoundException; -import android.content.Context; -import android.content.DialogInterface; -import android.content.Intent; -import android.net.Proxy; -import android.net.Uri; -import android.os.Build; -import android.os.Parcelable; -import android.util.ArrayMap; -import android.util.Log; -import android.webkit.WebView; - -import org.torproject.android.service.wrapper.orbotLocalConstants; - -import ch.boye.httpclientandroidlib.HttpHost; - -public class WebkitProxy { - - private final static String DEFAULT_HOST = "localhost";//"127.0.0.1"; - private final static int DEFAULT_PORT = orbotLocalConstants.mHTTPPort; - private final static int DEFAULT_SOCKS_PORT = orbotLocalConstants.mSOCKSPort; - - private final static int REQUEST_CODE = 0; - - private final static String TAG = "OrbotHelpher"; - - public static boolean setProxy(String appClass, Context ctx, WebView wView, String host, int port) throws Exception - { - - setSystemProperties(host, port); - - boolean worked = false; - - if (Build.VERSION.SDK_INT < 13) - { -// worked = setWebkitProxyGingerbread(ctx, host, port); - setProxyUpToHC(wView, host, port); - } - else if (Build.VERSION.SDK_INT < 19) - { - worked = setWebkitProxyICS(ctx, host, port); - } - else if (Build.VERSION.SDK_INT < 20) - { - worked = setKitKatProxy(appClass, ctx, host, port); - - if (!worked) //some kitkat's still use ICS browser component (like Cyanogen 11) - worked = setWebkitProxyICS(ctx, host, port); - - } - else if (Build.VERSION.SDK_INT >= 21) - { - worked = setWebkitProxyLollipop(ctx, host, port); - - } - - return worked; - } - - private static void setSystemProperties(String host, int port) - { - - System.setProperty("proxyHost", host); - System.setProperty("proxyPort", Integer.toString(port)); - - System.setProperty("http.proxyHost", host); - System.setProperty("http.proxyPort", Integer.toString(port)); - - System.setProperty("https.proxyHost", host); - System.setProperty("https.proxyPort", Integer.toString(port)); - - - System.setProperty("socks.proxyHost", host); - System.setProperty("socks.proxyPort", Integer.toString(DEFAULT_SOCKS_PORT)); - - System.setProperty("socksProxyHost", host); - System.setProperty("socksProxyPort", Integer.toString(DEFAULT_SOCKS_PORT)); - - - /* - ProxySelector pSelect = new ProxySelector(); - pSelect.addProxy(Proxy.Type.HTTP, host, port); - ProxySelector.setDefault(pSelect); - */ - /* - System.setProperty("http_proxy", "http://" + host + ":" + port); - System.setProperty("proxy-server", "http://" + host + ":" + port); - System.setProperty("host-resolver-rules","MAP * 0.0.0.0 , EXCLUDE myproxy"); - - System.getProperty("networkaddress.cache.ttl", "-1"); - */ - - } - - private static void resetSystemProperties() - { - - System.setProperty("proxyHost", ""); - System.setProperty("proxyPort", ""); - - System.setProperty("http.proxyHost", ""); - System.setProperty("http.proxyPort", ""); - - System.setProperty("https.proxyHost", ""); - System.setProperty("https.proxyPort", ""); - - - System.setProperty("socks.proxyHost", ""); - System.setProperty("socks.proxyPort", Integer.toString(DEFAULT_SOCKS_PORT)); - - System.setProperty("socksProxyHost", ""); - System.setProperty("socksProxyPort", Integer.toString(DEFAULT_SOCKS_PORT)); - - } - - /** - * Override WebKit Proxy settings - * - * @param ctx Android ApplicationContext - * @param host - * @param port - * @return true if Proxy was successfully set - */ - private static boolean setWebkitProxyGingerbread(Context ctx, String host, int port) - throws Exception - { - - boolean ret = false; - - Object requestQueueObject = getRequestQueue(ctx); - if (requestQueueObject != null) { - // Create Proxy config object and set it into request Q - HttpHost httpHost = new HttpHost(host, port, "http"); - setDeclaredField(requestQueueObject, "mProxyHost", httpHost); - return true; - } - return false; - - } - - -/** - * Set Proxy for Android 3.2 and below. - */ -@SuppressWarnings("all") -private static boolean setProxyUpToHC(WebView webview, String host, int port) { - Log.d(TAG, "Setting proxy with <= 3.2 API."); - - HttpHost proxyServer = new HttpHost(host, port); - // Getting network - Class networkClass = null; - Object network = null; - try { - networkClass = Class.forName("android.webkit.Network"); - if (networkClass == null) { - Log.e(TAG, "failed to get class for android.webkit.Network"); - return false; - } - Method getInstanceMethod = networkClass.getMethod("getInstance", Context.class); - if (getInstanceMethod == null) { - Log.e(TAG, "failed to get getInstance method"); - } - network = getInstanceMethod.invoke(networkClass, new Object[]{webview.getContext()}); - } catch (Exception ex) { - Log.e(TAG, "error getting network: " + ex); - return false; - } - if (network == null) { - Log.e(TAG, "error getting network: network is null"); - return false; - } - Object requestQueue = null; - try { - Field requestQueueField = networkClass - .getDeclaredField("mRequestQueue"); - requestQueue = getFieldValueSafely(requestQueueField, network); - } catch (Exception ex) { - Log.e(TAG, "error getting field value"); - return false; - } - if (requestQueue == null) { - Log.e(TAG, "Request queue is null"); - return false; - } - Field proxyHostField = null; - try { - Class requestQueueClass = Class.forName("android.net.http.RequestQueue"); - proxyHostField = requestQueueClass - .getDeclaredField("mProxyHost"); - } catch (Exception ex) { - Log.e(TAG, "error getting proxy host field"); - return false; - } - - boolean temp = proxyHostField.isAccessible(); - try { - proxyHostField.setAccessible(true); - proxyHostField.set(requestQueue, proxyServer); - } catch (Exception ex) { - Log.e(TAG, "error setting proxy host"); - } finally { - proxyHostField.setAccessible(temp); - } - - Log.d(TAG, "Setting proxy with <= 3.2 API successful!"); - return true; -} - - -private static Object getFieldValueSafely(Field field, Object classInstance) throws IllegalArgumentException, IllegalAccessException { - boolean oldAccessibleValue = field.isAccessible(); - field.setAccessible(true); - Object result = field.get(classInstance); - field.setAccessible(oldAccessibleValue); - return result; -} - - private static boolean setWebkitProxyICS(Context ctx, String host, int port) - { - - // PSIPHON: added support for Android 4.x WebView proxy - try - { - Class webViewCoreClass = Class.forName("android.webkit.WebViewCore"); - - Class proxyPropertiesClass = Class.forName("android.net.ProxyProperties"); - if (webViewCoreClass != null && proxyPropertiesClass != null) - { - Method m = webViewCoreClass.getDeclaredMethod("sendStaticMessage", Integer.TYPE, - Object.class); - Constructor c = proxyPropertiesClass.getConstructor(String.class, Integer.TYPE, - String.class); - - if (m != null && c != null) - { - m.setAccessible(true); - c.setAccessible(true); - Object properties = c.newInstance(host, port, null); - - // android.webkit.WebViewCore.EventHub.PROXY_CHANGED = 193; - m.invoke(null, 193, properties); - - - return true; - } - - - } - } catch (Exception e) - { - Log.e("ProxySettings", - "Exception setting WebKit proxy through android.net.ProxyProperties: " - + e.toString()); - } catch (Error e) - { - Log.e("ProxySettings", - "Exception setting WebKit proxy through android.webkit.Network: " - + e.toString()); - } - - return false; - - } - - @TargetApi(19) - public static boolean resetKitKatProxy(String appClass, Context appContext) { - - return setKitKatProxy(appClass, appContext,null,0); - } - - @TargetApi(19) - private static boolean setKitKatProxy(String appClass, Context appContext, String host, int port) { - //Context appContext = webView.getContext().getApplicationContext(); - - if (host != null) - { - System.setProperty("http.proxyHost", host); - System.setProperty("http.proxyPort", Integer.toString(port)); - System.setProperty("https.proxyHost", host); - System.setProperty("https.proxyPort", Integer.toString(port)); - } - - try { - Class applictionCls = Class.forName(appClass); - Field loadedApkField = applictionCls.getField("mLoadedApk"); - loadedApkField.setAccessible(true); - Object loadedApk = loadedApkField.get(appContext); - Class loadedApkCls = Class.forName("android.app.LoadedApk"); - Field receiversField = loadedApkCls.getDeclaredField("mReceivers"); - receiversField.setAccessible(true); - ArrayMap receivers = (ArrayMap) receiversField.get(loadedApk); - for (Object receiverMap : receivers.values()) { - for (Object rec : ((ArrayMap) receiverMap).keySet()) { - Class clazz = rec.getClass(); - if (clazz.getName().contains("ProxyChangeListener")) { - Method onReceiveMethod = clazz.getDeclaredMethod("onReceive", Context.class, Intent.class); - Intent intent = new Intent(Proxy.PROXY_CHANGE_ACTION); - - if (host != null) - { - /*********** optional, may be need in future *************/ - final String CLASS_NAME = "android.net.ProxyProperties"; - Class cls = Class.forName(CLASS_NAME); - Constructor constructor = cls.getConstructor(String.class, Integer.TYPE, String.class); - constructor.setAccessible(true); - Object proxyProperties = constructor.newInstance(host, port, null); - intent.putExtra("proxy", (Parcelable) proxyProperties); - /*********** optional, may be need in future *************/ - } - - onReceiveMethod.invoke(rec, appContext, intent); - } - } - } - return true; - } catch (ClassNotFoundException e) { - StringWriter sw = new StringWriter(); - e.printStackTrace(new PrintWriter(sw)); - String exceptionAsString = sw.toString(); - Log.v(TAG, e.getMessage()); - Log.v(TAG, exceptionAsString); - } catch (NoSuchFieldException e) { - StringWriter sw = new StringWriter(); - e.printStackTrace(new PrintWriter(sw)); - String exceptionAsString = sw.toString(); - Log.v(TAG, e.getMessage()); - Log.v(TAG, exceptionAsString); - } catch (IllegalAccessException e) { - StringWriter sw = new StringWriter(); - e.printStackTrace(new PrintWriter(sw)); - String exceptionAsString = sw.toString(); - Log.v(TAG, e.getMessage()); - Log.v(TAG, exceptionAsString); - } catch (IllegalArgumentException e) { - StringWriter sw = new StringWriter(); - e.printStackTrace(new PrintWriter(sw)); - String exceptionAsString = sw.toString(); - Log.v(TAG, e.getMessage()); - Log.v(TAG, exceptionAsString); - } catch (NoSuchMethodException e) { - StringWriter sw = new StringWriter(); - e.printStackTrace(new PrintWriter(sw)); - String exceptionAsString = sw.toString(); - Log.v(TAG, e.getMessage()); - Log.v(TAG, exceptionAsString); - } catch (InvocationTargetException e) { - StringWriter sw = new StringWriter(); - e.printStackTrace(new PrintWriter(sw)); - String exceptionAsString = sw.toString(); - Log.v(TAG, e.getMessage()); - Log.v(TAG, exceptionAsString); - } catch (InstantiationException e) { - StringWriter sw = new StringWriter(); - e.printStackTrace(new PrintWriter(sw)); - String exceptionAsString = sw.toString(); - Log.v(TAG, e.getMessage()); - Log.v(TAG, exceptionAsString); - } - return false; } - - @TargetApi(21) - public static boolean resetLollipopProxy(String appClass, Context appContext) { - - return setWebkitProxyLollipop(appContext,null,0); - } - - // http://stackanswers.com/questions/25272393/android-webview-set-proxy-programmatically-on-android-l - @TargetApi(21) // for android.util.ArrayMap methods - @SuppressWarnings("rawtypes") - private static boolean setWebkitProxyLollipop(Context appContext, String host, int port) - { - System.setProperty("http.proxyHost", host); - System.setProperty("http.proxyPort", Integer.toString(port)); - System.setProperty("https.proxyHost", host); - System.setProperty("https.proxyPort", Integer.toString(port)); - try { - Class applictionClass = Class.forName("android.app.Application"); - Field mLoadedApkField = applictionClass.getDeclaredField("mLoadedApk"); - mLoadedApkField.setAccessible(true); - Object mloadedApk = mLoadedApkField.get(appContext); - Class loadedApkClass = Class.forName("android.app.LoadedApk"); - Field mReceiversField = loadedApkClass.getDeclaredField("mReceivers"); - mReceiversField.setAccessible(true); - ArrayMap receivers = (ArrayMap) mReceiversField.get(mloadedApk); - for (Object receiverMap : receivers.values()) - { - for (Object receiver : ((ArrayMap) receiverMap).keySet()) - { - Class clazz = receiver.getClass(); - if (clazz.getName().contains("ProxyChangeListener")) - { - Method onReceiveMethod = clazz.getDeclaredMethod("onReceive", Context.class, Intent.class); - Intent intent = new Intent(Proxy.PROXY_CHANGE_ACTION); - onReceiveMethod.invoke(receiver, appContext, intent); - } - } - } - return true; - } - catch (ClassNotFoundException e) - { - Log.d("ProxySettings","Exception setting WebKit proxy on Lollipop through ProxyChangeListener: " + e.toString()); - } - catch (NoSuchFieldException e) - { - Log.d("ProxySettings","Exception setting WebKit proxy on Lollipop through ProxyChangeListener: " + e.toString()); - } - catch (IllegalAccessException e) - { - Log.d("ProxySettings","Exception setting WebKit proxy on Lollipop through ProxyChangeListener: " + e.toString()); - } - catch (NoSuchMethodException e) - { - Log.d("ProxySettings","Exception setting WebKit proxy on Lollipop through ProxyChangeListener: " + e.toString()); - } - catch (InvocationTargetException e) - { - Log.d("ProxySettings","Exception setting WebKit proxy on Lollipop through ProxyChangeListener: " + e.toString()); - } - return false; - } - - private static boolean sendProxyChangedIntent(Context ctx, String host, int port) - { - - try - { - Class proxyPropertiesClass = Class.forName("android.net.ProxyProperties"); - if (proxyPropertiesClass != null) - { - Constructor c = proxyPropertiesClass.getConstructor(String.class, Integer.TYPE, - String.class); - - if (c != null) - { - c.setAccessible(true); - Object properties = c.newInstance(host, port, null); - - Intent intent = new Intent(android.net.Proxy.PROXY_CHANGE_ACTION); - intent.putExtra("proxy",(Parcelable)properties); - ctx.sendBroadcast(intent); - - } - - } - } catch (Exception e) - { - Log.e("ProxySettings", - "Exception sending Intent ",e); - } catch (Error e) - { - Log.e("ProxySettings", - "Exception sending Intent ",e); - } - - return false; - - } - - /** - private static boolean setKitKatProxy0(Context ctx, String host, int port) - { - - try - { - Class cmClass = Class.forName("android.net.ConnectivityManager"); - - Class proxyPropertiesClass = Class.forName("android.net.ProxyProperties"); - if (cmClass != null && proxyPropertiesClass != null) - { - Constructor c = proxyPropertiesClass.getConstructor(String.class, Integer.TYPE, - String.class); - - if (c != null) - { - c.setAccessible(true); - - Object proxyProps = c.newInstance(host, port, null); - ConnectivityManager cm = - (ConnectivityManager)ctx.getSystemService(Context.CONNECTIVITY_SERVICE); - - Method mSetGlobalProxy = cmClass.getDeclaredMethod("setGlobalProxy", proxyPropertiesClass); - - mSetGlobalProxy.invoke(cm, proxyProps); - - return true; - } - - } - } catch (Exception e) - { - Log.e("ProxySettings", - "ConnectivityManager.setGlobalProxy ",e); - } - - return false; - - } - */ - //CommandLine.initFromFile(COMMAND_LINE_FILE); - - /** - private static boolean setKitKatProxy2 (Context ctx, String host, int port) - { - - String commandLinePath = "/data/local/tmp/orweb.conf"; - try - { - Class webViewCoreClass = Class.forName("org.chromium.content.common.CommandLine"); - - if (webViewCoreClass != null) - { - for (Method method : webViewCoreClass.getDeclaredMethods()) - { - Log.d("Orweb","Proxy methods: " + method.getName()); - } - - Method m = webViewCoreClass.getDeclaredMethod("initFromFile", - String.class); - - if (m != null) - { - m.setAccessible(true); - m.invoke(null, commandLinePath); - return true; - } - else - return false; - } - } catch (Exception e) - { - Log.e("ProxySettings", - "Exception setting WebKit proxy through android.net.ProxyProperties: " - + e.toString()); - } catch (Error e) - { - Log.e("ProxySettings", - "Exception setting WebKit proxy through android.webkit.Network: " - + e.toString()); - } - - return false; - } - - /** - private static boolean setKitKatProxy (Context ctx, String host, int port) - { - - try - { - Class webViewCoreClass = Class.forName("android.net.Proxy"); - - Class proxyPropertiesClass = Class.forName("android.net.ProxyProperties"); - if (webViewCoreClass != null && proxyPropertiesClass != null) - { - for (Method method : webViewCoreClass.getDeclaredMethods()) - { - Log.d("Orweb","Proxy methods: " + method.getName()); - } - - Method m = webViewCoreClass.getDeclaredMethod("setHttpProxySystemProperty", - proxyPropertiesClass); - Constructor c = proxyPropertiesClass.getConstructor(String.class, Integer.TYPE, - String.class); - - if (m != null && c != null) - { - m.setAccessible(true); - c.setAccessible(true); - Object properties = c.newInstance(host, port, null); - - m.invoke(null, properties); - return true; - } - else - return false; - } - } catch (Exception e) - { - Log.e("ProxySettings", - "Exception setting WebKit proxy through android.net.ProxyProperties: " - + e.toString()); - } catch (Error e) - { - Log.e("ProxySettings", - "Exception setting WebKit proxy through android.webkit.Network: " - + e.toString()); - } - - return false; - } - - private static boolean resetProxyForKitKat () - { - - try - { - Class webViewCoreClass = Class.forName("android.net.Proxy"); - - Class proxyPropertiesClass = Class.forName("android.net.ProxyProperties"); - if (webViewCoreClass != null && proxyPropertiesClass != null) - { - for (Method method : webViewCoreClass.getDeclaredMethods()) - { - Log.d("Orweb","Proxy methods: " + method.getName()); - } - - Method m = webViewCoreClass.getDeclaredMethod("setHttpProxySystemProperty", - proxyPropertiesClass); - - if (m != null) - { - m.setAccessible(true); - - m.invoke(null, null); - return true; - } - else - return false; - } - } catch (Exception e) - { - Log.e("ProxySettings", - "Exception setting WebKit proxy through android.net.ProxyProperties: " - + e.toString()); - } catch (Error e) - { - Log.e("ProxySettings", - "Exception setting WebKit proxy through android.webkit.Network: " - + e.toString()); - } - - return false; - }**/ - - public static void resetProxy(String appClass, Context ctx) throws Exception { - - resetSystemProperties(); - - if (Build.VERSION.SDK_INT < 14) - { - resetProxyForGingerBread(ctx); - } - else if (Build.VERSION.SDK_INT < 19) - { - resetProxyForICS(); - } - else - { - resetKitKatProxy(appClass, ctx); - } - - } - - private static void resetProxyForICS() throws Exception{ - try - { - Class webViewCoreClass = Class.forName("android.webkit.WebViewCore"); - Class proxyPropertiesClass = Class.forName("android.net.ProxyProperties"); - if (webViewCoreClass != null && proxyPropertiesClass != null) - { - Method m = webViewCoreClass.getDeclaredMethod("sendStaticMessage", Integer.TYPE, - Object.class); - - if (m != null) - { - m.setAccessible(true); - - // android.webkit.WebViewCore.EventHub.PROXY_CHANGED = 193; - m.invoke(null, 193, null); - } - } - } catch (Exception e) - { - Log.e("ProxySettings", - "Exception setting WebKit proxy through android.net.ProxyProperties: " - + e.toString()); - throw e; - } catch (Error e) - { - Log.e("ProxySettings", - "Exception setting WebKit proxy through android.webkit.Network: " - + e.toString()); - throw e; - } - } - - private static void resetProxyForGingerBread(Context ctx) throws Exception { - Object requestQueueObject = getRequestQueue(ctx); - if (requestQueueObject != null) { - setDeclaredField(requestQueueObject, "mProxyHost", null); - } - } - - public static Object getRequestQueue(Context ctx) throws Exception { - Object ret = null; - Class networkClass = Class.forName("android.webkit.Network"); - if (networkClass != null) { - Object networkObj = invokeMethod(networkClass, "getInstance", new Object[] { - ctx - }, Context.class); - if (networkObj != null) { - ret = getDeclaredField(networkObj, "mRequestQueue"); - } - } - return ret; - } - - private static Object getDeclaredField(Object obj, String name) - throws SecurityException, NoSuchFieldException, - IllegalArgumentException, IllegalAccessException { - Field f = obj.getClass().getDeclaredField(name); - f.setAccessible(true); - Object out = f.get(obj); - // System.out.println(obj.getClass().getName() + "." + name + " = "+ - // out); - return out; - } - - private static void setDeclaredField(Object obj, String name, Object value) - throws SecurityException, NoSuchFieldException, - IllegalArgumentException, IllegalAccessException { - Field f = obj.getClass().getDeclaredField(name); - f.setAccessible(true); - f.set(obj, value); - } - - private static Object invokeMethod(Object object, String methodName, Object[] params, - Class... types) throws Exception { - Object out = null; - Class c = object instanceof Class ? (Class) object : object.getClass(); - if (types != null) { - Method method = c.getMethod(methodName, types); - out = method.invoke(object, params); - } else { - Method method = c.getMethod(methodName); - out = method.invoke(object); - } - // System.out.println(object.getClass().getName() + "." + methodName + - // "() = "+ out); - return out; - } - - public static Socket getSocket(Context context, String proxyHost, int proxyPort) - throws IOException - { - Socket sock = new Socket(); - - sock.connect(new InetSocketAddress(proxyHost, proxyPort), 10000); - - return sock; - } - - public static Socket getSocket(Context context) throws IOException - { - return getSocket(context, DEFAULT_HOST, DEFAULT_SOCKS_PORT); - - } - - public static AlertDialog initOrbot(Activity activity, - CharSequence stringTitle, - CharSequence stringMessage, - CharSequence stringButtonYes, - CharSequence stringButtonNo, - CharSequence stringDesiredBarcodeFormats) { - Intent intentScan = new Intent("org.torproject.android.START_TOR"); - intentScan.addCategory(Intent.CATEGORY_DEFAULT); - - try { - activity.startActivityForResult(intentScan, REQUEST_CODE); - return null; - } catch (ActivityNotFoundException e) { - return showDownloadDialog(activity, stringTitle, stringMessage, stringButtonYes, - stringButtonNo); - } - } - - private static AlertDialog showDownloadDialog(final Activity activity, - CharSequence stringTitle, - CharSequence stringMessage, - CharSequence stringButtonYes, - CharSequence stringButtonNo) { - AlertDialog.Builder downloadDialog = new AlertDialog.Builder(activity); - downloadDialog.setTitle(stringTitle); - downloadDialog.setMessage(stringMessage); - downloadDialog.setPositiveButton(stringButtonYes, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialogInterface, int i) { - Uri uri = Uri.parse("market://search?q=pname:org.torproject.android"); - Intent intent = new Intent(Intent.ACTION_VIEW, uri); - activity.startActivity(intent); - } - }); - downloadDialog.setNegativeButton(stringButtonNo, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialogInterface, int i) { - } - }); - return downloadDialog.show(); - } - - - -} +/* + * Copyright 2015 Anthony Restaino + * Copyright 2012-2016 Nathan Freitas + + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.hiddenservices.genesissearchengine.production.libs.netcipher.web; + +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.net.InetSocketAddress; +import java.net.Socket; +import android.annotation.TargetApi; +import android.app.Activity; +import android.app.AlertDialog; +import android.content.ActivityNotFoundException; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.net.Proxy; +import android.net.Uri; +import android.os.Build; +import android.os.Parcelable; +import android.util.ArrayMap; +import android.util.Log; +import android.webkit.WebView; + +import org.orbotproject.android.service.wrapper.orbotLocalConstants; + +import ch.boye.httpclientandroidlib.HttpHost; + +public class WebkitProxy { + + private final static String DEFAULT_HOST = "localhost";//"127.0.0.1"; + private final static int DEFAULT_PORT = orbotLocalConstants.mHTTPPort; + private final static int DEFAULT_SOCKS_PORT = orbotLocalConstants.mSOCKSPort; + + private final static int REQUEST_CODE = 0; + + private final static String TAG = "OrbotHelpher"; + + public static boolean setProxy(String appClass, Context ctx, WebView wView, String host, int port) throws Exception + { + + setSystemProperties(host, port); + + boolean worked = false; + + if (Build.VERSION.SDK_INT < 13) + { +// worked = setWebkitProxyGingerbread(ctx, host, port); + setProxyUpToHC(wView, host, port); + } + else if (Build.VERSION.SDK_INT < 19) + { + worked = setWebkitProxyICS(ctx, host, port); + } + else if (Build.VERSION.SDK_INT < 20) + { + worked = setKitKatProxy(appClass, ctx, host, port); + + if (!worked) //some kitkat's still use ICS browser component (like Cyanogen 11) + worked = setWebkitProxyICS(ctx, host, port); + + } + else if (Build.VERSION.SDK_INT >= 21) + { + worked = setWebkitProxyLollipop(ctx, host, port); + + } + + return worked; + } + + private static void setSystemProperties(String host, int port) + { + + System.setProperty("proxyHost", host); + System.setProperty("proxyPort", Integer.toString(port)); + + System.setProperty("http.proxyHost", host); + System.setProperty("http.proxyPort", Integer.toString(port)); + + System.setProperty("https.proxyHost", host); + System.setProperty("https.proxyPort", Integer.toString(port)); + + + System.setProperty("socks.proxyHost", host); + System.setProperty("socks.proxyPort", Integer.toString(DEFAULT_SOCKS_PORT)); + + System.setProperty("socksProxyHost", host); + System.setProperty("socksProxyPort", Integer.toString(DEFAULT_SOCKS_PORT)); + + + /* + ProxySelector pSelect = new ProxySelector(); + pSelect.addProxy(Proxy.Type.HTTP, host, port); + ProxySelector.setDefault(pSelect); + */ + /* + System.setProperty("http_proxy", "http://" + host + ":" + port); + System.setProperty("proxy-server", "http://" + host + ":" + port); + System.setProperty("host-resolver-rules","MAP * 0.0.0.0 , EXCLUDE myproxy"); + + System.getProperty("networkaddress.cache.ttl", "-1"); + */ + + } + + private static void resetSystemProperties() + { + + System.setProperty("proxyHost", ""); + System.setProperty("proxyPort", ""); + + System.setProperty("http.proxyHost", ""); + System.setProperty("http.proxyPort", ""); + + System.setProperty("https.proxyHost", ""); + System.setProperty("https.proxyPort", ""); + + + System.setProperty("socks.proxyHost", ""); + System.setProperty("socks.proxyPort", Integer.toString(DEFAULT_SOCKS_PORT)); + + System.setProperty("socksProxyHost", ""); + System.setProperty("socksProxyPort", Integer.toString(DEFAULT_SOCKS_PORT)); + + } + + /** + * Override WebKit Proxy settings + * + * @param ctx Android ApplicationContext + * @param host + * @param port + * @return true if Proxy was successfully set + */ + private static boolean setWebkitProxyGingerbread(Context ctx, String host, int port) + throws Exception + { + + boolean ret = false; + + Object requestQueueObject = getRequestQueue(ctx); + if (requestQueueObject != null) { + // Create Proxy config object and set it into request Q + HttpHost httpHost = new HttpHost(host, port, "http"); + setDeclaredField(requestQueueObject, "mProxyHost", httpHost); + return true; + } + return false; + + } + + +/** + * Set Proxy for Android 3.2 and below. + */ +@SuppressWarnings("all") +private static boolean setProxyUpToHC(WebView webview, String host, int port) { + Log.d(TAG, "Setting proxy with <= 3.2 API."); + + HttpHost proxyServer = new HttpHost(host, port); + // Getting network + Class networkClass = null; + Object network = null; + try { + networkClass = Class.forName("android.webkit.Network"); + if (networkClass == null) { + Log.e(TAG, "failed to get class for android.webkit.Network"); + return false; + } + Method getInstanceMethod = networkClass.getMethod("getInstance", Context.class); + if (getInstanceMethod == null) { + Log.e(TAG, "failed to get getInstance method"); + } + network = getInstanceMethod.invoke(networkClass, new Object[]{webview.getContext()}); + } catch (Exception ex) { + Log.e(TAG, "error getting network: " + ex); + return false; + } + if (network == null) { + Log.e(TAG, "error getting network: network is null"); + return false; + } + Object requestQueue = null; + try { + Field requestQueueField = networkClass + .getDeclaredField("mRequestQueue"); + requestQueue = getFieldValueSafely(requestQueueField, network); + } catch (Exception ex) { + Log.e(TAG, "error getting field value"); + return false; + } + if (requestQueue == null) { + Log.e(TAG, "Request queue is null"); + return false; + } + Field proxyHostField = null; + try { + Class requestQueueClass = Class.forName("android.net.http.RequestQueue"); + proxyHostField = requestQueueClass + .getDeclaredField("mProxyHost"); + } catch (Exception ex) { + Log.e(TAG, "error getting proxy host field"); + return false; + } + + boolean temp = proxyHostField.isAccessible(); + try { + proxyHostField.setAccessible(true); + proxyHostField.set(requestQueue, proxyServer); + } catch (Exception ex) { + Log.e(TAG, "error setting proxy host"); + } finally { + proxyHostField.setAccessible(temp); + } + + Log.d(TAG, "Setting proxy with <= 3.2 API successful!"); + return true; +} + + +private static Object getFieldValueSafely(Field field, Object classInstance) throws IllegalArgumentException, IllegalAccessException { + boolean oldAccessibleValue = field.isAccessible(); + field.setAccessible(true); + Object result = field.get(classInstance); + field.setAccessible(oldAccessibleValue); + return result; +} + + private static boolean setWebkitProxyICS(Context ctx, String host, int port) + { + + // PSIPHON: added support for Android 4.x WebView proxy + try + { + Class webViewCoreClass = Class.forName("android.webkit.WebViewCore"); + + Class proxyPropertiesClass = Class.forName("android.net.ProxyProperties"); + if (webViewCoreClass != null && proxyPropertiesClass != null) + { + Method m = webViewCoreClass.getDeclaredMethod("sendStaticMessage", Integer.TYPE, + Object.class); + Constructor c = proxyPropertiesClass.getConstructor(String.class, Integer.TYPE, + String.class); + + if (m != null && c != null) + { + m.setAccessible(true); + c.setAccessible(true); + Object properties = c.newInstance(host, port, null); + + // android.webkit.WebViewCore.EventHub.PROXY_CHANGED = 193; + m.invoke(null, 193, properties); + + + return true; + } + + + } + } catch (Exception e) + { + Log.e("ProxySettings", + "Exception setting WebKit proxy through android.net.ProxyProperties: " + + e.toString()); + } catch (Error e) + { + Log.e("ProxySettings", + "Exception setting WebKit proxy through android.webkit.Network: " + + e.toString()); + } + + return false; + + } + + @TargetApi(19) + public static boolean resetKitKatProxy(String appClass, Context appContext) { + + return setKitKatProxy(appClass, appContext,null,0); + } + + @TargetApi(19) + private static boolean setKitKatProxy(String appClass, Context appContext, String host, int port) { + //Context appContext = webView.getContext().getApplicationContext(); + + if (host != null) + { + System.setProperty("http.proxyHost", host); + System.setProperty("http.proxyPort", Integer.toString(port)); + System.setProperty("https.proxyHost", host); + System.setProperty("https.proxyPort", Integer.toString(port)); + } + + try { + Class applictionCls = Class.forName(appClass); + Field loadedApkField = applictionCls.getField("mLoadedApk"); + loadedApkField.setAccessible(true); + Object loadedApk = loadedApkField.get(appContext); + Class loadedApkCls = Class.forName("android.app.LoadedApk"); + Field receiversField = loadedApkCls.getDeclaredField("mReceivers"); + receiversField.setAccessible(true); + ArrayMap receivers = (ArrayMap) receiversField.get(loadedApk); + for (Object receiverMap : receivers.values()) { + for (Object rec : ((ArrayMap) receiverMap).keySet()) { + Class clazz = rec.getClass(); + if (clazz.getName().contains("ProxyChangeListener")) { + Method onReceiveMethod = clazz.getDeclaredMethod("onReceive", Context.class, Intent.class); + Intent intent = new Intent(Proxy.PROXY_CHANGE_ACTION); + + if (host != null) + { + /*********** optional, may be need in future *************/ + final String CLASS_NAME = "android.net.ProxyProperties"; + Class cls = Class.forName(CLASS_NAME); + Constructor constructor = cls.getConstructor(String.class, Integer.TYPE, String.class); + constructor.setAccessible(true); + Object proxyProperties = constructor.newInstance(host, port, null); + intent.putExtra("proxy", (Parcelable) proxyProperties); + /*********** optional, may be need in future *************/ + } + + onReceiveMethod.invoke(rec, appContext, intent); + } + } + } + return true; + } catch (ClassNotFoundException e) { + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw)); + String exceptionAsString = sw.toString(); + Log.v(TAG, e.getMessage()); + Log.v(TAG, exceptionAsString); + } catch (NoSuchFieldException e) { + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw)); + String exceptionAsString = sw.toString(); + Log.v(TAG, e.getMessage()); + Log.v(TAG, exceptionAsString); + } catch (IllegalAccessException e) { + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw)); + String exceptionAsString = sw.toString(); + Log.v(TAG, e.getMessage()); + Log.v(TAG, exceptionAsString); + } catch (IllegalArgumentException e) { + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw)); + String exceptionAsString = sw.toString(); + Log.v(TAG, e.getMessage()); + Log.v(TAG, exceptionAsString); + } catch (NoSuchMethodException e) { + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw)); + String exceptionAsString = sw.toString(); + Log.v(TAG, e.getMessage()); + Log.v(TAG, exceptionAsString); + } catch (InvocationTargetException e) { + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw)); + String exceptionAsString = sw.toString(); + Log.v(TAG, e.getMessage()); + Log.v(TAG, exceptionAsString); + } catch (InstantiationException e) { + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw)); + String exceptionAsString = sw.toString(); + Log.v(TAG, e.getMessage()); + Log.v(TAG, exceptionAsString); + } + return false; } + + @TargetApi(21) + public static boolean resetLollipopProxy(String appClass, Context appContext) { + + return setWebkitProxyLollipop(appContext,null,0); + } + + // http://stackanswers.com/questions/25272393/android-webview-set-proxy-programmatically-on-android-l + @TargetApi(21) // for android.util.ArrayMap methods + @SuppressWarnings("rawtypes") + private static boolean setWebkitProxyLollipop(Context appContext, String host, int port) + { + System.setProperty("http.proxyHost", host); + System.setProperty("http.proxyPort", Integer.toString(port)); + System.setProperty("https.proxyHost", host); + System.setProperty("https.proxyPort", Integer.toString(port)); + try { + Class applictionClass = Class.forName("android.app.Application"); + Field mLoadedApkField = applictionClass.getDeclaredField("mLoadedApk"); + mLoadedApkField.setAccessible(true); + Object mloadedApk = mLoadedApkField.get(appContext); + Class loadedApkClass = Class.forName("android.app.LoadedApk"); + Field mReceiversField = loadedApkClass.getDeclaredField("mReceivers"); + mReceiversField.setAccessible(true); + ArrayMap receivers = (ArrayMap) mReceiversField.get(mloadedApk); + for (Object receiverMap : receivers.values()) + { + for (Object receiver : ((ArrayMap) receiverMap).keySet()) + { + Class clazz = receiver.getClass(); + if (clazz.getName().contains("ProxyChangeListener")) + { + Method onReceiveMethod = clazz.getDeclaredMethod("onReceive", Context.class, Intent.class); + Intent intent = new Intent(Proxy.PROXY_CHANGE_ACTION); + onReceiveMethod.invoke(receiver, appContext, intent); + } + } + } + return true; + } + catch (ClassNotFoundException e) + { + Log.d("ProxySettings","Exception setting WebKit proxy on Lollipop through ProxyChangeListener: " + e.toString()); + } + catch (NoSuchFieldException e) + { + Log.d("ProxySettings","Exception setting WebKit proxy on Lollipop through ProxyChangeListener: " + e.toString()); + } + catch (IllegalAccessException e) + { + Log.d("ProxySettings","Exception setting WebKit proxy on Lollipop through ProxyChangeListener: " + e.toString()); + } + catch (NoSuchMethodException e) + { + Log.d("ProxySettings","Exception setting WebKit proxy on Lollipop through ProxyChangeListener: " + e.toString()); + } + catch (InvocationTargetException e) + { + Log.d("ProxySettings","Exception setting WebKit proxy on Lollipop through ProxyChangeListener: " + e.toString()); + } + return false; + } + + private static boolean sendProxyChangedIntent(Context ctx, String host, int port) + { + + try + { + Class proxyPropertiesClass = Class.forName("android.net.ProxyProperties"); + if (proxyPropertiesClass != null) + { + Constructor c = proxyPropertiesClass.getConstructor(String.class, Integer.TYPE, + String.class); + + if (c != null) + { + c.setAccessible(true); + Object properties = c.newInstance(host, port, null); + + Intent intent = new Intent(android.net.Proxy.PROXY_CHANGE_ACTION); + intent.putExtra("proxy",(Parcelable)properties); + ctx.sendBroadcast(intent); + + } + + } + } catch (Exception e) + { + Log.e("ProxySettings", + "Exception sending Intent ",e); + } catch (Error e) + { + Log.e("ProxySettings", + "Exception sending Intent ",e); + } + + return false; + + } + + /** + private static boolean setKitKatProxy0(Context ctx, String host, int port) + { + + try + { + Class cmClass = Class.forName("android.net.ConnectivityManager"); + + Class proxyPropertiesClass = Class.forName("android.net.ProxyProperties"); + if (cmClass != null && proxyPropertiesClass != null) + { + Constructor c = proxyPropertiesClass.getConstructor(String.class, Integer.TYPE, + String.class); + + if (c != null) + { + c.setAccessible(true); + + Object proxyProps = c.newInstance(host, port, null); + ConnectivityManager cm = + (ConnectivityManager)ctx.getSystemService(Context.CONNECTIVITY_SERVICE); + + Method mSetGlobalProxy = cmClass.getDeclaredMethod("setGlobalProxy", proxyPropertiesClass); + + mSetGlobalProxy.invoke(cm, proxyProps); + + return true; + } + + } + } catch (Exception e) + { + Log.e("ProxySettings", + "ConnectivityManager.setGlobalProxy ",e); + } + + return false; + + } + */ + //CommandLine.initFromFile(COMMAND_LINE_FILE); + + /** + private static boolean setKitKatProxy2 (Context ctx, String host, int port) + { + + String commandLinePath = "/data/local/tmp/orweb.conf"; + try + { + Class webViewCoreClass = Class.forName("org.chromium.content.common.CommandLine"); + + if (webViewCoreClass != null) + { + for (Method method : webViewCoreClass.getDeclaredMethods()) + { + Log.d("Orweb","Proxy methods: " + method.getName()); + } + + Method m = webViewCoreClass.getDeclaredMethod("initFromFile", + String.class); + + if (m != null) + { + m.setAccessible(true); + m.invoke(null, commandLinePath); + return true; + } + else + return false; + } + } catch (Exception e) + { + Log.e("ProxySettings", + "Exception setting WebKit proxy through android.net.ProxyProperties: " + + e.toString()); + } catch (Error e) + { + Log.e("ProxySettings", + "Exception setting WebKit proxy through android.webkit.Network: " + + e.toString()); + } + + return false; + } + + /** + private static boolean setKitKatProxy (Context ctx, String host, int port) + { + + try + { + Class webViewCoreClass = Class.forName("android.net.Proxy"); + + Class proxyPropertiesClass = Class.forName("android.net.ProxyProperties"); + if (webViewCoreClass != null && proxyPropertiesClass != null) + { + for (Method method : webViewCoreClass.getDeclaredMethods()) + { + Log.d("Orweb","Proxy methods: " + method.getName()); + } + + Method m = webViewCoreClass.getDeclaredMethod("setHttpProxySystemProperty", + proxyPropertiesClass); + Constructor c = proxyPropertiesClass.getConstructor(String.class, Integer.TYPE, + String.class); + + if (m != null && c != null) + { + m.setAccessible(true); + c.setAccessible(true); + Object properties = c.newInstance(host, port, null); + + m.invoke(null, properties); + return true; + } + else + return false; + } + } catch (Exception e) + { + Log.e("ProxySettings", + "Exception setting WebKit proxy through android.net.ProxyProperties: " + + e.toString()); + } catch (Error e) + { + Log.e("ProxySettings", + "Exception setting WebKit proxy through android.webkit.Network: " + + e.toString()); + } + + return false; + } + + private static boolean resetProxyForKitKat () + { + + try + { + Class webViewCoreClass = Class.forName("android.net.Proxy"); + + Class proxyPropertiesClass = Class.forName("android.net.ProxyProperties"); + if (webViewCoreClass != null && proxyPropertiesClass != null) + { + for (Method method : webViewCoreClass.getDeclaredMethods()) + { + Log.d("Orweb","Proxy methods: " + method.getName()); + } + + Method m = webViewCoreClass.getDeclaredMethod("setHttpProxySystemProperty", + proxyPropertiesClass); + + if (m != null) + { + m.setAccessible(true); + + m.invoke(null, null); + return true; + } + else + return false; + } + } catch (Exception e) + { + Log.e("ProxySettings", + "Exception setting WebKit proxy through android.net.ProxyProperties: " + + e.toString()); + } catch (Error e) + { + Log.e("ProxySettings", + "Exception setting WebKit proxy through android.webkit.Network: " + + e.toString()); + } + + return false; + }**/ + + public static void resetProxy(String appClass, Context ctx) throws Exception { + + resetSystemProperties(); + + if (Build.VERSION.SDK_INT < 14) + { + resetProxyForGingerBread(ctx); + } + else if (Build.VERSION.SDK_INT < 19) + { + resetProxyForICS(); + } + else + { + resetKitKatProxy(appClass, ctx); + } + + } + + private static void resetProxyForICS() throws Exception{ + try + { + Class webViewCoreClass = Class.forName("android.webkit.WebViewCore"); + Class proxyPropertiesClass = Class.forName("android.net.ProxyProperties"); + if (webViewCoreClass != null && proxyPropertiesClass != null) + { + Method m = webViewCoreClass.getDeclaredMethod("sendStaticMessage", Integer.TYPE, + Object.class); + + if (m != null) + { + m.setAccessible(true); + + // android.webkit.WebViewCore.EventHub.PROXY_CHANGED = 193; + m.invoke(null, 193, null); + } + } + } catch (Exception e) + { + Log.e("ProxySettings", + "Exception setting WebKit proxy through android.net.ProxyProperties: " + + e.toString()); + throw e; + } catch (Error e) + { + Log.e("ProxySettings", + "Exception setting WebKit proxy through android.webkit.Network: " + + e.toString()); + throw e; + } + } + + private static void resetProxyForGingerBread(Context ctx) throws Exception { + Object requestQueueObject = getRequestQueue(ctx); + if (requestQueueObject != null) { + setDeclaredField(requestQueueObject, "mProxyHost", null); + } + } + + public static Object getRequestQueue(Context ctx) throws Exception { + Object ret = null; + Class networkClass = Class.forName("android.webkit.Network"); + if (networkClass != null) { + Object networkObj = invokeMethod(networkClass, "getInstance", new Object[] { + ctx + }, Context.class); + if (networkObj != null) { + ret = getDeclaredField(networkObj, "mRequestQueue"); + } + } + return ret; + } + + private static Object getDeclaredField(Object obj, String name) + throws SecurityException, NoSuchFieldException, + IllegalArgumentException, IllegalAccessException { + Field f = obj.getClass().getDeclaredField(name); + f.setAccessible(true); + Object out = f.get(obj); + // System.out.println(obj.getClass().getName() + "." + name + " = "+ + // out); + return out; + } + + private static void setDeclaredField(Object obj, String name, Object value) + throws SecurityException, NoSuchFieldException, + IllegalArgumentException, IllegalAccessException { + Field f = obj.getClass().getDeclaredField(name); + f.setAccessible(true); + f.set(obj, value); + } + + private static Object invokeMethod(Object object, String methodName, Object[] params, + Class... types) throws Exception { + Object out = null; + Class c = object instanceof Class ? (Class) object : object.getClass(); + if (types != null) { + Method method = c.getMethod(methodName, types); + out = method.invoke(object, params); + } else { + Method method = c.getMethod(methodName); + out = method.invoke(object); + } + // System.out.println(object.getClass().getName() + "." + methodName + + // "() = "+ out); + return out; + } + + public static Socket getSocket(Context context, String proxyHost, int proxyPort) + throws IOException + { + Socket sock = new Socket(); + + sock.connect(new InetSocketAddress(proxyHost, proxyPort), 10000); + + return sock; + } + + public static Socket getSocket(Context context) throws IOException + { + return getSocket(context, DEFAULT_HOST, DEFAULT_SOCKS_PORT); + + } + + public static AlertDialog initOrbot(Activity activity, + CharSequence stringTitle, + CharSequence stringMessage, + CharSequence stringButtonYes, + CharSequence stringButtonNo, + CharSequence stringDesiredBarcodeFormats) { + Intent intentScan = new Intent("org.torproject.android.START_TOR"); + intentScan.addCategory(Intent.CATEGORY_DEFAULT); + + try { + activity.startActivityForResult(intentScan, REQUEST_CODE); + return null; + } catch (ActivityNotFoundException e) { + return showDownloadDialog(activity, stringTitle, stringMessage, stringButtonYes, + stringButtonNo); + } + } + + private static AlertDialog showDownloadDialog(final Activity activity, + CharSequence stringTitle, + CharSequence stringMessage, + CharSequence stringButtonYes, + CharSequence stringButtonNo) { + AlertDialog.Builder downloadDialog = new AlertDialog.Builder(activity); + downloadDialog.setTitle(stringTitle); + downloadDialog.setMessage(stringMessage); + downloadDialog.setPositiveButton(stringButtonYes, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialogInterface, int i) { + Uri uri = Uri.parse("market://search?q=pname:org.torproject.android"); + Intent intent = new Intent(Intent.ACTION_VIEW, uri); + activity.startActivity(intent); + } + }); + downloadDialog.setNegativeButton(stringButtonNo, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialogInterface, int i) { + } + }); + return downloadDialog.show(); + } + + + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/libs/providers/ClientAuthContentProviderGenesis.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/providers/ClientAuthContentProviderGenesis.java similarity index 94% rename from app/src/main/java/com/darkweb/genesissearchengine/libs/providers/ClientAuthContentProviderGenesis.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/providers/ClientAuthContentProviderGenesis.java index 46d4db5d..5521e390 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/libs/providers/ClientAuthContentProviderGenesis.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/providers/ClientAuthContentProviderGenesis.java @@ -1,104 +1,104 @@ -package com.darkweb.genesissearchengine.libs.providers; - -import android.content.ContentProvider; -import android.content.ContentUris; -import android.content.ContentValues; -import android.content.UriMatcher; -import android.database.Cursor; -import android.database.sqlite.SQLiteDatabase; -import android.net.Uri; -import android.provider.BaseColumns; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -public class ClientAuthContentProviderGenesis extends ContentProvider { - public static final String[] PROJECTION = { - V3ClientAuth._ID, - V3ClientAuth.DOMAIN, - V3ClientAuth.HASH, - V3ClientAuth.ENABLED, - }; - private static final String AUTH = "org.torproject.android.ui.v3onionservice.genesis.clientauth"; - public static final Uri CONTENT_URI = Uri.parse("content://" + AUTH + "/v3auth"); - private static final int V3AUTHS = 1, V3AUTH_ID = 2; - - private static final UriMatcher uriMatcher; - - static { - uriMatcher = new UriMatcher(UriMatcher.NO_MATCH); - uriMatcher.addURI(AUTH, "v3auth", V3AUTHS); - uriMatcher.addURI(AUTH, "v3auth/#", V3AUTH_ID); - } - - private ClientAuthDatabase mDatabase; - - @Override - public boolean onCreate() { - mDatabase = new ClientAuthDatabase(getContext()); - return true; - } - - @Nullable - @Override - public String getType(@NonNull Uri uri) { - int match = uriMatcher.match(uri); - switch (match) { - case V3AUTHS: - return "vnd.android.cursor.dir/vnd.torproject.v3auths"; - case V3AUTH_ID: - return "vnd.android.cursor.item/vnd.torproject.v3auth"; - default: - return null; - } - } - - @Nullable - @Override - public Cursor query(@NonNull Uri uri, @Nullable String[] projection, @Nullable String selection, @Nullable String[] selectionArgs, @Nullable String sortOrder) { - if (uriMatcher.match(uri) == V3AUTH_ID) - selection = "_id=" + uri.getLastPathSegment(); - SQLiteDatabase db = mDatabase.getReadableDatabase(); - return db.query(ClientAuthDatabase.DATABASE_NAME, projection, selection, selectionArgs, null, null, sortOrder); - } - - @Nullable - @Override - public Uri insert(@NonNull Uri uri, @Nullable ContentValues values) { - SQLiteDatabase db = mDatabase.getWritableDatabase(); - long regId = db.insert(ClientAuthDatabase.DATABASE_NAME, null, values); - getContext().getContentResolver().notifyChange(CONTENT_URI, null); - return ContentUris.withAppendedId(CONTENT_URI, regId); - } - - @Override - public int delete(@NonNull Uri uri, @Nullable String selection, @Nullable String[] selectionArgs) { - if (uriMatcher.match(uri) == V3AUTH_ID) - selection = "_id=" + uri.getLastPathSegment(); - SQLiteDatabase db = mDatabase.getWritableDatabase(); - int rows = db.delete(ClientAuthDatabase.DATABASE_NAME, selection, selectionArgs); - getContext().getContentResolver().notifyChange(CONTENT_URI, null); - return rows; - } - - @Override - public int update(@NonNull Uri uri, @Nullable ContentValues values, @Nullable String selection, @Nullable String[] selectionArgs) { - SQLiteDatabase db = mDatabase.getWritableDatabase(); - if (uriMatcher.match(uri) == V3AUTH_ID) - selection = "id_=" + uri.getLastPathSegment(); - int rows = db.update(ClientAuthDatabase.DATABASE_NAME, values, selection, null); - getContext().getContentResolver().notifyChange(CONTENT_URI, null); - return rows; - } - - public static final class V3ClientAuth implements BaseColumns { - private V3ClientAuth() { - } // no-op - - public static final String - DOMAIN = "domain", - HASH = "hash", - ENABLED = "enabled"; - } - +package com.hiddenservices.genesissearchengine.production.libs.providers; + +import android.content.ContentProvider; +import android.content.ContentUris; +import android.content.ContentValues; +import android.content.UriMatcher; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.net.Uri; +import android.provider.BaseColumns; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +public class ClientAuthContentProviderGenesis extends ContentProvider { + public static final String[] PROJECTION = { + V3ClientAuth._ID, + V3ClientAuth.DOMAIN, + V3ClientAuth.HASH, + V3ClientAuth.ENABLED, + }; + private static final String AUTH = "org.torproject.android.ui.v3onionservice.genesishiddenservices.clientauth"; + public static final Uri CONTENT_URI = Uri.parse("content://" + AUTH + "/v3auth"); + private static final int V3AUTHS = 1, V3AUTH_ID = 2; + + private static final UriMatcher uriMatcher; + + static { + uriMatcher = new UriMatcher(UriMatcher.NO_MATCH); + uriMatcher.addURI(AUTH, "v3auth", V3AUTHS); + uriMatcher.addURI(AUTH, "v3auth/#", V3AUTH_ID); + } + + private ClientAuthDatabase mDatabase; + + @Override + public boolean onCreate() { + mDatabase = new ClientAuthDatabase(getContext()); + return true; + } + + @Nullable + @Override + public String getType(@NonNull Uri uri) { + int match = uriMatcher.match(uri); + switch (match) { + case V3AUTHS: + return "vnd.android.cursor.dir/vnd.torproject.v3auths"; + case V3AUTH_ID: + return "vnd.android.cursor.item/vnd.torproject.v3auth"; + default: + return null; + } + } + + @Nullable + @Override + public Cursor query(@NonNull Uri uri, @Nullable String[] projection, @Nullable String selection, @Nullable String[] selectionArgs, @Nullable String sortOrder) { + if (uriMatcher.match(uri) == V3AUTH_ID) + selection = "_id=" + uri.getLastPathSegment(); + SQLiteDatabase db = mDatabase.getReadableDatabase(); + return db.query(ClientAuthDatabase.DATABASE_NAME, projection, selection, selectionArgs, null, null, sortOrder); + } + + @Nullable + @Override + public Uri insert(@NonNull Uri uri, @Nullable ContentValues values) { + SQLiteDatabase db = mDatabase.getWritableDatabase(); + long regId = db.insert(ClientAuthDatabase.DATABASE_NAME, null, values); + getContext().getContentResolver().notifyChange(CONTENT_URI, null); + return ContentUris.withAppendedId(CONTENT_URI, regId); + } + + @Override + public int delete(@NonNull Uri uri, @Nullable String selection, @Nullable String[] selectionArgs) { + if (uriMatcher.match(uri) == V3AUTH_ID) + selection = "_id=" + uri.getLastPathSegment(); + SQLiteDatabase db = mDatabase.getWritableDatabase(); + int rows = db.delete(ClientAuthDatabase.DATABASE_NAME, selection, selectionArgs); + getContext().getContentResolver().notifyChange(CONTENT_URI, null); + return rows; + } + + @Override + public int update(@NonNull Uri uri, @Nullable ContentValues values, @Nullable String selection, @Nullable String[] selectionArgs) { + SQLiteDatabase db = mDatabase.getWritableDatabase(); + if (uriMatcher.match(uri) == V3AUTH_ID) + selection = "id_=" + uri.getLastPathSegment(); + int rows = db.update(ClientAuthDatabase.DATABASE_NAME, values, selection, null); + getContext().getContentResolver().notifyChange(CONTENT_URI, null); + return rows; + } + + public static final class V3ClientAuth implements BaseColumns { + private V3ClientAuth() { + } // no-op + + public static final String + DOMAIN = "domain", + HASH = "hash", + ENABLED = "enabled"; + } + } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/libs/providers/ClientAuthDatabase.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/providers/ClientAuthDatabase.java similarity index 89% rename from app/src/main/java/com/darkweb/genesissearchengine/libs/providers/ClientAuthDatabase.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/providers/ClientAuthDatabase.java index eea4273b..c27763cc 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/libs/providers/ClientAuthDatabase.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/providers/ClientAuthDatabase.java @@ -1,30 +1,30 @@ -package com.darkweb.genesissearchengine.libs.providers; - -import android.content.Context; -import android.database.sqlite.SQLiteDatabase; -import android.database.sqlite.SQLiteOpenHelper; - -public class ClientAuthDatabase extends SQLiteOpenHelper { - static final String DATABASE_NAME = "v3_client_auths"; - private static final int DATABASE_VERSION = 1; - - private static final String V3_AUTHS_CREATE_SQL = - "CREATE TABLE " + DATABASE_NAME + " (" + - "_id INTEGER PRIMARY KEY AUTOINCREMENT, " + - "domain TEXT, " + - "hash TEXT, " + - "enabled INTEGER DEFAULT 1);"; - - ClientAuthDatabase(Context context) { - super(context, DATABASE_NAME, null, DATABASE_VERSION); - } - - @Override - public void onCreate(SQLiteDatabase db) { - db.execSQL(V3_AUTHS_CREATE_SQL); - } - - @Override - public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { - } -} +package com.hiddenservices.genesissearchengine.production.libs.providers; + +import android.content.Context; +import android.database.sqlite.SQLiteDatabase; +import android.database.sqlite.SQLiteOpenHelper; + +public class ClientAuthDatabase extends SQLiteOpenHelper { + static final String DATABASE_NAME = "v3_client_auths"; + private static final int DATABASE_VERSION = 1; + + private static final String V3_AUTHS_CREATE_SQL = + "CREATE TABLE " + DATABASE_NAME + " (" + + "_id INTEGER PRIMARY KEY AUTOINCREMENT, " + + "domain TEXT, " + + "hash TEXT, " + + "enabled INTEGER DEFAULT 1);"; + + ClientAuthDatabase(Context context) { + super(context, DATABASE_NAME, null, DATABASE_VERSION); + } + + @Override + public void onCreate(SQLiteDatabase db) { + db.execSQL(V3_AUTHS_CREATE_SQL); + } + + @Override + public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/libs/providers/CookieContentProvider.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/providers/CookieContentProvider.java similarity index 93% rename from app/src/main/java/com/darkweb/genesissearchengine/libs/providers/CookieContentProvider.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/providers/CookieContentProvider.java index 1ecfb482..1578b656 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/libs/providers/CookieContentProvider.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/providers/CookieContentProvider.java @@ -1,133 +1,132 @@ -package com.darkweb.genesissearchengine.libs.providers; - -import android.content.ContentProvider; -import android.content.ContentUris; -import android.content.ContentValues; -import android.content.Context; -import android.content.UriMatcher; -import android.database.Cursor; -import android.database.sqlite.SQLiteDatabase; -import android.net.Uri; -import android.provider.BaseColumns; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.darkweb.genesissearchengine.libs.providers.HSDatabase; - - -public class CookieContentProvider extends ContentProvider { - public static final String[] PROJECTION = new String[]{ - ClientCookie._ID, - ClientCookie.DOMAIN, - ClientCookie.AUTH_COOKIE_VALUE, - ClientCookie.ENABLED - }; - private static final String AUTH = "org.torproject.android.ui.hiddenservices.providers.genesis.cookie"; - public static final Uri CONTENT_URI = - Uri.parse("content://" + AUTH + "/cookie"); - //UriMatcher - private static final int COOKIES = 1; - private static final int COOKIE_ID = 2; - - private static final UriMatcher uriMatcher; - - static { - uriMatcher = new UriMatcher(UriMatcher.NO_MATCH); - uriMatcher.addURI(AUTH, "hs", COOKIES); - uriMatcher.addURI(AUTH, "hs/#", COOKIE_ID); - } - - private HSDatabase mServervices; - private Context mContext; - - @Override - public boolean onCreate() { - mContext = getContext(); - mServervices = new HSDatabase(mContext); - return true; - } - - @Nullable - @Override - public Cursor query(@NonNull Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) { - String where = selection; - if (uriMatcher.match(uri) == COOKIE_ID) { - where = "_id=" + uri.getLastPathSegment(); - } - - SQLiteDatabase db = mServervices.getReadableDatabase(); - - return db.query(HSDatabase.HS_CLIENT_COOKIE_TABLE_NAME, projection, where, - selectionArgs, null, null, sortOrder); - } - - @Nullable - @Override - public String getType(@NonNull Uri uri) { - int match = uriMatcher.match(uri); - - switch (match) { - case COOKIES: - return "vnd.android.cursor.dir/vnd.torproject.cookies"; - case COOKIE_ID: - return "vnd.android.cursor.item/vnd.torproject.cookie"; - default: - return null; - } - } - - @Nullable - @Override - public Uri insert(@NonNull Uri uri, ContentValues values) { - long regId; - - SQLiteDatabase db = mServervices.getWritableDatabase(); - - regId = db.insert(HSDatabase.HS_CLIENT_COOKIE_TABLE_NAME, null, values); - - mContext.getContentResolver().notifyChange(CONTENT_URI, null); - - return ContentUris.withAppendedId(CONTENT_URI, regId); - } - - @Override - public int delete(@NonNull Uri uri, String selection, String[] selectionArgs) { - - String where = selection; - if (uriMatcher.match(uri) == COOKIE_ID) { - where = "_id=" + uri.getLastPathSegment(); - } - - SQLiteDatabase db = mServervices.getWritableDatabase(); - - int rows = db.delete(HSDatabase.HS_CLIENT_COOKIE_TABLE_NAME, where, selectionArgs); - - mContext.getContentResolver().notifyChange(CONTENT_URI, null); - - return rows; - - } - - @Override - public int update(@NonNull Uri uri, ContentValues values, String selection, String[] selectionArgs) { - SQLiteDatabase db = mServervices.getWritableDatabase(); - - String where = selection; - if (uriMatcher.match(uri) == COOKIE_ID) { - where = "_id=" + uri.getLastPathSegment(); - } - - int rows = db.update(HSDatabase.HS_CLIENT_COOKIE_TABLE_NAME, values, where, null); - mContext.getContentResolver().notifyChange(CONTENT_URI, null); - - return rows; - } - - public static final class ClientCookie implements BaseColumns { - public static final String DOMAIN = "domain"; - public static final String AUTH_COOKIE_VALUE = "auth_cookie_value"; - public static final String ENABLED = "enabled"; - - private ClientCookie() { - } - } +package com.hiddenservices.genesissearchengine.production.libs.providers; + +import android.content.ContentProvider; +import android.content.ContentUris; +import android.content.ContentValues; +import android.content.Context; +import android.content.UriMatcher; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.net.Uri; +import android.provider.BaseColumns; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + + +public class CookieContentProvider extends ContentProvider { + public static final String[] PROJECTION = new String[]{ + ClientCookie._ID, + ClientCookie.DOMAIN, + ClientCookie.AUTH_COOKIE_VALUE, + ClientCookie.ENABLED + }; + private static final String AUTH = "org.torproject.android.ui.hiddenservices.providers.genesishiddenservices.cookie"; + public static final Uri CONTENT_URI = + Uri.parse("content://" + AUTH + "/cookie"); + //UriMatcher + private static final int COOKIES = 1; + private static final int COOKIE_ID = 2; + + private static final UriMatcher uriMatcher; + + static { + uriMatcher = new UriMatcher(UriMatcher.NO_MATCH); + uriMatcher.addURI(AUTH, "hs", COOKIES); + uriMatcher.addURI(AUTH, "hs/#", COOKIE_ID); + } + + private HSDatabase mServervices; + private Context mContext; + + @Override + public boolean onCreate() { + mContext = getContext(); + mServervices = new HSDatabase(mContext); + return true; + } + + @Nullable + @Override + public Cursor query(@NonNull Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) { + String where = selection; + if (uriMatcher.match(uri) == COOKIE_ID) { + where = "_id=" + uri.getLastPathSegment(); + } + + SQLiteDatabase db = mServervices.getReadableDatabase(); + + return db.query(HSDatabase.HS_CLIENT_COOKIE_TABLE_NAME, projection, where, + selectionArgs, null, null, sortOrder); + } + + @Nullable + @Override + public String getType(@NonNull Uri uri) { + int match = uriMatcher.match(uri); + + switch (match) { + case COOKIES: + return "vnd.android.cursor.dir/vnd.torproject.cookies"; + case COOKIE_ID: + return "vnd.android.cursor.item/vnd.torproject.cookie"; + default: + return null; + } + } + + @Nullable + @Override + public Uri insert(@NonNull Uri uri, ContentValues values) { + long regId; + + SQLiteDatabase db = mServervices.getWritableDatabase(); + + regId = db.insert(HSDatabase.HS_CLIENT_COOKIE_TABLE_NAME, null, values); + + mContext.getContentResolver().notifyChange(CONTENT_URI, null); + + return ContentUris.withAppendedId(CONTENT_URI, regId); + } + + @Override + public int delete(@NonNull Uri uri, String selection, String[] selectionArgs) { + + String where = selection; + if (uriMatcher.match(uri) == COOKIE_ID) { + where = "_id=" + uri.getLastPathSegment(); + } + + SQLiteDatabase db = mServervices.getWritableDatabase(); + + int rows = db.delete(HSDatabase.HS_CLIENT_COOKIE_TABLE_NAME, where, selectionArgs); + + mContext.getContentResolver().notifyChange(CONTENT_URI, null); + + return rows; + + } + + @Override + public int update(@NonNull Uri uri, ContentValues values, String selection, String[] selectionArgs) { + SQLiteDatabase db = mServervices.getWritableDatabase(); + + String where = selection; + if (uriMatcher.match(uri) == COOKIE_ID) { + where = "_id=" + uri.getLastPathSegment(); + } + + int rows = db.update(HSDatabase.HS_CLIENT_COOKIE_TABLE_NAME, values, where, null); + mContext.getContentResolver().notifyChange(CONTENT_URI, null); + + return rows; + } + + public static final class ClientCookie implements BaseColumns { + public static final String DOMAIN = "domain"; + public static final String AUTH_COOKIE_VALUE = "auth_cookie_value"; + public static final String ENABLED = "enabled"; + + private ClientCookie() { + } + } } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/libs/providers/HSContentProvider.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/providers/HSContentProvider.java similarity index 94% rename from app/src/main/java/com/darkweb/genesissearchengine/libs/providers/HSContentProvider.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/providers/HSContentProvider.java index 124dc05a..76a82af8 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/libs/providers/HSContentProvider.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/providers/HSContentProvider.java @@ -1,141 +1,140 @@ -package com.darkweb.genesissearchengine.libs.providers; - -import android.content.ContentProvider; -import android.content.ContentUris; -import android.content.ContentValues; -import android.content.Context; -import android.content.UriMatcher; -import android.database.Cursor; -import android.database.sqlite.SQLiteDatabase; -import android.net.Uri; -import android.provider.BaseColumns; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.darkweb.genesissearchengine.libs.providers.HSDatabase; - - -public class HSContentProvider extends ContentProvider { - public static final String[] PROJECTION = new String[]{ - HiddenService._ID, - HiddenService.NAME, - HiddenService.PORT, - HiddenService.DOMAIN, - HiddenService.ONION_PORT, - HiddenService.AUTH_COOKIE, - HiddenService.AUTH_COOKIE_VALUE, - HiddenService.CREATED_BY_USER, - HiddenService.ENABLED - }; - private static final String AUTH = "org.torproject.android.ui.hiddenservices.providers.genesis"; - public static final Uri CONTENT_URI = Uri.parse("content://" + AUTH + "/hs"); - //UriMatcher - private static final int ONIONS = 1; - private static final int ONION_ID = 2; - - private static final UriMatcher uriMatcher; - - static { - uriMatcher = new UriMatcher(UriMatcher.NO_MATCH); - uriMatcher.addURI(AUTH, "hs", ONIONS); - uriMatcher.addURI(AUTH, "hs/#", ONION_ID); - } - - private HSDatabase mServervices; - private Context mContext; - - @Override - public boolean onCreate() { - mContext = getContext(); - mServervices = new HSDatabase(mContext); - return true; - } - - @Nullable - @Override - public Cursor query(@NonNull Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) { - String where = selection; - if (uriMatcher.match(uri) == ONION_ID) { - where = "_id=" + uri.getLastPathSegment(); - } - - SQLiteDatabase db = mServervices.getReadableDatabase(); - - return db.query(HSDatabase.HS_DATA_TABLE_NAME, projection, where, selectionArgs, null, null, sortOrder); - } - - @Nullable - @Override - public String getType(@NonNull Uri uri) { - int match = uriMatcher.match(uri); - - switch (match) { - case ONIONS: - return "vnd.android.cursor.dir/vnd.torproject.onions"; - case ONION_ID: - return "vnd.android.cursor.item/vnd.torproject.onion"; - default: - return null; - } - } - - @Nullable - @Override - public Uri insert(@NonNull Uri uri, ContentValues values) { - long regId; - - SQLiteDatabase db = mServervices.getWritableDatabase(); - - regId = db.insert(HSDatabase.HS_DATA_TABLE_NAME, null, values); - - mContext.getContentResolver().notifyChange(CONTENT_URI, null); - - return ContentUris.withAppendedId(CONTENT_URI, regId); - } - - @Override - public int delete(@NonNull Uri uri, String selection, String[] selectionArgs) { - - String where = selection; - if (uriMatcher.match(uri) == ONION_ID) { - where = "_id=" + uri.getLastPathSegment(); - } - - SQLiteDatabase db = mServervices.getWritableDatabase(); - - int rows = db.delete(HSDatabase.HS_DATA_TABLE_NAME, where, selectionArgs); - - mContext.getContentResolver().notifyChange(CONTENT_URI, null); - - return rows; - - } - - @Override - public int update(@NonNull Uri uri, ContentValues values, String selection, String[] selectionArgs) { - SQLiteDatabase db = mServervices.getWritableDatabase(); - - String where = selection; - if (uriMatcher.match(uri) == ONION_ID) { - where = "_id=" + uri.getLastPathSegment(); - } - - int rows = db.update(HSDatabase.HS_DATA_TABLE_NAME, values, where, null); - mContext.getContentResolver().notifyChange(CONTENT_URI, null); - - return rows; - } - - public static final class HiddenService implements BaseColumns { - public static final String NAME = "name"; - public static final String PORT = "port"; - public static final String ONION_PORT = "onion_port"; - public static final String DOMAIN = "domain"; - public static final String AUTH_COOKIE = "auth_cookie"; - public static final String AUTH_COOKIE_VALUE = "auth_cookie_value"; - public static final String CREATED_BY_USER = "created_by_user"; - public static final String ENABLED = "enabled"; - - private HiddenService() { - } - } +package com.hiddenservices.genesissearchengine.production.libs.providers; + +import android.content.ContentProvider; +import android.content.ContentUris; +import android.content.ContentValues; +import android.content.Context; +import android.content.UriMatcher; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.net.Uri; +import android.provider.BaseColumns; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + + +public class HSContentProvider extends ContentProvider { + public static final String[] PROJECTION = new String[]{ + HiddenService._ID, + HiddenService.NAME, + HiddenService.PORT, + HiddenService.DOMAIN, + HiddenService.ONION_PORT, + HiddenService.AUTH_COOKIE, + HiddenService.AUTH_COOKIE_VALUE, + HiddenService.CREATED_BY_USER, + HiddenService.ENABLED + }; + private static final String AUTH = "org.torproject.android.ui.hiddenservices.providers.genesishiddenservices"; + public static final Uri CONTENT_URI = Uri.parse("content://" + AUTH + "/hs"); + //UriMatcher + private static final int ONIONS = 1; + private static final int ONION_ID = 2; + + private static final UriMatcher uriMatcher; + + static { + uriMatcher = new UriMatcher(UriMatcher.NO_MATCH); + uriMatcher.addURI(AUTH, "hs", ONIONS); + uriMatcher.addURI(AUTH, "hs/#", ONION_ID); + } + + private HSDatabase mServervices; + private Context mContext; + + @Override + public boolean onCreate() { + mContext = getContext(); + mServervices = new HSDatabase(mContext); + return true; + } + + @Nullable + @Override + public Cursor query(@NonNull Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) { + String where = selection; + if (uriMatcher.match(uri) == ONION_ID) { + where = "_id=" + uri.getLastPathSegment(); + } + + SQLiteDatabase db = mServervices.getReadableDatabase(); + + return db.query(HSDatabase.HS_DATA_TABLE_NAME, projection, where, selectionArgs, null, null, sortOrder); + } + + @Nullable + @Override + public String getType(@NonNull Uri uri) { + int match = uriMatcher.match(uri); + + switch (match) { + case ONIONS: + return "vnd.android.cursor.dir/vnd.torproject.onions"; + case ONION_ID: + return "vnd.android.cursor.item/vnd.torproject.onion"; + default: + return null; + } + } + + @Nullable + @Override + public Uri insert(@NonNull Uri uri, ContentValues values) { + long regId; + + SQLiteDatabase db = mServervices.getWritableDatabase(); + + regId = db.insert(HSDatabase.HS_DATA_TABLE_NAME, null, values); + + mContext.getContentResolver().notifyChange(CONTENT_URI, null); + + return ContentUris.withAppendedId(CONTENT_URI, regId); + } + + @Override + public int delete(@NonNull Uri uri, String selection, String[] selectionArgs) { + + String where = selection; + if (uriMatcher.match(uri) == ONION_ID) { + where = "_id=" + uri.getLastPathSegment(); + } + + SQLiteDatabase db = mServervices.getWritableDatabase(); + + int rows = db.delete(HSDatabase.HS_DATA_TABLE_NAME, where, selectionArgs); + + mContext.getContentResolver().notifyChange(CONTENT_URI, null); + + return rows; + + } + + @Override + public int update(@NonNull Uri uri, ContentValues values, String selection, String[] selectionArgs) { + SQLiteDatabase db = mServervices.getWritableDatabase(); + + String where = selection; + if (uriMatcher.match(uri) == ONION_ID) { + where = "_id=" + uri.getLastPathSegment(); + } + + int rows = db.update(HSDatabase.HS_DATA_TABLE_NAME, values, where, null); + mContext.getContentResolver().notifyChange(CONTENT_URI, null); + + return rows; + } + + public static final class HiddenService implements BaseColumns { + public static final String NAME = "name"; + public static final String PORT = "port"; + public static final String ONION_PORT = "onion_port"; + public static final String DOMAIN = "domain"; + public static final String AUTH_COOKIE = "auth_cookie"; + public static final String AUTH_COOKIE_VALUE = "auth_cookie_value"; + public static final String CREATED_BY_USER = "created_by_user"; + public static final String ENABLED = "enabled"; + + private HiddenService() { + } + } } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/libs/providers/HSDatabase.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/providers/HSDatabase.java similarity index 93% rename from app/src/main/java/com/darkweb/genesissearchengine/libs/providers/HSDatabase.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/providers/HSDatabase.java index c08171bf..7cf776a7 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/libs/providers/HSDatabase.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/providers/HSDatabase.java @@ -1,49 +1,49 @@ -package com.darkweb.genesissearchengine.libs.providers; - -import android.content.Context; -import android.database.sqlite.SQLiteDatabase; -import android.database.sqlite.SQLiteOpenHelper; - -public class HSDatabase extends SQLiteOpenHelper { - - public static final String HS_DATA_TABLE_NAME = "hs_data"; - public static final String HS_CLIENT_COOKIE_TABLE_NAME = "hs_client_cookie"; - private static final int DATABASE_VERSION = 4; - private static final String DATABASE_NAME = "hidden_services"; - private static final String HS_DATA_TABLE_CREATE = - "CREATE TABLE " + HS_DATA_TABLE_NAME + " (" + - "_id INTEGER PRIMARY KEY AUTOINCREMENT, " + - "name TEXT, " + - "domain TEXT, " + - "onion_port INTEGER, " + - "auth_cookie INTEGER DEFAULT 0, " + - "auth_cookie_value TEXT, " + - "created_by_user INTEGER DEFAULT 0, " + - "enabled INTEGER DEFAULT 1, " + - "port INTEGER, " + - "filepath TEXT);"; - - private static final String HS_CLIENT_COOKIE_TABLE_CREATE = - "CREATE TABLE " + HS_CLIENT_COOKIE_TABLE_NAME + " (" + - "_id INTEGER PRIMARY KEY AUTOINCREMENT, " + - "domain TEXT, " + - "auth_cookie_value TEXT, " + - "enabled INTEGER DEFAULT 1);"; - - public HSDatabase(Context context) { - super(context, DATABASE_NAME, null, DATABASE_VERSION); - } - - @Override - public void onCreate(SQLiteDatabase db) { - db.execSQL(HS_DATA_TABLE_CREATE); - db.execSQL(HS_CLIENT_COOKIE_TABLE_CREATE); - } - - @Override - public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { - if (newVersion > oldVersion) { - db.execSQL("ALTER TABLE " + HS_DATA_TABLE_NAME + " ADD COLUMN filepath TEXT"); - } - } +package com.hiddenservices.genesissearchengine.production.libs.providers; + +import android.content.Context; +import android.database.sqlite.SQLiteDatabase; +import android.database.sqlite.SQLiteOpenHelper; + +public class HSDatabase extends SQLiteOpenHelper { + + public static final String HS_DATA_TABLE_NAME = "hs_data"; + public static final String HS_CLIENT_COOKIE_TABLE_NAME = "hs_client_cookie"; + private static final int DATABASE_VERSION = 4; + private static final String DATABASE_NAME = "hidden_services"; + private static final String HS_DATA_TABLE_CREATE = + "CREATE TABLE " + HS_DATA_TABLE_NAME + " (" + + "_id INTEGER PRIMARY KEY AUTOINCREMENT, " + + "name TEXT, " + + "domain TEXT, " + + "onion_port INTEGER, " + + "auth_cookie INTEGER DEFAULT 0, " + + "auth_cookie_value TEXT, " + + "created_by_user INTEGER DEFAULT 0, " + + "enabled INTEGER DEFAULT 1, " + + "port INTEGER, " + + "filepath TEXT);"; + + private static final String HS_CLIENT_COOKIE_TABLE_CREATE = + "CREATE TABLE " + HS_CLIENT_COOKIE_TABLE_NAME + " (" + + "_id INTEGER PRIMARY KEY AUTOINCREMENT, " + + "domain TEXT, " + + "auth_cookie_value TEXT, " + + "enabled INTEGER DEFAULT 1);"; + + public HSDatabase(Context context) { + super(context, DATABASE_NAME, null, DATABASE_VERSION); + } + + @Override + public void onCreate(SQLiteDatabase db) { + db.execSQL(HS_DATA_TABLE_CREATE); + db.execSQL(HS_CLIENT_COOKIE_TABLE_CREATE); + } + + @Override + public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { + if (newVersion > oldVersion) { + db.execSQL("ALTER TABLE " + HS_DATA_TABLE_NAME + " ADD COLUMN filepath TEXT"); + } + } } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/libs/providers/OnionServiceContentProvider.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/providers/OnionServiceContentProvider.java similarity index 94% rename from app/src/main/java/com/darkweb/genesissearchengine/libs/providers/OnionServiceContentProvider.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/providers/OnionServiceContentProvider.java index 223bba59..fc1344c8 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/libs/providers/OnionServiceContentProvider.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/providers/OnionServiceContentProvider.java @@ -1,110 +1,110 @@ -package com.darkweb.genesissearchengine.libs.providers; - -import android.content.ContentProvider; -import android.content.ContentUris; -import android.content.ContentValues; -import android.content.UriMatcher; -import android.database.Cursor; -import android.database.sqlite.SQLiteDatabase; -import android.net.Uri; -import android.provider.BaseColumns; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -public class OnionServiceContentProvider extends ContentProvider { - - public static final String[] PROJECTION = { - OnionService._ID, - OnionService.NAME, - OnionService.PORT, - OnionService.DOMAIN, - OnionService.ONION_PORT, - OnionService.CREATED_BY_USER, - OnionService.ENABLED - }; - - private static final int ONIONS = 1, ONION_ID = 2; - private static final String AUTH = "org.torproject.android.ui.v3onionservice.genesis"; - public static final Uri CONTENT_URI = Uri.parse("content://" + AUTH + "/v3"); - private static final UriMatcher uriMatcher; - - static { - uriMatcher = new UriMatcher(UriMatcher.NO_MATCH); - uriMatcher.addURI(AUTH, "v3", ONIONS); - uriMatcher.addURI(AUTH, "v3/#", ONION_ID); - } - - private OnionServiceDatabase mDatabase; - - @Override - public boolean onCreate() { - mDatabase = new OnionServiceDatabase(getContext()); - return true; - } - - @Nullable - @Override - public Cursor query(@NonNull Uri uri, @Nullable String[] projection, @Nullable String selection, @Nullable String[] selectionArgs, @Nullable String sortOrder) { - if (uriMatcher.match(uri) == ONION_ID) - selection = "_id=" + uri.getLastPathSegment(); - SQLiteDatabase db = mDatabase.getReadableDatabase(); - return db.query(OnionServiceDatabase.ONION_SERVICE_TABLE_NAME, projection, selection, selectionArgs, null, null, sortOrder); - } - - @Nullable - @Override - public String getType(@NonNull Uri uri) { - int match = uriMatcher.match(uri); - switch (match) { - case ONIONS: - return "vnd.android.cursor.dir/vnd.torproject.onions"; - case ONION_ID: - return "vnd.android.cursor.item/vnd.torproject.onion"; - default: - return null; - } - } - - @Nullable - @Override - public Uri insert(@NonNull Uri uri, @Nullable ContentValues values) { - SQLiteDatabase db = mDatabase.getWritableDatabase(); - long regId = db.insert(OnionServiceDatabase.ONION_SERVICE_TABLE_NAME, null, values); - getContext().getContentResolver().notifyChange(CONTENT_URI, null); - return ContentUris.withAppendedId(CONTENT_URI, regId); - } - - @Override - public int delete(@NonNull Uri uri, @Nullable String selection, @Nullable String[] selectionArgs) { - if (uriMatcher.match(uri) == ONION_ID) - selection = "_id=" + uri.getLastPathSegment(); - SQLiteDatabase db = mDatabase.getWritableDatabase(); - int rows = db.delete(OnionServiceDatabase.ONION_SERVICE_TABLE_NAME, selection, selectionArgs); - getContext().getContentResolver().notifyChange(CONTENT_URI, null); - return rows; - } - - @Override - public int update(@NonNull Uri uri, @Nullable ContentValues values, @Nullable String selection, @Nullable String[] selectionArgs) { - SQLiteDatabase db = mDatabase.getWritableDatabase(); - if (uriMatcher.match(uri) == ONION_ID) - selection = "_id=" + uri.getLastPathSegment(); - int rows = db.update(OnionServiceDatabase.ONION_SERVICE_TABLE_NAME, values, selection, null); - getContext().getContentResolver().notifyChange(CONTENT_URI, null); - return rows; - } - - public static final class OnionService implements BaseColumns { - public static final String NAME = "name"; - public static final String PORT = "port"; - public static final String ONION_PORT = "onion_port"; - public static final String DOMAIN = "domain"; - public static final String CREATED_BY_USER = "created_by_user"; - public static final String ENABLED = "enabled"; - - private OnionService() { // no-op - } - } - +package com.hiddenservices.genesissearchengine.production.libs.providers; + +import android.content.ContentProvider; +import android.content.ContentUris; +import android.content.ContentValues; +import android.content.UriMatcher; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.net.Uri; +import android.provider.BaseColumns; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +public class OnionServiceContentProvider extends ContentProvider { + + public static final String[] PROJECTION = { + OnionService._ID, + OnionService.NAME, + OnionService.PORT, + OnionService.DOMAIN, + OnionService.ONION_PORT, + OnionService.CREATED_BY_USER, + OnionService.ENABLED + }; + + private static final int ONIONS = 1, ONION_ID = 2; + private static final String AUTH = "org.torproject.android.ui.v3onionservice.genesishiddenservices"; + public static final Uri CONTENT_URI = Uri.parse("content://" + AUTH + "/v3"); + private static final UriMatcher uriMatcher; + + static { + uriMatcher = new UriMatcher(UriMatcher.NO_MATCH); + uriMatcher.addURI(AUTH, "v3", ONIONS); + uriMatcher.addURI(AUTH, "v3/#", ONION_ID); + } + + private OnionServiceDatabase mDatabase; + + @Override + public boolean onCreate() { + mDatabase = new OnionServiceDatabase(getContext()); + return true; + } + + @Nullable + @Override + public Cursor query(@NonNull Uri uri, @Nullable String[] projection, @Nullable String selection, @Nullable String[] selectionArgs, @Nullable String sortOrder) { + if (uriMatcher.match(uri) == ONION_ID) + selection = "_id=" + uri.getLastPathSegment(); + SQLiteDatabase db = mDatabase.getReadableDatabase(); + return db.query(OnionServiceDatabase.ONION_SERVICE_TABLE_NAME, projection, selection, selectionArgs, null, null, sortOrder); + } + + @Nullable + @Override + public String getType(@NonNull Uri uri) { + int match = uriMatcher.match(uri); + switch (match) { + case ONIONS: + return "vnd.android.cursor.dir/vnd.torproject.onions"; + case ONION_ID: + return "vnd.android.cursor.item/vnd.torproject.onion"; + default: + return null; + } + } + + @Nullable + @Override + public Uri insert(@NonNull Uri uri, @Nullable ContentValues values) { + SQLiteDatabase db = mDatabase.getWritableDatabase(); + long regId = db.insert(OnionServiceDatabase.ONION_SERVICE_TABLE_NAME, null, values); + getContext().getContentResolver().notifyChange(CONTENT_URI, null); + return ContentUris.withAppendedId(CONTENT_URI, regId); + } + + @Override + public int delete(@NonNull Uri uri, @Nullable String selection, @Nullable String[] selectionArgs) { + if (uriMatcher.match(uri) == ONION_ID) + selection = "_id=" + uri.getLastPathSegment(); + SQLiteDatabase db = mDatabase.getWritableDatabase(); + int rows = db.delete(OnionServiceDatabase.ONION_SERVICE_TABLE_NAME, selection, selectionArgs); + getContext().getContentResolver().notifyChange(CONTENT_URI, null); + return rows; + } + + @Override + public int update(@NonNull Uri uri, @Nullable ContentValues values, @Nullable String selection, @Nullable String[] selectionArgs) { + SQLiteDatabase db = mDatabase.getWritableDatabase(); + if (uriMatcher.match(uri) == ONION_ID) + selection = "_id=" + uri.getLastPathSegment(); + int rows = db.update(OnionServiceDatabase.ONION_SERVICE_TABLE_NAME, values, selection, null); + getContext().getContentResolver().notifyChange(CONTENT_URI, null); + return rows; + } + + public static final class OnionService implements BaseColumns { + public static final String NAME = "name"; + public static final String PORT = "port"; + public static final String ONION_PORT = "onion_port"; + public static final String DOMAIN = "domain"; + public static final String CREATED_BY_USER = "created_by_user"; + public static final String ENABLED = "enabled"; + + private OnionService() { // no-op + } + } + } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/libs/providers/OnionServiceDatabase.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/providers/OnionServiceDatabase.java similarity index 92% rename from app/src/main/java/com/darkweb/genesissearchengine/libs/providers/OnionServiceDatabase.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/providers/OnionServiceDatabase.java index 3a037b6d..47b0e998 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/libs/providers/OnionServiceDatabase.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/providers/OnionServiceDatabase.java @@ -1,41 +1,41 @@ -package com.darkweb.genesissearchengine.libs.providers; - -import android.content.Context; -import android.database.sqlite.SQLiteDatabase; -import android.database.sqlite.SQLiteOpenHelper; - -public class OnionServiceDatabase extends SQLiteOpenHelper { - - static final String DATABASE_NAME = "onion_service", - ONION_SERVICE_TABLE_NAME = "onion_services"; - private static final int DATABASE_VERSION = 2; - - private static final String ONION_SERVICES_CREATE_SQL = - "CREATE TABLE " + ONION_SERVICE_TABLE_NAME + " (" + - "_id INTEGER PRIMARY KEY AUTOINCREMENT, " + - "name TEXT, " + - "domain TEXT, " + - "onion_port INTEGER, " + - "created_by_user INTEGER DEFAULT 0, " + - "enabled INTEGER DEFAULT 1, " + - "port INTEGER, " + - "filepath TEXT);"; - - OnionServiceDatabase(Context context) { - super(context, DATABASE_NAME, null, DATABASE_VERSION); - } - - @Override - public void onCreate(SQLiteDatabase db) { - db.execSQL(ONION_SERVICES_CREATE_SQL); - } - - @Override - public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { - if (newVersion > oldVersion) { - db.execSQL("ALTER TABLE " + ONION_SERVICE_TABLE_NAME + " ADD COLUMN filepath text"); - } - } - - -} +package com.hiddenservices.genesissearchengine.production.libs.providers; + +import android.content.Context; +import android.database.sqlite.SQLiteDatabase; +import android.database.sqlite.SQLiteOpenHelper; + +public class OnionServiceDatabase extends SQLiteOpenHelper { + + static final String DATABASE_NAME = "onion_service", + ONION_SERVICE_TABLE_NAME = "onion_services"; + private static final int DATABASE_VERSION = 2; + + private static final String ONION_SERVICES_CREATE_SQL = + "CREATE TABLE " + ONION_SERVICE_TABLE_NAME + " (" + + "_id INTEGER PRIMARY KEY AUTOINCREMENT, " + + "name TEXT, " + + "domain TEXT, " + + "onion_port INTEGER, " + + "created_by_user INTEGER DEFAULT 0, " + + "enabled INTEGER DEFAULT 1, " + + "port INTEGER, " + + "filepath TEXT);"; + + OnionServiceDatabase(Context context) { + super(context, DATABASE_NAME, null, DATABASE_VERSION); + } + + @Override + public void onCreate(SQLiteDatabase db) { + db.execSQL(ONION_SERVICES_CREATE_SQL); + } + + @Override + public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { + if (newVersion > oldVersion) { + db.execSQL("ALTER TABLE " + ONION_SERVICE_TABLE_NAME + " ADD COLUMN filepath text"); + } + } + + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/libs/trueTime/trueTimeEncryption.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/trueTime/trueTimeEncryption.java similarity index 81% rename from app/src/main/java/com/darkweb/genesissearchengine/libs/trueTime/trueTimeEncryption.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/trueTime/trueTimeEncryption.java index 103c1010..f6a6850e 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/libs/trueTime/trueTimeEncryption.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/trueTime/trueTimeEncryption.java @@ -1,11 +1,8 @@ -package com.darkweb.genesissearchengine.libs.trueTime; +package com.hiddenservices.genesissearchengine.production.libs.trueTime; -import android.os.Build; -import androidx.annotation.RequiresApi; import com.instacart.library.truetime.TrueTime; import com.macasaet.fernet.Key; import com.macasaet.fernet.Token; - import java.util.Base64; public class trueTimeEncryption { @@ -31,7 +28,7 @@ public class trueTimeEncryption { if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { mkey = new Key(Base64.getUrlEncoder().encodeToString(S_FERNET_KEY.getBytes())); } - Token token = Token.generate(mkey, S_APP_BLOCK_KEY); + Token token = Token.generate(mkey, S_APP_BLOCK_KEY + "----" + System.currentTimeMillis()/1000); return token.serialise(); } } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/libs/views/ColorAnimator.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/views/ColorAnimator.java similarity index 90% rename from app/src/main/java/com/darkweb/genesissearchengine/libs/views/ColorAnimator.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/views/ColorAnimator.java index 2fff8841..002f04b0 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/libs/views/ColorAnimator.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/views/ColorAnimator.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.libs.views; +package com.hiddenservices.genesissearchengine.production.libs.views; import android.graphics.Color; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/libs/views/KeyboardUtils.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/views/KeyboardUtils.java similarity index 95% rename from app/src/main/java/com/darkweb/genesissearchengine/libs/views/KeyboardUtils.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/views/KeyboardUtils.java index f3ea0ce8..6e6770af 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/libs/views/KeyboardUtils.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/views/KeyboardUtils.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.libs.views; +package com.hiddenservices.genesissearchengine.production.libs.views; import android.app.Activity; import android.graphics.Rect; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/libs/views/ThumbnailCrop.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/views/ThumbnailCrop.java similarity index 93% rename from app/src/main/java/com/darkweb/genesissearchengine/libs/views/ThumbnailCrop.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/views/ThumbnailCrop.java index 8daf5b04..2015f219 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/libs/views/ThumbnailCrop.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/libs/views/ThumbnailCrop.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.libs.views; +package com.hiddenservices.genesissearchengine.production.libs.views; import android.content.Context; import android.graphics.Matrix; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/adPluginManager/admobManager.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/adPluginManager/admobManager.java similarity index 78% rename from app/src/main/java/com/darkweb/genesissearchengine/pluginManager/adPluginManager/admobManager.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/adPluginManager/admobManager.java index 68495d9c..108d0bbe 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/adPluginManager/admobManager.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/adPluginManager/admobManager.java @@ -1,116 +1,114 @@ -package com.darkweb.genesissearchengine.pluginManager.adPluginManager; - -import android.content.Context; -import android.util.Log; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; -import com.google.android.gms.ads.AdListener; -import com.google.android.gms.ads.AdRequest; -import com.google.android.gms.ads.AdView; -import com.google.android.gms.ads.LoadAdError; -import com.google.android.gms.ads.MobileAds; -import com.google.android.gms.ads.RequestConfiguration; -import java.lang.ref.WeakReference; -import java.util.Collections; -import java.util.List; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eAdManagerCallbacks.M_ON_AD_CLICK; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eAdManagerCallbacks.M_ON_AD_HIDE; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eAdManagerCallbacks.M_ON_AD_LOAD; - -public class admobManager extends AdListener { - - /*Private Variables */ - - private eventObserver.eventListener mEvent; - private WeakReference mBannerAds; - - private boolean bannerAdsLoaded = false; - private boolean mAdvertClicked = false; - private static boolean mBannerAdvertLoadReqest = false; - - /*Initializations*/ - - public admobManager(eventObserver.eventListener pEvent, AdView pBannerAds, Context pContext) { - this.mEvent = pEvent; - this.mBannerAds = new WeakReference(pBannerAds); - loadAds(pContext); - } - - /*Local Overrides*/ - - @Override - public void onAdLoaded() { - super.onAdLoaded(); - bannerAdsLoaded = true; - mEvent.invokeObserver(null, M_ON_AD_LOAD); - } - - @Override - public void onAdClicked(){ - super.onAdClicked(); - mEvent.invokeObserver(null, M_ON_AD_CLICK); - onDestroy(); - mAdvertClicked = true; - } - - @Override - public void onAdOpened(){ - super.onAdClicked(); - mEvent.invokeObserver(null, M_ON_AD_CLICK); - onDestroy(); - mAdvertClicked = true; - } - - @Override - public void onAdFailedToLoad(LoadAdError var1){ - Log.i("asd","asd"); - } - - /*Local Helper Methods*/ - - private void loadAds(Context pContext){ - if(!mBannerAdvertLoadReqest){ - mBannerAdvertLoadReqest = true; - - - AdRequest adRequest = new AdRequest.Builder().build(); - mBannerAds.get().setAdListener(this); - mBannerAds.get().loadAd(adRequest); - - - }else { - onDestroy(); - mEvent.invokeObserver(null, M_ON_AD_HIDE); - } - } - - - private boolean isAdvertLoaded(){ - if(mAdvertClicked){ - return false; - }else { - return bannerAdsLoaded; - } - } - - private void onDestroy(){ - mBannerAds.get().destroy(); - } - - /*External Triggers*/ - - public Object onTrigger(pluginEnums.eAdManager pEventType) { - if(pEventType.equals(pluginEnums.eAdManager.M_INITIALIZE_BANNER_ADS)) - { - } - else if(pEventType.equals(pluginEnums.eAdManager.M_IS_ADVERT_LOADED)) - { - return isAdvertLoaded(); - } - else if(pEventType.equals(pluginEnums.eAdManager.M_DESTROY)) - { - onDestroy(); - } - return null; - } -} +package com.hiddenservices.genesissearchengine.production.pluginManager.adPluginManager; + +import android.content.Context; +import android.util.Log; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums; +import com.google.android.gms.ads.AdListener; +import com.google.android.gms.ads.AdRequest; +import com.google.android.gms.ads.AdView; +import com.google.android.gms.ads.LoadAdError; + +import java.lang.ref.WeakReference; + +import static com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums.eAdManagerCallbacks.M_ON_AD_CLICK; +import static com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums.eAdManagerCallbacks.M_ON_AD_HIDE; +import static com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums.eAdManagerCallbacks.M_ON_AD_LOAD; + +public class admobManager extends AdListener { + + /*Private Variables */ + + private eventObserver.eventListener mEvent; + private WeakReference mBannerAds; + + private boolean bannerAdsLoaded = false; + private boolean mAdvertClicked = false; + private static boolean mBannerAdvertLoadReqest = false; + + /*Initializations*/ + + public admobManager(eventObserver.eventListener pEvent, AdView pBannerAds, Context pContext) { + this.mEvent = pEvent; + this.mBannerAds = new WeakReference(pBannerAds); + loadAds(pContext); + } + + /*Local Overrides*/ + + @Override + public void onAdLoaded() { + super.onAdLoaded(); + bannerAdsLoaded = true; + mEvent.invokeObserver(null, M_ON_AD_LOAD); + } + + @Override + public void onAdClicked(){ + super.onAdClicked(); + mEvent.invokeObserver(null, M_ON_AD_CLICK); + onDestroy(); + mAdvertClicked = true; + } + + @Override + public void onAdOpened(){ + super.onAdClicked(); + mEvent.invokeObserver(null, M_ON_AD_CLICK); + onDestroy(); + mAdvertClicked = true; + } + + @Override + public void onAdFailedToLoad(LoadAdError var1){ + Log.i("asd","asd"); + } + + /*Local Helper Methods*/ + + private void loadAds(Context pContext){ + if(!mBannerAdvertLoadReqest){ + mBannerAdvertLoadReqest = true; + + + AdRequest adRequest = new AdRequest.Builder().build(); + mBannerAds.get().setAdListener(this); + mBannerAds.get().loadAd(adRequest); + + + }else { + onDestroy(); + mEvent.invokeObserver(null, M_ON_AD_HIDE); + } + } + + + private boolean isAdvertLoaded(){ + if(mAdvertClicked){ + return false; + }else { + return bannerAdsLoaded; + } + } + + private void onDestroy(){ + mBannerAds.get().destroy(); + } + + /*External Triggers*/ + + public Object onTrigger(pluginEnums.eAdManager pEventType) { + if(pEventType.equals(pluginEnums.eAdManager.M_INITIALIZE_BANNER_ADS)) + { + } + else if(pEventType.equals(pluginEnums.eAdManager.M_IS_ADVERT_LOADED)) + { + return isAdvertLoaded(); + } + else if(pEventType.equals(pluginEnums.eAdManager.M_DESTROY)) + { + onDestroy(); + } + return null; + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/adPluginManager/facebookAdsManager.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/adPluginManager/facebookAdsManager.java similarity index 79% rename from app/src/main/java/com/darkweb/genesissearchengine/pluginManager/adPluginManager/facebookAdsManager.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/adPluginManager/facebookAdsManager.java index 2cd23772..18d1a26f 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/adPluginManager/facebookAdsManager.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/adPluginManager/facebookAdsManager.java @@ -1,87 +1,87 @@ -package com.darkweb.genesissearchengine.pluginManager.adPluginManager; - -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eAdManagerCallbacks.M_ON_AD_CLICK; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eAdManagerCallbacks.M_ON_AD_LOAD; -import android.widget.LinearLayout; -import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; -import com.facebook.ads.*; -import org.mozilla.thirdparty.com.google.android.exoplayer2.util.Log; -import java.lang.ref.WeakReference; - -public class facebookAdsManager implements AdListener { - - /*Private Variables */ - - private eventObserver.eventListener mEvent; - private WeakReference mBannerAds; - private AdView adView; - - private boolean bannerAdsLoaded = false; - - /*Initializations*/ - - public facebookAdsManager(eventObserver.eventListener pEvent, LinearLayout pBannerAds, AppCompatActivity pContext) { - this.mEvent = pEvent; - this.mBannerAds = new WeakReference(pBannerAds); - loadAds(pContext, pBannerAds); - } - - /*Local Overrides*/ - @Override - public void onError(Ad ad, AdError adError) { - Log.i("asd","asd"); - } - - @Override - public void onAdLoaded(Ad ad) { - bannerAdsLoaded = true; - mEvent.invokeObserver(null, M_ON_AD_LOAD); - } - - @Override - public void onAdClicked(Ad ad) { - mEvent.invokeObserver(null, M_ON_AD_CLICK); - } - - @Override - public void onLoggingImpression(Ad ad) { - } - - - /*Local Helper Methods*/ - - private void loadAds(AppCompatActivity pContext, LinearLayout pLinearLayout){ - AudienceNetworkAds.initialize(pContext); - adView = new AdView(pContext, "IMG_16_9_APP_INSTALL#YOUR_PLACEMENT_ID", AdSize.BANNER_HEIGHT_50); - pLinearLayout.addView(adView); - adView.loadAd(adView.buildLoadAdConfig().withAdListener(this).build()); - } - - - private boolean isAdvertLoaded(){ - return bannerAdsLoaded; - } - - private void onDestroy(){ - adView.destroy(); - } - - /*External Triggers*/ - - public Object onTrigger(pluginEnums.eAdManager pEventType) { - if(pEventType.equals(pluginEnums.eAdManager.M_INITIALIZE_BANNER_ADS)) - { - } - else if(pEventType.equals(pluginEnums.eAdManager.M_IS_ADVERT_LOADED)) - { - return isAdvertLoaded(); - } - else if(pEventType.equals(pluginEnums.eAdManager.M_DESTROY)) - { - onDestroy(); - } - return null; - } -} +package com.hiddenservices.genesissearchengine.production.pluginManager.adPluginManager; + +import static com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums.eAdManagerCallbacks.M_ON_AD_CLICK; +import static com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums.eAdManagerCallbacks.M_ON_AD_LOAD; +import android.widget.LinearLayout; +import androidx.appcompat.app.AppCompatActivity; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums; +import com.facebook.ads.*; +import org.mozilla.thirdparty.com.google.android.exoplayer2.util.Log; +import java.lang.ref.WeakReference; + +public class facebookAdsManager implements AdListener { + + /*Private Variables */ + + private eventObserver.eventListener mEvent; + private WeakReference mBannerAds; + private AdView adView; + + private boolean bannerAdsLoaded = false; + + /*Initializations*/ + + public facebookAdsManager(eventObserver.eventListener pEvent, LinearLayout pBannerAds, AppCompatActivity pContext) { + this.mEvent = pEvent; + this.mBannerAds = new WeakReference(pBannerAds); + loadAds(pContext, pBannerAds); + } + + /*Local Overrides*/ + @Override + public void onError(Ad ad, AdError adError) { + Log.i("asd","asd"); + } + + @Override + public void onAdLoaded(Ad ad) { + bannerAdsLoaded = true; + mEvent.invokeObserver(null, M_ON_AD_LOAD); + } + + @Override + public void onAdClicked(Ad ad) { + mEvent.invokeObserver(null, M_ON_AD_CLICK); + } + + @Override + public void onLoggingImpression(Ad ad) { + } + + + /*Local Helper Methods*/ + + private void loadAds(AppCompatActivity pContext, LinearLayout pLinearLayout){ + AudienceNetworkAds.initialize(pContext); + adView = new AdView(pContext, "IMG_16_9_APP_INSTALL#YOUR_PLACEMENT_ID", AdSize.BANNER_HEIGHT_50); + pLinearLayout.addView(adView); + adView.loadAd(adView.buildLoadAdConfig().withAdListener(this).build()); + } + + + private boolean isAdvertLoaded(){ + return bannerAdsLoaded; + } + + private void onDestroy(){ + adView.destroy(); + } + + /*External Triggers*/ + + public Object onTrigger(pluginEnums.eAdManager pEventType) { + if(pEventType.equals(pluginEnums.eAdManager.M_INITIALIZE_BANNER_ADS)) + { + } + else if(pEventType.equals(pluginEnums.eAdManager.M_IS_ADVERT_LOADED)) + { + return isAdvertLoaded(); + } + else if(pEventType.equals(pluginEnums.eAdManager.M_DESTROY)) + { + onDestroy(); + } + return null; + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/adPluginManager/mopubManager.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/adPluginManager/mopubManager.java similarity index 85% rename from app/src/main/java/com/darkweb/genesissearchengine/pluginManager/adPluginManager/mopubManager.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/adPluginManager/mopubManager.java index 56376ddb..8594af47 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/adPluginManager/mopubManager.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/adPluginManager/mopubManager.java @@ -1,118 +1,118 @@ -package com.darkweb.genesissearchengine.pluginManager.adPluginManager; - -import android.content.Context; -import android.os.Handler; -import androidx.annotation.NonNull; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; -import com.facebook.ads.AudienceNetworkAds; -import com.mopub.common.MoPub; -import com.mopub.common.SdkConfiguration; -import com.mopub.common.SdkInitializationListener; -import com.mopub.mobileads.MoPubErrorCode; -import com.mopub.mobileads.MoPubView; -import java.lang.ref.WeakReference; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eAdManagerCallbacks.M_ON_AD_LOAD; -import static com.mopub.common.logging.MoPubLog.LogLevel.INFO; - -public class mopubManager implements MoPubView.BannerAdListener -{ - //70f6dfc0cde14baaaa25083653700416 - /*Private Variables */ - - private eventObserver.eventListener mEvent; - private WeakReference mBannerAds; - private int mRequestCount = 0; - - private boolean bannerAdsLoaded = false; - private boolean bannerAdRequested = false; - - /*Initializations*/ - - public mopubManager(eventObserver.eventListener pEvent, MoPubView pBannerAds, Context pContext) { - this.mEvent = pEvent; - this.mBannerAds = new WeakReference(pBannerAds); - initializeBannerAds(pContext); - } - - private void initializeBannerAds(Context pContext){ - final SdkConfiguration.Builder configBuilder = new SdkConfiguration.Builder(keys.ADMANAGER_APPID_KEY); - configBuilder.withLogLevel(INFO); - - AudienceNetworkAds.initialize(pContext); - MoPub.initializeSdk(pContext, configBuilder.build(), initSdkListener()); - } - - private SdkInitializationListener initSdkListener() { - return () -> { - }; - } - - /* Local Overrides */ - - @Override - public void onBannerLoaded(@NonNull MoPubView moPubView) { - bannerAdsLoaded = true; - mEvent.invokeObserver(null, M_ON_AD_LOAD); - } - - @Override - public void onBannerFailed(MoPubView moPubView, MoPubErrorCode moPubErrorCode) { - new Handler().postDelayed(() -> - { - if(mRequestCount<=10){ - mRequestCount +=1; - mBannerAds.get().setAdUnitId(keys.ADMANAGER_APPID_KEY); - mBannerAds.get().setAdSize(MoPubView.MoPubAdSize.HEIGHT_50); - mBannerAds.get().loadAd(); - mBannerAds.get().setBannerAdListener(this); - } - }, 10000); - } - - @Override - public void onBannerClicked(MoPubView moPubView) { - - } - - @Override - public void onBannerExpanded(MoPubView moPubView) { - - } - - @Override - public void onBannerCollapsed(MoPubView moPubView) { - - } - - /*Local Helper Methods*/ - - private void loadAds(){ - if(!bannerAdRequested){ - bannerAdRequested = true; - mBannerAds.get().setAdUnitId(keys.ADMANAGER_APPID_KEY); - mBannerAds.get().loadAd(); - mBannerAds.get().setBannerAdListener(this); - } - } - - private boolean isAdvertLoaded(){ - return bannerAdsLoaded; - } - - /*External Triggers*/ - - public Object onTrigger(pluginEnums.eAdManager pEventType) { - if(pEventType.equals(pluginEnums.eAdManager.M_INITIALIZE_BANNER_ADS)) - { - loadAds(); - } - else if(pEventType.equals(pluginEnums.eAdManager.M_IS_ADVERT_LOADED)) - { - return isAdvertLoaded(); - } - return null; - } -} - +package com.hiddenservices.genesissearchengine.production.pluginManager.adPluginManager; + +import android.content.Context; +import android.os.Handler; +import androidx.annotation.NonNull; +import com.hiddenservices.genesissearchengine.production.constants.keys; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums; +import com.facebook.ads.AudienceNetworkAds; +import com.mopub.common.MoPub; +import com.mopub.common.SdkConfiguration; +import com.mopub.common.SdkInitializationListener; +import com.mopub.mobileads.MoPubErrorCode; +import com.mopub.mobileads.MoPubView; +import java.lang.ref.WeakReference; +import static com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums.eAdManagerCallbacks.M_ON_AD_LOAD; +import static com.mopub.common.logging.MoPubLog.LogLevel.INFO; + +public class mopubManager implements MoPubView.BannerAdListener +{ + //70f6dfc0cde14baaaa25083653700416 + /*Private Variables */ + + private eventObserver.eventListener mEvent; + private WeakReference mBannerAds; + private int mRequestCount = 0; + + private boolean bannerAdsLoaded = false; + private boolean bannerAdRequested = false; + + /*Initializations*/ + + public mopubManager(eventObserver.eventListener pEvent, MoPubView pBannerAds, Context pContext) { + this.mEvent = pEvent; + this.mBannerAds = new WeakReference(pBannerAds); + initializeBannerAds(pContext); + } + + private void initializeBannerAds(Context pContext){ + final SdkConfiguration.Builder configBuilder = new SdkConfiguration.Builder(keys.ADMANAGER_APPID_KEY); + configBuilder.withLogLevel(INFO); + + AudienceNetworkAds.initialize(pContext); + MoPub.initializeSdk(pContext, configBuilder.build(), initSdkListener()); + } + + private SdkInitializationListener initSdkListener() { + return () -> { + }; + } + + /* Local Overrides */ + + @Override + public void onBannerLoaded(@NonNull MoPubView moPubView) { + bannerAdsLoaded = true; + mEvent.invokeObserver(null, M_ON_AD_LOAD); + } + + @Override + public void onBannerFailed(MoPubView moPubView, MoPubErrorCode moPubErrorCode) { + new Handler().postDelayed(() -> + { + if(mRequestCount<=10){ + mRequestCount +=1; + mBannerAds.get().setAdUnitId(keys.ADMANAGER_APPID_KEY); + mBannerAds.get().setAdSize(MoPubView.MoPubAdSize.HEIGHT_50); + mBannerAds.get().loadAd(); + mBannerAds.get().setBannerAdListener(this); + } + }, 10000); + } + + @Override + public void onBannerClicked(MoPubView moPubView) { + + } + + @Override + public void onBannerExpanded(MoPubView moPubView) { + + } + + @Override + public void onBannerCollapsed(MoPubView moPubView) { + + } + + /*Local Helper Methods*/ + + private void loadAds(){ + if(!bannerAdRequested){ + bannerAdRequested = true; + mBannerAds.get().setAdUnitId(keys.ADMANAGER_APPID_KEY); + mBannerAds.get().loadAd(); + mBannerAds.get().setBannerAdListener(this); + } + } + + private boolean isAdvertLoaded(){ + return bannerAdsLoaded; + } + + /*External Triggers*/ + + public Object onTrigger(pluginEnums.eAdManager pEventType) { + if(pEventType.equals(pluginEnums.eAdManager.M_INITIALIZE_BANNER_ADS)) + { + loadAds(); + } + else if(pEventType.equals(pluginEnums.eAdManager.M_IS_ADVERT_LOADED)) + { + return isAdvertLoaded(); + } + return null; + } +} + diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/analyticPluginManager/analyticManager.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/analyticPluginManager/analyticManager.java similarity index 78% rename from app/src/main/java/com/darkweb/genesissearchengine/pluginManager/analyticPluginManager/analyticManager.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/analyticPluginManager/analyticManager.java index 61f14855..0c449ef1 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/analyticPluginManager/analyticManager.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/analyticPluginManager/analyticManager.java @@ -1,8 +1,8 @@ -package com.darkweb.genesissearchengine.pluginManager.analyticPluginManager; +package com.hiddenservices.genesissearchengine.production.pluginManager.analyticPluginManager; import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums; import com.flurry.android.FlurryAgent; import java.lang.ref.WeakReference; import java.util.List; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadPluginManager/blobDownloader.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/downloadPluginManager/blobDownloader.java similarity index 95% rename from app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadPluginManager/blobDownloader.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/downloadPluginManager/blobDownloader.java index 045cce80..45f564bf 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadPluginManager/blobDownloader.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/downloadPluginManager/blobDownloader.java @@ -1,78 +1,78 @@ -package com.darkweb.genesissearchengine.pluginManager.downloadPluginManager; - -import android.app.NotificationManager; -import android.content.Context; -import android.os.Environment; -import android.os.Handler; -import android.util.Base64; -import android.webkit.JavascriptInterface; -import androidx.core.app.NotificationCompat; -import com.example.myapplication.R; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.text.DateFormat; -import java.util.Date; - -public class blobDownloader { - - private Context context; - private NotificationManager nm; - public blobDownloader(Context context) { - this.context = context; - } - - @JavascriptInterface - public void getBase64FromBlobData(String base64Data) throws IOException { - convertBase64StringToPdfAndStoreIt(base64Data); - } - public static String getBase64StringFromBlobUrl(String blobUrl){ - if(blobUrl.startsWith("blob")){ - return "javascript: var xhr = new XMLHttpRequest();" + - "xhr.open('GET', 'YOUR BLOB URL GOES HERE', true);" + - "xhr.setRequestHeader('Content-type','application/pdf');" + - "xhr.responseType = 'blob';" + - "xhr.onload = function(e) {" + - " if (this.status == 200) {" + - " var blobPdf = this.response;" + - " var reader = new FileReader();" + - " reader.readAsDataURL(blobPdf);" + - " reader.onloadend = function() {" + - " base64data = reader.result;" + - " Android.getBase64FromBlobData(base64data);" + - " }" + - " }" + - "};" + - "xhr.send();"; - } - return "javascript: console.log('It is not a Blob URL');"; - } - - private void convertBase64StringToPdfAndStoreIt(String base64PDf) throws IOException { - final int notificationId = 1; - String currentDateTime = DateFormat.getDateTimeInstance().format(new Date()); - final File dwldsPath = new File(Environment.getExternalStoragePublicDirectory( - Environment.DIRECTORY_DOWNLOADS) + "/YourFileName_" + currentDateTime + "_.pdf"); - byte[] pdfAsBytes = Base64.decode(base64PDf.replaceFirst("^data:application/pdf;base64,", ""), 0); - FileOutputStream os; - os = new FileOutputStream(dwldsPath, false); - os.write(pdfAsBytes); - os.flush(); - - if(dwldsPath.exists()) { - NotificationCompat.Builder b = new NotificationCompat.Builder(context, "MY_DL") - .setDefaults(NotificationCompat.DEFAULT_ALL) - .setWhen(System.currentTimeMillis()) - .setSmallIcon(R.xml.ic_download) - .setContentTitle("MY TITLE") - .setContentText("MY TEXT CONTENT"); - nm = (NotificationManager) this.context.getSystemService(Context.NOTIFICATION_SERVICE); - if(nm != null) { - nm.notify(notificationId, b.build()); - Handler h = new Handler(); - long delayInMilliseconds = 5000; - h.postDelayed(() -> nm.cancel(notificationId), delayInMilliseconds); - } - } - } +package com.hiddenservices.genesissearchengine.production.pluginManager.downloadPluginManager; + +import android.app.NotificationManager; +import android.content.Context; +import android.os.Environment; +import android.os.Handler; +import android.util.Base64; +import android.webkit.JavascriptInterface; +import androidx.core.app.NotificationCompat; +import com.example.myapplication.R; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.text.DateFormat; +import java.util.Date; + +public class blobDownloader { + + private Context context; + private NotificationManager nm; + public blobDownloader(Context context) { + this.context = context; + } + + @JavascriptInterface + public void getBase64FromBlobData(String base64Data) throws IOException { + convertBase64StringToPdfAndStoreIt(base64Data); + } + public static String getBase64StringFromBlobUrl(String blobUrl){ + if(blobUrl.startsWith("blob")){ + return "javascript: var xhr = new XMLHttpRequest();" + + "xhr.open('GET', 'YOUR BLOB URL GOES HERE', true);" + + "xhr.setRequestHeader('Content-type','application/pdf');" + + "xhr.responseType = 'blob';" + + "xhr.onload = function(e) {" + + " if (this.status == 200) {" + + " var blobPdf = this.response;" + + " var reader = new FileReader();" + + " reader.readAsDataURL(blobPdf);" + + " reader.onloadend = function() {" + + " base64data = reader.result;" + + " Android.getBase64FromBlobData(base64data);" + + " }" + + " }" + + "};" + + "xhr.send();"; + } + return "javascript: console.log('It is not a Blob URL');"; + } + + private void convertBase64StringToPdfAndStoreIt(String base64PDf) throws IOException { + final int notificationId = 1; + String currentDateTime = DateFormat.getDateTimeInstance().format(new Date()); + final File dwldsPath = new File(Environment.getExternalStoragePublicDirectory( + Environment.DIRECTORY_DOWNLOADS) + "/YourFileName_" + currentDateTime + "_.pdf"); + byte[] pdfAsBytes = Base64.decode(base64PDf.replaceFirst("^data:application/pdf;base64,", ""), 0); + FileOutputStream os; + os = new FileOutputStream(dwldsPath, false); + os.write(pdfAsBytes); + os.flush(); + + if(dwldsPath.exists()) { + NotificationCompat.Builder b = new NotificationCompat.Builder(context, "MY_DL") + .setDefaults(NotificationCompat.DEFAULT_ALL) + .setWhen(System.currentTimeMillis()) + .setSmallIcon(R.xml.ic_download) + .setContentTitle("MY TITLE") + .setContentText("MY TEXT CONTENT"); + nm = (NotificationManager) this.context.getSystemService(Context.NOTIFICATION_SERVICE); + if(nm != null) { + nm.notify(notificationId, b.build()); + Handler h = new Handler(); + long delayInMilliseconds = 5000; + h.postDelayed(() -> nm.cancel(notificationId), delayInMilliseconds); + } + } + } } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadPluginManager/downloadManager.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/downloadPluginManager/downloadManager.java similarity index 85% rename from app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadPluginManager/downloadManager.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/downloadPluginManager/downloadManager.java index ce983d78..72f76eb8 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadPluginManager/downloadManager.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/downloadPluginManager/downloadManager.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.pluginManager.downloadPluginManager; +package com.hiddenservices.genesissearchengine.production.pluginManager.downloadPluginManager; import android.app.NotificationManager; import android.content.Context; @@ -6,17 +6,16 @@ import android.os.Environment; import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; -import com.darkweb.genesissearchengine.pluginManager.pluginReciever.downloadNotificationReciever; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginReciever.downloadNotificationReciever; import java.lang.ref.WeakReference; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; import static org.webrtc.ContextUtils.getApplicationContext; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadPluginManager/downloadReciever.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/downloadPluginManager/downloadReciever.java similarity index 91% rename from app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadPluginManager/downloadReciever.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/downloadPluginManager/downloadReciever.java index 28e13e67..34727634 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadPluginManager/downloadReciever.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/downloadPluginManager/downloadReciever.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.pluginManager.downloadPluginManager; +package com.hiddenservices.genesissearchengine.production.pluginManager.downloadPluginManager; import android.annotation.SuppressLint; import android.app.DownloadManager; @@ -22,16 +22,14 @@ import android.provider.MediaStore; import androidx.core.app.NotificationCompat; import androidx.core.content.FileProvider; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.libs.netcipher.client.StrongHttpsClient; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.hiddenservices.genesissearchengine.production.appManager.activityContextManager; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.libs.netcipher.client.StrongHttpsClient; import com.example.myapplication.R; import org.mozilla.thirdparty.com.google.android.exoplayer2.util.Log; -import org.torproject.android.service.wrapper.orbotLocalConstants; +import org.orbotproject.android.service.wrapper.orbotLocalConstants; import java.io.File; import java.io.FileOutputStream; @@ -44,13 +42,12 @@ import java.net.URI; import java.net.URL; import java.net.URLConnection; import java.text.DecimalFormat; -import java.util.Arrays; import java.util.Collections; import ch.boye.httpclientandroidlib.HttpResponse; import ch.boye.httpclientandroidlib.client.methods.HttpGet; -import static com.darkweb.genesissearchengine.constants.enums.etype.M_DOWNLOAD_FAILURE; +import static com.hiddenservices.genesissearchengine.production.constants.enums.etype.M_DOWNLOAD_FAILURE; import static java.lang.Thread.sleep; @@ -333,7 +330,7 @@ public class downloadReciever extends AsyncTask { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { - Uri uri = FileProvider.getUriForFile(context, "com.darkweb.genesissearchengine.production.provider", mFile); + Uri uri = FileProvider.getUriForFile(context, "com.hiddenservices.genesissearchengine.production.provider", mFile); ContentValues contentValues = new ContentValues(); contentValues.put(MediaStore.Downloads.TITLE, mFileName); @@ -344,7 +341,7 @@ public class downloadReciever extends AsyncTask { ContentResolver database = context.getContentResolver(); database.insert(MediaStore.Downloads.EXTERNAL_CONTENT_URI, contentValues); } else { - Uri uri = FileProvider.getUriForFile(context, "com.darkweb.genesissearchengine.production.provider", mFile); + Uri uri = FileProvider.getUriForFile(context, "com.hiddenservices.genesissearchengine.production.provider", mFile); String mime = helperMethod.getMimeType(uri.toString(), context); if(mime!=null){ dm.addCompletedDownload(mFileName, mURL, false, mime, mFile.getAbsolutePath(), mFile.length(), false); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadPluginManager/downloadService.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/downloadPluginManager/downloadService.java similarity index 83% rename from app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadPluginManager/downloadService.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/downloadPluginManager/downloadService.java index 83e2328a..f69c0f90 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadPluginManager/downloadService.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/downloadPluginManager/downloadService.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.pluginManager.downloadPluginManager; +package com.hiddenservices.genesissearchengine.production.pluginManager.downloadPluginManager; import android.annotation.SuppressLint; import android.app.IntentService; @@ -8,8 +8,8 @@ import android.content.Intent; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginController; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums; import java.util.Arrays; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/langPluginManager/langManager.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/langPluginManager/langManager.java similarity index 93% rename from app/src/main/java/com/darkweb/genesissearchengine/pluginManager/langPluginManager/langManager.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/langPluginManager/langManager.java index a24a0b00..4587bdff 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/langPluginManager/langManager.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/langPluginManager/langManager.java @@ -1,15 +1,14 @@ -package com.darkweb.genesissearchengine.pluginManager.langPluginManager; +package com.hiddenservices.genesissearchengine.production.pluginManager.langPluginManager; import android.content.res.Configuration; import android.content.res.Resources; import android.os.Build; import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums; import java.util.Collections; import java.util.List; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/messagePluginManager/messageManager.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/messagePluginManager/messageManager.java similarity index 92% rename from app/src/main/java/com/darkweb/genesissearchengine/pluginManager/messagePluginManager/messageManager.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/messagePluginManager/messageManager.java index 36dc6969..13c064cf 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/messagePluginManager/messageManager.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/messagePluginManager/messageManager.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.pluginManager.messagePluginManager; +package com.hiddenservices.genesissearchengine.production.pluginManager.messagePluginManager; import android.app.Dialog; import android.content.DialogInterface; @@ -25,31 +25,29 @@ import android.widget.ScrollView; import android.widget.TextView; import androidx.appcompat.app.AppCompatActivity; import androidx.constraintlayout.widget.ConstraintLayout; - -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.constants.strings; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.hiddenservices.genesissearchengine.production.constants.enums; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.constants.strings; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums; import com.example.myapplication.R; import com.google.android.material.switchmaterial.SwitchMaterial; import org.mozilla.geckoview.ContentBlocking; - import java.util.Arrays; import java.util.Collections; import java.util.List; -import static com.darkweb.genesissearchengine.constants.constants.*; -import static com.darkweb.genesissearchengine.constants.strings.BRIDGE_CUSTOM_INVALID_TYPE; -import static com.darkweb.genesissearchengine.constants.strings.BRIDGE_CUSTOM_INVALID_TYPE_STRING; -import static com.darkweb.genesissearchengine.constants.strings.GENERIC_EMPTY_DOT; -import static com.darkweb.genesissearchengine.constants.strings.MESSAGE_PLAYSTORE_NOT_FOUND; -import static com.darkweb.genesissearchengine.constants.strings.MESSAGE_SECURE_ONION_SERVICE; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.*; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManagerCallbacks.*; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManagerCallbacks.M_CLEAR_BOOKMARK; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManagerCallbacks.M_CLEAR_HISTORY; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManagerCallbacks.M_LOAD_NEW_TAB; +import static com.hiddenservices.genesissearchengine.production.constants.constants.*; +import static com.hiddenservices.genesissearchengine.production.constants.strings.BRIDGE_CUSTOM_INVALID_TYPE; +import static com.hiddenservices.genesissearchengine.production.constants.strings.BRIDGE_CUSTOM_INVALID_TYPE_STRING; +import static com.hiddenservices.genesissearchengine.production.constants.strings.GENERIC_EMPTY_DOT; +import static com.hiddenservices.genesissearchengine.production.constants.strings.MESSAGE_PLAYSTORE_NOT_FOUND; +import static com.hiddenservices.genesissearchengine.production.constants.strings.MESSAGE_SECURE_ONION_SERVICE; +import static com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums.eMessageManager.*; +import static com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums.eMessageManagerCallbacks.*; +import static com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums.eMessageManagerCallbacks.M_CLEAR_BOOKMARK; +import static com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums.eMessageManagerCallbacks.M_CLEAR_HISTORY; +import static com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums.eMessageManagerCallbacks.M_LOAD_NEW_TAB; public class messageManager implements View.OnClickListener, DialogInterface.OnDismissListener { @@ -436,6 +434,18 @@ public class messageManager implements View.OnClickListener, DialogInterface.OnD } } + public String getStoreLink() { + if(status.sStoreType == enums.StoreType.GOOGLE_PLAY){ + return CONST_PLAYSTORE_URL; + } + else if(status.sStoreType == enums.StoreType.AMAZON){ + return CONST_AMAZON_URL; + } + else { + return CONST_SAMSUNG_URL; + } + } + @Override public void onClick(View view) { if(view.getId() == R.id.pPopupToastTrigger || @@ -529,7 +539,8 @@ public class messageManager implements View.OnClickListener, DialogInterface.OnD RatingBar mPopupRateusRating = mDialog.findViewById(R.id.pPopupRateusRating); if(mPopupRateusRating.getRating()>=3){ mEvent.invokeObserver(null, M_APP_RATED); - Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(CONST_PLAYSTORE_URL)); + String mStoreURL = getStoreLink(); + Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(mStoreURL)); try { mContext.startActivity(intent); } catch (Exception ignored) { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/notificationPluginManager/localEngagementManager.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/notificationPluginManager/localEngagementManager.java similarity index 89% rename from app/src/main/java/com/darkweb/genesissearchengine/pluginManager/notificationPluginManager/localEngagementManager.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/notificationPluginManager/localEngagementManager.java index f0758d7e..1fd30076 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/notificationPluginManager/localEngagementManager.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/notificationPluginManager/localEngagementManager.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.pluginManager.notificationPluginManager; +package com.hiddenservices.genesissearchengine.production.pluginManager.notificationPluginManager; import android.app.Notification ; import android.app.NotificationChannel ; @@ -11,11 +11,11 @@ import android.graphics.Color; import android.os.Build; import android.util.Log; import androidx.core.app.NotificationCompat; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.constants.strings; +import com.hiddenservices.genesissearchengine.production.appManager.activityContextManager; +import com.hiddenservices.genesissearchengine.production.constants.strings; import com.example.myapplication.R; import java.util.Random; -import static com.darkweb.genesissearchengine.constants.constants.mUserEngagementNotificationID; +import static com.hiddenservices.genesissearchengine.production.constants.constants.mUserEngagementNotificationID; public class localEngagementManager extends BroadcastReceiver { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/notificationPluginManager/notifictionManager.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/notificationPluginManager/notifictionManager.java similarity index 87% rename from app/src/main/java/com/darkweb/genesissearchengine/pluginManager/notificationPluginManager/notifictionManager.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/notificationPluginManager/notifictionManager.java index 8112af70..bbcdb464 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/notificationPluginManager/notifictionManager.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/notificationPluginManager/notifictionManager.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.pluginManager.notificationPluginManager; +package com.hiddenservices.genesissearchengine.production.pluginManager.notificationPluginManager; import android.app.AlarmManager; import android.app.Notification; @@ -10,13 +10,13 @@ import android.graphics.Color; import android.os.SystemClock; import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.NotificationCompat; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; + +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums; import com.example.myapplication.R; import java.lang.ref.WeakReference; import java.util.List; -import static com.darkweb.genesissearchengine.constants.constants.*; +import static com.hiddenservices.genesissearchengine.production.constants.constants.*; public class notifictionManager { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbotPluginManager/orbotLogManager.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/orbotPluginManager/orbotLogManager.java similarity index 74% rename from app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbotPluginManager/orbotLogManager.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/orbotPluginManager/orbotLogManager.java index d2730d81..d8445d94 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbotPluginManager/orbotLogManager.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/orbotPluginManager/orbotLogManager.java @@ -1,49 +1,49 @@ -package com.darkweb.genesissearchengine.pluginManager.orbotPluginManager; - -import com.darkweb.genesissearchengine.constants.strings; -import java.util.List; -import static com.darkweb.genesissearchengine.pluginManager.orbotPluginManager.orbotPluginEnums.eLogManager.M_GET_CLEANED_LOGS; - -public class orbotLogManager -{ - - private String onGetCleanedLogs(String pLogs) - { - String logs = pLogs; - - if(logs.equals("Starting Genesis | Please Wait ...")){ - return logs; - } - - if(pLogs.equals("No internet connection")){ - return "Warning | " + pLogs; - } - - else if(pLogs.startsWith("Invalid Configuration")){ - return pLogs; - } - - if(!logs.contains("Bootstrapped")){ - logs = "Initializing Bootstrap"; - } - - if(!logs.equals(strings.GENERIC_EMPTY_STR)) - { - String Logs = logs; - Logs="Installing | " + Logs.replace("FAILED","Securing"); - return Logs; - } - return "Loading Please Wait..."; - } - - /*External Triggers*/ - - public Object onTrigger(List pData, orbotPluginEnums.eLogManager pEventType) { - if(pEventType.equals(M_GET_CLEANED_LOGS)) - { - return onGetCleanedLogs((String) pData.get(0)); - } - return null; - } - -} +package com.hiddenservices.genesissearchengine.production.pluginManager.orbotPluginManager; + +import com.hiddenservices.genesissearchengine.production.constants.strings; +import java.util.List; +import static com.hiddenservices.genesissearchengine.production.pluginManager.orbotPluginManager.orbotPluginEnums.eLogManager.M_GET_CLEANED_LOGS; + +public class orbotLogManager +{ + + private String onGetCleanedLogs(String pLogs) + { + String logs = pLogs; + + if(logs.equals("Starting Genesis | Please Wait ...")){ + return logs; + } + + if(pLogs.equals("No internet connection")){ + return "Warning | " + pLogs; + } + + else if(pLogs.startsWith("Invalid Configuration")){ + return pLogs; + } + + if(!logs.contains("Bootstrapped")){ + logs = "Initializing Bootstrap"; + } + + if(!logs.equals(strings.GENERIC_EMPTY_STR)) + { + String Logs = logs; + Logs="Installing | " + Logs.replace("FAILED","Securing"); + return Logs; + } + return "Loading Please Wait..."; + } + + /*External Triggers*/ + + public Object onTrigger(List pData, orbotPluginEnums.eLogManager pEventType) { + if(pEventType.equals(M_GET_CLEANED_LOGS)) + { + return onGetCleanedLogs((String) pData.get(0)); + } + return null; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbotPluginManager/orbotManager.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/orbotPluginManager/orbotManager.java similarity index 86% rename from app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbotPluginManager/orbotManager.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/orbotPluginManager/orbotManager.java index 08c899b8..cbce6f69 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbotPluginManager/orbotManager.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/orbotPluginManager/orbotManager.java @@ -1,23 +1,23 @@ -package com.darkweb.genesissearchengine.pluginManager.orbotPluginManager; +package com.hiddenservices.genesissearchengine.production.pluginManager.orbotPluginManager; import android.content.Intent; import android.content.SharedPreferences; import android.os.Build; import androidx.appcompat.app.AppCompatActivity; -import org.torproject.android.service.OrbotService; -import org.torproject.android.service.util.Prefs; -import org.torproject.android.service.wrapper.orbotLocalConstants; +import org.orbotproject.android.service.OrbotService; +import org.orbotproject.android.service.util.Prefs; +import org.orbotproject.android.service.wrapper.orbotLocalConstants; import java.lang.ref.WeakReference; import java.util.Collections; import java.util.List; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.hiddenservices.genesissearchengine.production.constants.constants; +import com.hiddenservices.genesissearchengine.production.constants.keys; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums; import static android.content.Context.MODE_PRIVATE; -import static com.darkweb.genesissearchengine.pluginManager.orbotPluginManager.orbotPluginEnums.eLogManager.M_GET_CLEANED_LOGS; -import static org.torproject.android.service.TorServiceConstants.ACTION_START; -import static org.torproject.android.service.TorServiceConstants.ACTION_STOP; +import static com.hiddenservices.genesissearchengine.production.pluginManager.orbotPluginManager.orbotPluginEnums.eLogManager.M_GET_CLEANED_LOGS; +import static org.orbotproject.android.service.TorServiceConstants.ACTION_START; +import static org.orbotproject.android.service.TorServiceConstants.ACTION_STOP; // https://github.com/guardianproject/orbot/blob/8fca5f8ecddb4da9565ac3fd8936e4f28acdd352/BUILD.md diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbotPluginManager/orbotPluginEnums.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/orbotPluginManager/orbotPluginEnums.java similarity index 65% rename from app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbotPluginManager/orbotPluginEnums.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/orbotPluginManager/orbotPluginEnums.java index 2365d253..8576f37c 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbotPluginManager/orbotPluginEnums.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/orbotPluginManager/orbotPluginEnums.java @@ -1,13 +1,13 @@ -package com.darkweb.genesissearchengine.pluginManager.orbotPluginManager; - -public class orbotPluginEnums -{ - /*Orbot Log Manager*/ - public enum eLogManager { - M_GET_CLEANED_LOGS - } - - public enum eProxyManager { - M_INIT_PROXY, M_INIT_PRIVACY - } +package com.hiddenservices.genesissearchengine.production.pluginManager.orbotPluginManager; + +public class orbotPluginEnums +{ + /*Orbot Log Manager*/ + public enum eLogManager { + M_GET_CLEANED_LOGS + } + + public enum eProxyManager { + M_INIT_PROXY, M_INIT_PRIVACY + } } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginController.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/pluginController.java old mode 100755 new mode 100644 similarity index 79% rename from app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginController.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/pluginController.java index 0f8202dc..df8976b3 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginController.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/pluginController.java @@ -1,51 +1,51 @@ -package com.darkweb.genesissearchengine.pluginManager; +package com.hiddenservices.genesissearchengine.production.pluginManager; import android.view.WindowManager; import android.widget.ImageView; import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.geckoSession; -import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController; -import com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogController; -import com.darkweb.genesissearchengine.appManager.settingManager.privacyManager.settingPrivacyController; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.pluginManager.adPluginManager.mopubManager; -import com.darkweb.genesissearchengine.pluginManager.analyticPluginManager.analyticManager; -import com.darkweb.genesissearchengine.pluginManager.downloadPluginManager.downloadManager; -import com.darkweb.genesissearchengine.pluginManager.langPluginManager.langManager; -import com.darkweb.genesissearchengine.pluginManager.messagePluginManager.messageManager; -import com.darkweb.genesissearchengine.pluginManager.notificationPluginManager.notifictionManager; -import com.darkweb.genesissearchengine.pluginManager.orbotPluginManager.orbotManager; +import com.hiddenservices.genesissearchengine.production.appManager.activityContextManager; +import com.hiddenservices.genesissearchengine.production.appManager.homeManager.geckoManager.geckoSession; +import com.hiddenservices.genesissearchengine.production.appManager.homeManager.homeController.homeController; +import com.hiddenservices.genesissearchengine.production.appManager.orbotLogManager.orbotLogController; +import com.hiddenservices.genesissearchengine.production.appManager.settingManager.privacyManager.settingPrivacyController; +import com.hiddenservices.genesissearchengine.production.constants.constants; +import com.hiddenservices.genesissearchengine.production.constants.enums; +import com.hiddenservices.genesissearchengine.production.constants.keys; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.dataManager.dataController; +import com.hiddenservices.genesissearchengine.production.dataManager.dataEnums; +import com.hiddenservices.genesissearchengine.production.eventObserver; +import com.hiddenservices.genesissearchengine.production.helperManager.helperMethod; +import com.hiddenservices.genesissearchengine.production.pluginManager.adPluginManager.mopubManager; +import com.hiddenservices.genesissearchengine.production.pluginManager.analyticPluginManager.analyticManager; +import com.hiddenservices.genesissearchengine.production.pluginManager.downloadPluginManager.downloadManager; +import com.hiddenservices.genesissearchengine.production.pluginManager.langPluginManager.langManager; +import com.hiddenservices.genesissearchengine.production.pluginManager.messagePluginManager.messageManager; +import com.hiddenservices.genesissearchengine.production.pluginManager.notificationPluginManager.notifictionManager; +import com.hiddenservices.genesissearchengine.production.pluginManager.orbotPluginManager.orbotManager; import java.lang.ref.WeakReference; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Locale; -import static com.darkweb.genesissearchengine.constants.enums.etype.fetch_favicon; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eAdManagerCallbacks.M_ON_AD_CLICK; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eAdManagerCallbacks.M_ON_AD_HIDE; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eAdManagerCallbacks.M_ON_AD_LOAD; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eLangManager.M_ACTIVITY_CREATED; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eLangManager.M_RESUME; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.*; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManagerCallbacks.*; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManagerCallbacks.M_CLEAR_BOOKMARK; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManagerCallbacks.M_CLEAR_HISTORY; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManagerCallbacks.M_LOAD_NEW_TAB; +import static com.hiddenservices.genesissearchengine.production.constants.enums.etype.fetch_favicon; +import static com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums.eAdManagerCallbacks.M_ON_AD_CLICK; +import static com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums.eAdManagerCallbacks.M_ON_AD_HIDE; +import static com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums.eAdManagerCallbacks.M_ON_AD_LOAD; +import static com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums.eLangManager.M_ACTIVITY_CREATED; +import static com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums.eLangManager.M_RESUME; +import static com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums.eMessageManager.*; +import static com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums.eMessageManagerCallbacks.*; +import static com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums.eMessageManagerCallbacks.M_CLEAR_BOOKMARK; +import static com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums.eMessageManagerCallbacks.M_CLEAR_HISTORY; +import static com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums.eMessageManagerCallbacks.M_LOAD_NEW_TAB; public class pluginController { /*Plugin Instance*/ private mopubManager mAdManager; - private com.darkweb.genesissearchengine.pluginManager.analyticPluginManager.analyticManager mAnalyticsManager; + private com.hiddenservices.genesissearchengine.production.pluginManager.analyticPluginManager.analyticManager mAnalyticsManager; private messageManager mMessageManager; private notifictionManager mNotificationManager; private activityContextManager mContextManager; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginEnums.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/pluginEnums.java similarity index 95% rename from app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginEnums.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/pluginEnums.java index b14e8185..4b1e7bf3 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginEnums.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/pluginEnums.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.pluginManager; +package com.hiddenservices.genesissearchengine.production.pluginManager; public class pluginEnums { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginReciever/downloadNotificationReciever.java b/app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/pluginReciever/downloadNotificationReciever.java similarity index 73% rename from app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginReciever/downloadNotificationReciever.java rename to app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/pluginReciever/downloadNotificationReciever.java index 3fef7079..77d74af4 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginReciever/downloadNotificationReciever.java +++ b/app/src/main/java/com/hiddenservices/genesissearchengine.production/pluginManager/pluginReciever/downloadNotificationReciever.java @@ -1,13 +1,13 @@ -package com.darkweb.genesissearchengine.pluginManager.pluginReciever; +package com.hiddenservices.genesissearchengine.production.pluginManager.pluginReciever; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginController; +import com.hiddenservices.genesissearchengine.production.pluginManager.pluginEnums; import java.util.Collections; -import static com.darkweb.genesissearchengine.constants.constants.*; +import static com.hiddenservices.genesissearchengine.production.constants.constants.*; public class downloadNotificationReciever extends BroadcastReceiver { public void onReceive (Context context , Intent intent) { diff --git a/app/src/main/java/com/widget/Genesis/helperMethod/helperMethod.java b/app/src/main/java/com/widget/Genesis/helperMethod/helperMethod.java index 38b975bb..4b3f4561 100644 --- a/app/src/main/java/com/widget/Genesis/helperMethod/helperMethod.java +++ b/app/src/main/java/com/widget/Genesis/helperMethod/helperMethod.java @@ -4,15 +4,8 @@ import android.app.PendingIntent; import android.content.Context; import android.content.Intent; -import androidx.appcompat.app.AppCompatActivity; - -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.constants.keys; import com.widget.Genesis.widgetManager.widgetController; -import static android.content.Intent.FLAG_ACTIVITY_NO_ANIMATION; -import static com.darkweb.genesissearchengine.constants.constants.CONST_PACKAGE_NAME; - public class helperMethod { /*Helper Methods General*/ diff --git a/app/src/main/java/com/widget/Genesis/widgetManager/widgetController.java b/app/src/main/java/com/widget/Genesis/widgetManager/widgetController.java index 4f93d143..23203f8f 100644 --- a/app/src/main/java/com/widget/Genesis/widgetManager/widgetController.java +++ b/app/src/main/java/com/widget/Genesis/widgetManager/widgetController.java @@ -7,7 +7,7 @@ import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.widget.RemoteViews; -import com.darkweb.genesissearchengine.eventObserver; +import com.hiddenservices.genesissearchengine.production.eventObserver; import com.example.myapplication.R; import com.widget.Genesis.helperMethod.helperMethod; import java.util.Arrays; diff --git a/app/src/main/java/com/widget/Genesis/widgetManager/widgetModelController.java b/app/src/main/java/com/widget/Genesis/widgetManager/widgetModelController.java index 5886561d..b77954ad 100644 --- a/app/src/main/java/com/widget/Genesis/widgetManager/widgetModelController.java +++ b/app/src/main/java/com/widget/Genesis/widgetManager/widgetModelController.java @@ -4,13 +4,13 @@ import android.appwidget.AppWidgetManager; import android.content.Context; import android.content.Intent; import android.os.Bundle; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; +import com.hiddenservices.genesissearchengine.production.constants.enums; +import com.hiddenservices.genesissearchengine.production.constants.status; +import com.hiddenservices.genesissearchengine.production.eventObserver; import com.widget.Genesis.helperMethod.helperMethod; import java.util.Arrays; import java.util.List; -import static com.darkweb.genesissearchengine.constants.constants.CONST_PACKAGE_NAME; +import static com.hiddenservices.genesissearchengine.production.constants.constants.CONST_PACKAGE_NAME; public class widgetModelController { diff --git a/app/src/main/java/com/widget/Genesis/widgetManager/widgetViewController.java b/app/src/main/java/com/widget/Genesis/widgetManager/widgetViewController.java index 840f21bb..a762e913 100644 --- a/app/src/main/java/com/widget/Genesis/widgetManager/widgetViewController.java +++ b/app/src/main/java/com/widget/Genesis/widgetManager/widgetViewController.java @@ -4,7 +4,7 @@ import android.appwidget.AppWidgetProvider; import android.content.Context; import android.view.View; import android.widget.RemoteViews; -import com.darkweb.genesissearchengine.eventObserver; +import com.hiddenservices.genesissearchengine.production.eventObserver; import com.example.myapplication.R; import java.util.List; diff --git a/app/src/main/res/custom-xml/generic/xml-v25/shortcuts.xml b/app/src/main/res/custom-xml/generic/xml-v25/shortcuts.xml index 81d8550e..40076550 100644 --- a/app/src/main/res/custom-xml/generic/xml-v25/shortcuts.xml +++ b/app/src/main/res/custom-xml/generic/xml-v25/shortcuts.xml @@ -1,43 +1,43 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/bookmark/layout/bookmark_setting_view.xml b/app/src/main/res/layouts/bookmark/layout/bookmark_setting_view.xml index 5ccddddc..714cfbbf 100644 --- a/app/src/main/res/layouts/bookmark/layout/bookmark_setting_view.xml +++ b/app/src/main/res/layouts/bookmark/layout/bookmark_setting_view.xml @@ -1,197 +1,197 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layouts/bookmark/layout/bookmark_view.xml b/app/src/main/res/layouts/bookmark/layout/bookmark_view.xml index 045c8ee5..52e1ae73 100644 --- a/app/src/main/res/layouts/bookmark/layout/bookmark_view.xml +++ b/app/src/main/res/layouts/bookmark/layout/bookmark_view.xml @@ -5,7 +5,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/c_background" - tools:context="com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkHome.bookmarkController"> + tools:context="com.hiddenservices.genesissearchengine.production.appManager.bookmarkManager.bookmarkHome.bookmarkController"> - + tools:context="com.hiddenservices.genesissearchengine.production.appManager.helpManager.helpController"> - + tools:context="com.hiddenservices.genesissearchengine.production.appManager.historyManager.historyController"> - + tools:context="com.hiddenservices.genesissearchengine.production.appManager.homeManager.homeController.homeController"> - - + - - + @@ -73,10 +73,10 @@ @@ -96,11 +96,11 @@ + tools:context="com.hiddenservices.genesissearchengine.production.appManager.languageManager.languageController"> diff --git a/app/src/main/res/layouts/setting/layout/setting.xml b/app/src/main/res/layouts/setting/layout/setting.xml index 75ee8e94..ef92a301 100644 --- a/app/src/main/res/layouts/setting/layout/setting.xml +++ b/app/src/main/res/layouts/setting/layout/setting.xml @@ -5,7 +5,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/c_background" - tools:context="com.darkweb.genesissearchengine.appManager.settingManager.settingHomeManager.settingHomeController"> + tools:context="com.hiddenservices.genesissearchengine.production.appManager.settingManager.settingHomeManager.settingHomeController"> diff --git a/app/src/main/res/layouts/setting/layout/setting_accessibility_view.xml b/app/src/main/res/layouts/setting/layout/setting_accessibility_view.xml index 6fc79efc..f5050e20 100644 --- a/app/src/main/res/layouts/setting/layout/setting_accessibility_view.xml +++ b/app/src/main/res/layouts/setting/layout/setting_accessibility_view.xml @@ -4,7 +4,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/c_background" - tools:context="com.darkweb.genesissearchengine.appManager.settingManager.accessibilityManager.settingAccessibilityController"> + tools:context="com.hiddenservices.genesissearchengine.production.appManager.settingManager.accessibilityManager.settingAccessibilityController"> diff --git a/app/src/main/res/layouts/setting/layout/setting_advance_view.xml b/app/src/main/res/layouts/setting/layout/setting_advance_view.xml index 753e8bd2..72058bb9 100644 --- a/app/src/main/res/layouts/setting/layout/setting_advance_view.xml +++ b/app/src/main/res/layouts/setting/layout/setting_advance_view.xml @@ -4,7 +4,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/c_background" - tools:context="com.darkweb.genesissearchengine.appManager.settingManager.advanceManager.settingAdvanceController"> + tools:context="com.hiddenservices.genesissearchengine.production.appManager.settingManager.advanceManager.settingAdvanceController"> diff --git a/app/src/main/res/layouts/setting/layout/setting_clear_view.xml b/app/src/main/res/layouts/setting/layout/setting_clear_view.xml index b5363ae9..90e128f8 100644 --- a/app/src/main/res/layouts/setting/layout/setting_clear_view.xml +++ b/app/src/main/res/layouts/setting/layout/setting_clear_view.xml @@ -5,7 +5,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/c_background" - tools:context="com.darkweb.genesissearchengine.appManager.settingManager.clearManager.settingClearController"> + tools:context="com.hiddenservices.genesissearchengine.production.appManager.settingManager.clearManager.settingClearController"> diff --git a/app/src/main/res/layouts/setting/layout/setting_general_view.xml b/app/src/main/res/layouts/setting/layout/setting_general_view.xml index a872b33a..f48e1e99 100644 --- a/app/src/main/res/layouts/setting/layout/setting_general_view.xml +++ b/app/src/main/res/layouts/setting/layout/setting_general_view.xml @@ -4,7 +4,7 @@ android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto" android:background="@color/c_background" - tools:context="com.darkweb.genesissearchengine.appManager.settingManager.generalManager.settingGeneralController"> + tools:context="com.hiddenservices.genesissearchengine.production.appManager.settingManager.generalManager.settingGeneralController"> diff --git a/app/src/main/res/layouts/setting/layout/setting_log_view.xml b/app/src/main/res/layouts/setting/layout/setting_log_view.xml index f15cb6c1..7a6bfa47 100644 --- a/app/src/main/res/layouts/setting/layout/setting_log_view.xml +++ b/app/src/main/res/layouts/setting/layout/setting_log_view.xml @@ -4,7 +4,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/c_background" - tools:context="com.darkweb.genesissearchengine.appManager.settingManager.logManager.settingLogController"> + tools:context="com.hiddenservices.genesissearchengine.production.appManager.settingManager.logManager.settingLogController"> diff --git a/app/src/main/res/layouts/setting/layout/setting_notification_view.xml b/app/src/main/res/layouts/setting/layout/setting_notification_view.xml index 09ad0a9e..5e42b187 100644 --- a/app/src/main/res/layouts/setting/layout/setting_notification_view.xml +++ b/app/src/main/res/layouts/setting/layout/setting_notification_view.xml @@ -4,7 +4,7 @@ android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto" android:background="@color/c_background" - tools:context="com.darkweb.genesissearchengine.appManager.settingManager.notificationManager.settingNotificationController"> + tools:context="com.hiddenservices.genesissearchengine.production.appManager.settingManager.notificationManager.settingNotificationController"> diff --git a/app/src/main/res/layouts/setting/layout/setting_privacy_view.xml b/app/src/main/res/layouts/setting/layout/setting_privacy_view.xml index 2da2cb4c..24e09d09 100644 --- a/app/src/main/res/layouts/setting/layout/setting_privacy_view.xml +++ b/app/src/main/res/layouts/setting/layout/setting_privacy_view.xml @@ -4,7 +4,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/c_background" - tools:context="com.darkweb.genesissearchengine.appManager.settingManager.privacyManager.settingPrivacyController"> + tools:context="com.hiddenservices.genesissearchengine.production.appManager.settingManager.privacyManager.settingPrivacyController"> diff --git a/app/src/main/res/layouts/setting/layout/setting_search_view.xml b/app/src/main/res/layouts/setting/layout/setting_search_view.xml index 09ce55eb..ac3fcaa1 100644 --- a/app/src/main/res/layouts/setting/layout/setting_search_view.xml +++ b/app/src/main/res/layouts/setting/layout/setting_search_view.xml @@ -4,7 +4,7 @@ android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto" android:background="@color/c_background" - tools:context="com.darkweb.genesissearchengine.appManager.settingManager.searchEngineManager.settingSearchController"> + tools:context="com.hiddenservices.genesissearchengine.production.appManager.settingManager.searchEngineManager.settingSearchController"> diff --git a/app/src/main/res/layouts/setting/layout/setting_tracking_view.xml b/app/src/main/res/layouts/setting/layout/setting_tracking_view.xml index d4bd1028..30af16cd 100644 --- a/app/src/main/res/layouts/setting/layout/setting_tracking_view.xml +++ b/app/src/main/res/layouts/setting/layout/setting_tracking_view.xml @@ -4,7 +4,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/c_background" - tools:context="com.darkweb.genesissearchengine.appManager.settingManager.trackingManager.settingTrackingController"> + tools:context="com.hiddenservices.genesissearchengine.production.appManager.settingManager.trackingManager.settingTrackingController"> diff --git a/app/src/main/res/layouts/tab/layout/tab_grid_view.xml b/app/src/main/res/layouts/tab/layout/tab_grid_view.xml index ae25c46b..99764377 100644 --- a/app/src/main/res/layouts/tab/layout/tab_grid_view.xml +++ b/app/src/main/res/layouts/tab/layout/tab_grid_view.xml @@ -77,7 +77,7 @@ app:cardElevation="0dp" app:contentPadding="0dp"> - - digital freedom reload you are facing the one of the following problem. webpage or website might not be working. your internet connection might be poor. you might be using a proxy. website might be blocked by firewall - com.darkweb.genesissearchengine.production.provider + com.hiddenservices.genesissearchengine.production.provider BBC | Israel Strikes Again diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index 11c16bc6..e908d98c 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -12,7 +12,7 @@ الحرية الرقمية إعادة تحميل لديك واحدة من المشاكل التالية. قد لا تعمل صفحة الويب أو موقع الويب. قد يكون اتصالك بالإنترنت معطلاً. ربما كنت تستخدم وكيل. قد يتم حظر موقع الويب بواسطة جدار حماية - com.darkweb.genesissearchengine.production.provider + com.hiddenservices.genesissearchengine.production.provider بي بي سي | هاجمت إسرائيل مرة أخرى diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index 3d7599ed..ff76254c 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -12,7 +12,7 @@ llibertat digital recarregar us trobeu amb el problema següent. pot ser que la pàgina web o el lloc web no funcionin. és possible que la vostra connexió a Internet sigui deficient. és possible que utilitzeu un servidor intermediari. el tallafoc podria bloquejar el lloc web - com.darkweb.genesissearchengine.production.provider + com.hiddenservices.genesissearchengine.production.provider BBC, Israel torna a atacar diff --git a/app/src/main/res/values-ch/strings.xml b/app/src/main/res/values-ch/strings.xml index 174e7432..abb44159 100644 --- a/app/src/main/res/values-ch/strings.xml +++ b/app/src/main/res/values-ch/strings.xml @@ -12,7 +12,7 @@ digitální svoboda Znovu načíst čelíte jednomu z následujících problémů. webová stránka nebo web nemusí fungovat. vaše připojení k internetu může být špatné. možná používáte proxy. web může být blokován bránou firewall - com.darkweb.genesissearchengine.production.provider + com.hiddenservices.genesissearchengine.production.provider BBC | Izrael znovu udeří diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index b0b27824..253c14cf 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -12,7 +12,7 @@ digitale Freiheit neu laden Sie stehen vor einem der folgenden Probleme. Webseite oder Website funktioniert möglicherweise nicht. Ihre Internetverbindung ist möglicherweise schlecht. Möglicherweise verwenden Sie einen Proxy. Die Website wird möglicherweise von der Firewall blockiert - com.darkweb.genesissearchengine.production.provider + com.hiddenservices.genesissearchengine.production.provider BBC | Israel schlägt erneut zu diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index f22acf40..0c96c5cf 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -12,7 +12,7 @@ ψηφιακή ελευθερία φορτώνω πάλι αντιμετωπίζετε ένα από τα ακόλουθα προβλήματα. η ιστοσελίδα ή ο ιστότοπος ενδέχεται να μην λειτουργούν. η σύνδεσή σας στο Διαδίκτυο μπορεί να είναι κακή. μπορεί να χρησιμοποιείτε διακομιστή μεσολάβησης. Ο ιστότοπος ενδέχεται να αποκλειστεί από το τείχος προστασίας - com.darkweb.genesissearchengine.production.provider + com.hiddenservices.genesissearchengine.production.provider BBC | Το Ισραήλ χτυπά ξανά diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 420b37d4..ec1fb6be 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -12,7 +12,7 @@ liberté numérique recharger vous êtes confronté à l\'un des problèmes suivants. la page Web ou le site Web peut ne pas fonctionner. votre connexion Internet est peut-être mauvaise. vous utilisez peut-être un proxy. le site Web peut être bloqué par le pare-feu - com.darkweb.genesissearchengine.production.provider + com.hiddenservices.genesissearchengine.production.provider BBC | Israël frappe à nouveau diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index ea3c9f70..38099fe2 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -12,7 +12,7 @@ digitális szabadság újratöltés a következő probléma egyikével áll szemben. előfordulhat, hogy egy weboldal vagy webhely nem működik. gyenge lehet az internetkapcsolat. lehet, hogy proxyt használ. előfordulhat, hogy a webhelyet tűzfal blokkolja - com.darkweb.genesissearchengine.production.provider + com.hiddenservices.genesissearchengine.production.provider BBC | Izrael újra sztrájkol diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 664968a5..c9e8dbce 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -12,7 +12,7 @@ libertà digitale ricaricare stai affrontando uno dei seguenti problemi. la pagina web o il sito web potrebbero non funzionare. la tua connessione Internet potrebbe essere scarsa. potresti utilizzare un proxy. il sito Web potrebbe essere bloccato dal firewall - com.darkweb.genesissearchengine.production.provider + com.hiddenservices.genesissearchengine.production.provider BBC | Israele colpisce ancora diff --git a/app/src/main/res/values-ja-rJP/strings.xml b/app/src/main/res/values-ja-rJP/strings.xml index 3be21e49..770417bb 100644 --- a/app/src/main/res/values-ja-rJP/strings.xml +++ b/app/src/main/res/values-ja-rJP/strings.xml @@ -12,7 +12,7 @@ デジタルの自由 リロード 次のいずれかの問題が発生しています。ウェブページまたはウェブサイトが機能していない可能性があります。インターネット接続が悪い可能性があります。プロキシを使用している可能性があります。ウェブサイトがファイアウォールによってブロックされている可能性があります - com.darkweb.genesissearchengine.production.provider + com.hiddenservices.genesissearchengine.production.provider BBC |イスラエルが再びストライキ diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml index 6a7a34fa..65a869db 100644 --- a/app/src/main/res/values-ko/strings.xml +++ b/app/src/main/res/values-ko/strings.xml @@ -12,7 +12,7 @@ 디지털 자유 재 장전 다음 문제 중 하나에 직면하고 있습니다. 웹 페이지 또는 웹 사이트가 작동하지 않을 수 있습니다. 인터넷 연결 상태가 좋지 않을 수 있습니다. 프록시를 사용하고있을 수 있습니다. 웹 사이트가 방화벽에 의해 차단 될 수 있음 - com.darkweb.genesissearchengine.production.provider + com.hiddenservices.genesissearchengine.production.provider BBC | 이스라엘이 다시 공격하다 diff --git a/app/src/main/res/values-night/colors.xml b/app/src/main/res/values-night/colors.xml index e91e6954..c6cb868d 100644 --- a/app/src/main/res/values-night/colors.xml +++ b/app/src/main/res/values-night/colors.xml @@ -64,7 +64,6 @@ #121216 #293a56 #3a5278 - #ffffff #3385ff #ffffff #4d4d4d @@ -116,8 +115,8 @@ #425e8a #324467 #0f0f0f - #90000000 #d9d9d9 #1c1b21 + #141414 diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 86a6e521..d718a326 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -12,7 +12,7 @@ digital freedom recarregar você está enfrentando um dos seguintes problemas. página da Web ou site pode não estar funcionando. sua conexão com a internet pode estar ruim. você pode estar usando um proxy. site pode estar bloqueado por firewall - com.darkweb.genesissearchengine.production.provider + com.hiddenservices.genesissearchengine.production.provider BBC | Israel ataca novamente diff --git a/app/src/main/res/values-ro/strings.xml b/app/src/main/res/values-ro/strings.xml index cc221f58..6ec8c39b 100644 --- a/app/src/main/res/values-ro/strings.xml +++ b/app/src/main/res/values-ro/strings.xml @@ -12,7 +12,7 @@ libertatea digitală reîncărcați vă confruntați cu una dintre următoarele probleme. este posibil ca pagina web sau site-ul web să nu funcționeze. conexiunea la internet ar putea fi slabă. s-ar putea să utilizați un proxy. site-ul web ar putea fi blocat de firewall - com.darkweb.genesissearchengine.production.provider + com.hiddenservices.genesissearchengine.production.provider BBC | Israelul lovește din nou diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 9bdfe4fe..e50f4238 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -12,7 +12,7 @@ цифровая свобода перезагрузить вы столкнулись с одной из следующих проблем. веб-страница или веб-сайт могут не работать. ваше интернет-соединение может быть плохим. вы можете использовать прокси. веб-сайт может быть заблокирован брандмауэром - com.darkweb.genesissearchengine.production.provider + com.hiddenservices.genesissearchengine.production.provider BBC | Израиль снова наносит удар diff --git a/app/src/main/res/values-th/strings.xml b/app/src/main/res/values-th/strings.xml index 23329df2..3cdff654 100644 --- a/app/src/main/res/values-th/strings.xml +++ b/app/src/main/res/values-th/strings.xml @@ -12,7 +12,7 @@ เสรีภาพดิจิทัล โหลดใหม่ คุณกำลังประสบปัญหาอย่างใดอย่างหนึ่งต่อไปนี้ หน้าเว็บหรือเว็บไซต์อาจไม่ทำงาน การเชื่อมต่ออินเทอร์เน็ตของคุณอาจไม่ดี คุณอาจใช้พร็อกซี เว็บไซต์อาจถูกปิดกั้นโดยไฟร์วอลล์ - com.darkweb.genesissearchengine.production.provider + com.hiddenservices.genesissearchengine.production.provider BBC | อิสราเอลนัดหยุดงานอีกครั้ง diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 8cba6e70..835a7711 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -1,532 +1,532 @@ - - - - Genesis - bir şey arayın veya bir web bağlantısı yazın - sayfada bul - arama motoru - https://genesis.onion - opps! bir şeyler ters gitti - herşey - Genesis search engine - dijital özgürlük - Tekrar yükle - aşağıdaki problemlerden biriyle karşı karşıyasınız. web sayfası veya web sitesi çalışmıyor olabilir. İnternet bağlantınız zayıf olabilir. bir proxy kullanıyor olabilirsiniz. web sitesi güvenlik duvarı tarafından engelleniyor olabilir - com.darkweb.genesissearchengine.production.provider - BBC | İsrail Yeniden Grevde - - - Tarayıcı önbelleğini sil - Taranan web sitesini sil - Verilerinizi silin ve tarayıcıyı açın - Tarayıcı önbelleğini sil - Genesis tarayıcısını yeniden başlatın - Tarayıcınızı Yeniden Başlatın - - - Yer İşaretini Düzenle - Yer İşareti Adı - İşaretli URL\'nin adı burada gösterilecek - Yer imi adını girin… - - - Reddet - - - "Bazen Tor ağına ulaşmak için bir Köprü gerekir" - "BANA DAHA FAZLA ANLAT" - "Merhaba" - "Mobilde Genesis\'e hoş geldiniz." - "İnternette güvenli ve güvenli bir şekilde gezinin." - "İzleme yok. Sansür yok." - - - Bağlantı güvenli - Bilgileriniz (örneğin, şifre veya kredi kartı numaraları) bu siteye gönderildiğinde güvendedir - Güvenlik Ayarı - Javascript - Kimliğinizi güvende tutun ve aşağıdaki seçenekleri kullanın - Takip Etme - Sitelere sizi izlememelerini söyleyeceğiz - İzleme Koruması - Tarafımızdan sağlanan izleme korumasını etkinleştirin - Sertifika - - - Sertifika Bilgisi - - - proxy günlükleri - Sistem Günlüğü bilgisi - Genesis\'e başlarken bağlantı sorunu yaşıyorsanız, lütfen aşağıdaki kodu kopyalayın ve çevrimiçi sorunu bulun veya bize gönderin, böylece size yardımcı olmaya çalışabiliriz - ~ Genesis on standby at the moment - - - proxy özelleştirmek - Sizi dünya çapında binlerce gönüllünün yönettiği Tor ağına bağlıyoruz! Bu seçenekler size yardımcı olabilir mi - İnternet burada sansürlenir (güvenlik duvarını atlayın) - güvenlik duvarını atla - Bridges internetin çok yavaş çalışmasına neden olur. bunları yalnızca ülkenizde internet sansürlenmişse veya Tor ağı engellenmişse kullanın - güvenlik özelleştir - - - Güvenlik Ayarları - "BRIDGE" Ayarlarını Değiştir - Otomatik Olarak Oluştur - "KÖPRÜ" ayarlarını otomatik olarak yapılandır - Bildiğim bir "BRIDGE" sağlayın - Özel "BRIDGE" yapıştır - Proxy Settings | Bridge - "BRIDGE", Tor ağına yapılan bağlantıları engellemeyi zorlaştıran, listelenmemiş Tor röleleridir. Bazı ülkelerin Tor\'u engellemeye çalışması nedeniyle, bazı "BRIDGE" bazı ülkelerde çalışır, ancak bazılarında çalışmaz - Varsayılan "BRIDGE"yü Seç - Talep - obfs4 (Önerilen) - Meek-masmavi (Çin) - - - bildiğiniz bir Bridge sağlayın - güvenilir bir kaynaktan bridge bilgi girin - istek - - - Sistem Günlüğünün görünme şeklini değiştirin - modern liste görünümünü kullanarak Günlüğü göster - klasik ve modern liste görünümü arasında geçiş yap - - - Yer işareti kaldırıldı - Yer imi güncellendi - Veriler başarıyla temizlendi - URL Panoya kopyalandı - Uygulama bulunamadı - Değişikliklerden sonra yeniden başlatma gerekli - Yeniden Başlat - Sekme Kapalı - Yeni sekme açıldı - Genesis proxy bağlanıyor... - Bellek dolu ➔ Sekme temizleniyor - Pop-up engellendi - Hata Günlüklerini Aç - Anahtar - Geri al - Yeni kimlik oluşturuldu - ayarları aç - - - BUNU DUYDUĞUM İÇİN ÜZGÜNÜM - Bu uygulamayı kullanırken zorluk yaşıyorsanız, lütfen bize e-posta yoluyla ulaşın. Sorununuzu en kısa sürede çözmeye çalışacağız - - - SORUN GİDERME - Çalışmıyorsa, uygulamayı sıfırlayın. Yeniden çalışabilmesi için yeniden yapılandırmayı deneyeceğiz. - Sıfırla - Kapat - - - İndirmek için bekleniyor... - İndir - - - ABD\'yi Değerlendir - Başkalarına bu uygulama hakkında ne düşündüğünüzü söyleyin - Puan - - - Bitti - Bridge dize (obfs4 212.21.66.66:20621 ...) - Bridge tipi (obfs4, meek, ...) - - - Yer İşareti Web Sitesi - Bu sayfayı yer imlerinize ekleyin - yer imi adı... - Bitti - - - URL Bildirimi - Yeni Sekmede Aç - Geçerli Sekmede Aç - Panoya Kopyala - Dosyayı İndir - - - URL\'yi yeni sekmede aç - URL\'yi geçerli sekmede aç - URL\'yi panoya kopyala - Resmi yeni sekmede aç - Görüntü geçerli sekmesini aç - Resmi panoya kopyala - Resim dosyasını indirin - - - Yeni Bridge Talebi - REQUEST Bridge - Bridge adresi istemek için aşağıdaki E-posta\'yı seçin. Bir adresiniz olduğunda, kopyalayıp yukarıdaki kutuya yapıştırın ve uygulamayı başlatın. - Posta - - - - - - - - - - - - - - - - - - - - - ru - Sistem ayarı - Genesis\'i varsayılan tarayıcınız yapın - Sistem ayarı - arama motoru - javascript - taranan web bağlantılarını kaldır - yazı tipi özelleştirmek - Sistem Yazı Tipi Konstomizasyonu - yazı tipini otomatik olarak değiştir - Çerez Ayarı - kurabiye - Sistem ayarı . Bildirim - bildirimler - bildirim tercihlerini değiştir - ağ durumu ve bildirim - yerel bildirimler - Yazılım bildirimini özelleştirin - sistem bildirimleri - arama motorunu yönet - ekle, varsayılan ayarla. Önerileri göster - bildirimleri yönet - yeni özellikler, ağ durumu - Yazılımı Özelleştirin. Arama motoru - desteklenen arama motorları - Varsayılan arama motorunu seçin - Yazılımı Özelleştirin. Arama motoru - Web Aramalarının nasıl göründüğünü değiştirin - default - Genesis - DuckDuckGo - Google - Bing - Wikipedia - taranan web bağlantılarını göster - arama sırasında önerileri göster - arama çubuğuna yazdığınızda göz atılan web bağlantılarından öneriler görüntülenir - arama çubuğuna yazdığınızda odaklanmış öneriler görünür - ulaşılabilirlik - metin boyutu, yakınlaştırma, ses kullanarak giriş - özelleştir | ulaşılabilirlik - özel verileri temizle - sekmeler, göz atılan web bağlantıları, yer imi, tanımlama bilgileri, önbellek - Sistem Ayarını Değiştirin. Sistem Verilerini Temizle - net veriler - tüm sekmeleri sil - taranan web bağlantılarını sil - yer imlerini sil - önbelleği sil - önerileri sil - verileri sil - oturumu sil - çerezleri sil - sil özelleştir - yazı tipi ölçekleme - web içeriğini sistem yazı tipi boyutuna göre ölçeklendirin - yakınlaştırmayı aç - tüm web sayfaları için aç ve yakınlaştırmaya zorla - ses kullanarak giriş - url çubuğunda ses dikte etmeye izin ver - özel yazı tipi ölçeklemeyi seçin - bunu rahatça okuyana kadar kaydırıcıyı sürükleyin. metin bir paragrafa iki kez dokunduktan sonra en az bu kadar büyük görünmelidir - 200% - etkileşimler - web sitesi içeriğiyle etkileşim şeklini değiştirmek - Kullanıcı Açık - kullanıcı gözetimi, girişler, veri seçenekleri - Kullanıcı Gözetim Koruması - adblock, izleyiciler, parmak izi - Sistem ayarı . gizlilik - Sistem ayarı . kullanıcı sürekliliği koruması - çevrimiçi kimliğinizi koruyun - kimliğinizi gizli tutun. Sizi çevrimiçi olarak takip eden birkaç izleyiciden koruyabiliriz. bu Sistem Ayarı, reklamı engellemek için de kullanılabilir - kendinizi kullanıcı Survelance Protection\'dan kurtarın - Genesis sitelere beni izlememelerini söyleyecek - web sitesine beni takip etmemesini söyle - Kullanıcı Gözetim Koruması - Genesis tarafından sağlanan kullanıcı Survelance Protection\'ı etkinleştirin - web sitesi çerezleri - güvenlik ihtiyaçlarınıza göre web sitesi çerez tercihlerini seçin - çıkışta özel verileri temizle - yazılım kapatıldığında verileri otomatik olarak temizleyin - özel Tarama - kimliğinizi güvende tutun ve aşağıdaki seçenekleri kullanın - etkinleştirildi - etkinleştirildi, web sitesi izleme çerezleri hariç - etkinleştirildi, 3. taraf hariç - engelli - - korumayı devre dışı bırak - kimlik Gözetleme Korumasına izin verin. bu çevrimiçi kimliğinizin çalınmasına neden olabilir - varsayılan (önerilir) - çevrimiçi reklamı ve sosyal web kullanıcısı Survelance\'ı engelleyin. sayfalar varsayılan olarak yüklenecek - sıkı politika - bilinen tüm izleyicileri durdurun, sayfalar daha hızlı yüklenecek ancak bazı işlevler çalışmayabilir - - javascript - çeşitli komut dosyası saldırıları için java komut dosyasını devre dışı bırakın - Sistem ayarı . karmaşık Sistem Ayarı - sekmeleri geri yükle - tarayıcıdan çıktıktan sonra geri yükleme - araç çubuğu teması - web sitesinde tanımlandığı gibi araç çubuğu temasını ayarla - Resimleri göster - her zaman web sitesi resimlerini yükle - web yazı tiplerini göster - bir sayfayı yüklerken uzak yazı tiplerini indirin - otomatik oynatmaya izin ver - medyanın otomatik olarak başlamasına izin ver - veri koruyucu - sekme - yazılımı yeniden başlattıktan sonra sekmenin nasıl davranacağını değiştirin - medya - varsayılan veri koruyucuyu değiştir özelleştir - varsayılan medyayı değiştir özelleştir - her zaman resimleri göster - resimleri yalnızca kablosuz bağlantı kullanırken göster - tüm resimleri engelle - Gelişmiş Sistem Ayarı - sekmeleri geri yükle, veri tasarrufu, geliştirici araçları - onion vekalet koşulu - onion ağ durumunu kontrol et - web sitesini bildir - kötüye kullanılan web sitesini bildir - bu uygulamayı oyla - Play Store\'da oy verin ve yorum yapın - bu uygulamayı paylaş - bu yazılımı arkadaşlarınızla paylaşın - Sistem ayarı . genel özelleştirme - Varsayılan Sistem Ayarı - ana sayfa, dil - tam ekran tarama - bir sayfayı aşağı kaydırırken tarayıcı araç çubuğunu gizle - dil - tarayıcınızın dilini değiştirin - yazılım teması - parlak ve koyu tema seçin - tema parlak - tema Koyu - tam ekran taramayı ve dili değiştir - sistem varsayılanı - anasayfa - about:blank - yeni sekme - ana sayfayı yeni sekmede aç - tüm sekmeleri kaldır - taranan web bağlantılarını kaldır - yer imlerini kaldır - göz atma önbelleğini kaldır - önerileri kaldır - site verilerini kaldır - oturum verilerini kaldır - web tarama çerezlerini kaldır - tarayıcı özelleştirmesini kaldır - - - - yer imi web sitesi - taranan web bağlantılarını ve Verileri sil - yer imini ve Verileri temizle - verileri temizlemek, göz atılan web bağlantılarını, çerezleri ve diğer tarama verilerini kaldırır - verilerin silinmesi, yer imi eklenmiş web sitelerinin silinmesine neden olur - iptal etmek - https:// - bildiri - web sitesini bildir - Bu URL\'nin yasa dışı veya rahatsız edici olduğunu düşünüyorsanız, bize bildirin, böylece yasal işlem yapabiliriz - başarıyla rapor edildi - url başarıyla rapor edildi. bir şey bulunursa yasal işlem yapılacaktır - dil desteklenmiyor - sistem dili bu yazılım tarafından desteklenmemektedir. yakında dahil etmek için çalışıyoruz - Orbot başlatılıyor - eylem desteklenmiyor - aşağıdaki komutu işleyecek herhangi bir yazılım bulunamadı - hoşgeldiniz | gizli web Gateway - bu yazılım size gizli web adreslerini aramak ve açmak için bir platform sağlar. işte birkaç öneri \n - gizli web çevrimiçi pazarı - sızdırılmış belgeler ve kitaplar - karanlık web haberleri ve makaleler - gizli yazılımlar ve bilgisayar korsanlığı araçları - bir daha gösterme - finans ve para - sosyal toplumlar - Manuel - oyun mağazası - dosya bildirimi - indirme bildirimi - indirme bildirimi - web bağlantısı bildirimi - - e-postayı işleyecek yazılım bulunamadı - dosya indirme | - veriler temizlendi | yeniden başlatma gerekiyor - - - - - - - Orbot günlükler - yeni sekmeler - sekmeyi kapat - son sekmeleri aç - dil - İndirilenler - taranan web bağlantıları - Sistem ayarı - masaüstü sitesi - bu sayfayı kaydet - yer imleri - web sitesini bildir - bu uygulamayı oyla - sayfada bul - çıkış - Paylaş - - - yeni sekmeler - tüm sekmeleri kapat - Sistem ayarı - sekmeleri seç - - - açık sekmeler - kopya - Paylaş - seçimi temizle - mevcut sekmede aç - yeni sekmede aç - sil - - - taranan web bağlantıları - Bunu kaldır - arama ... - - - yer imi - Bunu kaldır - arama ... - - - yeniden dene - opps! ağ bağlantısı hatası. ağ bağlı değil - yardım ve Destek - - - dil - Dili değiştir - sadece aşağıdaki dillerde çalışıyoruz. yakında daha fazlasını ekleyeceğiz - ingilizce (amerika birleşik devletleri) - alman (almanya) - italyanca (italya) - Portekiz Brezilyası) - rusça (rusya) - ukraynaca (ukrayna) - basitleştirilmiş çince (anakara çin) - - - ⚠️ uyarı - Bridges\'ü özelleştir - Bridges\'ü etkinleştir - VPN serisini etkinleştir - Bridge Gateway\'ü etkinleştir - Gateway\'ü etkinleştir - - - vekaletname durumu - orbot vekilinin mevcut durumu - Orbot vekalet koşulu - onion - VPN bağlantı durumu - Bridge vekalet koşulu - bilgi | Sistem Ayarını değiştir - yazılımı yeniden başlatıp proxy yöneticisine giderek proxy\'yi değiştirebilirsiniz. alttaki dişli çark simgesine tıklayarak açılabilir - - - - - default.jpg - bunu aç - - - 1 - connect - Genesis is paused at the moment - açık sekmeler burada gösterilecek - - - bu siteye ulaşılamıyor - web sitesine bağlanırken bir hata oluştu - görüntülemeye çalıştığınız sayfa, alınan verilerin gerçekliği doğrulanamadığı için gösterilemiyor - sayfa şu anda bir nedenden dolayı çalışmıyor - Bu sorunu bildirmek için lütfen web sitesi sahipleriyle iletişime geçin. - Tekrar yükle - - pref_language - Geçersiz paket imzası - oturum açmak için tıklayın. - verileri manuel olarak seçmek için tıklayın. - Web alanı güvenlik istisnası. - DAL doğrulama hatası. - - Son sekmeler - Yeni kimlik - Gizlilik Politikası - Genesis Browser gizlilik ilkesi - Web sitesini bildir - Yasadışı web sitesini bildirin - web sitenizi yayınlayın - Web sitenizi arama motorumuza ekleyin - - - - - - Yüzde 55 - Yüzde 70 - Yüzde 85 - Yüzde 100 - Yüzde 115 - Yüzde 130 - Yüzde 145 - - - - Etkin - Devre dışı - - - - Hepsini etkinleştir - Hepsini etkisiz hale getir - Bant Genişliği Yok - - - - Hepsine izin ver - Güvenilir\'e İzin Ver - Hiçbirine İzin Verme - Ziyaret Edilmesine İzin Ver - İzleyici Olmayanlara İzin Ver - - - - + + + + Genesis + bir şey arayın veya bir web bağlantısı yazın + sayfada bul + arama motoru + https://genesis.onion + opps! bir şeyler ters gitti + herşey + Genesis search engine + dijital özgürlük + Tekrar yükle + aşağıdaki problemlerden biriyle karşı karşıyasınız. web sayfası veya web sitesi çalışmıyor olabilir. İnternet bağlantınız zayıf olabilir. bir proxy kullanıyor olabilirsiniz. web sitesi güvenlik duvarı tarafından engelleniyor olabilir + com.hiddenservices.genesissearchengine.production.provider + BBC | İsrail Yeniden Grevde + + + Tarayıcı önbelleğini sil + Taranan web sitesini sil + Verilerinizi silin ve tarayıcıyı açın + Tarayıcı önbelleğini sil + Genesis tarayıcısını yeniden başlatın + Tarayıcınızı Yeniden Başlatın + + + Yer İşaretini Düzenle + Yer İşareti Adı + İşaretli URL\'nin adı burada gösterilecek + Yer imi adını girin… + + + Reddet + + + "Bazen Tor ağına ulaşmak için bir Köprü gerekir" + "BANA DAHA FAZLA ANLAT" + "Merhaba" + "Mobilde Genesis\'e hoş geldiniz." + "İnternette güvenli ve güvenli bir şekilde gezinin." + "İzleme yok. Sansür yok." + + + Bağlantı güvenli + Bilgileriniz (örneğin, şifre veya kredi kartı numaraları) bu siteye gönderildiğinde güvendedir + Güvenlik Ayarı + Javascript + Kimliğinizi güvende tutun ve aşağıdaki seçenekleri kullanın + Takip Etme + Sitelere sizi izlememelerini söyleyeceğiz + İzleme Koruması + Tarafımızdan sağlanan izleme korumasını etkinleştirin + Sertifika + + + Sertifika Bilgisi + + + proxy günlükleri + Sistem Günlüğü bilgisi + Genesis\'e başlarken bağlantı sorunu yaşıyorsanız, lütfen aşağıdaki kodu kopyalayın ve çevrimiçi sorunu bulun veya bize gönderin, böylece size yardımcı olmaya çalışabiliriz + ~ Genesis on standby at the moment + + + proxy özelleştirmek + Sizi dünya çapında binlerce gönüllünün yönettiği Tor ağına bağlıyoruz! Bu seçenekler size yardımcı olabilir mi + İnternet burada sansürlenir (güvenlik duvarını atlayın) + güvenlik duvarını atla + Bridges internetin çok yavaş çalışmasına neden olur. bunları yalnızca ülkenizde internet sansürlenmişse veya Tor ağı engellenmişse kullanın + güvenlik özelleştir + + + Güvenlik Ayarları + "BRIDGE" Ayarlarını Değiştir + Otomatik Olarak Oluştur + "KÖPRÜ" ayarlarını otomatik olarak yapılandır + Bildiğim bir "BRIDGE" sağlayın + Özel "BRIDGE" yapıştır + Proxy Settings | Bridge + "BRIDGE", Tor ağına yapılan bağlantıları engellemeyi zorlaştıran, listelenmemiş Tor röleleridir. Bazı ülkelerin Tor\'u engellemeye çalışması nedeniyle, bazı "BRIDGE" bazı ülkelerde çalışır, ancak bazılarında çalışmaz + Varsayılan "BRIDGE"yü Seç + Talep + obfs4 (Önerilen) + Meek-masmavi (Çin) + + + bildiğiniz bir Bridge sağlayın + güvenilir bir kaynaktan bridge bilgi girin + istek + + + Sistem Günlüğünün görünme şeklini değiştirin + modern liste görünümünü kullanarak Günlüğü göster + klasik ve modern liste görünümü arasında geçiş yap + + + Yer işareti kaldırıldı + Yer imi güncellendi + Veriler başarıyla temizlendi + URL Panoya kopyalandı + Uygulama bulunamadı + Değişikliklerden sonra yeniden başlatma gerekli + Yeniden Başlat + Sekme Kapalı + Yeni sekme açıldı + Genesis proxy bağlanıyor... + Bellek dolu ➔ Sekme temizleniyor + Pop-up engellendi + Hata Günlüklerini Aç + Anahtar + Geri al + Yeni kimlik oluşturuldu + ayarları aç + + + BUNU DUYDUĞUM İÇİN ÜZGÜNÜM + Bu uygulamayı kullanırken zorluk yaşıyorsanız, lütfen bize e-posta yoluyla ulaşın. Sorununuzu en kısa sürede çözmeye çalışacağız + + + SORUN GİDERME + Çalışmıyorsa, uygulamayı sıfırlayın. Yeniden çalışabilmesi için yeniden yapılandırmayı deneyeceğiz. + Sıfırla + Kapat + + + İndirmek için bekleniyor... + İndir + + + ABD\'yi Değerlendir + Başkalarına bu uygulama hakkında ne düşündüğünüzü söyleyin + Puan + + + Bitti + Bridge dize (obfs4 212.21.66.66:20621 ...) + Bridge tipi (obfs4, meek, ...) + + + Yer İşareti Web Sitesi + Bu sayfayı yer imlerinize ekleyin + yer imi adı... + Bitti + + + URL Bildirimi + Yeni Sekmede Aç + Geçerli Sekmede Aç + Panoya Kopyala + Dosyayı İndir + + + URL\'yi yeni sekmede aç + URL\'yi geçerli sekmede aç + URL\'yi panoya kopyala + Resmi yeni sekmede aç + Görüntü geçerli sekmesini aç + Resmi panoya kopyala + Resim dosyasını indirin + + + Yeni Bridge Talebi + REQUEST Bridge + Bridge adresi istemek için aşağıdaki E-posta\'yı seçin. Bir adresiniz olduğunda, kopyalayıp yukarıdaki kutuya yapıştırın ve uygulamayı başlatın. + Posta + + + + + + + + + + + + + + + + + + + + + ru + Sistem ayarı + Genesis\'i varsayılan tarayıcınız yapın + Sistem ayarı + arama motoru + javascript + taranan web bağlantılarını kaldır + yazı tipi özelleştirmek + Sistem Yazı Tipi Konstomizasyonu + yazı tipini otomatik olarak değiştir + Çerez Ayarı + kurabiye + Sistem ayarı . Bildirim + bildirimler + bildirim tercihlerini değiştir + ağ durumu ve bildirim + yerel bildirimler + Yazılım bildirimini özelleştirin + sistem bildirimleri + arama motorunu yönet + ekle, varsayılan ayarla. Önerileri göster + bildirimleri yönet + yeni özellikler, ağ durumu + Yazılımı Özelleştirin. Arama motoru + desteklenen arama motorları + Varsayılan arama motorunu seçin + Yazılımı Özelleştirin. Arama motoru + Web Aramalarının nasıl göründüğünü değiştirin + default + Genesis + DuckDuckGo + Google + Bing + Wikipedia + taranan web bağlantılarını göster + arama sırasında önerileri göster + arama çubuğuna yazdığınızda göz atılan web bağlantılarından öneriler görüntülenir + arama çubuğuna yazdığınızda odaklanmış öneriler görünür + ulaşılabilirlik + metin boyutu, yakınlaştırma, ses kullanarak giriş + özelleştir | ulaşılabilirlik + özel verileri temizle + sekmeler, göz atılan web bağlantıları, yer imi, tanımlama bilgileri, önbellek + Sistem Ayarını Değiştirin. Sistem Verilerini Temizle + net veriler + tüm sekmeleri sil + taranan web bağlantılarını sil + yer imlerini sil + önbelleği sil + önerileri sil + verileri sil + oturumu sil + çerezleri sil + sil özelleştir + yazı tipi ölçekleme + web içeriğini sistem yazı tipi boyutuna göre ölçeklendirin + yakınlaştırmayı aç + tüm web sayfaları için aç ve yakınlaştırmaya zorla + ses kullanarak giriş + url çubuğunda ses dikte etmeye izin ver + özel yazı tipi ölçeklemeyi seçin + bunu rahatça okuyana kadar kaydırıcıyı sürükleyin. metin bir paragrafa iki kez dokunduktan sonra en az bu kadar büyük görünmelidir + 200% + etkileşimler + web sitesi içeriğiyle etkileşim şeklini değiştirmek + Kullanıcı Açık + kullanıcı gözetimi, girişler, veri seçenekleri + Kullanıcı Gözetim Koruması + adblock, izleyiciler, parmak izi + Sistem ayarı . gizlilik + Sistem ayarı . kullanıcı sürekliliği koruması + çevrimiçi kimliğinizi koruyun + kimliğinizi gizli tutun. Sizi çevrimiçi olarak takip eden birkaç izleyiciden koruyabiliriz. bu Sistem Ayarı, reklamı engellemek için de kullanılabilir + kendinizi kullanıcı Survelance Protection\'dan kurtarın + Genesis sitelere beni izlememelerini söyleyecek + web sitesine beni takip etmemesini söyle + Kullanıcı Gözetim Koruması + Genesis tarafından sağlanan kullanıcı Survelance Protection\'ı etkinleştirin + web sitesi çerezleri + güvenlik ihtiyaçlarınıza göre web sitesi çerez tercihlerini seçin + çıkışta özel verileri temizle + yazılım kapatıldığında verileri otomatik olarak temizleyin + özel Tarama + kimliğinizi güvende tutun ve aşağıdaki seçenekleri kullanın + etkinleştirildi + etkinleştirildi, web sitesi izleme çerezleri hariç + etkinleştirildi, 3. taraf hariç + engelli + + korumayı devre dışı bırak + kimlik Gözetleme Korumasına izin verin. bu çevrimiçi kimliğinizin çalınmasına neden olabilir + varsayılan (önerilir) + çevrimiçi reklamı ve sosyal web kullanıcısı Survelance\'ı engelleyin. sayfalar varsayılan olarak yüklenecek + sıkı politika + bilinen tüm izleyicileri durdurun, sayfalar daha hızlı yüklenecek ancak bazı işlevler çalışmayabilir + + javascript + çeşitli komut dosyası saldırıları için java komut dosyasını devre dışı bırakın + Sistem ayarı . karmaşık Sistem Ayarı + sekmeleri geri yükle + tarayıcıdan çıktıktan sonra geri yükleme + araç çubuğu teması + web sitesinde tanımlandığı gibi araç çubuğu temasını ayarla + Resimleri göster + her zaman web sitesi resimlerini yükle + web yazı tiplerini göster + bir sayfayı yüklerken uzak yazı tiplerini indirin + otomatik oynatmaya izin ver + medyanın otomatik olarak başlamasına izin ver + veri koruyucu + sekme + yazılımı yeniden başlattıktan sonra sekmenin nasıl davranacağını değiştirin + medya + varsayılan veri koruyucuyu değiştir özelleştir + varsayılan medyayı değiştir özelleştir + her zaman resimleri göster + resimleri yalnızca kablosuz bağlantı kullanırken göster + tüm resimleri engelle + Gelişmiş Sistem Ayarı + sekmeleri geri yükle, veri tasarrufu, geliştirici araçları + onion vekalet koşulu + onion ağ durumunu kontrol et + web sitesini bildir + kötüye kullanılan web sitesini bildir + bu uygulamayı oyla + Play Store\'da oy verin ve yorum yapın + bu uygulamayı paylaş + bu yazılımı arkadaşlarınızla paylaşın + Sistem ayarı . genel özelleştirme + Varsayılan Sistem Ayarı + ana sayfa, dil + tam ekran tarama + bir sayfayı aşağı kaydırırken tarayıcı araç çubuğunu gizle + dil + tarayıcınızın dilini değiştirin + yazılım teması + parlak ve koyu tema seçin + tema parlak + tema Koyu + tam ekran taramayı ve dili değiştir + sistem varsayılanı + anasayfa + about:blank + yeni sekme + ana sayfayı yeni sekmede aç + tüm sekmeleri kaldır + taranan web bağlantılarını kaldır + yer imlerini kaldır + göz atma önbelleğini kaldır + önerileri kaldır + site verilerini kaldır + oturum verilerini kaldır + web tarama çerezlerini kaldır + tarayıcı özelleştirmesini kaldır + + + + yer imi web sitesi + taranan web bağlantılarını ve Verileri sil + yer imini ve Verileri temizle + verileri temizlemek, göz atılan web bağlantılarını, çerezleri ve diğer tarama verilerini kaldırır + verilerin silinmesi, yer imi eklenmiş web sitelerinin silinmesine neden olur + iptal etmek + https:// + bildiri + web sitesini bildir + Bu URL\'nin yasa dışı veya rahatsız edici olduğunu düşünüyorsanız, bize bildirin, böylece yasal işlem yapabiliriz + başarıyla rapor edildi + url başarıyla rapor edildi. bir şey bulunursa yasal işlem yapılacaktır + dil desteklenmiyor + sistem dili bu yazılım tarafından desteklenmemektedir. yakında dahil etmek için çalışıyoruz + Orbot başlatılıyor + eylem desteklenmiyor + aşağıdaki komutu işleyecek herhangi bir yazılım bulunamadı + hoşgeldiniz | gizli web Gateway + bu yazılım size gizli web adreslerini aramak ve açmak için bir platform sağlar. işte birkaç öneri \n + gizli web çevrimiçi pazarı + sızdırılmış belgeler ve kitaplar + karanlık web haberleri ve makaleler + gizli yazılımlar ve bilgisayar korsanlığı araçları + bir daha gösterme + finans ve para + sosyal toplumlar + Manuel + oyun mağazası + dosya bildirimi + indirme bildirimi + indirme bildirimi + web bağlantısı bildirimi + + e-postayı işleyecek yazılım bulunamadı + dosya indirme | + veriler temizlendi | yeniden başlatma gerekiyor + + + + + + + Orbot günlükler + yeni sekmeler + sekmeyi kapat + son sekmeleri aç + dil + İndirilenler + taranan web bağlantıları + Sistem ayarı + masaüstü sitesi + bu sayfayı kaydet + yer imleri + web sitesini bildir + bu uygulamayı oyla + sayfada bul + çıkış + Paylaş + + + yeni sekmeler + tüm sekmeleri kapat + Sistem ayarı + sekmeleri seç + + + açık sekmeler + kopya + Paylaş + seçimi temizle + mevcut sekmede aç + yeni sekmede aç + sil + + + taranan web bağlantıları + Bunu kaldır + arama ... + + + yer imi + Bunu kaldır + arama ... + + + yeniden dene + opps! ağ bağlantısı hatası. ağ bağlı değil + yardım ve Destek + + + dil + Dili değiştir + sadece aşağıdaki dillerde çalışıyoruz. yakında daha fazlasını ekleyeceğiz + ingilizce (amerika birleşik devletleri) + alman (almanya) + italyanca (italya) + Portekiz Brezilyası) + rusça (rusya) + ukraynaca (ukrayna) + basitleştirilmiş çince (anakara çin) + + + ⚠️ uyarı + Bridges\'ü özelleştir + Bridges\'ü etkinleştir + VPN serisini etkinleştir + Bridge Gateway\'ü etkinleştir + Gateway\'ü etkinleştir + + + vekaletname durumu + orbot vekilinin mevcut durumu + Orbot vekalet koşulu + onion + VPN bağlantı durumu + Bridge vekalet koşulu + bilgi | Sistem Ayarını değiştir + yazılımı yeniden başlatıp proxy yöneticisine giderek proxy\'yi değiştirebilirsiniz. alttaki dişli çark simgesine tıklayarak açılabilir + + + + + default.jpg + bunu aç + + + 1 + connect + Genesis is paused at the moment + açık sekmeler burada gösterilecek + + + bu siteye ulaşılamıyor + web sitesine bağlanırken bir hata oluştu + görüntülemeye çalıştığınız sayfa, alınan verilerin gerçekliği doğrulanamadığı için gösterilemiyor + sayfa şu anda bir nedenden dolayı çalışmıyor + Bu sorunu bildirmek için lütfen web sitesi sahipleriyle iletişime geçin. + Tekrar yükle + + pref_language + Geçersiz paket imzası + oturum açmak için tıklayın. + verileri manuel olarak seçmek için tıklayın. + Web alanı güvenlik istisnası. + DAL doğrulama hatası. + + Son sekmeler + Yeni kimlik + Gizlilik Politikası + Genesis Browser gizlilik ilkesi + Web sitesini bildir + Yasadışı web sitesini bildirin + web sitenizi yayınlayın + Web sitenizi arama motorumuza ekleyin + + + + + + Yüzde 55 + Yüzde 70 + Yüzde 85 + Yüzde 100 + Yüzde 115 + Yüzde 130 + Yüzde 145 + + + + Etkin + Devre dışı + + + + Hepsini etkinleştir + Hepsini etkisiz hale getir + Bant Genişliği Yok + + + + Hepsine izin ver + Güvenilir\'e İzin Ver + Hiçbirine İzin Verme + Ziyaret Edilmesine İzin Ver + İzleyici Olmayanlara İzin Ver + + + + \ No newline at end of file diff --git a/app/src/main/res/values-ur/strings.xml b/app/src/main/res/values-ur/strings.xml index 14ec5543..e9e0a145 100644 --- a/app/src/main/res/values-ur/strings.xml +++ b/app/src/main/res/values-ur/strings.xml @@ -12,7 +12,7 @@ ڈیجیٹل آزادی دوبارہ لوڈ کریں آپ کو مندرجہ ذیل میں سے ایک مسئلہ درپیش ہے۔ ہوسکتا ہے کہ ویب صفحہ یا ویب سائٹ کام نہیں کررہی ہے۔ ہوسکتا ہے کہ آپ کا انٹرنیٹ کنیکشن خراب ہو۔ آپ شاید ایک پراکسی استعمال کر رہے ہوں گے۔ ہوسکتا ہے کہ ویب سائٹ فائر وال کے ذریعے مسدود کردی جائے - com.darkweb.genesissearchengine.production.provider + com.hiddenservices.genesissearchengine.production.provider بی بی سی | اسرائیل نے ایک بار پھر حملہ کیا diff --git a/app/src/main/res/values-vi/strings.xml b/app/src/main/res/values-vi/strings.xml index 43fee984..c5eedcad 100644 --- a/app/src/main/res/values-vi/strings.xml +++ b/app/src/main/res/values-vi/strings.xml @@ -1,532 +1,532 @@ - - - - Genesis - tìm kiếm thứ gì đó hoặc nhập một liên kết web - Tìm ở trang - máy tìm kiếm - https://genesis.onion - opps! có gì đó không ổn - mọi điều - Genesis search engine - tự do kỹ thuật số - tải lại - bạn đang phải đối mặt với một trong những vấn đề sau. trang web hoặc trang web có thể không hoạt động. kết nối internet của bạn có thể kém. bạn có thể đang sử dụng proxy. trang web có thể bị tường lửa chặn - com.darkweb.genesissearchengine.production.provider - BBC | Israel lại tấn công - - - Xóa bộ nhớ cache của trình duyệt - Xóa trang web đã duyệt - Xóa dữ liệu của bạn và mở trình duyệt - Xóa bộ nhớ cache của trình duyệt - Khởi động lại trình duyệt genesis - Khởi động Lại Trình Duyệt Của Bạn - - - Chỉnh Sửa Dấu Trang - Tên Dấu Trang - Tên của url được đánh dấu sẽ được hiển thị ở đây - Nhập tên dấu trang… - - - bỏ qua - - - "Đôi khi bạn cần một Cầu nối để truy cập Mạng Tor" - "NÓI CHO TÔI THÊM" - "Xin chào" - "Chào mừng bạn đến với Genesis trên điện thoại di động." - "Duyệt Internet một cách an toàn và bảo mật." - "Không theo dõi. Không kiểm duyệt." - - - Kết nối an toàn - Thông tin của bạn (ví dụ: mật khẩu hoặc số thẻ tín dụng) được bảo mật khi nó được gửi đến trang web này - Cài đặt Bảo Mật - Javascript - Giữ an toàn cho danh tính của bạn và sử dụng các tùy chọn bên dưới - Không Theo Dõi - Chúng tôi sẽ thông báo cho các trang web không theo dõi bạn - Bảo Vệ Theo Dõi - Bật tính năng bảo vệ theo dõi do chúng tôi cung cấp - Giấy chứng nhận - - - Thông Tin Chứng Chỉ - - - nhật ký proxy - Thông tin nhật ký hệ thống - nếu bạn gặp sự cố kết nối khi khởi động Genesis, vui lòng sao chép mã sau và tìm sự cố trực tuyến hoặc gửi cho chúng tôi, để chúng tôi có thể cố gắng giúp bạn - ~ Genesis on standby at the moment - - - tùy chỉnh proxy - chúng tôi kết nối bạn với mạng Tor do hàng nghìn tình nguyện viên trên khắp thế giới điều hành! Những tùy chọn này có thể giúp bạn không - Internet được kiểm duyệt ở đây (vượt tường lửa) - vượt tường lửa - Bridges khiến Internet chạy rất chậm. chỉ sử dụng chúng nếu internet bị kiểm duyệt ở quốc gia của bạn hoặc mạng Tor bị chặn - tùy chỉnh bảo mật - - - Cài đặt Bảo Mật - Thay đổi Cài đặt "BRIDGE" - Tạo Tự động - Tự động định cấu hình cài đặt "BRIDGE" - Cung cấp một "BRIDGE" mà tôi biết - Dán tùy chỉnh "BRIDGE" - Proxy Settings | Bridge - "BRIDGE" là các rơ le Tor không được liệt kê khiến việc chặn các kết nối vào mạng Tor trở nên khó khăn hơn. Vì cách một số quốc gia cố gắng chặn Tor, "BRIDGE" nhất định hoạt động ở một số quốc gia nhưng không hoạt động ở một số quốc gia khác - Chọn Mặc định "BRIDGE" - Yêu cầu - obfs4 (Khuyến nghị) - Meek-azure (Trung Quốc) - - - thay đổi cách hiển thị Nhật ký hệ thống - hiển thị Nhật ký bằng chế độ xem danh sách hiện đại - toogle giữa chế độ xem danh sách cổ điển và hiện đại - - - Đã xóa dấu trang - Đã cập nhật dấu trang - Đã xóa dữ liệu thành công - URL được sao chép vào khay nhớ tạm - Không tìm thấy ứng dụng nào - Yêu cầu khởi động lại sau khi thay đổi - Khởi động lại - Tab Bị đóng - Tab mới đã mở - Genesis proxy kết nối ... - Bộ nhớ đầy ➔ Xóa tab - Cửa sổ bật lên bị chặn - Mở Nhật Ký Lỗi - Chuyển đổi - Hoàn tác - Danh tính mới được tạo - mở cài đặt - - - Yêu Cầu Mới Bridge - REQUEST Bridge - Chọn E-mail bên dưới để yêu cầu địa chỉ Bridge. Sau khi bạn có địa chỉ, hãy sao chép và dán nó vào ô trên và khởi động ứng dụng. - Thư tín - - - XIN LỖI KHI NGHE RỒI - Nếu bạn gặp khó khăn khi sử dụng ứng dụng này, vui lòng liên hệ với chúng tôi qua email. Chúng tôi sẽ cố gắng giải quyết vấn đề của bạn càng sớm càng tốt - - - KHẮC PHỤC SỰ CỐ - Đặt lại ứng dụng trong trường hợp nó không hoạt động. Chúng tôi sẽ cố gắng cấu hình lại nó để nó có thể hoạt động trở lại. - Đặt lại - Loại bỏ - - - Đang chờ tải xuống ... - Tải xuống - - - Đánh Giá US - Cho người khác biết suy nghĩ của bạn về ứng dụng này - Đánh giá - - - Đã xong - Bridge string (obfs4 212.21.66.66:20621 ...) - Bridge kiểu (obfs4, meek, ...) - - - Đánh Dấu Trang Web - Thêm trang này vào dấu trang của bạn - bookmark tên ... - Đã xong - - - Thông Báo URL - Mở Trong Tab Mới - Mở Trong Tab Hiện Tại - Sao chép vào Clipboard - Tải Xuống Tệp - - - Mở url trong tab mới - Mở url trong tab hiện tại - Sao chép url vào khay nhớ tạm - Mở hình ảnh trong tab mới - Mở tab hình ảnh hiện tại - Sao chép hình ảnh vào khay nhớ tạm - Tải xuống tệp hình ảnh - - - cung cấp một Bridge bạn biết - nhập thông tin bridge từ một nguồn đáng tin cậy - yêu cầu - - - - - - - - - - - - - - - - - - - - - ru - Thiết lập hệ thống - đặt Genesis làm trình duyệt mặc định của bạn - Thiết lập hệ thống - máy tìm kiếm - javascript - xóa các liên kết web đã duyệt - tùy chỉnh phông chữ - Chòm sao Phông chữ Hệ thống - thay đổi phông chữ tự động - Cài đặt cookie - bánh quy - Thiết lập hệ thống . Thông báo - thông báo - thay đổi tùy chọn thông báo - tình trạng của mạng và thông báo - thông báo địa phương - tùy chỉnh thông báo phần mềm - thông báo hệ thống - Quản lý công cụ tìm kiếm - thêm, đặt mặc định. hiển thị đề xuất - quản lý thông báo - các tính năng mới, tình trạng của mạng - Tùy chỉnh phần mềm. Máy tìm kiếm - công cụ tìm kiếm được hỗ trợ - chọn Công cụ tìm kiếm mặc định - Tùy chỉnh phần mềm. Máy tìm kiếm - thay đổi cách các Tìm kiếm trên Web xuất hiện - default - Genesis - DuckDuckGo - Google - Bing - Wikipedia - hiển thị các liên kết web đã duyệt - hiển thị các đề xuất trong quá trình tìm kiếm - đề xuất từ ​​các liên kết web đã duyệt xuất hiện khi bạn nhập vào thanh tìm kiếm - đề xuất tập trung xuất hiện khi bạn nhập vào thanh tìm kiếm - khả năng tiếp cận - kích thước văn bản, thu phóng, nhập liệu bằng giọng nói - tùy chỉnh | khả năng tiếp cận - xóa dữ liệu cá nhân - tab, liên kết web đã duyệt, dấu trang, cookie, bộ nhớ cache - Thay đổi cài đặt hệ thống. Xóa dữ liệu hệ thống - xóa dữ liệu - xóa tất cả các tab - xóa các liên kết web đã duyệt - xóa dấu trang - xóa bộ nhớ cache - xóa đề xuất - xóa dữ liệu - xóa phiên - xóa cookie - xóa tùy chỉnh - chia tỷ lệ phông chữ - chia tỷ lệ nội dung web theo kích thước phông chữ hệ thống - bật thu phóng - bật và buộc thu phóng cho tất cả các trang web - đầu vào bằng giọng nói - cho phép đọc chính tả bằng giọng nói trong thanh url - chọn tỷ lệ phông chữ tùy chỉnh - kéo thanh trượt cho đến khi bạn có thể đọc thoải mái. văn bản ít nhất phải lớn như thế này sau khi nhấn đúp vào một đoạn văn - 200% - tương tác - thay đổi cách tương tác với nội dung trang web - Người dùng đang bật - mức độ người dùng, thông tin đăng nhập, lựa chọn dữ liệu - Bảo vệ giám sát người dùng - adblock, trình theo dõi, lấy dấu vân tay - Thiết lập hệ thống . riêng tư - Thiết lập hệ thống . bảo vệ người dùng tuyệt vời - bảo vệ danh tính trực tuyến của bạn - giữ bí mật danh tính của bạn. chúng tôi có thể bảo vệ bạn khỏi một số trình theo dõi theo dõi bạn trực tuyến. Cài đặt Hệ thống này cũng có thể được sử dụng để chặn quảng cáo - cứu bản thân khỏi tính năng Bảo vệ sự ngạc nhiên của người dùng - Genesis sẽ yêu cầu các trang web không theo dõi tôi - yêu cầu trang web không theo dõi tôi - Bảo vệ giám sát người dùng - kích hoạt tính năng Bảo vệ Survelance của người dùng do Genesis cung cấp - cookie trang web - chọn tùy chọn cookie trang web theo nhu cầu bảo mật của bạn - xóa dữ liệu cá nhân khi thoát - xóa dữ liệu tự động sau khi phần mềm được đóng - duyệt web riêng tư - giữ an toàn cho danh tính của bạn và sử dụng các tùy chọn bên dưới - được kích hoạt - được bật, không bao gồm cookie theo dõi trang web - được bật, không bao gồm bên thứ 3 - tàn tật - - vô hiệu hóa bảo vệ - cho phép Bảo vệ Survelance nhận dạng. điều này có thể khiến danh tính trực tuyến của bạn bị đánh cắp - mặc định (khuyến nghị) - chặn quảng cáo trực tuyến và người dùng web xã hội Survelance. các trang sẽ tải như mặc định - chính sách nghiêm ngặt - dừng tất cả các trình theo dõi đã biết, các trang sẽ tải nhanh hơn nhưng một số chức năng có thể không hoạt động - - javascript - vô hiệu hóa tập lệnh java cho các cuộc tấn công tập lệnh khác nhau - Thiết lập hệ thống . Thiết lập hệ thống phức tạp - khôi phục các tab - không khôi phục sau khi thoát khỏi trình duyệt - chủ đề thanh công cụ - đặt chủ đề thanh công cụ như được xác định trong trang web - hiển thị hình ảnh - luôn tải hình ảnh trang web - hiển thị phông chữ web - tải xuống phông chữ từ xa khi tải trang - cho phép tự động phát - cho phép phương tiện tự động khởi động - trình tiết kiệm dữ liệu - chuyển hướng - thay đổi cách hoạt động của tab sau khi khởi động lại phần mềm - phương tiện truyền thông - thay đổi tùy chỉnh trình tiết kiệm dữ liệu mặc định - thay đổi tùy chỉnh phương tiện mặc định - luôn hiển thị hình ảnh - chỉ hiển thị hình ảnh khi sử dụng wifi - chặn tất cả hình ảnh - Cài đặt hệ thống nâng cao - khôi phục các tab, trình tiết kiệm dữ liệu, công cụ dành cho nhà phát triển - onion điều kiện của proxy - kiểm tra điều kiện mạng onion - báo cáo trang web - báo cáo trang web lạm dụng - đánh giá ứng dụng này - đánh giá và bình luận trên playstore - chia sẻ ứng dụng này - chia sẻ phần mềm này với bạn bè của bạn - Thiết lập hệ thống . tùy chỉnh chung - Cài đặt hệ thống mặc định - trang chủ, ngôn ngữ - duyệt toàn màn hình - ẩn thanh công cụ của trình duyệt khi cuộn xuống một trang - ngôn ngữ - thay đổi ngôn ngữ của trình duyệt của bạn - chủ đề phần mềm - chọn chủ đề sáng và tối - chủ đề tươi sáng - chủ đề Tối - thay đổi ngôn ngữ và duyệt toàn màn hình - mặc định hệ thống - trang chủ - about:blank - tab mới - mở trang chủ trong tab mới - xóa tất cả các tab - xóa các liên kết web đã duyệt - xóa dấu trang - xóa bộ nhớ cache duyệt web - loại bỏ các đề xuất - xóa dữ liệu trang web - xóa dữ liệu phiên - xóa cookie duyệt web - loại bỏ tùy chỉnh trình duyệt - - - bookmark website - xóa các liên kết web đã duyệt và Dữ liệu - xóa dấu trang và dữ liệu - xóa dữ liệu sẽ xóa các liên kết web đã duyệt, cookie và dữ liệu duyệt web khác - xóa dữ liệu sẽ xóa các trang web được đánh dấu - hủy bỏ - https:// - báo cáo - báo cáo trang web - nếu bạn cho rằng URL này bất hợp pháp hoặc đáng lo ngại, hãy báo cáo cho chúng tôi để chúng tôi có thể thực hiện hành động pháp lý - đã được báo cáo thành công - url đã được báo cáo thành công. nếu một cái gì đó được tìm thấy, hành động pháp lý sẽ được thực hiện - ngôn ngữ không được hỗ trợ - ngôn ngữ hệ thống không được phần mềm này hỗ trợ. chúng tôi đang làm việc để sớm đưa nó vào - khởi tạo Orbot - hành động không được hỗ trợ - không tìm thấy phần mềm nào để xử lý lệnh sau - chào mừng | web ẩn Gateway - phần mềm này cung cấp cho bạn một nền tảng để tìm kiếm và mở các url web ẩn. đây là một vài gợi ý \n - thị trường trực tuyến web ẩn - tài liệu và sách bị rò rỉ - tin tức và bài báo trên dark web - phần mềm bí mật và công cụ hack - không hiển thị lại - tài chính và tiền bạc - xã hội xã hội - sổ tay - Cửa hang tro chơi - thông báo tệp - thông báo tải xuống - thông báo tải xuống - thông báo liên kết web - - không tìm thấy phần mềm để xử lý email - tải tập tin | - dữ liệu bị xóa | yêu cầu khởi động lại - - - - - - - Orbot nhật ký - tab mới - đóng tab - mở các tab gần đây - ngôn ngữ - tải xuống - liên kết web đã duyệt - Thiết lập hệ thống - trang máy tính để bàn - lưu trang này - dấu trang - báo cáo trang web - đánh giá ứng dụng này - Tìm ở trang - lối ra - chia sẻ - - - tab mới - đóng tất cả cửa sổ - Thiết lập hệ thống - chọn tab - - - mở tab - sao chép - chia sẻ - lựa chọn rõ ràng - mở trong tab hiện tại - mở trang mới - xóa bỏ - - - liên kết web đã duyệt - tháo cái này - Tìm kiếm ... - - - dấu trang - tháo cái này - Tìm kiếm ... - - - thử lại - opps! lỗi kết nối mạng. mạng không kết nối - giúp đỡ và hỗ trợ - - - ngôn ngữ - thay đổi ngôn ngữ - chúng tôi chỉ chạy trên các ngôn ngữ sau. chúng tôi sẽ sớm bổ sung thêm - tiếng anh (các bang thống nhất) - đức (đức) - tiếng Ý (italy) - người Bồ Đào Nha (Brazil) - nga (nga) - ukrainian (ukraine) - tiếng Trung giản thể (Trung Quốc đại lục) - - - ⚠️ cảnh báo - tùy chỉnh Bridges - kích hoạt Bridges - kích hoạt VPN serivces - kích hoạt Bridge Gateway - kích hoạt Gateway - - - điều kiện của proxy - tình trạng hiện tại của orbot proxy - Orbot điều kiện của proxy - onion - VPN điều kiện kết nối - Bridge điều kiện của proxy - thông tin | thay đổi cài đặt hệ thống - bạn có thể thay đổi proxy bằng cách khởi động lại phần mềm và chuyển đến trình quản lý proxy. nó có thể được mở bằng cách nhấp vào biểu tượng bánh răng ở dưới cùng - - - - - default.jpg - mở thứ này - - - 1 - connect - Genesis is paused at the moment - các tab đang mở sẽ hiển thị ở đây - - - trang web này không thể truy cập được - đã xảy ra lỗi khi kết nối với trang web - không thể hiển thị trang bạn đang cố xem vì không thể xác minh tính xác thực của dữ liệu đã nhận - trang này hiện không hoạt động do một số lý do - vui lòng liên hệ với chủ sở hữu trang web để thông báo cho họ về vấn đề này. - tải lại - - - pref_language - Chữ ký gói không hợp lệ - bấm để đăng nhập. - bấm để chọn dữ liệu theo cách thủ công. - Ngoại lệ bảo mật tên miền web. - Không xác minh được DAL. - - Các tab gần đây - Nhận dạng mới - Chính sách bảo mật - Genesis Browser chính sách về quyền riêng tư - Báo cáo trang web - Báo cáo trang web bất hợp pháp - xuất bản trang web của bạn - Thêm trang web của bạn vào công cụ tìm kiếm của chúng tôi - - - - - - 55 Phần trăm - 70 Phần trăm - 85 Phần trăm - 100 phần trăm - 115 Phần trăm - 130 Phần trăm - 145 Phần trăm - - - - Đã bật - Tàn tật - - - - Cho phép tất cả - Vô hiệu hóa tất cả - Không có băng thông - - - - Chấp nhận tất cả - Cho phép Tin cậy - Cho phép Không - Cho phép truy cập - Cho phép không theo dõi - - - - + + + + Genesis + tìm kiếm thứ gì đó hoặc nhập một liên kết web + Tìm ở trang + máy tìm kiếm + https://genesis.onion + opps! có gì đó không ổn + mọi điều + Genesis search engine + tự do kỹ thuật số + tải lại + bạn đang phải đối mặt với một trong những vấn đề sau. trang web hoặc trang web có thể không hoạt động. kết nối internet của bạn có thể kém. bạn có thể đang sử dụng proxy. trang web có thể bị tường lửa chặn + com.hiddenservices.genesissearchengine.production.provider + BBC | Israel lại tấn công + + + Xóa bộ nhớ cache của trình duyệt + Xóa trang web đã duyệt + Xóa dữ liệu của bạn và mở trình duyệt + Xóa bộ nhớ cache của trình duyệt + Khởi động lại trình duyệt genesis + Khởi động Lại Trình Duyệt Của Bạn + + + Chỉnh Sửa Dấu Trang + Tên Dấu Trang + Tên của url được đánh dấu sẽ được hiển thị ở đây + Nhập tên dấu trang… + + + bỏ qua + + + "Đôi khi bạn cần một Cầu nối để truy cập Mạng Tor" + "NÓI CHO TÔI THÊM" + "Xin chào" + "Chào mừng bạn đến với Genesis trên điện thoại di động." + "Duyệt Internet một cách an toàn và bảo mật." + "Không theo dõi. Không kiểm duyệt." + + + Kết nối an toàn + Thông tin của bạn (ví dụ: mật khẩu hoặc số thẻ tín dụng) được bảo mật khi nó được gửi đến trang web này + Cài đặt Bảo Mật + Javascript + Giữ an toàn cho danh tính của bạn và sử dụng các tùy chọn bên dưới + Không Theo Dõi + Chúng tôi sẽ thông báo cho các trang web không theo dõi bạn + Bảo Vệ Theo Dõi + Bật tính năng bảo vệ theo dõi do chúng tôi cung cấp + Giấy chứng nhận + + + Thông Tin Chứng Chỉ + + + nhật ký proxy + Thông tin nhật ký hệ thống + nếu bạn gặp sự cố kết nối khi khởi động Genesis, vui lòng sao chép mã sau và tìm sự cố trực tuyến hoặc gửi cho chúng tôi, để chúng tôi có thể cố gắng giúp bạn + ~ Genesis on standby at the moment + + + tùy chỉnh proxy + chúng tôi kết nối bạn với mạng Tor do hàng nghìn tình nguyện viên trên khắp thế giới điều hành! Những tùy chọn này có thể giúp bạn không + Internet được kiểm duyệt ở đây (vượt tường lửa) + vượt tường lửa + Bridges khiến Internet chạy rất chậm. chỉ sử dụng chúng nếu internet bị kiểm duyệt ở quốc gia của bạn hoặc mạng Tor bị chặn + tùy chỉnh bảo mật + + + Cài đặt Bảo Mật + Thay đổi Cài đặt "BRIDGE" + Tạo Tự động + Tự động định cấu hình cài đặt "BRIDGE" + Cung cấp một "BRIDGE" mà tôi biết + Dán tùy chỉnh "BRIDGE" + Proxy Settings | Bridge + "BRIDGE" là các rơ le Tor không được liệt kê khiến việc chặn các kết nối vào mạng Tor trở nên khó khăn hơn. Vì cách một số quốc gia cố gắng chặn Tor, "BRIDGE" nhất định hoạt động ở một số quốc gia nhưng không hoạt động ở một số quốc gia khác + Chọn Mặc định "BRIDGE" + Yêu cầu + obfs4 (Khuyến nghị) + Meek-azure (Trung Quốc) + + + thay đổi cách hiển thị Nhật ký hệ thống + hiển thị Nhật ký bằng chế độ xem danh sách hiện đại + toogle giữa chế độ xem danh sách cổ điển và hiện đại + + + Đã xóa dấu trang + Đã cập nhật dấu trang + Đã xóa dữ liệu thành công + URL được sao chép vào khay nhớ tạm + Không tìm thấy ứng dụng nào + Yêu cầu khởi động lại sau khi thay đổi + Khởi động lại + Tab Bị đóng + Tab mới đã mở + Genesis proxy kết nối ... + Bộ nhớ đầy ➔ Xóa tab + Cửa sổ bật lên bị chặn + Mở Nhật Ký Lỗi + Chuyển đổi + Hoàn tác + Danh tính mới được tạo + mở cài đặt + + + Yêu Cầu Mới Bridge + REQUEST Bridge + Chọn E-mail bên dưới để yêu cầu địa chỉ Bridge. Sau khi bạn có địa chỉ, hãy sao chép và dán nó vào ô trên và khởi động ứng dụng. + Thư tín + + + XIN LỖI KHI NGHE RỒI + Nếu bạn gặp khó khăn khi sử dụng ứng dụng này, vui lòng liên hệ với chúng tôi qua email. Chúng tôi sẽ cố gắng giải quyết vấn đề của bạn càng sớm càng tốt + + + KHẮC PHỤC SỰ CỐ + Đặt lại ứng dụng trong trường hợp nó không hoạt động. Chúng tôi sẽ cố gắng cấu hình lại nó để nó có thể hoạt động trở lại. + Đặt lại + Loại bỏ + + + Đang chờ tải xuống ... + Tải xuống + + + Đánh Giá US + Cho người khác biết suy nghĩ của bạn về ứng dụng này + Đánh giá + + + Đã xong + Bridge string (obfs4 212.21.66.66:20621 ...) + Bridge kiểu (obfs4, meek, ...) + + + Đánh Dấu Trang Web + Thêm trang này vào dấu trang của bạn + bookmark tên ... + Đã xong + + + Thông Báo URL + Mở Trong Tab Mới + Mở Trong Tab Hiện Tại + Sao chép vào Clipboard + Tải Xuống Tệp + + + Mở url trong tab mới + Mở url trong tab hiện tại + Sao chép url vào khay nhớ tạm + Mở hình ảnh trong tab mới + Mở tab hình ảnh hiện tại + Sao chép hình ảnh vào khay nhớ tạm + Tải xuống tệp hình ảnh + + + cung cấp một Bridge bạn biết + nhập thông tin bridge từ một nguồn đáng tin cậy + yêu cầu + + + + + + + + + + + + + + + + + + + + + ru + Thiết lập hệ thống + đặt Genesis làm trình duyệt mặc định của bạn + Thiết lập hệ thống + máy tìm kiếm + javascript + xóa các liên kết web đã duyệt + tùy chỉnh phông chữ + Chòm sao Phông chữ Hệ thống + thay đổi phông chữ tự động + Cài đặt cookie + bánh quy + Thiết lập hệ thống . Thông báo + thông báo + thay đổi tùy chọn thông báo + tình trạng của mạng và thông báo + thông báo địa phương + tùy chỉnh thông báo phần mềm + thông báo hệ thống + Quản lý công cụ tìm kiếm + thêm, đặt mặc định. hiển thị đề xuất + quản lý thông báo + các tính năng mới, tình trạng của mạng + Tùy chỉnh phần mềm. Máy tìm kiếm + công cụ tìm kiếm được hỗ trợ + chọn Công cụ tìm kiếm mặc định + Tùy chỉnh phần mềm. Máy tìm kiếm + thay đổi cách các Tìm kiếm trên Web xuất hiện + default + Genesis + DuckDuckGo + Google + Bing + Wikipedia + hiển thị các liên kết web đã duyệt + hiển thị các đề xuất trong quá trình tìm kiếm + đề xuất từ ​​các liên kết web đã duyệt xuất hiện khi bạn nhập vào thanh tìm kiếm + đề xuất tập trung xuất hiện khi bạn nhập vào thanh tìm kiếm + khả năng tiếp cận + kích thước văn bản, thu phóng, nhập liệu bằng giọng nói + tùy chỉnh | khả năng tiếp cận + xóa dữ liệu cá nhân + tab, liên kết web đã duyệt, dấu trang, cookie, bộ nhớ cache + Thay đổi cài đặt hệ thống. Xóa dữ liệu hệ thống + xóa dữ liệu + xóa tất cả các tab + xóa các liên kết web đã duyệt + xóa dấu trang + xóa bộ nhớ cache + xóa đề xuất + xóa dữ liệu + xóa phiên + xóa cookie + xóa tùy chỉnh + chia tỷ lệ phông chữ + chia tỷ lệ nội dung web theo kích thước phông chữ hệ thống + bật thu phóng + bật và buộc thu phóng cho tất cả các trang web + đầu vào bằng giọng nói + cho phép đọc chính tả bằng giọng nói trong thanh url + chọn tỷ lệ phông chữ tùy chỉnh + kéo thanh trượt cho đến khi bạn có thể đọc thoải mái. văn bản ít nhất phải lớn như thế này sau khi nhấn đúp vào một đoạn văn + 200% + tương tác + thay đổi cách tương tác với nội dung trang web + Người dùng đang bật + mức độ người dùng, thông tin đăng nhập, lựa chọn dữ liệu + Bảo vệ giám sát người dùng + adblock, trình theo dõi, lấy dấu vân tay + Thiết lập hệ thống . riêng tư + Thiết lập hệ thống . bảo vệ người dùng tuyệt vời + bảo vệ danh tính trực tuyến của bạn + giữ bí mật danh tính của bạn. chúng tôi có thể bảo vệ bạn khỏi một số trình theo dõi theo dõi bạn trực tuyến. Cài đặt Hệ thống này cũng có thể được sử dụng để chặn quảng cáo + cứu bản thân khỏi tính năng Bảo vệ sự ngạc nhiên của người dùng + Genesis sẽ yêu cầu các trang web không theo dõi tôi + yêu cầu trang web không theo dõi tôi + Bảo vệ giám sát người dùng + kích hoạt tính năng Bảo vệ Survelance của người dùng do Genesis cung cấp + cookie trang web + chọn tùy chọn cookie trang web theo nhu cầu bảo mật của bạn + xóa dữ liệu cá nhân khi thoát + xóa dữ liệu tự động sau khi phần mềm được đóng + duyệt web riêng tư + giữ an toàn cho danh tính của bạn và sử dụng các tùy chọn bên dưới + được kích hoạt + được bật, không bao gồm cookie theo dõi trang web + được bật, không bao gồm bên thứ 3 + tàn tật + + vô hiệu hóa bảo vệ + cho phép Bảo vệ Survelance nhận dạng. điều này có thể khiến danh tính trực tuyến của bạn bị đánh cắp + mặc định (khuyến nghị) + chặn quảng cáo trực tuyến và người dùng web xã hội Survelance. các trang sẽ tải như mặc định + chính sách nghiêm ngặt + dừng tất cả các trình theo dõi đã biết, các trang sẽ tải nhanh hơn nhưng một số chức năng có thể không hoạt động + + javascript + vô hiệu hóa tập lệnh java cho các cuộc tấn công tập lệnh khác nhau + Thiết lập hệ thống . Thiết lập hệ thống phức tạp + khôi phục các tab + không khôi phục sau khi thoát khỏi trình duyệt + chủ đề thanh công cụ + đặt chủ đề thanh công cụ như được xác định trong trang web + hiển thị hình ảnh + luôn tải hình ảnh trang web + hiển thị phông chữ web + tải xuống phông chữ từ xa khi tải trang + cho phép tự động phát + cho phép phương tiện tự động khởi động + trình tiết kiệm dữ liệu + chuyển hướng + thay đổi cách hoạt động của tab sau khi khởi động lại phần mềm + phương tiện truyền thông + thay đổi tùy chỉnh trình tiết kiệm dữ liệu mặc định + thay đổi tùy chỉnh phương tiện mặc định + luôn hiển thị hình ảnh + chỉ hiển thị hình ảnh khi sử dụng wifi + chặn tất cả hình ảnh + Cài đặt hệ thống nâng cao + khôi phục các tab, trình tiết kiệm dữ liệu, công cụ dành cho nhà phát triển + onion điều kiện của proxy + kiểm tra điều kiện mạng onion + báo cáo trang web + báo cáo trang web lạm dụng + đánh giá ứng dụng này + đánh giá và bình luận trên playstore + chia sẻ ứng dụng này + chia sẻ phần mềm này với bạn bè của bạn + Thiết lập hệ thống . tùy chỉnh chung + Cài đặt hệ thống mặc định + trang chủ, ngôn ngữ + duyệt toàn màn hình + ẩn thanh công cụ của trình duyệt khi cuộn xuống một trang + ngôn ngữ + thay đổi ngôn ngữ của trình duyệt của bạn + chủ đề phần mềm + chọn chủ đề sáng và tối + chủ đề tươi sáng + chủ đề Tối + thay đổi ngôn ngữ và duyệt toàn màn hình + mặc định hệ thống + trang chủ + about:blank + tab mới + mở trang chủ trong tab mới + xóa tất cả các tab + xóa các liên kết web đã duyệt + xóa dấu trang + xóa bộ nhớ cache duyệt web + loại bỏ các đề xuất + xóa dữ liệu trang web + xóa dữ liệu phiên + xóa cookie duyệt web + loại bỏ tùy chỉnh trình duyệt + + + bookmark website + xóa các liên kết web đã duyệt và Dữ liệu + xóa dấu trang và dữ liệu + xóa dữ liệu sẽ xóa các liên kết web đã duyệt, cookie và dữ liệu duyệt web khác + xóa dữ liệu sẽ xóa các trang web được đánh dấu + hủy bỏ + https:// + báo cáo + báo cáo trang web + nếu bạn cho rằng URL này bất hợp pháp hoặc đáng lo ngại, hãy báo cáo cho chúng tôi để chúng tôi có thể thực hiện hành động pháp lý + đã được báo cáo thành công + url đã được báo cáo thành công. nếu một cái gì đó được tìm thấy, hành động pháp lý sẽ được thực hiện + ngôn ngữ không được hỗ trợ + ngôn ngữ hệ thống không được phần mềm này hỗ trợ. chúng tôi đang làm việc để sớm đưa nó vào + khởi tạo Orbot + hành động không được hỗ trợ + không tìm thấy phần mềm nào để xử lý lệnh sau + chào mừng | web ẩn Gateway + phần mềm này cung cấp cho bạn một nền tảng để tìm kiếm và mở các url web ẩn. đây là một vài gợi ý \n + thị trường trực tuyến web ẩn + tài liệu và sách bị rò rỉ + tin tức và bài báo trên dark web + phần mềm bí mật và công cụ hack + không hiển thị lại + tài chính và tiền bạc + xã hội xã hội + sổ tay + Cửa hang tro chơi + thông báo tệp + thông báo tải xuống + thông báo tải xuống + thông báo liên kết web + + không tìm thấy phần mềm để xử lý email + tải tập tin | + dữ liệu bị xóa | yêu cầu khởi động lại + + + + + + + Orbot nhật ký + tab mới + đóng tab + mở các tab gần đây + ngôn ngữ + tải xuống + liên kết web đã duyệt + Thiết lập hệ thống + trang máy tính để bàn + lưu trang này + dấu trang + báo cáo trang web + đánh giá ứng dụng này + Tìm ở trang + lối ra + chia sẻ + + + tab mới + đóng tất cả cửa sổ + Thiết lập hệ thống + chọn tab + + + mở tab + sao chép + chia sẻ + lựa chọn rõ ràng + mở trong tab hiện tại + mở trang mới + xóa bỏ + + + liên kết web đã duyệt + tháo cái này + Tìm kiếm ... + + + dấu trang + tháo cái này + Tìm kiếm ... + + + thử lại + opps! lỗi kết nối mạng. mạng không kết nối + giúp đỡ và hỗ trợ + + + ngôn ngữ + thay đổi ngôn ngữ + chúng tôi chỉ chạy trên các ngôn ngữ sau. chúng tôi sẽ sớm bổ sung thêm + tiếng anh (các bang thống nhất) + đức (đức) + tiếng Ý (italy) + người Bồ Đào Nha (Brazil) + nga (nga) + ukrainian (ukraine) + tiếng Trung giản thể (Trung Quốc đại lục) + + + ⚠️ cảnh báo + tùy chỉnh Bridges + kích hoạt Bridges + kích hoạt VPN serivces + kích hoạt Bridge Gateway + kích hoạt Gateway + + + điều kiện của proxy + tình trạng hiện tại của orbot proxy + Orbot điều kiện của proxy + onion + VPN điều kiện kết nối + Bridge điều kiện của proxy + thông tin | thay đổi cài đặt hệ thống + bạn có thể thay đổi proxy bằng cách khởi động lại phần mềm và chuyển đến trình quản lý proxy. nó có thể được mở bằng cách nhấp vào biểu tượng bánh răng ở dưới cùng + + + + + default.jpg + mở thứ này + + + 1 + connect + Genesis is paused at the moment + các tab đang mở sẽ hiển thị ở đây + + + trang web này không thể truy cập được + đã xảy ra lỗi khi kết nối với trang web + không thể hiển thị trang bạn đang cố xem vì không thể xác minh tính xác thực của dữ liệu đã nhận + trang này hiện không hoạt động do một số lý do + vui lòng liên hệ với chủ sở hữu trang web để thông báo cho họ về vấn đề này. + tải lại + + + pref_language + Chữ ký gói không hợp lệ + bấm để đăng nhập. + bấm để chọn dữ liệu theo cách thủ công. + Ngoại lệ bảo mật tên miền web. + Không xác minh được DAL. + + Các tab gần đây + Nhận dạng mới + Chính sách bảo mật + Genesis Browser chính sách về quyền riêng tư + Báo cáo trang web + Báo cáo trang web bất hợp pháp + xuất bản trang web của bạn + Thêm trang web của bạn vào công cụ tìm kiếm của chúng tôi + + + + + + 55 Phần trăm + 70 Phần trăm + 85 Phần trăm + 100 phần trăm + 115 Phần trăm + 130 Phần trăm + 145 Phần trăm + + + + Đã bật + Tàn tật + + + + Cho phép tất cả + Vô hiệu hóa tất cả + Không có băng thông + + + + Chấp nhận tất cả + Cho phép Tin cậy + Cho phép Không + Cho phép truy cập + Cho phép không theo dõi + + + + \ No newline at end of file diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index 7c0a98b8..2d14f4b7 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -12,7 +12,7 @@ 数字自由 重装 您正面临以下问题之一。网页或网站可能无法正常工作。您的互联网连接可能不佳。您可能正在使用代理。网站可能被防火墙阻止 - com.darkweb.genesissearchengine.production.provider + com.hiddenservices.genesissearchengine.production.provider 英国广播公司|以色列再次罢工 diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 00887c54..07f39ec7 100755 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -137,6 +137,7 @@ #ffffff #7591bd #e6e6e6 + #f0f0f0 /* Shared Colors */ #0066FF diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 60b9e145..49d45dde 100755 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -14,7 +14,7 @@ Online Freedom Reload These might be the problems you are facing \n\n• Webpage or Website might be down \n• Your Internet connection might be poor \n• You might be using a proxy \n• Website might be blocked by firewall - com.darkweb.genesissearchengine.production.provider + com.hiddenservices.genesissearchengine.production.provider BBC | Israel Strikes Again Search the web ... diff --git a/app/variables.gradle b/app/variables.gradle index 0d29f137..a15ec6b8 100755 --- a/app/variables.gradle +++ b/app/variables.gradle @@ -33,7 +33,7 @@ project.ext.min_sdk_version = 21 project.ext.target_sdk_version = 30 project.ext.build_tool_version = '30.0.3' project.ext.ndk_version = '21.4.7075529' -project.ext.application_id = "com.darkweb.genesissearchengine.production" +project.ext.application_id = "com.hiddenservices.genesissearchengine.production" project.ext.debugSymbolLevel = 'FULL' /* Splits */ diff --git a/orbotmanager/build.gradle b/orbotmanager/build.gradle index a96ef159..b8a230f2 100644 --- a/orbotmanager/build.gradle +++ b/orbotmanager/build.gradle @@ -1,67 +1,67 @@ -apply plugin: 'com.android.library' - -android { - compileSdkVersion 31 - buildToolsVersion '30.0.3' - ndkVersion '21.3.6528147' - - sourceSets { - main { - jniLibs.srcDirs = ['./src/main/libs'] - } - } - - defaultConfig { - minSdkVersion 16 - targetSdkVersion 31 - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } - } - - aaptOptions { - cruncherEnabled = false - } - - lintOptions { - checkReleaseBuilds false - abortOnError true - - htmlReport true - xmlReport false - textReport false - - lintConfig file("../lint.xml") - } - - packagingOptions { - exclude 'META-INF/androidx.localbroadcastmanager_localbroadcastmanager.version' - } -} - -dependencies { - implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0' - implementation 'com.gitlab.guardianproject:jsocksandroid:1.0.4' - - implementation 'com.jaredrummler:android-shell:1.0.0' - - implementation 'androidx.core:core:1.6.0' - implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0' - testImplementation 'junit:junit:4.13.2' - - implementation 'com.offbynull.portmapper:portmapper:2.0.5' - - implementation 'info.guardianproject:geoip:20191217' - - api 'info.guardianproject:jtorctl:0.4.5.7' - implementation 'info.guardianproject:tor-android:0.4.5.9' - - implementation 'com.github.tladesignz:IPtProxy:1.0.0' -} +apply plugin: 'com.android.library' + +android { + compileSdkVersion 31 + buildToolsVersion '30.0.3' + ndkVersion '21.3.6528147' + + sourceSets { + main { + jniLibs.srcDirs = ['./src/main/libs'] + } + } + + defaultConfig { + minSdkVersion 16 + targetSdkVersion 31 + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } + + aaptOptions { + cruncherEnabled = false + } + + lintOptions { + checkReleaseBuilds false + abortOnError true + + htmlReport true + xmlReport false + textReport false + + lintConfig file("../lint.xml") + } + + packagingOptions { + exclude 'META-INF/androidx.localbroadcastmanager_localbroadcastmanager.version' + } +} + +dependencies { + implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0' + implementation 'com.gitlab.guardianproject:jsocksandroid:1.0.4' + + implementation 'com.jaredrummler:android-shell:1.0.0' + + implementation 'androidx.core:core:1.7.0' + implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0' + testImplementation 'junit:junit:4.13.2' + + implementation 'com.offbynull.portmapper:portmapper:2.0.5' + + implementation 'info.guardianproject:geoip:20191217' + + api 'info.guardianproject:jtorctl:0.4.5.7' + implementation 'info.guardianproject:tor-android:0.4.5.9' + + implementation 'com.github.tladesignz:IPtProxy:1.0.0' +} diff --git a/orbotmanager/src/main/AndroidManifest.xml b/orbotmanager/src/main/AndroidManifest.xml index 589ee334..aecfe6ad 100644 --- a/orbotmanager/src/main/AndroidManifest.xml +++ b/orbotmanager/src/main/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="org.orbotproject.android.service"> diff --git a/orbotmanager/src/main/java/org/torproject/android/service/OrbotConstants.java b/orbotmanager/src/main/java/org/orbotproject/android/service/OrbotConstants.java similarity index 93% rename from orbotmanager/src/main/java/org/torproject/android/service/OrbotConstants.java rename to orbotmanager/src/main/java/org/orbotproject/android/service/OrbotConstants.java index 3960fb6c..596f30f8 100644 --- a/orbotmanager/src/main/java/org/torproject/android/service/OrbotConstants.java +++ b/orbotmanager/src/main/java/org/orbotproject/android/service/OrbotConstants.java @@ -1,38 +1,38 @@ -/* Copyright (c) 2009, Nathan Freitas, Orbot/The Guardian Project - http://openideals.com/guardian */ -/* See LICENSE for licensing information */ - -package org.torproject.android.service; - -public interface OrbotConstants { - - String TAG = "Orbot"; - - String PREF_OR = "pref_or"; - String PREF_OR_PORT = "pref_or_port"; - String PREF_OR_NICKNAME = "pref_or_nickname"; - String PREF_REACHABLE_ADDRESSES = "pref_reachable_addresses"; - String PREF_REACHABLE_ADDRESSES_PORTS = "pref_reachable_addresses_ports"; - - String PREF_DISABLE_NETWORK = "pref_disable_network"; - - String PREF_TOR_SHARED_PREFS = "org.torproject.android_preferences"; - - String PREF_SOCKS = "pref_socks"; - - String PREF_HTTP = "pref_http"; - - String PREF_ISOLATE_DEST = "pref_isolate_dest"; - - String PREF_CONNECTION_PADDING = "pref_connection_padding"; - String PREF_REDUCED_CONNECTION_PADDING = "pref_reduced_connection_padding"; - String PREF_CIRCUIT_PADDING = "pref_circuit_padding"; - String PREF_REDUCED_CIRCUIT_PADDING = "pref_reduced_circuit_padding"; - - String PREF_PREFER_IPV6 = "pref_prefer_ipv6"; - String PREF_DISABLE_IPV4 = "pref_disable_ipv4"; - - - String APP_TOR_KEY = "_app_tor"; - String APP_DATA_KEY = "_app_data"; - String APP_WIFI_KEY = "_app_wifi"; -} +/* Copyright (c) 2009, Nathan Freitas, Orbot/The Guardian Project - http://openideals.com/guardian */ +/* See LICENSE for licensing information */ + +package org.orbotproject.android.service; + +public interface OrbotConstants { + + String TAG = "Orbot"; + + String PREF_OR = "pref_or"; + String PREF_OR_PORT = "pref_or_port"; + String PREF_OR_NICKNAME = "pref_or_nickname"; + String PREF_REACHABLE_ADDRESSES = "pref_reachable_addresses"; + String PREF_REACHABLE_ADDRESSES_PORTS = "pref_reachable_addresses_ports"; + + String PREF_DISABLE_NETWORK = "pref_disable_network"; + + String PREF_TOR_SHARED_PREFS = "org.torproject.android_preferences"; + + String PREF_SOCKS = "pref_socks"; + + String PREF_HTTP = "pref_http"; + + String PREF_ISOLATE_DEST = "pref_isolate_dest"; + + String PREF_CONNECTION_PADDING = "pref_connection_padding"; + String PREF_REDUCED_CONNECTION_PADDING = "pref_reduced_connection_padding"; + String PREF_CIRCUIT_PADDING = "pref_circuit_padding"; + String PREF_REDUCED_CIRCUIT_PADDING = "pref_reduced_circuit_padding"; + + String PREF_PREFER_IPV6 = "pref_prefer_ipv6"; + String PREF_DISABLE_IPV4 = "pref_disable_ipv4"; + + + String APP_TOR_KEY = "_app_tor"; + String APP_DATA_KEY = "_app_data"; + String APP_WIFI_KEY = "_app_wifi"; +} diff --git a/orbotmanager/src/main/java/org/torproject/android/service/OrbotService.java b/orbotmanager/src/main/java/org/orbotproject/android/service/OrbotService.java similarity index 93% rename from orbotmanager/src/main/java/org/torproject/android/service/OrbotService.java rename to orbotmanager/src/main/java/org/orbotproject/android/service/OrbotService.java index 681070f7..3aa81627 100644 --- a/orbotmanager/src/main/java/org/torproject/android/service/OrbotService.java +++ b/orbotmanager/src/main/java/org/orbotproject/android/service/OrbotService.java @@ -1,1975 +1,1974 @@ -package org.torproject.android.service; - -import android.annotation.SuppressLint; -import android.app.Application; -import android.app.Notification; -import android.app.NotificationChannel; -import android.app.NotificationManager; -import android.app.PendingIntent; -import android.app.Service; -import android.content.BroadcastReceiver; -import android.content.ComponentName; -import android.content.ContentResolver; -import android.content.ContentValues; -import android.content.Context; -import android.content.ContextWrapper; -import android.content.Intent; -import android.content.IntentFilter; -import android.content.ServiceConnection; -import android.content.SharedPreferences; -import android.content.pm.PackageManager; -import android.database.Cursor; -import android.net.ConnectivityManager; -import android.net.NetworkInfo; -import android.net.Uri; -import android.net.VpnService; -import android.os.BatteryManager; -import android.os.Build; -import android.os.Handler; -import android.os.HandlerThread; -import android.os.IBinder; -import android.os.Looper; -import android.provider.BaseColumns; -import android.text.TextUtils; -import android.util.Log; - -import net.freehaven.tor.control.TorControlCommands; -import net.freehaven.tor.control.TorControlConnection; - -import org.torproject.android.service.util.CustomTorResourceInstaller; -import org.torproject.android.service.util.DummyActivity; -import org.torproject.android.service.util.Prefs; -import org.torproject.android.service.util.TorServiceUtils; -import org.torproject.android.service.util.Utils; -import org.torproject.android.service.vpn.OrbotVpnManager; -import org.torproject.android.service.vpn.VpnPrefs; -import org.torproject.android.service.wrapper.localHelperMethod; -import org.torproject.android.service.wrapper.logRowModel; -import org.torproject.android.service.wrapper.orbotLocalConstants; -import org.torproject.jni.TorService; - -import java.io.BufferedReader; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.FileWriter; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.PrintStream; -import java.io.PrintWriter; -import java.io.Reader; -import java.io.StringReader; -import java.text.NumberFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Objects; -import java.util.Random; -import java.util.StringTokenizer; -import java.util.UUID; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.TimeoutException; - -import IPtProxy.IPtProxy; -import androidx.annotation.RequiresApi; -import androidx.core.app.NotificationCompat; -import androidx.localbroadcastmanager.content.LocalBroadcastManager; - -import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; -import static org.torproject.android.service.wrapper.orbotLocalConstants.mBridgesDefault; - -public class OrbotService extends VpnService implements TorServiceConstants, OrbotConstants { - - public final static String BINARY_TOR_VERSION = TorService.VERSION_NAME; - - static final int NOTIFY_ID = 1; - private static final int ERROR_NOTIFY_ID = 3; - private static final int HS_NOTIFY_ID = 4; - private static final Uri V2_HS_CONTENT_URI = Uri.parse("content://org.torproject.android.ui.hiddenservices.providers.genesis/hs"); - private static final Uri V3_ONION_SERVICES_CONTENT_URI = Uri.parse("content://org.torproject.android.ui.v3onionservice.genesis/v3"); - private static final Uri COOKIE_CONTENT_URI = Uri.parse("content://org.torproject.android.ui.hiddenservices.providers.genesis.cookie/cookie"); - private static final Uri V3_CLIENT_AUTH_URI = Uri.parse("content://org.torproject.android.ui.v3onionservice.genesis.clientauth/v3auth"); - private final static String NOTIFICATION_CHANNEL_ID = "orbot_channel_1"; - private static final String[] LEGACY_V2_ONION_SERVICE_PROJECTION = new String[]{ - OnionService._ID, - OnionService.NAME, - OnionService.DOMAIN, - OnionService.PORT, - OnionService.AUTH_COOKIE, - OnionService.AUTH_COOKIE_VALUE, - OnionService.ONION_PORT, - OnionService.ENABLED, - OnionService.PATH}; - private static final String[] V3_ONION_SERVICE_PROJECTION = new String[]{ - OnionService._ID, - OnionService.NAME, - OnionService.DOMAIN, - OnionService.PORT, - OnionService.ONION_PORT, - OnionService.ENABLED, - OnionService.PATH - }; - private static final String[] LEGACY_COOKIE_PROJECTION = new String[]{ - ClientCookie._ID, - ClientCookie.DOMAIN, - ClientCookie.AUTH_COOKIE_VALUE, - ClientCookie.ENABLED}; - private static final String[] V3_CLIENT_AUTH_PROJECTION = new String[]{ - V3ClientAuth._ID, - V3ClientAuth.DOMAIN, - V3ClientAuth.HASH, - V3ClientAuth.ENABLED - }; - - public boolean isAppClosed = false; - public static int mPortSOCKS = -1; - public static int mPortHTTP = -1; - public static int mPortDns = TOR_DNS_PORT_DEFAULT; - public static int mPortTrans = TOR_TRANSPROXY_PORT_DEFAULT; - public static File appBinHome; - public static File appCacheHome; - private final ExecutorService mExecutor = Executors.newCachedThreadPool(); - boolean mIsLollipop = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP; - TorEventHandler mEventHandler; - OrbotVpnManager mVpnManager; - Handler mHandler; - //we should randomly sort alBridges so we don't have the same bridge order each time - Random bridgeSelectRandom = new Random(System.nanoTime()); - ActionBroadcastReceiver mActionBroadcastReceiver; - private String mCurrentStatus = STATUS_OFF; - private TorControlConnection conn = null; - private ServiceConnection torServiceConnection; - private TorService torService; - private boolean shouldUnbindTorService; - private NotificationManager mNotificationManager = null; - private NotificationCompat.Builder mNotifyBuilder; - private boolean mNotificationShowing = false; - private File mHSBasePath, mV3OnionBasePath, mV3AuthBasePath; - private ArrayList alBridges = null; - - /** - * @param bridgeList bridges that were manually entered into Orbot settings - * @return Array with each bridge as an element, no whitespace entries see issue #289... - */ - private static String[] parseBridgesFromSettings(String bridgeList) { - // this regex replaces lines that only contain whitespace with an empty String - bridgeList = bridgeList.trim().replaceAll("(?m)^[ \t]*\r?\n", ""); - return bridgeList.split("\\n"); - } - - public void debug(String msg) { - Log.d(OrbotConstants.TAG, msg); - - if (Prefs.useDebugLogging()) { - sendCallbackLogMessage(msg); - } - } - - public void logException(String msg, Exception e) { - if (Prefs.useDebugLogging()) { - Log.e(OrbotConstants.TAG, msg, e); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - e.printStackTrace(new PrintStream(baos)); - - sendCallbackLogMessage(msg + '\n' + new String(baos.toByteArray())); - - } else - sendCallbackLogMessage(msg); - - } - - private void showConnectedToTorNetworkNotification() { - showToolbarNotification(getString(R.string.status_activated), NOTIFY_ID, R.mipmap.ic_stat_tor_logo); - } - - @Override - public void onLowMemory() { - super.onLowMemory(); - logNotice("Low Memory Warning!"); - } - - private void clearNotifications() { - if (mNotificationManager != null) - mNotificationManager.cancelAll(); - - if (mEventHandler != null) - mEventHandler.getNodes().clear(); - - mNotificationShowing = false; - } - - @RequiresApi(api = Build.VERSION_CODES.O) - private void createNotificationChannel() { - NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); - - CharSequence name = getString(R.string.app_name); // The user-visible name of the channel. - String description = getString(R.string.app_description); // The user-visible description of the channel. - NotificationChannel mChannel = new NotificationChannel(NOTIFICATION_CHANNEL_ID, name, NotificationManager.IMPORTANCE_LOW); - // Configure the notification channel. - mChannel.setDescription(description); - mChannel.enableLights(false); - mChannel.enableVibration(false); - mChannel.setShowBadge(false); - mChannel.setLockscreenVisibility(Notification.VISIBILITY_SECRET); - mNotificationManager.createNotificationChannel(mChannel); - } - - boolean mToolbarUpdating = false; - @SuppressLint({"NewApi", "RestrictedApi"}) - public void showToolbarNotification(String notifyMsg, int notifyType, int icon) { - if(!mToolbarUpdating){ - mToolbarUpdating = true; - }else { - return; - } - - try{ - if(isAppClosed){ - Log.i("superman", "superman"); - return; - } - PackageManager pm = getPackageManager(); - Intent intent = pm.getLaunchIntentForPackage(getPackageName()); - PendingIntent pendIntent = PendingIntent.getActivity(OrbotService.this, 0, intent, 0); - - if (mNotifyBuilder == null) { - mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); - mNotifyBuilder = new NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID) - .setContentTitle(getString(R.string.app_name)) - .setSmallIcon(R.mipmap.ic_stat_tor_logo) - .setContentIntent(pendIntent) - .setCategory(Notification.CATEGORY_SERVICE) - .setOngoing(Prefs.persistNotifications()); - } - - mNotifyBuilder.mActions.clear(); - if (conn != null && orbotLocalConstants.mIsTorInitialized) { - Intent intentRefresh = new Intent(CMD_NEWNYM); - PendingIntent pendingIntentNewNym = PendingIntent.getBroadcast(this, 0, intentRefresh, PendingIntent.FLAG_UPDATE_CURRENT); - mNotifyBuilder.addAction(R.mipmap.ic_stat_tor_logo, getString(R.string.menu_new_identity), pendingIntentNewNym); - - Intent intentSetting = new Intent(CMD_SETTING); - PendingIntent pendingIntentSetting = PendingIntent.getBroadcast(this, 0, intentSetting, PendingIntent.FLAG_UPDATE_CURRENT); - mNotifyBuilder.addAction(0, "Notification Settings", pendingIntentSetting); - } - - mNotifyBuilder.setContentText(notifyMsg) - .setSmallIcon(icon) - .setTicker(notifyType != NOTIFY_ID ? notifyMsg : null); - - if (!Prefs.persistNotifications()) - mNotifyBuilder.setPriority(Notification.PRIORITY_LOW); - - Notification notification = mNotifyBuilder.build(); - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - startForeground(11337, notification); - } else if (Prefs.persistNotifications() && (!mNotificationShowing)) { - startForeground(11337, notification); - logNotice("Set background service to FOREGROUND"); - } else { - mNotificationManager.notify(NOTIFY_ID, notification); - } - }catch (Exception ex){ - Log.i("sad","asd"); - } - - mNotificationShowing = true; - mToolbarUpdating = false; - } - - public int onStartCommand(Intent intent, int flags, int startId) { - showToolbarNotification("", NOTIFY_ID, R.mipmap.ic_stat_tor_logo); - - self = this; - if (intent != null) - mExecutor.execute(new IncomingIntentRouter(intent)); - else - Log.d(OrbotConstants.TAG, "Got null onStartCommand() intent"); - - return Service.START_STICKY; - } - - @Override - public void onTaskRemoved(Intent rootIntent) { - try{ - Intent intent = new Intent(this, DummyActivity.class); - intent.addFlags(FLAG_ACTIVITY_NEW_TASK); - startActivity(intent); - }catch (Exception ignored){ - Log.i("sda","ASd"); - - } - } - - @Override - public void onDestroy() { - - try { - disableNotification(); - clearNotifications(); - unregisterReceiver(mNetworkStateReceiver); - unregisterReceiver(mActionBroadcastReceiver); - }catch (Exception ex){ - Log.i("sad","asd"); - ex.printStackTrace(); - } - - isAppClosed = true; - - try { - stopTor(); - stopTorAsync(); - clearNotifications(); - killAllDaemons(); - } catch (Exception exception) { - exception.printStackTrace(); - } - - super.onDestroy(); - } - - private void killAllDaemons() throws Exception { - - if (conn != null) { - logNotice("Using control port to shutdown Tor"); - - try { - logNotice("sending HALT signal to Tor process"); - conn.shutdownTor("SHUTDOWN"); - - } catch (IOException e) { - Log.d(OrbotConstants.TAG, "error shutting down Tor via connection", e); - } - - conn = null; - } - } - - private void stopTorAsync() { - - debug("stopTor"); - - try { - sendCallbackStatus(STATUS_STOPPING); - sendCallbackLogMessage(getString(R.string.status_shutting_down)); - - if (Prefs.bridgesEnabled()) { - if (useIPtObfsMeekProxy()) - IPtProxy.stopObfs4Proxy(); - else if (useIPtSnowflakeProxy()) - IPtProxy.stopSnowflake(); - } - else if (Prefs.beSnowflakeProxy()) - disableSnowflakeProxy(); - - stopTor(); - - //stop the foreground priority and make sure to remove the persistant notification - stopForeground(true); - - sendCallbackLogMessage(getString(R.string.status_disabled)); - } catch (Exception e) { - logNotice("An error occured stopping Tor: " + e.getMessage()); - sendCallbackLogMessage(getString(R.string.something_bad_happened)); - } - clearNotifications(); - sendCallbackStatus(STATUS_OFF); - } - - private void disableSnowflakeProxy () { - IPtProxy.stopSnowflakeProxy(); - logNotice("Snowflake Proxy mode DISABLED"); - } - - private void stopTorOnError(String message) { - stopTorAsync(); - showToolbarNotification( - getString(R.string.unable_to_start_tor) + ": " + message, - ERROR_NOTIFY_ID, R.drawable.ic_stat_notifyerr); - } - - private static boolean useIPtObfsMeekProxy() { - String bridgeList = Prefs.getBridgesList(); - return bridgeList.contains("obfs") || bridgeList.contains("meek"); - } - - private static boolean useIPtSnowflakeProxy() { - String bridgeList = Prefs.getBridgesList(); - return bridgeList.contains("snowflake"); - } - - private static HashMap mFronts; - - public static void loadCdnFronts (Context context) { - if (mFronts == null) { - mFronts = new HashMap<>(); - try { - BufferedReader reader = new BufferedReader(new InputStreamReader(context.getAssets().open("fronts"))); - String line; - while ((line = reader.readLine())!=null) { - String[] front = line.split(" "); - mFronts.put(front[0],front[1]); - } - } catch (IOException e) { - e.printStackTrace(); - } - } - } - - public static String getCdnFront(String service) { - return mFronts.get(service); - } - - private void startSnowflakeClient() { - String target = getCdnFront("snowflake-target"); - String front = getCdnFront("snowflake-front"); - String stunServer = getCdnFront("snowflake-stun"); - IPtProxy.startSnowflake(stunServer, target, front,null, true, false, true, 3); - } - - /* - This is to host a snowflake entrance node / bridge - */ - private void runSnowflakeProxy () { - int capacity = 3; - String broker = "https://snowflake-broker.bamsoftware.com/"; - String relay = "wss://snowflake.bamsoftware.com/"; - String stun = "stun:stun.stunprotocol.org:3478"; - String logFile = null; - boolean keepLocalAddresses = true; - boolean unsafeLogging = false; - IPtProxy.startSnowflakeProxy(capacity, broker, relay, stun, logFile, keepLocalAddresses, unsafeLogging); - } - - private void stopSnowflakeProxy () { - IPtProxy.stopSnowflakeProxy(); - } - /** - * if someone stops during startup, we may have to wait for the conn port to be setup, so we can properly shutdown tor - */ - private synchronized void stopTor() throws Exception { - - if (conn != null) { - logNotice("Using control port to shutdown Tor"); - - try { - logNotice("sending HALT signal to Tor process"); - conn.shutdownTor(TorControlCommands.SIGNAL_SHUTDOWN); - - } catch (IOException e) { - Log.d(OrbotConstants.TAG, "error shutting down Tor via connection", e); - } - - if (shouldUnbindTorService) { - unbindService(torServiceConnection); - shouldUnbindTorService = false; - } - - conn = null; - } - } - - private void requestTorRereadConfig() { - try { - if (conn != null) { - conn.signal(TorControlCommands.SIGNAL_RELOAD); - } - } catch (IOException e) { - Log.i("sad","asd"); - e.printStackTrace(); - } - } - - protected void logNotice(String msg) { - if (msg != null && msg.trim().length() > 0) { - if (Prefs.useDebugLogging()) - Log.d(OrbotConstants.TAG, msg); - - sendCallbackLogMessage(msg); - } - } - - @Override - public void onCreate() { - super.onCreate(); - - try { - if (Build.VERSION.SDK_INT <= 25) { - Intent notificationIntent = new Intent(this, OrbotService.class); - - PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, - notificationIntent, 0); - - Notification notification = new NotificationCompat.Builder(this) - .setSmallIcon(R.drawable.ic_stat_starting_tor_logo) - .setContentTitle("Starting Genesis") - .setContentIntent(pendingIntent).build(); - - startForeground(11337, notification); - }else { - String id = "_channel_01"; - int importance = NotificationManager.IMPORTANCE_LOW; - NotificationChannel mChannel = new NotificationChannel(id, "notification", importance); - mChannel.enableLights(true); - - Notification notification = new Notification.Builder(getApplicationContext(), id) - .setSmallIcon(R.drawable.ic_stat_starting_tor_logo) - .setContentTitle("Starting Genesis") - .build(); - - NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); - if (mNotificationManager != null) { - mNotificationManager.createNotificationChannel(mChannel); - mNotificationManager.notify(11337, notification); - } - - startForeground(11337, notification); - } - - - mHandler = new Handler(); - - appBinHome = getFilesDir(); - if (!appBinHome.exists()) - appBinHome.mkdirs(); - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - appCacheHome = new File(getDataDir(), DIRECTORY_TOR_DATA); - } else { - appCacheHome = getDir(DIRECTORY_TOR_DATA, Application.MODE_PRIVATE); - } - - if (!appCacheHome.exists()) - appCacheHome.mkdirs(); - - mHSBasePath = new File(getFilesDir().getAbsolutePath(), TorServiceConstants.HIDDEN_SERVICES_DIR); - if (!mHSBasePath.isDirectory()) - mHSBasePath.mkdirs(); - - mV3OnionBasePath = new File(getFilesDir().getAbsolutePath(), TorServiceConstants.ONION_SERVICES_DIR); - if (!mV3OnionBasePath.isDirectory()) - mV3OnionBasePath.mkdirs(); - - mV3AuthBasePath = new File(getFilesDir().getAbsolutePath(), TorServiceConstants.V3_CLIENT_AUTH_DIR); - if (!mV3AuthBasePath.isDirectory()) - mV3AuthBasePath.mkdirs(); - - if (mNotificationManager == null) { - mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); - } - - IntentFilter mNetworkStateFilter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION); - registerReceiver(mNetworkStateReceiver , mNetworkStateFilter); - - IntentFilter filter = new IntentFilter(); - filter.addAction(CMD_NEWNYM); - filter.addAction(CMD_SETTING); - filter.addAction(CMD_ACTIVE); - mActionBroadcastReceiver = new ActionBroadcastReceiver(); - registerReceiver(mActionBroadcastReceiver, filter); - - if (Build.VERSION.SDK_INT >= 26) - createNotificationChannel(); - - CustomTorResourceInstaller installer = new CustomTorResourceInstaller(this, appBinHome); - installer.installGeoIP(); - - pluggableTransportInstall(); - - mVpnManager = new OrbotVpnManager(this); - - loadCdnFronts(this); - - } catch (Exception e) { - //what error here - Log.e(OrbotConstants.TAG, "Error installing Orbot binaries", e); - logNotice("There was an error installing Orbot binaries"); - } - - Log.i("OrbotService", "onCreate end"); - } - - protected String getCurrentStatus() { - return mCurrentStatus; - } - - private boolean pluggableTransportInstall() { - - File fileCacheDir = new File(getCacheDir(), "pt"); - if (!fileCacheDir.exists()) - //noinspection ResultOfMethodCallIgnored - fileCacheDir.mkdir(); - IPtProxy.setStateLocation(fileCacheDir.getAbsolutePath()); - String fileTestState = IPtProxy.getStateLocation(); - debug("IPtProxy state: " + fileTestState); - - return false; - } - - private File updateTorrcCustomFile() throws IOException, TimeoutException { - SharedPreferences prefs = Prefs.getSharedPrefs(getApplicationContext()); - - StringBuffer extraLines = new StringBuffer(); - - extraLines.append("\n"); - - extraLines.append("RunAsDaemon 0").append('\n'); - extraLines.append("AvoidDiskWrites 0").append('\n'); - - String socksPortPref = prefs.getString(OrbotConstants.PREF_SOCKS, (TorServiceConstants.SOCKS_PROXY_PORT_DEFAULT)); - - if (socksPortPref.indexOf(':') != -1) - socksPortPref = socksPortPref.split(":")[1]; - - - String httpPortPref = prefs.getString(OrbotConstants.PREF_HTTP, (TorServiceConstants.HTTP_PROXY_PORT_DEFAULT)); - - if (httpPortPref.indexOf(':') != -1) - httpPortPref = httpPortPref.split(":")[1]; - - - try{ - orbotLocalConstants.mSOCKSPort = Integer.parseInt(socksPortPref); - orbotLocalConstants.mHTTPPort = Integer.parseInt(httpPortPref); - - }catch (Exception ex){ - orbotLocalConstants.mSOCKSPort = 9050; - orbotLocalConstants.mHTTPPort = 8118; - } - - String isolate = ""; - if (prefs.getBoolean(OrbotConstants.PREF_ISOLATE_DEST, false)) { - isolate += " IsolateDestAddr "; - } - - String ipv6Pref = ""; - - if (prefs.getBoolean(OrbotConstants.PREF_PREFER_IPV6, true)) { - ipv6Pref += " IPv6Traffic PreferIPv6 "; - } - - if (prefs.getBoolean(OrbotConstants.PREF_DISABLE_IPV4, false)) { - ipv6Pref += " IPv6Traffic NoIPv4Traffic "; - } - - extraLines.append("SOCKSPort ").append(socksPortPref).append(isolate).append(ipv6Pref).append('\n'); - extraLines.append("SafeSocks 0").append('\n'); - extraLines.append("TestSocks 0").append('\n'); - - if (Prefs.openProxyOnAllInterfaces()) - extraLines.append("SocksListenAddress 0.0.0.0").append('\n'); - - - extraLines.append("HTTPTunnelPort ").append(httpPortPref).append('\n'); - - if (prefs.getBoolean(OrbotConstants.PREF_CONNECTION_PADDING, false)) { - extraLines.append("ConnectionPadding 1").append('\n'); - } - - if (prefs.getBoolean(OrbotConstants.PREF_REDUCED_CONNECTION_PADDING, true)) { - extraLines.append("ReducedConnectionPadding 1").append('\n'); - } - - if (prefs.getBoolean(OrbotConstants.PREF_CIRCUIT_PADDING, true)) { - extraLines.append("CircuitPadding 1").append('\n'); - } else { - extraLines.append("CircuitPadding 0").append('\n'); - } - - if (prefs.getBoolean(OrbotConstants.PREF_REDUCED_CIRCUIT_PADDING, true)) { - extraLines.append("ReducedCircuitPadding 1").append('\n'); - } - - String transPort = prefs.getString("pref_transport", TorServiceConstants.TOR_TRANSPROXY_PORT_DEFAULT + ""); - String dnsPort = prefs.getString("pref_dnsport", TorServiceConstants.TOR_DNS_PORT_DEFAULT + ""); - - extraLines.append("TransPort ").append(checkPortOrAuto(transPort)).append('\n'); - extraLines.append("DNSPort ").append(checkPortOrAuto(dnsPort)).append('\n'); - - extraLines.append("VirtualAddrNetwork 10.192.0.0/10").append('\n'); - extraLines.append("AutomapHostsOnResolve 1").append('\n'); - - extraLines.append("DormantClientTimeout 10 minutes").append('\n'); - // extraLines.append("DormantOnFirstStartup 0").append('\n'); - extraLines.append("DormantCanceledByStartup 1").append('\n'); - - extraLines.append("DisableNetwork 0").append('\n'); - - if (Prefs.useDebugLogging()) { - extraLines.append("Log debug syslog").append('\n'); - extraLines.append("SafeLogging 0").append('\n'); - } - - extraLines = processSettingsImpl(extraLines); - - if (extraLines == null) - return null; - - extraLines.append('\n'); - extraLines.append(prefs.getString("pref_custom_torrc", "")).append('\n'); - - logNotice("updating torrc custom configuration..."); - - debug("torrc.custom=" + extraLines.toString()); - - File fileTorRcCustom = TorService.getTorrc(this); - updateTorConfigCustom(fileTorRcCustom, extraLines.toString()); - return fileTorRcCustom; - } - - public int getPortHTTP(){ - return orbotLocalConstants.mHTTPPort; - } - - public int getPortSOCKS(){ - return orbotLocalConstants.mSOCKSPort; - } - - private String checkPortOrAuto(String portString) { - if (!portString.equalsIgnoreCase("auto")) { - boolean isPortUsed = true; - int port = Integer.parseInt(portString); - - while (isPortUsed) { - isPortUsed = TorServiceUtils.isPortOpen("127.0.0.1", port, 500); - - if (isPortUsed) //the specified port is not available, so let Tor find one instead - port++; - } - return port + ""; - } - - return portString; - } - - public boolean updateTorConfigCustom(File fileTorRcCustom, String extraLines) throws IOException, TimeoutException { - FileWriter fos = new FileWriter(fileTorRcCustom, false); - PrintWriter ps = new PrintWriter(fos); - ps.print(extraLines); - ps.flush(); - ps.close(); - return true; - } - - /** - * Send Orbot's status in reply to an - * {@link TorServiceConstants#ACTION_START} {@link Intent}, targeted only to - * the app that sent the initial request. If the user has disabled auto- - * starts, the reply {@code ACTION_START Intent} will include the extra - * {@link TorServiceConstants#STATUS_STARTS_DISABLED} - */ - private void replyWithStatus(Intent startRequest) { - String packageName = startRequest.getStringExtra(EXTRA_PACKAGE_NAME); - - Intent reply = new Intent(ACTION_STATUS); - reply.putExtra(EXTRA_STATUS, mCurrentStatus); - reply.putExtra(EXTRA_SOCKS_PROXY, "socks://127.0.0.1:" + mPortSOCKS); - reply.putExtra(EXTRA_SOCKS_PROXY_HOST, "127.0.0.1"); - reply.putExtra(EXTRA_SOCKS_PROXY_PORT, mPortSOCKS); - reply.putExtra(EXTRA_HTTP_PROXY, "http://127.0.0.1:" + mPortHTTP); - reply.putExtra(EXTRA_HTTP_PROXY_HOST, "127.0.0.1"); - reply.putExtra(EXTRA_HTTP_PROXY_PORT, mPortHTTP); - - if (packageName != null) { - reply.setPackage(packageName); - sendBroadcast(reply); - } - - LocalBroadcastManager.getInstance(this).sendBroadcast(reply); - - if (mPortSOCKS != -1 && mPortHTTP != -1) - sendCallbackPorts(mPortSOCKS, mPortHTTP, mPortDns, mPortTrans); - - } - - /** - * The entire process for starting tor and related services is run from this method. - */ - public void onRestart() { - try { - startTorService(); - } catch (Exception exception) { - exception.printStackTrace(); - } - } - - private void startTor() { - try { - - // STATUS_STARTING is set in onCreate() - if (mCurrentStatus.equals(STATUS_STOPPING)) { - // these states should probably be handled better - sendCallbackLogMessage("Ignoring start request, currently " + mCurrentStatus); - return; - } else if (mCurrentStatus.equals(STATUS_ON)) { - showConnectedToTorNetworkNotification(); - sendCallbackLogMessage("Ignoring start request, already started."); - return; - } - - sendCallbackStatus(STATUS_STARTING); - - // make sure there are no stray daemons running - stopTor(); - - showToolbarNotification(getString(R.string.status_starting_up), NOTIFY_ID, R.drawable.ic_stat_starting_tor_logo); - //sendCallbackLogMessage(getString(R.string.status_starting_up)); - //logNotice(getString(R.string.status_starting_up)); - - ArrayList customEnv = new ArrayList<>(); - - if (Prefs.bridgesEnabled()) - if (Prefs.useVpn() && !mIsLollipop) { - customEnv.add("TOR_PT_PROXY=socks5://" + OrbotVpnManager.sSocksProxyLocalhost + ":" + OrbotVpnManager.sSocksProxyServerPort); - } - - startTorService(); - - if (Prefs.hostOnionServicesEnabled()) { - try { - updateLegacyV2OnionNames(); - } catch (SecurityException se) { - logNotice("unable to upload legacy v2 onion names"); - } - try { - updateV3OnionNames(); - } catch (SecurityException se) { - logNotice("unable to upload v3 onion names"); - } - } - } catch (Exception e) { - Log.i("sad","asd"); - logException("Unable to start Tor: " + e.toString(), e); - stopTorOnError(e.getLocalizedMessage()); - } - } - - - private void updateV3OnionNames() throws SecurityException { - ContentResolver contentResolver = getApplicationContext().getContentResolver(); - Cursor onionServices = contentResolver.query(V3_ONION_SERVICES_CONTENT_URI, null, null, null, null); - if (onionServices != null) { - try { - while (onionServices.moveToNext()) { - String domain = onionServices.getString(onionServices.getColumnIndex(OnionService.DOMAIN)); - if (domain == null || TextUtils.isEmpty(domain)) { - String path = onionServices.getString(onionServices.getColumnIndex(OnionService.PATH)); - String v3OnionDirPath = new File(mV3OnionBasePath.getAbsolutePath(), path).getCanonicalPath(); - File hostname = new File(v3OnionDirPath, "hostname"); - if (hostname.exists()) { - int id = onionServices.getInt(onionServices.getColumnIndex(OnionService._ID)); - domain = Utils.readString(new FileInputStream(hostname)).trim(); - ContentValues fields = new ContentValues(); - fields.put(OnionService.DOMAIN, domain); - contentResolver.update(V3_ONION_SERVICES_CONTENT_URI, fields, OnionService._ID + "=" + id, null); - } - } - - } - } catch (Exception e) { - Log.i("sad","asd"); - e.printStackTrace(); - } - onionServices.close(); - } - } - - private void updateLegacyV2OnionNames() throws SecurityException { - // Tor is running, update new .onion names at db - ContentResolver mCR = getApplicationContext().getContentResolver(); - Cursor hidden_services = mCR.query(V2_HS_CONTENT_URI, LEGACY_V2_ONION_SERVICE_PROJECTION, null, null, null); - if (hidden_services != null) { - try { - while (hidden_services.moveToNext()) { - String HSDomain = hidden_services.getString(hidden_services.getColumnIndex(OnionService.DOMAIN)); - int HSAuthCookie = hidden_services.getInt(hidden_services.getColumnIndex(OnionService.AUTH_COOKIE)); - String HSAuthCookieValue = hidden_services.getString(hidden_services.getColumnIndex(OnionService.AUTH_COOKIE_VALUE)); - // Update only new domains or restored from backup with auth cookie - if ((HSDomain == null || HSDomain.length() < 1) || (HSAuthCookie == 1 && (HSAuthCookieValue == null || HSAuthCookieValue.length() < 1))) { - String hsDirPath = new File(mHSBasePath.getAbsolutePath(), hidden_services.getString(hidden_services.getColumnIndex(OnionService.PATH))).getCanonicalPath(); - File file = new File(hsDirPath, "hostname"); - - if (file.exists()) { - ContentValues fields = new ContentValues(); - - try { - int id = hidden_services.getInt(hidden_services.getColumnIndex(OnionService._ID)); - String onionHostname = Utils.readString(new FileInputStream(file)).trim(); - if (HSAuthCookie == 1) { - String[] aux = onionHostname.split(" "); - onionHostname = aux[0]; - fields.put(OnionService.AUTH_COOKIE_VALUE, aux[1]); - } - fields.put(OnionService.DOMAIN, onionHostname); - mCR.update(V2_HS_CONTENT_URI, fields, OnionService._ID + "=" + id, null); - } catch (FileNotFoundException e) { - logException("unable to read onion hostname file", e); - showToolbarNotification(getString(R.string.unable_to_read_hidden_service_name), HS_NOTIFY_ID, R.drawable.ic_stat_notifyerr); - } - } else { - showToolbarNotification(getString(R.string.unable_to_read_hidden_service_name), HS_NOTIFY_ID, R.drawable.ic_stat_notifyerr); - } - } - } - - } catch (NumberFormatException e) { - Log.e(OrbotConstants.TAG, "error parsing hsport", e); - } catch (Exception e) { - Log.e(OrbotConstants.TAG, "error starting share server", e); - } - - hidden_services.close(); - } - } - - private synchronized void startTorService() throws Exception { - updateTorConfigCustom(TorService.getDefaultsTorrc(this), - "DNSPort 0\n" + - "TransPort 0\n" + - "DisableNetwork 1\n"); - - File fileTorrcCustom = updateTorrcCustomFile(); - if ((!fileTorrcCustom.exists()) || (!fileTorrcCustom.canRead())) - return; - - sendCallbackLogMessage(getString(R.string.status_starting_up)); - - torServiceConnection = new ServiceConnection() { - @Override - public void onServiceConnected(ComponentName componentName, IBinder iBinder) { - new Thread(){ - public void run(){ - torService = ((TorService.LocalBinder) iBinder).getService(); - try { - conn = torService.getTorControlConnection(); - while (conn == null) { - Log.v(TAG, "Waiting for Tor Control Connection..."); - Thread.sleep(500); - conn = torService.getTorControlConnection(); - } - sleep(2000); - mEventHandler = new TorEventHandler(OrbotService.this); - logNotice("adding control port event handler"); - conn.setEventHandler(mEventHandler); - ArrayList events = new ArrayList<>(Arrays.asList( - TorControlCommands.EVENT_OR_CONN_STATUS, - TorControlCommands.EVENT_CIRCUIT_STATUS, - TorControlCommands.EVENT_NOTICE_MSG, - TorControlCommands.EVENT_WARN_MSG, - TorControlCommands.EVENT_ERR_MSG, - TorControlCommands.EVENT_BANDWIDTH_USED, - TorControlCommands.EVENT_NEW_DESC, - TorControlCommands.EVENT_ADDRMAP)); - if (Prefs.useDebugLogging()) { - events.add(TorControlCommands.EVENT_DEBUG_MSG); - events.add(TorControlCommands.EVENT_INFO_MSG); - } - - conn.setEvents(events); - initControlConnection(); - logNotice("SUCCESS added control port event handler"); - } catch (InterruptedException | IOException e) { - e.printStackTrace(); - stopTorOnError(e.getLocalizedMessage()); - conn = null; - } - } - }.start(); - } - - @Override - public void onServiceDisconnected(ComponentName componentName) { - conn = null; - torService = null; - mEventHandler = null; - } - - @Override - public void onNullBinding(ComponentName componentName) { - stopTorOnError("Tor was unable to start: " + "onNullBinding"); - conn = null; - torService = null; - mEventHandler = null; - } - - @Override - public void onBindingDied(ComponentName componentName) { - stopTorOnError("Tor was unable to start: " + "onBindingDied"); - conn = null; - torService = null; - mEventHandler = null; - } - }; - - BroadcastReceiver receiver = new BroadcastReceiver() { - @Override - public void onReceive(Context context, Intent intent) { - if (TorService.ACTION_STATUS.equals(intent.getAction()) - && TorService.STATUS_ON.equals(intent.getStringExtra(TorService.EXTRA_STATUS))) { - initControlConnection(); - unregisterReceiver(this); - } - } - }; - // run the BroadcastReceiver in its own thread - HandlerThread handlerThread = new HandlerThread(receiver.getClass().getSimpleName()); - handlerThread.start(); - Looper looper = handlerThread.getLooper(); - Handler handler = new Handler(looper); - registerReceiver(receiver, new IntentFilter(TorService.ACTION_STATUS), null, handler); - - Intent serviceIntent = new Intent(this, TorService.class); - if (Build.VERSION.SDK_INT < 29) { - shouldUnbindTorService = bindService(serviceIntent, torServiceConnection, BIND_AUTO_CREATE); - } else { - shouldUnbindTorService = bindService(serviceIntent, BIND_AUTO_CREATE, mExecutor, torServiceConnection); - } - } - - protected void exec(Runnable runn) { - mExecutor.execute(runn); - } - - public int getNotifyId() { - return NOTIFY_ID; - } - - public String getProxyStatus() { - return mCurrentStatus; - } - - private static OrbotService self = null; - - public static OrbotService getServiceObject(){ - return self; - } - - private boolean mConnectivity = true; - private int mNetworkType = -1; - private final BroadcastReceiver mNetworkStateReceiver = new BroadcastReceiver() { - @Override - public void onReceive(Context context, Intent intent) { - - SharedPreferences prefs = Prefs.getSharedPrefs(getApplicationContext()); - - if(prefs==null){ - } - - boolean doNetworKSleep = prefs.getBoolean(OrbotConstants.PREF_DISABLE_NETWORK, true); - - final ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); - final NetworkInfo netInfo = cm.getActiveNetworkInfo(); - - boolean newConnectivityState; - int newNetType = -1; - - if (netInfo!=null) - newNetType = netInfo.getType(); - - if(netInfo != null && netInfo.isConnected()) { - // WE ARE CONNECTED: DO SOMETHING - newConnectivityState = true; - } - else { - // WE ARE NOT: DO SOMETHING ELSE - newConnectivityState = false; - } - - mNetworkType = newNetType; - - if (newConnectivityState != mConnectivity) { - mConnectivity = newConnectivityState; - orbotLocalConstants.mNetworkState = mConnectivity; - - if (mConnectivity){ - newIdentity(); - } - } - - if (doNetworKSleep) - { - //setTorNetworkEnabled (mConnectivity); - if (!mConnectivity) - { - //sendCallbackStatus(STATUS_OFF); - orbotLocalConstants.mTorLogsStatus = "No internet connection"; - if(orbotLocalConstants.mNotificationStatus!=0){ - showToolbarNotification(getString(R.string.newnym), getNotifyId(), R.drawable.ic_stat_tor_off); - showToolbarNotification("Genesis is sleeping | Internet connectivity issue",NOTIFY_ID,R.drawable.ic_stat_tor_off); - } - } - else - { - //sendCallbackStatus(STATUS_STARTING); - if(orbotLocalConstants.mNotificationStatus!=0){ - showToolbarNotification(getString(R.string.status_starting_up),NOTIFY_ID,R.drawable.ic_stat_starting_tor_logo); - } - } - - } - orbotLocalConstants.mNetworkState = mConnectivity; - } - }; - - private void initControlConnection() { - if (conn != null) { - logNotice("SUCCESS connected to Tor control port."); - try { - String confSocks = conn.getInfo("net/listeners/socks"); - StringTokenizer st = new StringTokenizer(confSocks, " "); - - confSocks = st.nextToken().split(":")[1]; - confSocks = confSocks.substring(0, confSocks.length() - 1); - mPortSOCKS = Integer.parseInt(confSocks); - - String confHttp = conn.getInfo("net/listeners/httptunnel"); - st = new StringTokenizer(confHttp, " "); - - confHttp = st.nextToken().split(":")[1]; - confHttp = confHttp.substring(0, confHttp.length() - 1); - mPortHTTP = Integer.parseInt(confHttp); - - String confDns = conn.getInfo("net/listeners/dns"); - st = new StringTokenizer(confDns, " "); - if (st.hasMoreTokens()) { - confDns = st.nextToken().split(":")[1]; - confDns = confDns.substring(0, confDns.length() - 1); - mPortDns = Integer.parseInt(confDns); - Prefs.getSharedPrefs(getApplicationContext()).edit().putInt(VpnPrefs.PREFS_DNS_PORT, mPortDns).apply(); - } - - String confTrans = conn.getInfo("net/listeners/trans"); - st = new StringTokenizer(confTrans, " "); - if (st.hasMoreTokens()) { - confTrans = st.nextToken().split(":")[1]; - confTrans = confTrans.substring(0, confTrans.length() - 1); - mPortTrans = Integer.parseInt(confTrans); - } - - sendCallbackPorts(mPortSOCKS, mPortHTTP, mPortDns, mPortTrans); - orbotLocalConstants.mIsTorInitialized = true; - - } catch (IOException e) { - Log.i("sad","asd"); - e.printStackTrace(); - stopTorOnError(e.getLocalizedMessage()); - conn = null; - } - } - } - - public void sendSignalActive() { - if (conn != null && mCurrentStatus == STATUS_ON) { - try { - conn.signal("ACTIVE"); - } catch (IOException e) { - debug("error send active: " + e.getLocalizedMessage()); - } - } - } - - public void newIdentity() { - //it is possible to not have a connection yet, and someone might try to newnym - if (conn != null) { - new Thread() { - public void run() { - try { - int iconId = R.mipmap.ic_stat_tor_logo; - - if (conn != null && mCurrentStatus == STATUS_ON && Prefs.expandedNotifications() && mConnectivity) - showToolbarNotification(getString(R.string.newnym), NOTIFY_ID, R.drawable.ic_stat_starting_tor_logo); - - conn.signal(TorControlCommands.SIGNAL_NEWNYM); - - sleep(1000); - if(mConnectivity) - enableNotification(); - - } catch (Exception ioe) { - debug("error requesting newnym: " + ioe.getLocalizedMessage()); - } - } - }.start(); - } - } - - protected void sendCallbackBandwidth(long lastWritten, long lastRead, long totalWritten, long totalRead) { - Intent intent = new Intent(LOCAL_ACTION_BANDWIDTH); - - intent.putExtra("totalWritten", totalWritten); - intent.putExtra("totalRead", totalRead); - intent.putExtra("lastWritten", lastWritten); - intent.putExtra("lastRead", lastRead); - intent.putExtra(EXTRA_STATUS, mCurrentStatus); - - LocalBroadcastManager.getInstance(this).sendBroadcast(intent); - } - - int e=0; - String mPrevLogs = ""; - private void sendCallbackLogMessage(String logMessage) - { - if(mPrevLogs.equals(logMessage)){ - return; - }else { - mPrevLogs = logMessage; - } - if(logMessage.contains("Bootstrapped 100%")){ - orbotLocalConstants.mIsTorInitialized = true; - } - mHandler.post(() -> { - Intent intent = new Intent(LOCAL_ACTION_LOG); - intent.putExtra(LOCAL_EXTRA_LOG, logMessage); - intent.putExtra(EXTRA_STATUS, mCurrentStatus); - orbotLocalConstants.mTorLogsHistory.add(new logRowModel(logMessage, localHelperMethod.getCurrentTime())); - - if(!mConnectivity){ - orbotLocalConstants.mTorLogsStatus = "No internet connection"; - }else { - orbotLocalConstants.mTorLogsStatus = logMessage; - } - LocalBroadcastManager.getInstance(this).sendBroadcast(intent); - }); - - } - - public boolean getConnectivity(){ - return mConnectivity; - } - - private void sendCallbackPorts(int socksPort, int httpPort, int dnsPort, int transPort) { - - orbotLocalConstants.mSOCKSPort = socksPort; - orbotLocalConstants.mHTTPPort = httpPort; - - Intent intent = new Intent(LOCAL_ACTION_PORTS); // You can also include some extra data. - intent.putExtra(EXTRA_SOCKS_PROXY_PORT, socksPort); - intent.putExtra(EXTRA_HTTP_PROXY_PORT, httpPort); - intent.putExtra(EXTRA_DNS_PORT, dnsPort); - intent.putExtra(EXTRA_TRANS_PORT, transPort); - - LocalBroadcastManager.getInstance(this).sendBroadcast(intent); - - if (Prefs.useVpn()) - mVpnManager.handleIntent(new Builder(), intent); - - } - - protected void sendCallbackStatus(String currentStatus) { - mCurrentStatus = currentStatus; - Intent intent = getActionStatusIntent(currentStatus); - sendBroadcastOnlyToOrbot(intent); // send for Orbot internals, using secure local broadcast - sendBroadcast(intent); // send for any apps that are interested - } - - /** - * Send a secure broadcast only to Orbot itself - * - * @see {@link ContextWrapper#sendBroadcast(Intent)} - * @see {@link LocalBroadcastManager} - */ - private boolean sendBroadcastOnlyToOrbot(Intent intent) { - return LocalBroadcastManager.getInstance(this).sendBroadcast(intent); - } - - private Intent getActionStatusIntent(String currentStatus) { - Intent intent = new Intent(ACTION_STATUS); - intent.putExtra(EXTRA_STATUS, currentStatus); - return intent; - } - - private StringBuffer processSettingsImpl(StringBuffer extraLines) throws IOException { - logNotice(getString(R.string.updating_settings_in_tor_service)); - SharedPreferences prefs = Prefs.getSharedPrefs(getApplicationContext()); - - boolean useBridges = Prefs.bridgesEnabled(); - boolean becomeRelay = prefs.getBoolean(OrbotConstants.PREF_OR, false); - boolean ReachableAddresses = prefs.getBoolean(OrbotConstants.PREF_REACHABLE_ADDRESSES, false); - boolean enableStrictNodes = prefs.getBoolean("pref_strict_nodes", false); - String entranceNodes = prefs.getString("pref_entrance_nodes", ""); - String exitNodes = prefs.getString("pref_exit_nodes", ""); - String excludeNodes = prefs.getString("pref_exclude_nodes", ""); - - if (!useBridges) { - extraLines.append("UseBridges 0").append('\n'); - if (Prefs.useVpn()) { //set the proxy here if we aren't using a bridge - if (!mIsLollipop) { - String proxyType = "socks5"; - extraLines.append(proxyType + "Proxy" + ' ' + OrbotVpnManager.sSocksProxyLocalhost + ':' + OrbotVpnManager.sSocksProxyServerPort).append('\n'); - } - - } else { - String proxyType = prefs.getString("pref_proxy_type", null); - if (proxyType != null && proxyType.length() > 0) { - String proxyHost = prefs.getString("pref_proxy_host", null); - String proxyPort = prefs.getString("pref_proxy_port", null); - String proxyUser = prefs.getString("pref_proxy_username", null); - String proxyPass = prefs.getString("pref_proxy_password", null); - - if ((proxyHost != null && proxyHost.length() > 0) && (proxyPort != null && proxyPort.length() > 0)) { - extraLines.append(proxyType).append("Proxy").append(' ').append(proxyHost).append(':').append(proxyPort).append('\n'); - - if (proxyUser != null && proxyPass != null) { - if (proxyType.equalsIgnoreCase("socks5")) { - extraLines.append("Socks5ProxyUsername").append(' ').append(proxyUser).append('\n'); - extraLines.append("Socks5ProxyPassword").append(' ').append(proxyPass).append('\n'); - } else - extraLines.append(proxyType).append("ProxyAuthenticator").append(' ').append(proxyUser).append(':').append(proxyPort).append('\n'); - - } else if (proxyPass != null) - extraLines.append(proxyType).append("ProxyAuthenticator").append(' ').append(proxyUser).append(':').append(proxyPort).append('\n'); - } - } - } - } else { - - loadBridgeDefaults(); - extraLines.append("UseBridges 1").append('\n'); - // extraLines.append("UpdateBridgesFromAuthority 1").append('\n'); - - String bridgeList = Prefs.getBridgesList(); - - String builtInBridgeType = null; - - //check if any PT bridges are needed - if (bridgeList.contains("obfs")) { - - extraLines.append("ClientTransportPlugin obfs3 socks5 127.0.0.1:" + IPtProxy.obfs3Port()).append('\n'); - extraLines.append("ClientTransportPlugin obfs4 socks5 127.0.0.1:" + IPtProxy.obfs4Port()).append('\n'); - - if (bridgeList.equals("obfs4")) - builtInBridgeType = "obfs4"; - } - - if (bridgeList.equals("meek")) { - extraLines.append("ClientTransportPlugin meek_lite socks5 127.0.0.1:" + IPtProxy.meekPort()).append('\n'); - builtInBridgeType = "meek_lite"; - } - - if (bridgeList.equals("snowflake")) { - extraLines.append("ClientTransportPlugin snowflake socks5 127.0.0.1:" + IPtProxy.snowflakePort()).append('\n'); - builtInBridgeType = "snowflake"; - } - - if (!TextUtils.isEmpty(builtInBridgeType)) - getBridges(builtInBridgeType, extraLines); - else { - String[] bridgeListLines = parseBridgesFromSettings(bridgeList); - int bridgeIdx = (int) Math.floor(Math.random() * ((double) bridgeListLines.length)); - String bridgeLine = bridgeListLines[bridgeIdx]; - extraLines.append("Bridge "); - extraLines.append(bridgeLine); - extraLines.append("\n"); - } - } - - //only apply GeoIP if you need it - File fileGeoIP = new File(appBinHome, GEOIP_ASSET_KEY); - File fileGeoIP6 = new File(appBinHome, GEOIP6_ASSET_KEY); - - if (fileGeoIP.exists()) { - extraLines.append("GeoIPFile" + ' ').append(fileGeoIP.getCanonicalPath()).append('\n'); - extraLines.append("GeoIPv6File" + ' ').append(fileGeoIP6.getCanonicalPath()).append('\n'); - } - - if (!TextUtils.isEmpty(entranceNodes)) - extraLines.append("EntryNodes" + ' ').append(entranceNodes).append('\n'); - - if (!TextUtils.isEmpty(exitNodes)) - extraLines.append("ExitNodes" + ' ').append(exitNodes).append('\n'); - - if (!TextUtils.isEmpty(excludeNodes)) - extraLines.append("ExcludeNodes" + ' ').append(excludeNodes).append('\n'); - - extraLines.append("StrictNodes" + ' ').append(enableStrictNodes ? "1" : "0").append('\n'); - - try { - if (ReachableAddresses) { - String ReachableAddressesPorts = prefs.getString(OrbotConstants.PREF_REACHABLE_ADDRESSES_PORTS, "*:80,*:443"); - extraLines.append("ReachableAddresses" + ' ').append(ReachableAddressesPorts).append('\n'); - } - - } catch (Exception e) { - showToolbarNotification(getString(R.string.your_reachableaddresses_settings_caused_an_exception_), ERROR_NOTIFY_ID, R.drawable.ic_stat_notifyerr); - return null; - } - - try { - if (becomeRelay && (!useBridges) && (!ReachableAddresses)) { - int ORPort = Integer.parseInt(Objects.requireNonNull(prefs.getString(OrbotConstants.PREF_OR_PORT, "9001"))); - String nickname = prefs.getString(OrbotConstants.PREF_OR_NICKNAME, "Orbot"); - String dnsFile = writeDNSFile(); - - extraLines.append("ServerDNSResolvConfFile").append(' ').append(dnsFile).append('\n'); - extraLines.append("ORPort").append(' ').append(ORPort).append('\n'); - extraLines.append("Nickname").append(' ').append(nickname).append('\n'); - extraLines.append("ExitPolicy").append(' ').append("reject *:*").append('\n'); - - } - } catch (Exception e) { - showToolbarNotification(getString(R.string.your_relay_settings_caused_an_exception_), ERROR_NOTIFY_ID, R.drawable.ic_stat_notifyerr); - return null; - } - - if (false) { - ContentResolver contentResolver = getApplicationContext().getContentResolver(); - addV3OnionServicesToTorrc(extraLines, contentResolver); - addV3ClientAuthToTorrc(extraLines, contentResolver); - addV2HiddenServicesToTorrc(extraLines, contentResolver); - addV2ClientCookiesToTorrc(extraLines, contentResolver); - } - - return extraLines; - } - - public static String formatBandwidthCount(Context context, long bitsPerSecond) { - NumberFormat nf = NumberFormat.getInstance(Locale.getDefault()); - if (bitsPerSecond < 1e6) - return nf.format(Math.round(((float) ((int) (bitsPerSecond * 10 / 1024)) / 10))) - + "kbps"; - else - return nf.format(Math.round(((float) ((int) (bitsPerSecond * 100 / 1024 / 1024)) / 100))) - + "mbps"; - } - - private void addV3OnionServicesToTorrc(StringBuffer torrc, ContentResolver contentResolver) { - try { - Cursor onionServices = contentResolver.query(V3_ONION_SERVICES_CONTENT_URI, V3_ONION_SERVICE_PROJECTION, OnionService.ENABLED + "=1", null, null); - if (onionServices != null) { - while (onionServices.moveToNext()) { - int id = onionServices.getInt(onionServices.getColumnIndex(OnionService._ID)); - int localPort = onionServices.getInt(onionServices.getColumnIndex(OnionService.PORT)); - int onionPort = onionServices.getInt(onionServices.getColumnIndex(OnionService.ONION_PORT)); - String path = onionServices.getString(onionServices.getColumnIndex(OnionService.PATH)); - String domain = onionServices.getString(onionServices.getColumnIndex(OnionService.DOMAIN)); - if (path == null) { - path = "v3"; - if (domain == null) - path += UUID.randomUUID().toString(); - else - path += localPort; - ContentValues cv = new ContentValues(); - cv.put(OnionService.PATH, path); - contentResolver.update(V3_ONION_SERVICES_CONTENT_URI, cv, OnionService._ID + "=" + id, null); - } - String v3DirPath = new File(mV3OnionBasePath.getAbsolutePath(), path).getCanonicalPath(); - torrc.append("HiddenServiceDir ").append(v3DirPath).append("\n"); - torrc.append("HiddenServiceVersion 3").append("\n"); - torrc.append("HiddenServicePort ").append(onionPort).append(" 127.0.0.1:").append(localPort).append("\n"); - } - onionServices.close(); - } - } catch (Exception e) { - Log.i("sad","asd"); - Log.e(TAG, e.getLocalizedMessage()); - } - } - - private void addV2HiddenServicesToTorrc(StringBuffer torrc, ContentResolver contentResolver) { - try { - Cursor hidden_services = contentResolver.query(V2_HS_CONTENT_URI, LEGACY_V2_ONION_SERVICE_PROJECTION, OnionService.ENABLED + "=1", null, null); - if (hidden_services != null) { - try { - while (hidden_services.moveToNext()) { - int id = hidden_services.getInt(hidden_services.getColumnIndex(OnionService._ID)); - String HSname = hidden_services.getString(hidden_services.getColumnIndex(OnionService.NAME)); - String domain = hidden_services.getString(hidden_services.getColumnIndex(OnionService.DOMAIN)); - int HSLocalPort = hidden_services.getInt(hidden_services.getColumnIndex(OnionService.PORT)); - int HSOnionPort = hidden_services.getInt(hidden_services.getColumnIndex(OnionService.ONION_PORT)); - int HSAuthCookie = hidden_services.getInt(hidden_services.getColumnIndex(OnionService.AUTH_COOKIE)); - String path = hidden_services.getString(hidden_services.getColumnIndex(OnionService.PATH)); - - // logic to fix bug where you can't have 2+ hidden services on same local port without breaking services that were configured before the bug fix - if (path == null) { - String newPath = "hs"; - if (domain == null) - newPath +=UUID.randomUUID().toString(); - else - newPath += HSLocalPort; - - ContentValues cv = new ContentValues(); - cv.put(OnionService.PATH, newPath); - contentResolver.update(V2_HS_CONTENT_URI, cv, OnionService._ID + "=" + id, null); - path = newPath; - } - - String hsDirPath = new File(mHSBasePath.getAbsolutePath(), path).getCanonicalPath(); - - - debug("Adding hidden service on port: " + HSLocalPort); - - torrc.append("HiddenServiceDir" + ' ' + hsDirPath).append('\n'); - torrc.append("HiddenServiceVersion 2").append('\n'); - torrc.append("HiddenServicePort" + ' ' + HSOnionPort + " 127.0.0.1:" + HSLocalPort).append('\n'); - - if (HSAuthCookie == 1) - torrc.append("HiddenServiceAuthorizeClient stealth " + HSname).append('\n'); - } - } catch (NumberFormatException e) { - Log.e(OrbotConstants.TAG, "error parsing hsport", e); - } catch (Exception e) { - Log.e(OrbotConstants.TAG, "error starting share server", e); - } - - hidden_services.close(); - } - } catch (SecurityException se) { - Log.i("sad","asd"); - } - } - - public static String buildV3ClientAuthFile(String domain, String keyHash) { - return domain + ":descriptor:x25519:" + keyHash; - } - - private void addV3ClientAuthToTorrc(StringBuffer torrc, ContentResolver contentResolver) { - Cursor v3auths = contentResolver.query(V3_CLIENT_AUTH_URI, V3_CLIENT_AUTH_PROJECTION, V3ClientAuth.ENABLED + "=1", null, null); - if (v3auths != null) { - for (File file : mV3AuthBasePath.listFiles()) { - if (!file.isDirectory()) - file.delete(); // todo the adapter should maybe just write these files and not do this in service... - } - torrc.append("ClientOnionAuthDir " + mV3AuthBasePath.getAbsolutePath()).append('\n'); - try { - int i = 0; - while (v3auths.moveToNext()) { - String domain = v3auths.getString(v3auths.getColumnIndex(V3ClientAuth.DOMAIN)); - String hash = v3auths.getString(v3auths.getColumnIndex(V3ClientAuth.HASH)); - File authFile = new File(mV3AuthBasePath, (i++) + ".auth_private"); - authFile.createNewFile(); - FileOutputStream fos = new FileOutputStream(authFile); - fos.write(buildV3ClientAuthFile(domain, hash).getBytes()); - fos.close(); - } - } catch (Exception e) { - Log.e(TAG, "error adding v3 client auth..."); - } - } - } - - private void addV2ClientCookiesToTorrc(StringBuffer torrc, ContentResolver contentResolver) { - try { - Cursor client_cookies = contentResolver.query(COOKIE_CONTENT_URI, LEGACY_COOKIE_PROJECTION, ClientCookie.ENABLED + "=1", null, null); - if (client_cookies != null) { - try { - while (client_cookies.moveToNext()) { - String domain = client_cookies.getString(client_cookies.getColumnIndex(ClientCookie.DOMAIN)); - String cookie = client_cookies.getString(client_cookies.getColumnIndex(ClientCookie.AUTH_COOKIE_VALUE)); - torrc.append("HidServAuth" + ' ' + domain + ' ' + cookie).append('\n'); - } - } catch (Exception e) { - Log.e(OrbotConstants.TAG, "error starting share server", e); - } - client_cookies.close(); - } - } catch (SecurityException se) { - Log.i("sad","asd"); - } - } - - //using Google DNS for now as the public DNS server - private String writeDNSFile() throws IOException { - File file = new File(appBinHome, "resolv.conf"); - - PrintWriter bw = new PrintWriter(new FileWriter(file)); - bw.println("nameserver 8.8.8.8"); - bw.println("nameserver 8.8.4.4"); - bw.close(); - - return file.getCanonicalPath(); - } - - @SuppressLint("NewApi") - @Override - public void onTrimMemory(int level) { - super.onTrimMemory(level); - - switch (level) { - case TRIM_MEMORY_BACKGROUND: - debug("trim memory requested: app in the background"); - break; - - case TRIM_MEMORY_COMPLETE: - debug("trim memory requested: cleanup all memory"); - break; - - case TRIM_MEMORY_MODERATE: - debug("trim memory requested: clean up some memory"); - break; - - case TRIM_MEMORY_RUNNING_CRITICAL: - debug("trim memory requested: memory on device is very low and critical"); - break; - - case TRIM_MEMORY_RUNNING_LOW: - debug("trim memory requested: memory on device is running low"); - break; - - case TRIM_MEMORY_RUNNING_MODERATE: - debug("trim memory requested: memory on device is moderate"); - break; - - case TRIM_MEMORY_UI_HIDDEN: - debug("trim memory requested: app is not showing UI anymore"); - break; - } - } - - @Override - public IBinder onBind(Intent intent) { - Log.e(TAG, "onBind"); - return super.onBind(intent); // invoking super class will call onRevoke() when appropriate - } - - // system calls this method when VPN disconnects (either by the user or another VPN app) - @Override - public void onRevoke() { - Prefs.putUseVpn(false); - mVpnManager.handleIntent(new Builder(), new Intent(ACTION_STOP_VPN)); - // tell UI, if it's open, to update immediately (don't wait for onResume() in Activity...) - LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent(ACTION_STOP_VPN)); - } - - private void setExitNode(String newExits) { - SharedPreferences prefs = Prefs.getSharedPrefs(getApplicationContext()); - - if (TextUtils.isEmpty(newExits)) { - prefs.edit().remove("pref_exit_nodes").apply(); - - if (conn != null) { - try { - ArrayList resetBuffer = new ArrayList<>(); - resetBuffer.add("ExitNodes"); - resetBuffer.add("StrictNodes"); - conn.resetConf(resetBuffer); - conn.setConf("DisableNetwork", "1"); - conn.setConf("DisableNetwork", "0"); - - } catch (Exception ioe) { - Log.e(OrbotConstants.TAG, "Connection exception occured resetting exits", ioe); - } - } - } else { - prefs.edit().putString("pref_exit_nodes", newExits).apply(); - - if (conn != null) { - try { - File fileGeoIP = new File(appBinHome, GEOIP_ASSET_KEY); - File fileGeoIP6 = new File(appBinHome, GEOIP6_ASSET_KEY); - - conn.setConf("GeoIPFile", fileGeoIP.getCanonicalPath()); - conn.setConf("GeoIPv6File", fileGeoIP6.getCanonicalPath()); - - conn.setConf("ExitNodes", newExits); - conn.setConf("StrictNodes", "1"); - - conn.setConf("DisableNetwork", "1"); - conn.setConf("DisableNetwork", "0"); - - } catch (Exception ioe) { - Log.e(OrbotConstants.TAG, "Connection exception occured resetting exits", ioe); - } - } - } - - } - - private void loadBridgeDefaults() { - if (alBridges == null) { - alBridges = new ArrayList<>(); - - try { - - BufferedReader in = new BufferedReader(new InputStreamReader(getResources().openRawResource(R.raw.bridges), "UTF-8")); - - if(mBridgesDefault.length()>1){ - Reader inputString = new StringReader(mBridgesDefault); - in = new BufferedReader(inputString); - } - String str; - - while ((str = in.readLine()) != null) { - - StringTokenizer st = new StringTokenizer(str, " "); - Bridge b = new Bridge(); - b.type = st.nextToken(); - - StringBuffer sbConfig = new StringBuffer(); - - while (st.hasMoreTokens()) - sbConfig.append(st.nextToken()).append(' '); - - b.config = sbConfig.toString().trim(); - - alBridges.add(b); - - } - - in.close(); - } catch (Exception e) { - Log.i("sad","asd"); - e.printStackTrace(); - } - } - - } - - private void getBridges(String type, StringBuffer extraLines) { - - Collections.shuffle(alBridges, bridgeSelectRandom); - - int maxBridges = 12; - int bridgeCount = 0; - - - if(orbotLocalConstants.mIsManualBridge){ - List mList = Arrays.asList(orbotLocalConstants.mBridges.split("\n")); - alBridges.clear(); - - for(int e=0;e maxBridges) - break; - } - } - } - - - public static final class OnionService implements BaseColumns { - public static final String NAME = "name"; - public static final String PORT = "port"; - public static final String ONION_PORT = "onion_port"; - public static final String DOMAIN = "domain"; - public static final String AUTH_COOKIE = "auth_cookie"; - public static final String AUTH_COOKIE_VALUE = "auth_cookie_value"; - public static final String ENABLED = "enabled"; - public static final String PATH = "filepath"; - } - - public static final class V3ClientAuth implements BaseColumns { - public static final String DOMAIN = "domain"; - public static final String HASH = "hash"; - public static final String ENABLED = "enabled"; - } - - public static final class ClientCookie implements BaseColumns { - public static final String DOMAIN = "domain"; - public static final String AUTH_COOKIE_VALUE = "auth_cookie_value"; - public static final String ENABLED = "enabled"; - } - - // for bridge loading from the assets default bridges.txt file - static class Bridge { - String type; - String config; - - public Bridge(String pConfig,String pType){ - config = pConfig; - type = pType; - } - - public Bridge(){ - } - } - - private class IncomingIntentRouter implements Runnable { - Intent mIntent; - - public IncomingIntentRouter(Intent intent) { - mIntent = intent; - } - - public void run() { - String action = mIntent.getAction(); - - if (!TextUtils.isEmpty(action)) { - if (action.equals(ACTION_START) || action.equals(ACTION_START_ON_BOOT)) { - - if (Prefs.bridgesEnabled()) { - if (useIPtObfsMeekProxy()) - IPtProxy.startObfs4Proxy("DEBUG", false, false); - else if (useIPtSnowflakeProxy()) - startSnowflakeClient(); - } else if (Prefs.beSnowflakeProxy()) { - - if (Prefs.limitSnowflakeProxying()) - { - if (isChargingAndWifi(OrbotService.this)) - { - enableSnowflakeProxy(); - } - - } - else - enableSnowflakeProxy(); - } - - startTor(); - replyWithStatus(mIntent); - - if (Prefs.useVpn()) { - if (mVpnManager != null - && (!mVpnManager.isStarted())) { - //start VPN here - Intent vpnIntent = VpnService.prepare(OrbotService.this); - if (vpnIntent == null) //then we can run the VPN - { - mVpnManager.handleIntent(new Builder(), mIntent); - - } - } - - if (mPortSOCKS != -1 && mPortHTTP != -1) - sendCallbackPorts(mPortSOCKS, mPortHTTP, mPortDns, mPortTrans); - } - } else if (action.equals(ACTION_STOP)) { - stopTorAsync(); - } else if (action.equals(ACTION_START_VPN)) { - if (mVpnManager != null && (!mVpnManager.isStarted())) { - //start VPN here - Intent vpnIntent = VpnService.prepare(OrbotService.this); - if (vpnIntent == null) { //then we can run the VPN - mVpnManager.handleIntent(new Builder(), mIntent); - } - } - - if (mPortSOCKS != -1 && mPortHTTP != -1) - sendCallbackPorts(mPortSOCKS, mPortHTTP, mPortDns, mPortTrans); - - - } else if (action.equals(ACTION_STOP_VPN)) { - if (mVpnManager != null) - mVpnManager.handleIntent(new Builder(), mIntent); - } else if (action.equals(ACTION_STATUS)) { - replyWithStatus(mIntent); - } else if (action.equals(TorControlCommands.SIGNAL_RELOAD)) { - requestTorRereadConfig(); - } else if (action.equals(TorControlCommands.SIGNAL_NEWNYM)) { - newIdentity(); - } else if (action.equals(CMD_ACTIVE)) { - sendSignalActive(); - } else if (action.equals(CMD_SET_EXIT)) { - setExitNode(mIntent.getStringExtra("exit")); - } else { - Log.w(OrbotConstants.TAG, "unhandled OrbotService Intent: " + action); - } - } - } - } - - private void enableSnowflakeProxy () { - int capacity = 1; - String broker = "https://snowflake-broker.bamsoftware.com/"; - String relay = "wss://snowflake.bamsoftware.com/"; - String stun = "stun:stun.stunprotocol.org:3478"; - String logFile = null; - boolean keepLocalAddresses = true; - boolean unsafeLogging = false; - IPtProxy.startSnowflakeProxy(capacity, broker, relay, stun, logFile, keepLocalAddresses, unsafeLogging); - - logNotice("Snowflake Proxy mode ENABLED"); - } - - public void disableNotification(){ - if(mNotificationManager!=null){ - mNotificationManager.cancel(NOTIFY_ID); - stopForeground(true); - orbotLocalConstants.mNotificationStatus = 0; - } - } - - public void enableTorNotificationNoBandwidth(){ - orbotLocalConstants.mNotificationStatus = 1; - showToolbarNotification("Connected to the Tor network", HS_NOTIFY_ID, R.mipmap.ic_stat_tor_logo); - } - - public void enableNotification(){ - if(mConnectivity && orbotLocalConstants.mIsTorInitialized){ - orbotLocalConstants.mNotificationStatus = 1; - showToolbarNotification(0+"kbps ⇣ / " +0+"kbps ⇡", HS_NOTIFY_ID, R.mipmap.ic_stat_tor_logo); - } - } - - public void onSettingRegister(){ - try { - Intent intent = null; - intent = new Intent(this, Class.forName("com.darkweb.genesissearchengine.appManager.settingManager.notificationManager.settingNotificationController")); - intent.setFlags(FLAG_ACTIVITY_NEW_TASK); - getApplicationContext().startActivity(intent); - } catch (ClassNotFoundException e) { - Log.i("sad","asd"); - e.printStackTrace(); - } - } - - public static boolean isChargingAndWifi(Context context) { - Intent intent = context.registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED)); - int plugged = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1); - boolean isCharging = plugged == BatteryManager.BATTERY_PLUGGED_AC || plugged == BatteryManager.BATTERY_PLUGGED_USB || plugged == BatteryManager.BATTERY_PLUGGED_WIRELESS; - - ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); - - boolean isUnmetered = cm.getActiveNetworkInfo() != null - && cm.getActiveNetworkInfo().isConnected() - && (!cm.isActiveNetworkMetered()); - - return isCharging && isUnmetered; - } - - private class ActionBroadcastReceiver extends BroadcastReceiver { - public void onReceive(Context context, Intent intent) { - switch (intent.getAction()) { - case CMD_NEWNYM: { - newIdentity(); - break; - } - case CMD_SETTING: { - onSettingRegister(); - break; - } - case CMD_ACTIVE: { - sendSignalActive(); - break; - } - } - } - } - -} +package org.orbotproject.android.service; + +import android.annotation.SuppressLint; +import android.app.Application; +import android.app.Notification; +import android.app.NotificationChannel; +import android.app.NotificationManager; +import android.app.PendingIntent; +import android.app.Service; +import android.content.BroadcastReceiver; +import android.content.ComponentName; +import android.content.ContentResolver; +import android.content.ContentValues; +import android.content.Context; +import android.content.ContextWrapper; +import android.content.Intent; +import android.content.IntentFilter; +import android.content.ServiceConnection; +import android.content.SharedPreferences; +import android.content.pm.PackageManager; +import android.database.Cursor; +import android.net.ConnectivityManager; +import android.net.NetworkInfo; +import android.net.Uri; +import android.net.VpnService; +import android.os.BatteryManager; +import android.os.Build; +import android.os.Handler; +import android.os.HandlerThread; +import android.os.IBinder; +import android.os.Looper; +import android.provider.BaseColumns; +import android.text.TextUtils; +import android.util.Log; + +import net.freehaven.tor.control.TorControlCommands; +import net.freehaven.tor.control.TorControlConnection; + +import org.orbotproject.android.service.util.CustomTorResourceInstaller; +import org.orbotproject.android.service.util.DummyActivity; +import org.orbotproject.android.service.util.Prefs; +import org.orbotproject.android.service.util.TorServiceUtils; +import org.orbotproject.android.service.util.Utils; +import org.orbotproject.android.service.vpn.OrbotVpnManager; +import org.orbotproject.android.service.vpn.VpnPrefs; +import org.orbotproject.android.service.wrapper.localHelperMethod; +import org.orbotproject.android.service.wrapper.logRowModel; +import org.orbotproject.android.service.wrapper.orbotLocalConstants; +import org.torproject.jni.TorService; + +import java.io.BufferedReader; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.PrintStream; +import java.io.PrintWriter; +import java.io.Reader; +import java.io.StringReader; +import java.text.NumberFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Objects; +import java.util.Random; +import java.util.StringTokenizer; +import java.util.UUID; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeoutException; + +import IPtProxy.IPtProxy; +import androidx.annotation.RequiresApi; +import androidx.core.app.NotificationCompat; +import androidx.localbroadcastmanager.content.LocalBroadcastManager; + +import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; + +public class OrbotService extends VpnService implements TorServiceConstants, OrbotConstants { + + public final static String BINARY_TOR_VERSION = TorService.VERSION_NAME; + + static final int NOTIFY_ID = 1; + private static final int ERROR_NOTIFY_ID = 3; + private static final int HS_NOTIFY_ID = 4; + private static final Uri V2_HS_CONTENT_URI = Uri.parse("content://org.torproject.android.ui.hiddenservices.providers.genesishiddenservices/hs"); + private static final Uri V3_ONION_SERVICES_CONTENT_URI = Uri.parse("content://org.torproject.android.ui.v3onionservice.genesishiddenservices/v3"); + private static final Uri COOKIE_CONTENT_URI = Uri.parse("content://org.torproject.android.ui.hiddenservices.providers.genesishiddenservices.cookie/cookie"); + private static final Uri V3_CLIENT_AUTH_URI = Uri.parse("content://org.torproject.android.ui.v3onionservice.genesishiddenservices.clientauth/v3auth"); + private final static String NOTIFICATION_CHANNEL_ID = "orbot_channel_1"; + private static final String[] LEGACY_V2_ONION_SERVICE_PROJECTION = new String[]{ + OnionService._ID, + OnionService.NAME, + OnionService.DOMAIN, + OnionService.PORT, + OnionService.AUTH_COOKIE, + OnionService.AUTH_COOKIE_VALUE, + OnionService.ONION_PORT, + OnionService.ENABLED, + OnionService.PATH}; + private static final String[] V3_ONION_SERVICE_PROJECTION = new String[]{ + OnionService._ID, + OnionService.NAME, + OnionService.DOMAIN, + OnionService.PORT, + OnionService.ONION_PORT, + OnionService.ENABLED, + OnionService.PATH + }; + private static final String[] LEGACY_COOKIE_PROJECTION = new String[]{ + ClientCookie._ID, + ClientCookie.DOMAIN, + ClientCookie.AUTH_COOKIE_VALUE, + ClientCookie.ENABLED}; + private static final String[] V3_CLIENT_AUTH_PROJECTION = new String[]{ + V3ClientAuth._ID, + V3ClientAuth.DOMAIN, + V3ClientAuth.HASH, + V3ClientAuth.ENABLED + }; + + public boolean isAppClosed = false; + public static int mPortSOCKS = -1; + public static int mPortHTTP = -1; + public static int mPortDns = TOR_DNS_PORT_DEFAULT; + public static int mPortTrans = TOR_TRANSPROXY_PORT_DEFAULT; + public static File appBinHome; + public static File appCacheHome; + private final ExecutorService mExecutor = Executors.newCachedThreadPool(); + boolean mIsLollipop = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP; + TorEventHandler mEventHandler; + OrbotVpnManager mVpnManager; + Handler mHandler; + //we should randomly sort alBridges so we don't have the same bridge order each time + Random bridgeSelectRandom = new Random(System.nanoTime()); + ActionBroadcastReceiver mActionBroadcastReceiver; + private String mCurrentStatus = STATUS_OFF; + private TorControlConnection conn = null; + private ServiceConnection torServiceConnection; + private TorService torService; + private boolean shouldUnbindTorService; + private NotificationManager mNotificationManager = null; + private NotificationCompat.Builder mNotifyBuilder; + private boolean mNotificationShowing = false; + private File mHSBasePath, mV3OnionBasePath, mV3AuthBasePath; + private ArrayList alBridges = null; + + /** + * @param bridgeList bridges that were manually entered into Orbot settings + * @return Array with each bridge as an element, no whitespace entries see issue #289... + */ + private static String[] parseBridgesFromSettings(String bridgeList) { + // this regex replaces lines that only contain whitespace with an empty String + bridgeList = bridgeList.trim().replaceAll("(?m)^[ \t]*\r?\n", ""); + return bridgeList.split("\\n"); + } + + public void debug(String msg) { + Log.d(TAG, msg); + + if (Prefs.useDebugLogging()) { + sendCallbackLogMessage(msg); + } + } + + public void logException(String msg, Exception e) { + if (Prefs.useDebugLogging()) { + Log.e(TAG, msg, e); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + e.printStackTrace(new PrintStream(baos)); + + sendCallbackLogMessage(msg + '\n' + new String(baos.toByteArray())); + + } else + sendCallbackLogMessage(msg); + + } + + private void showConnectedToTorNetworkNotification() { + showToolbarNotification(getString(R.string.status_activated), NOTIFY_ID, R.mipmap.ic_stat_tor_logo); + } + + @Override + public void onLowMemory() { + super.onLowMemory(); + logNotice("Low Memory Warning!"); + } + + private void clearNotifications() { + if (mNotificationManager != null) + mNotificationManager.cancelAll(); + + if (mEventHandler != null) + mEventHandler.getNodes().clear(); + + mNotificationShowing = false; + } + + @RequiresApi(api = Build.VERSION_CODES.O) + private void createNotificationChannel() { + NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); + + CharSequence name = getString(R.string.app_name); // The user-visible name of the channel. + String description = getString(R.string.app_description); // The user-visible description of the channel. + NotificationChannel mChannel = new NotificationChannel(NOTIFICATION_CHANNEL_ID, name, NotificationManager.IMPORTANCE_LOW); + // Configure the notification channel. + mChannel.setDescription(description); + mChannel.enableLights(false); + mChannel.enableVibration(false); + mChannel.setShowBadge(false); + mChannel.setLockscreenVisibility(Notification.VISIBILITY_SECRET); + mNotificationManager.createNotificationChannel(mChannel); + } + + boolean mToolbarUpdating = false; + @SuppressLint({"NewApi", "RestrictedApi"}) + public void showToolbarNotification(String notifyMsg, int notifyType, int icon) { + if(!mToolbarUpdating){ + mToolbarUpdating = true; + }else { + return; + } + + try{ + if(isAppClosed){ + Log.i("superman", "superman"); + return; + } + PackageManager pm = getPackageManager(); + Intent intent = pm.getLaunchIntentForPackage(getPackageName()); + PendingIntent pendIntent = PendingIntent.getActivity(OrbotService.this, 0, intent, 0); + + if (mNotifyBuilder == null) { + mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); + mNotifyBuilder = new NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID) + .setContentTitle(getString(R.string.app_name)) + .setSmallIcon(R.mipmap.ic_stat_tor_logo) + .setContentIntent(pendIntent) + .setCategory(Notification.CATEGORY_SERVICE) + .setOngoing(Prefs.persistNotifications()); + } + + mNotifyBuilder.mActions.clear(); + if (conn != null && orbotLocalConstants.mIsTorInitialized) { + Intent intentRefresh = new Intent(CMD_NEWNYM); + PendingIntent pendingIntentNewNym = PendingIntent.getBroadcast(this, 0, intentRefresh, PendingIntent.FLAG_UPDATE_CURRENT); + mNotifyBuilder.addAction(R.mipmap.ic_stat_tor_logo, getString(R.string.menu_new_identity), pendingIntentNewNym); + + Intent intentSetting = new Intent(CMD_SETTING); + PendingIntent pendingIntentSetting = PendingIntent.getBroadcast(this, 0, intentSetting, PendingIntent.FLAG_UPDATE_CURRENT); + mNotifyBuilder.addAction(0, "Notification Settings", pendingIntentSetting); + } + + mNotifyBuilder.setContentText(notifyMsg) + .setSmallIcon(icon) + .setTicker(notifyType != NOTIFY_ID ? notifyMsg : null); + + if (!Prefs.persistNotifications()) + mNotifyBuilder.setPriority(Notification.PRIORITY_LOW); + + Notification notification = mNotifyBuilder.build(); + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + startForeground(11337, notification); + } else if (Prefs.persistNotifications() && (!mNotificationShowing)) { + startForeground(11337, notification); + logNotice("Set background service to FOREGROUND"); + } else { + mNotificationManager.notify(NOTIFY_ID, notification); + } + }catch (Exception ex){ + Log.i("sad","asd"); + } + + mNotificationShowing = true; + mToolbarUpdating = false; + } + + public int onStartCommand(Intent intent, int flags, int startId) { + showToolbarNotification("", NOTIFY_ID, R.mipmap.ic_stat_tor_logo); + + self = this; + if (intent != null) + mExecutor.execute(new IncomingIntentRouter(intent)); + else + Log.d(TAG, "Got null onStartCommand() intent"); + + return Service.START_STICKY; + } + + @Override + public void onTaskRemoved(Intent rootIntent) { + try{ + Intent intent = new Intent(this, DummyActivity.class); + intent.addFlags(FLAG_ACTIVITY_NEW_TASK); + startActivity(intent); + }catch (Exception ignored){ + Log.i("sda","ASd"); + + } + } + + @Override + public void onDestroy() { + + try { + disableNotification(); + clearNotifications(); + unregisterReceiver(mNetworkStateReceiver); + unregisterReceiver(mActionBroadcastReceiver); + }catch (Exception ex){ + Log.i("sad","asd"); + ex.printStackTrace(); + } + + isAppClosed = true; + + try { + stopTor(); + stopTorAsync(); + clearNotifications(); + killAllDaemons(); + } catch (Exception exception) { + exception.printStackTrace(); + } + + super.onDestroy(); + } + + private void killAllDaemons() throws Exception { + + if (conn != null) { + logNotice("Using control port to shutdown Tor"); + + try { + logNotice("sending HALT signal to Tor process"); + conn.shutdownTor("SHUTDOWN"); + + } catch (IOException e) { + Log.d(TAG, "error shutting down Tor via connection", e); + } + + conn = null; + } + } + + private void stopTorAsync() { + + debug("stopTor"); + + try { + sendCallbackStatus(STATUS_STOPPING); + sendCallbackLogMessage(getString(R.string.status_shutting_down)); + + if (Prefs.bridgesEnabled()) { + if (useIPtObfsMeekProxy()) + IPtProxy.stopObfs4Proxy(); + else if (useIPtSnowflakeProxy()) + IPtProxy.stopSnowflake(); + } + else if (Prefs.beSnowflakeProxy()) + disableSnowflakeProxy(); + + stopTor(); + + //stop the foreground priority and make sure to remove the persistant notification + stopForeground(true); + + sendCallbackLogMessage(getString(R.string.status_disabled)); + } catch (Exception e) { + logNotice("An error occured stopping Tor: " + e.getMessage()); + sendCallbackLogMessage(getString(R.string.something_bad_happened)); + } + clearNotifications(); + sendCallbackStatus(STATUS_OFF); + } + + private void disableSnowflakeProxy () { + IPtProxy.stopSnowflakeProxy(); + logNotice("Snowflake Proxy mode DISABLED"); + } + + private void stopTorOnError(String message) { + stopTorAsync(); + showToolbarNotification( + getString(R.string.unable_to_start_tor) + ": " + message, + ERROR_NOTIFY_ID, R.drawable.ic_stat_notifyerr); + } + + private static boolean useIPtObfsMeekProxy() { + String bridgeList = Prefs.getBridgesList(); + return bridgeList.contains("obfs") || bridgeList.contains("meek"); + } + + private static boolean useIPtSnowflakeProxy() { + String bridgeList = Prefs.getBridgesList(); + return bridgeList.contains("snowflake"); + } + + private static HashMap mFronts; + + public static void loadCdnFronts (Context context) { + if (mFronts == null) { + mFronts = new HashMap<>(); + try { + BufferedReader reader = new BufferedReader(new InputStreamReader(context.getAssets().open("fronts"))); + String line; + while ((line = reader.readLine())!=null) { + String[] front = line.split(" "); + mFronts.put(front[0],front[1]); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + public static String getCdnFront(String service) { + return mFronts.get(service); + } + + private void startSnowflakeClient() { + String target = getCdnFront("snowflake-target"); + String front = getCdnFront("snowflake-front"); + String stunServer = getCdnFront("snowflake-stun"); + IPtProxy.startSnowflake(stunServer, target, front,null, true, false, true, 3); + } + + /* + This is to host a snowflake entrance node / bridge + */ + private void runSnowflakeProxy () { + int capacity = 3; + String broker = "https://snowflake-broker.bamsoftware.com/"; + String relay = "wss://snowflake.bamsoftware.com/"; + String stun = "stun:stun.stunprotocol.org:3478"; + String logFile = null; + boolean keepLocalAddresses = true; + boolean unsafeLogging = false; + IPtProxy.startSnowflakeProxy(capacity, broker, relay, stun, logFile, keepLocalAddresses, unsafeLogging); + } + + private void stopSnowflakeProxy () { + IPtProxy.stopSnowflakeProxy(); + } + /** + * if someone stops during startup, we may have to wait for the conn port to be setup, so we can properly shutdown tor + */ + private synchronized void stopTor() throws Exception { + + if (conn != null) { + logNotice("Using control port to shutdown Tor"); + + try { + logNotice("sending HALT signal to Tor process"); + conn.shutdownTor(TorControlCommands.SIGNAL_SHUTDOWN); + + } catch (IOException e) { + Log.d(TAG, "error shutting down Tor via connection", e); + } + + if (shouldUnbindTorService) { + unbindService(torServiceConnection); + shouldUnbindTorService = false; + } + + conn = null; + } + } + + private void requestTorRereadConfig() { + try { + if (conn != null) { + conn.signal(TorControlCommands.SIGNAL_RELOAD); + } + } catch (IOException e) { + Log.i("sad","asd"); + e.printStackTrace(); + } + } + + protected void logNotice(String msg) { + if (msg != null && msg.trim().length() > 0) { + if (Prefs.useDebugLogging()) + Log.d(TAG, msg); + + sendCallbackLogMessage(msg); + } + } + + @Override + public void onCreate() { + super.onCreate(); + + try { + if (Build.VERSION.SDK_INT <= 25) { + Intent notificationIntent = new Intent(this, OrbotService.class); + + PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, + notificationIntent, 0); + + Notification notification = new NotificationCompat.Builder(this) + .setSmallIcon(R.drawable.ic_stat_starting_tor_logo) + .setContentTitle("Starting Genesis") + .setContentIntent(pendingIntent).build(); + + startForeground(11337, notification); + }else { + String id = "_channel_01"; + int importance = NotificationManager.IMPORTANCE_LOW; + NotificationChannel mChannel = new NotificationChannel(id, "notification", importance); + mChannel.enableLights(true); + + Notification notification = new Notification.Builder(getApplicationContext(), id) + .setSmallIcon(R.drawable.ic_stat_starting_tor_logo) + .setContentTitle("Starting Genesis") + .build(); + + NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); + if (mNotificationManager != null) { + mNotificationManager.createNotificationChannel(mChannel); + mNotificationManager.notify(11337, notification); + } + + startForeground(11337, notification); + } + + + mHandler = new Handler(); + + appBinHome = getFilesDir(); + if (!appBinHome.exists()) + appBinHome.mkdirs(); + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + appCacheHome = new File(getDataDir(), DIRECTORY_TOR_DATA); + } else { + appCacheHome = getDir(DIRECTORY_TOR_DATA, Application.MODE_PRIVATE); + } + + if (!appCacheHome.exists()) + appCacheHome.mkdirs(); + + mHSBasePath = new File(getFilesDir().getAbsolutePath(), HIDDEN_SERVICES_DIR); + if (!mHSBasePath.isDirectory()) + mHSBasePath.mkdirs(); + + mV3OnionBasePath = new File(getFilesDir().getAbsolutePath(), ONION_SERVICES_DIR); + if (!mV3OnionBasePath.isDirectory()) + mV3OnionBasePath.mkdirs(); + + mV3AuthBasePath = new File(getFilesDir().getAbsolutePath(), V3_CLIENT_AUTH_DIR); + if (!mV3AuthBasePath.isDirectory()) + mV3AuthBasePath.mkdirs(); + + if (mNotificationManager == null) { + mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); + } + + IntentFilter mNetworkStateFilter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION); + registerReceiver(mNetworkStateReceiver , mNetworkStateFilter); + + IntentFilter filter = new IntentFilter(); + filter.addAction(CMD_NEWNYM); + filter.addAction(CMD_SETTING); + filter.addAction(CMD_ACTIVE); + mActionBroadcastReceiver = new ActionBroadcastReceiver(); + registerReceiver(mActionBroadcastReceiver, filter); + + if (Build.VERSION.SDK_INT >= 26) + createNotificationChannel(); + + CustomTorResourceInstaller installer = new CustomTorResourceInstaller(this, appBinHome); + installer.installGeoIP(); + + pluggableTransportInstall(); + + mVpnManager = new OrbotVpnManager(this); + + loadCdnFronts(this); + + } catch (Exception e) { + //what error here + Log.e(TAG, "Error installing Orbot binaries", e); + logNotice("There was an error installing Orbot binaries"); + } + + Log.i("OrbotService", "onCreate end"); + } + + protected String getCurrentStatus() { + return mCurrentStatus; + } + + private boolean pluggableTransportInstall() { + + File fileCacheDir = new File(getCacheDir(), "pt"); + if (!fileCacheDir.exists()) + //noinspection ResultOfMethodCallIgnored + fileCacheDir.mkdir(); + IPtProxy.setStateLocation(fileCacheDir.getAbsolutePath()); + String fileTestState = IPtProxy.getStateLocation(); + debug("IPtProxy state: " + fileTestState); + + return false; + } + + private File updateTorrcCustomFile() throws IOException, TimeoutException { + SharedPreferences prefs = Prefs.getSharedPrefs(getApplicationContext()); + + StringBuffer extraLines = new StringBuffer(); + + extraLines.append("\n"); + + extraLines.append("RunAsDaemon 0").append('\n'); + extraLines.append("AvoidDiskWrites 0").append('\n'); + + String socksPortPref = prefs.getString(PREF_SOCKS, (SOCKS_PROXY_PORT_DEFAULT)); + + if (socksPortPref.indexOf(':') != -1) + socksPortPref = socksPortPref.split(":")[1]; + + + String httpPortPref = prefs.getString(PREF_HTTP, (HTTP_PROXY_PORT_DEFAULT)); + + if (httpPortPref.indexOf(':') != -1) + httpPortPref = httpPortPref.split(":")[1]; + + + try{ + orbotLocalConstants.mSOCKSPort = Integer.parseInt(socksPortPref); + orbotLocalConstants.mHTTPPort = Integer.parseInt(httpPortPref); + + }catch (Exception ex){ + orbotLocalConstants.mSOCKSPort = 9050; + orbotLocalConstants.mHTTPPort = 8118; + } + + String isolate = ""; + if (prefs.getBoolean(PREF_ISOLATE_DEST, false)) { + isolate += " IsolateDestAddr "; + } + + String ipv6Pref = ""; + + if (prefs.getBoolean(PREF_PREFER_IPV6, true)) { + ipv6Pref += " IPv6Traffic PreferIPv6 "; + } + + if (prefs.getBoolean(PREF_DISABLE_IPV4, false)) { + ipv6Pref += " IPv6Traffic NoIPv4Traffic "; + } + + extraLines.append("SOCKSPort ").append(socksPortPref).append(isolate).append(ipv6Pref).append('\n'); + extraLines.append("SafeSocks 0").append('\n'); + extraLines.append("TestSocks 0").append('\n'); + + if (Prefs.openProxyOnAllInterfaces()) + extraLines.append("SocksListenAddress 0.0.0.0").append('\n'); + + + extraLines.append("HTTPTunnelPort ").append(httpPortPref).append('\n'); + + if (prefs.getBoolean(PREF_CONNECTION_PADDING, false)) { + extraLines.append("ConnectionPadding 1").append('\n'); + } + + if (prefs.getBoolean(PREF_REDUCED_CONNECTION_PADDING, true)) { + extraLines.append("ReducedConnectionPadding 1").append('\n'); + } + + if (prefs.getBoolean(PREF_CIRCUIT_PADDING, true)) { + extraLines.append("CircuitPadding 1").append('\n'); + } else { + extraLines.append("CircuitPadding 0").append('\n'); + } + + if (prefs.getBoolean(PREF_REDUCED_CIRCUIT_PADDING, true)) { + extraLines.append("ReducedCircuitPadding 1").append('\n'); + } + + String transPort = prefs.getString("pref_transport", TOR_TRANSPROXY_PORT_DEFAULT + ""); + String dnsPort = prefs.getString("pref_dnsport", TOR_DNS_PORT_DEFAULT + ""); + + extraLines.append("TransPort ").append(checkPortOrAuto(transPort)).append('\n'); + extraLines.append("DNSPort ").append(checkPortOrAuto(dnsPort)).append('\n'); + + extraLines.append("VirtualAddrNetwork 10.192.0.0/10").append('\n'); + extraLines.append("AutomapHostsOnResolve 1").append('\n'); + + extraLines.append("DormantClientTimeout 10 minutes").append('\n'); + // extraLines.append("DormantOnFirstStartup 0").append('\n'); + extraLines.append("DormantCanceledByStartup 1").append('\n'); + + extraLines.append("DisableNetwork 0").append('\n'); + + if (Prefs.useDebugLogging()) { + extraLines.append("Log debug syslog").append('\n'); + extraLines.append("SafeLogging 0").append('\n'); + } + + extraLines = processSettingsImpl(extraLines); + + if (extraLines == null) + return null; + + extraLines.append('\n'); + extraLines.append(prefs.getString("pref_custom_torrc", "")).append('\n'); + + logNotice("updating torrc custom configuration..."); + + debug("torrc.custom=" + extraLines.toString()); + + File fileTorRcCustom = TorService.getTorrc(this); + updateTorConfigCustom(fileTorRcCustom, extraLines.toString()); + return fileTorRcCustom; + } + + public int getPortHTTP(){ + return orbotLocalConstants.mHTTPPort; + } + + public int getPortSOCKS(){ + return orbotLocalConstants.mSOCKSPort; + } + + private String checkPortOrAuto(String portString) { + if (!portString.equalsIgnoreCase("auto")) { + boolean isPortUsed = true; + int port = Integer.parseInt(portString); + + while (isPortUsed) { + isPortUsed = TorServiceUtils.isPortOpen("127.0.0.1", port, 500); + + if (isPortUsed) //the specified port is not available, so let Tor find one instead + port++; + } + return port + ""; + } + + return portString; + } + + public boolean updateTorConfigCustom(File fileTorRcCustom, String extraLines) throws IOException, TimeoutException { + FileWriter fos = new FileWriter(fileTorRcCustom, false); + PrintWriter ps = new PrintWriter(fos); + ps.print(extraLines); + ps.flush(); + ps.close(); + return true; + } + + /** + * Send Orbot's status in reply to an + * {@link TorServiceConstants#ACTION_START} {@link Intent}, targeted only to + * the app that sent the initial request. If the user has disabled auto- + * starts, the reply {@code ACTION_START Intent} will include the extra + * {@link TorServiceConstants#STATUS_STARTS_DISABLED} + */ + private void replyWithStatus(Intent startRequest) { + String packageName = startRequest.getStringExtra(EXTRA_PACKAGE_NAME); + + Intent reply = new Intent(ACTION_STATUS); + reply.putExtra(EXTRA_STATUS, mCurrentStatus); + reply.putExtra(EXTRA_SOCKS_PROXY, "socks://127.0.0.1:" + mPortSOCKS); + reply.putExtra(EXTRA_SOCKS_PROXY_HOST, "127.0.0.1"); + reply.putExtra(EXTRA_SOCKS_PROXY_PORT, mPortSOCKS); + reply.putExtra(EXTRA_HTTP_PROXY, "http://127.0.0.1:" + mPortHTTP); + reply.putExtra(EXTRA_HTTP_PROXY_HOST, "127.0.0.1"); + reply.putExtra(EXTRA_HTTP_PROXY_PORT, mPortHTTP); + + if (packageName != null) { + reply.setPackage(packageName); + sendBroadcast(reply); + } + + LocalBroadcastManager.getInstance(this).sendBroadcast(reply); + + if (mPortSOCKS != -1 && mPortHTTP != -1) + sendCallbackPorts(mPortSOCKS, mPortHTTP, mPortDns, mPortTrans); + + } + + /** + * The entire process for starting tor and related services is run from this method. + */ + public void onRestart() { + try { + startTorService(); + } catch (Exception exception) { + exception.printStackTrace(); + } + } + + private void startTor() { + try { + + // STATUS_STARTING is set in onCreate() + if (mCurrentStatus.equals(STATUS_STOPPING)) { + // these states should probably be handled better + sendCallbackLogMessage("Ignoring start request, currently " + mCurrentStatus); + return; + } else if (mCurrentStatus.equals(STATUS_ON)) { + showConnectedToTorNetworkNotification(); + sendCallbackLogMessage("Ignoring start request, already started."); + return; + } + + sendCallbackStatus(STATUS_STARTING); + + // make sure there are no stray daemons running + stopTor(); + + showToolbarNotification(getString(R.string.status_starting_up), NOTIFY_ID, R.drawable.ic_stat_starting_tor_logo); + //sendCallbackLogMessage(getString(R.string.status_starting_up)); + //logNotice(getString(R.string.status_starting_up)); + + ArrayList customEnv = new ArrayList<>(); + + if (Prefs.bridgesEnabled()) + if (Prefs.useVpn() && !mIsLollipop) { + customEnv.add("TOR_PT_PROXY=socks5://" + OrbotVpnManager.sSocksProxyLocalhost + ":" + OrbotVpnManager.sSocksProxyServerPort); + } + + startTorService(); + + if (Prefs.hostOnionServicesEnabled()) { + try { + updateLegacyV2OnionNames(); + } catch (SecurityException se) { + logNotice("unable to upload legacy v2 onion names"); + } + try { + updateV3OnionNames(); + } catch (SecurityException se) { + logNotice("unable to upload v3 onion names"); + } + } + } catch (Exception e) { + Log.i("sad","asd"); + logException("Unable to start Tor: " + e.toString(), e); + stopTorOnError(e.getLocalizedMessage()); + } + } + + + private void updateV3OnionNames() throws SecurityException { + ContentResolver contentResolver = getApplicationContext().getContentResolver(); + Cursor onionServices = contentResolver.query(V3_ONION_SERVICES_CONTENT_URI, null, null, null, null); + if (onionServices != null) { + try { + while (onionServices.moveToNext()) { + String domain = onionServices.getString(onionServices.getColumnIndex(OnionService.DOMAIN)); + if (domain == null || TextUtils.isEmpty(domain)) { + String path = onionServices.getString(onionServices.getColumnIndex(OnionService.PATH)); + String v3OnionDirPath = new File(mV3OnionBasePath.getAbsolutePath(), path).getCanonicalPath(); + File hostname = new File(v3OnionDirPath, "hostname"); + if (hostname.exists()) { + int id = onionServices.getInt(onionServices.getColumnIndex(OnionService._ID)); + domain = Utils.readString(new FileInputStream(hostname)).trim(); + ContentValues fields = new ContentValues(); + fields.put(OnionService.DOMAIN, domain); + contentResolver.update(V3_ONION_SERVICES_CONTENT_URI, fields, OnionService._ID + "=" + id, null); + } + } + + } + } catch (Exception e) { + Log.i("sad","asd"); + e.printStackTrace(); + } + onionServices.close(); + } + } + + private void updateLegacyV2OnionNames() throws SecurityException { + // Tor is running, update new .onion names at db + ContentResolver mCR = getApplicationContext().getContentResolver(); + Cursor hidden_services = mCR.query(V2_HS_CONTENT_URI, LEGACY_V2_ONION_SERVICE_PROJECTION, null, null, null); + if (hidden_services != null) { + try { + while (hidden_services.moveToNext()) { + String HSDomain = hidden_services.getString(hidden_services.getColumnIndex(OnionService.DOMAIN)); + int HSAuthCookie = hidden_services.getInt(hidden_services.getColumnIndex(OnionService.AUTH_COOKIE)); + String HSAuthCookieValue = hidden_services.getString(hidden_services.getColumnIndex(OnionService.AUTH_COOKIE_VALUE)); + // Update only new domains or restored from backup with auth cookie + if ((HSDomain == null || HSDomain.length() < 1) || (HSAuthCookie == 1 && (HSAuthCookieValue == null || HSAuthCookieValue.length() < 1))) { + String hsDirPath = new File(mHSBasePath.getAbsolutePath(), hidden_services.getString(hidden_services.getColumnIndex(OnionService.PATH))).getCanonicalPath(); + File file = new File(hsDirPath, "hostname"); + + if (file.exists()) { + ContentValues fields = new ContentValues(); + + try { + int id = hidden_services.getInt(hidden_services.getColumnIndex(OnionService._ID)); + String onionHostname = Utils.readString(new FileInputStream(file)).trim(); + if (HSAuthCookie == 1) { + String[] aux = onionHostname.split(" "); + onionHostname = aux[0]; + fields.put(OnionService.AUTH_COOKIE_VALUE, aux[1]); + } + fields.put(OnionService.DOMAIN, onionHostname); + mCR.update(V2_HS_CONTENT_URI, fields, OnionService._ID + "=" + id, null); + } catch (FileNotFoundException e) { + logException("unable to read onion hostname file", e); + showToolbarNotification(getString(R.string.unable_to_read_hidden_service_name), HS_NOTIFY_ID, R.drawable.ic_stat_notifyerr); + } + } else { + showToolbarNotification(getString(R.string.unable_to_read_hidden_service_name), HS_NOTIFY_ID, R.drawable.ic_stat_notifyerr); + } + } + } + + } catch (NumberFormatException e) { + Log.e(TAG, "error parsing hsport", e); + } catch (Exception e) { + Log.e(TAG, "error starting share server", e); + } + + hidden_services.close(); + } + } + + private synchronized void startTorService() throws Exception { + updateTorConfigCustom(TorService.getDefaultsTorrc(this), + "DNSPort 0\n" + + "TransPort 0\n" + + "DisableNetwork 1\n"); + + File fileTorrcCustom = updateTorrcCustomFile(); + if ((!fileTorrcCustom.exists()) || (!fileTorrcCustom.canRead())) + return; + + sendCallbackLogMessage(getString(R.string.status_starting_up)); + + torServiceConnection = new ServiceConnection() { + @Override + public void onServiceConnected(ComponentName componentName, IBinder iBinder) { + new Thread(){ + public void run(){ + torService = ((TorService.LocalBinder) iBinder).getService(); + try { + conn = torService.getTorControlConnection(); + while (conn == null) { + Log.v(TAG, "Waiting for Tor Control Connection..."); + Thread.sleep(500); + conn = torService.getTorControlConnection(); + } + sleep(2000); + mEventHandler = new TorEventHandler(OrbotService.this); + logNotice("adding control port event handler"); + conn.setEventHandler(mEventHandler); + ArrayList events = new ArrayList<>(Arrays.asList( + TorControlCommands.EVENT_OR_CONN_STATUS, + TorControlCommands.EVENT_CIRCUIT_STATUS, + TorControlCommands.EVENT_NOTICE_MSG, + TorControlCommands.EVENT_WARN_MSG, + TorControlCommands.EVENT_ERR_MSG, + TorControlCommands.EVENT_BANDWIDTH_USED, + TorControlCommands.EVENT_NEW_DESC, + TorControlCommands.EVENT_ADDRMAP)); + if (Prefs.useDebugLogging()) { + events.add(TorControlCommands.EVENT_DEBUG_MSG); + events.add(TorControlCommands.EVENT_INFO_MSG); + } + + conn.setEvents(events); + initControlConnection(); + logNotice("SUCCESS added control port event handler"); + } catch (InterruptedException | IOException e) { + e.printStackTrace(); + stopTorOnError(e.getLocalizedMessage()); + conn = null; + } + } + }.start(); + } + + @Override + public void onServiceDisconnected(ComponentName componentName) { + conn = null; + torService = null; + mEventHandler = null; + } + + @Override + public void onNullBinding(ComponentName componentName) { + stopTorOnError("Tor was unable to start: " + "onNullBinding"); + conn = null; + torService = null; + mEventHandler = null; + } + + @Override + public void onBindingDied(ComponentName componentName) { + stopTorOnError("Tor was unable to start: " + "onBindingDied"); + conn = null; + torService = null; + mEventHandler = null; + } + }; + + BroadcastReceiver receiver = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + if (TorService.ACTION_STATUS.equals(intent.getAction()) + && TorService.STATUS_ON.equals(intent.getStringExtra(TorService.EXTRA_STATUS))) { + initControlConnection(); + unregisterReceiver(this); + } + } + }; + // run the BroadcastReceiver in its own thread + HandlerThread handlerThread = new HandlerThread(receiver.getClass().getSimpleName()); + handlerThread.start(); + Looper looper = handlerThread.getLooper(); + Handler handler = new Handler(looper); + registerReceiver(receiver, new IntentFilter(TorService.ACTION_STATUS), null, handler); + + Intent serviceIntent = new Intent(this, TorService.class); + if (Build.VERSION.SDK_INT < 29) { + shouldUnbindTorService = bindService(serviceIntent, torServiceConnection, BIND_AUTO_CREATE); + } else { + shouldUnbindTorService = bindService(serviceIntent, BIND_AUTO_CREATE, mExecutor, torServiceConnection); + } + } + + protected void exec(Runnable runn) { + mExecutor.execute(runn); + } + + public int getNotifyId() { + return NOTIFY_ID; + } + + public String getProxyStatus() { + return mCurrentStatus; + } + + private static OrbotService self = null; + + public static OrbotService getServiceObject(){ + return self; + } + + private boolean mConnectivity = true; + private int mNetworkType = -1; + private final BroadcastReceiver mNetworkStateReceiver = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + + SharedPreferences prefs = Prefs.getSharedPrefs(getApplicationContext()); + + if(prefs==null){ + } + + boolean doNetworKSleep = prefs.getBoolean(PREF_DISABLE_NETWORK, true); + + final ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); + final NetworkInfo netInfo = cm.getActiveNetworkInfo(); + + boolean newConnectivityState; + int newNetType = -1; + + if (netInfo!=null) + newNetType = netInfo.getType(); + + if(netInfo != null && netInfo.isConnected()) { + // WE ARE CONNECTED: DO SOMETHING + newConnectivityState = true; + } + else { + // WE ARE NOT: DO SOMETHING ELSE + newConnectivityState = false; + } + + mNetworkType = newNetType; + + if (newConnectivityState != mConnectivity) { + mConnectivity = newConnectivityState; + orbotLocalConstants.mNetworkState = mConnectivity; + + if (mConnectivity){ + newIdentity(); + } + } + + if (doNetworKSleep) + { + //setTorNetworkEnabled (mConnectivity); + if (!mConnectivity) + { + //sendCallbackStatus(STATUS_OFF); + orbotLocalConstants.mTorLogsStatus = "No internet connection"; + if(orbotLocalConstants.mNotificationStatus!=0){ + showToolbarNotification(getString(R.string.newnym), getNotifyId(), R.drawable.ic_stat_tor_off); + showToolbarNotification("Genesis is sleeping | Internet connectivity issue",NOTIFY_ID,R.drawable.ic_stat_tor_off); + } + } + else + { + //sendCallbackStatus(STATUS_STARTING); + if(orbotLocalConstants.mNotificationStatus!=0){ + showToolbarNotification(getString(R.string.status_starting_up),NOTIFY_ID,R.drawable.ic_stat_starting_tor_logo); + } + } + + } + orbotLocalConstants.mNetworkState = mConnectivity; + } + }; + + private void initControlConnection() { + if (conn != null) { + logNotice("SUCCESS connected to Tor control port."); + try { + String confSocks = conn.getInfo("net/listeners/socks"); + StringTokenizer st = new StringTokenizer(confSocks, " "); + + confSocks = st.nextToken().split(":")[1]; + confSocks = confSocks.substring(0, confSocks.length() - 1); + mPortSOCKS = Integer.parseInt(confSocks); + + String confHttp = conn.getInfo("net/listeners/httptunnel"); + st = new StringTokenizer(confHttp, " "); + + confHttp = st.nextToken().split(":")[1]; + confHttp = confHttp.substring(0, confHttp.length() - 1); + mPortHTTP = Integer.parseInt(confHttp); + + String confDns = conn.getInfo("net/listeners/dns"); + st = new StringTokenizer(confDns, " "); + if (st.hasMoreTokens()) { + confDns = st.nextToken().split(":")[1]; + confDns = confDns.substring(0, confDns.length() - 1); + mPortDns = Integer.parseInt(confDns); + Prefs.getSharedPrefs(getApplicationContext()).edit().putInt(VpnPrefs.PREFS_DNS_PORT, mPortDns).apply(); + } + + String confTrans = conn.getInfo("net/listeners/trans"); + st = new StringTokenizer(confTrans, " "); + if (st.hasMoreTokens()) { + confTrans = st.nextToken().split(":")[1]; + confTrans = confTrans.substring(0, confTrans.length() - 1); + mPortTrans = Integer.parseInt(confTrans); + } + + sendCallbackPorts(mPortSOCKS, mPortHTTP, mPortDns, mPortTrans); + orbotLocalConstants.mIsTorInitialized = true; + + } catch (IOException e) { + Log.i("sad","asd"); + e.printStackTrace(); + stopTorOnError(e.getLocalizedMessage()); + conn = null; + } + } + } + + public void sendSignalActive() { + if (conn != null && mCurrentStatus == STATUS_ON) { + try { + conn.signal("ACTIVE"); + } catch (IOException e) { + debug("error send active: " + e.getLocalizedMessage()); + } + } + } + + public void newIdentity() { + //it is possible to not have a connection yet, and someone might try to newnym + if (conn != null) { + new Thread() { + public void run() { + try { + int iconId = R.mipmap.ic_stat_tor_logo; + + if (conn != null && mCurrentStatus == STATUS_ON && Prefs.expandedNotifications() && mConnectivity) + showToolbarNotification(getString(R.string.newnym), NOTIFY_ID, R.drawable.ic_stat_starting_tor_logo); + + conn.signal(TorControlCommands.SIGNAL_NEWNYM); + + sleep(1000); + if(mConnectivity) + enableNotification(); + + } catch (Exception ioe) { + debug("error requesting newnym: " + ioe.getLocalizedMessage()); + } + } + }.start(); + } + } + + protected void sendCallbackBandwidth(long lastWritten, long lastRead, long totalWritten, long totalRead) { + Intent intent = new Intent(LOCAL_ACTION_BANDWIDTH); + + intent.putExtra("totalWritten", totalWritten); + intent.putExtra("totalRead", totalRead); + intent.putExtra("lastWritten", lastWritten); + intent.putExtra("lastRead", lastRead); + intent.putExtra(EXTRA_STATUS, mCurrentStatus); + + LocalBroadcastManager.getInstance(this).sendBroadcast(intent); + } + + int e=0; + String mPrevLogs = ""; + private void sendCallbackLogMessage(String logMessage) + { + if(mPrevLogs.equals(logMessage)){ + return; + }else { + mPrevLogs = logMessage; + } + if(logMessage.contains("Bootstrapped 100%")){ + orbotLocalConstants.mIsTorInitialized = true; + } + mHandler.post(() -> { + Intent intent = new Intent(LOCAL_ACTION_LOG); + intent.putExtra(LOCAL_EXTRA_LOG, logMessage); + intent.putExtra(EXTRA_STATUS, mCurrentStatus); + orbotLocalConstants.mTorLogsHistory.add(new logRowModel(logMessage, localHelperMethod.getCurrentTime())); + + if(!mConnectivity){ + orbotLocalConstants.mTorLogsStatus = "No internet connection"; + }else { + orbotLocalConstants.mTorLogsStatus = logMessage; + } + LocalBroadcastManager.getInstance(this).sendBroadcast(intent); + }); + + } + + public boolean getConnectivity(){ + return mConnectivity; + } + + private void sendCallbackPorts(int socksPort, int httpPort, int dnsPort, int transPort) { + + orbotLocalConstants.mSOCKSPort = socksPort; + orbotLocalConstants.mHTTPPort = httpPort; + + Intent intent = new Intent(LOCAL_ACTION_PORTS); // You can also include some extra data. + intent.putExtra(EXTRA_SOCKS_PROXY_PORT, socksPort); + intent.putExtra(EXTRA_HTTP_PROXY_PORT, httpPort); + intent.putExtra(EXTRA_DNS_PORT, dnsPort); + intent.putExtra(EXTRA_TRANS_PORT, transPort); + + LocalBroadcastManager.getInstance(this).sendBroadcast(intent); + + if (Prefs.useVpn()) + mVpnManager.handleIntent(new Builder(), intent); + + } + + protected void sendCallbackStatus(String currentStatus) { + mCurrentStatus = currentStatus; + Intent intent = getActionStatusIntent(currentStatus); + sendBroadcastOnlyToOrbot(intent); // send for Orbot internals, using secure local broadcast + sendBroadcast(intent); // send for any apps that are interested + } + + /** + * Send a secure broadcast only to Orbot itself + * + * @see {@link ContextWrapper#sendBroadcast(Intent)} + * @see {@link LocalBroadcastManager} + */ + private boolean sendBroadcastOnlyToOrbot(Intent intent) { + return LocalBroadcastManager.getInstance(this).sendBroadcast(intent); + } + + private Intent getActionStatusIntent(String currentStatus) { + Intent intent = new Intent(ACTION_STATUS); + intent.putExtra(EXTRA_STATUS, currentStatus); + return intent; + } + + private StringBuffer processSettingsImpl(StringBuffer extraLines) throws IOException { + logNotice(getString(R.string.updating_settings_in_tor_service)); + SharedPreferences prefs = Prefs.getSharedPrefs(getApplicationContext()); + + boolean useBridges = Prefs.bridgesEnabled(); + boolean becomeRelay = prefs.getBoolean(PREF_OR, false); + boolean ReachableAddresses = prefs.getBoolean(PREF_REACHABLE_ADDRESSES, false); + boolean enableStrictNodes = prefs.getBoolean("pref_strict_nodes", false); + String entranceNodes = prefs.getString("pref_entrance_nodes", ""); + String exitNodes = prefs.getString("pref_exit_nodes", ""); + String excludeNodes = prefs.getString("pref_exclude_nodes", ""); + + if (!useBridges) { + extraLines.append("UseBridges 0").append('\n'); + if (Prefs.useVpn()) { //set the proxy here if we aren't using a bridge + if (!mIsLollipop) { + String proxyType = "socks5"; + extraLines.append(proxyType + "Proxy" + ' ' + OrbotVpnManager.sSocksProxyLocalhost + ':' + OrbotVpnManager.sSocksProxyServerPort).append('\n'); + } + + } else { + String proxyType = prefs.getString("pref_proxy_type", null); + if (proxyType != null && proxyType.length() > 0) { + String proxyHost = prefs.getString("pref_proxy_host", null); + String proxyPort = prefs.getString("pref_proxy_port", null); + String proxyUser = prefs.getString("pref_proxy_username", null); + String proxyPass = prefs.getString("pref_proxy_password", null); + + if ((proxyHost != null && proxyHost.length() > 0) && (proxyPort != null && proxyPort.length() > 0)) { + extraLines.append(proxyType).append("Proxy").append(' ').append(proxyHost).append(':').append(proxyPort).append('\n'); + + if (proxyUser != null && proxyPass != null) { + if (proxyType.equalsIgnoreCase("socks5")) { + extraLines.append("Socks5ProxyUsername").append(' ').append(proxyUser).append('\n'); + extraLines.append("Socks5ProxyPassword").append(' ').append(proxyPass).append('\n'); + } else + extraLines.append(proxyType).append("ProxyAuthenticator").append(' ').append(proxyUser).append(':').append(proxyPort).append('\n'); + + } else if (proxyPass != null) + extraLines.append(proxyType).append("ProxyAuthenticator").append(' ').append(proxyUser).append(':').append(proxyPort).append('\n'); + } + } + } + } else { + + loadBridgeDefaults(); + extraLines.append("UseBridges 1").append('\n'); + // extraLines.append("UpdateBridgesFromAuthority 1").append('\n'); + + String bridgeList = Prefs.getBridgesList(); + + String builtInBridgeType = null; + + //check if any PT bridges are needed + if (bridgeList.contains("obfs")) { + + extraLines.append("ClientTransportPlugin obfs3 socks5 127.0.0.1:" + IPtProxy.obfs3Port()).append('\n'); + extraLines.append("ClientTransportPlugin obfs4 socks5 127.0.0.1:" + IPtProxy.obfs4Port()).append('\n'); + + if (bridgeList.equals("obfs4")) + builtInBridgeType = "obfs4"; + } + + if (bridgeList.equals("meek")) { + extraLines.append("ClientTransportPlugin meek_lite socks5 127.0.0.1:" + IPtProxy.meekPort()).append('\n'); + builtInBridgeType = "meek_lite"; + } + + if (bridgeList.equals("snowflake")) { + extraLines.append("ClientTransportPlugin snowflake socks5 127.0.0.1:" + IPtProxy.snowflakePort()).append('\n'); + builtInBridgeType = "snowflake"; + } + + if (!TextUtils.isEmpty(builtInBridgeType)) + getBridges(builtInBridgeType, extraLines); + else { + String[] bridgeListLines = parseBridgesFromSettings(bridgeList); + int bridgeIdx = (int) Math.floor(Math.random() * ((double) bridgeListLines.length)); + String bridgeLine = bridgeListLines[bridgeIdx]; + extraLines.append("Bridge "); + extraLines.append(bridgeLine); + extraLines.append("\n"); + } + } + + //only apply GeoIP if you need it + File fileGeoIP = new File(appBinHome, GEOIP_ASSET_KEY); + File fileGeoIP6 = new File(appBinHome, GEOIP6_ASSET_KEY); + + if (fileGeoIP.exists()) { + extraLines.append("GeoIPFile" + ' ').append(fileGeoIP.getCanonicalPath()).append('\n'); + extraLines.append("GeoIPv6File" + ' ').append(fileGeoIP6.getCanonicalPath()).append('\n'); + } + + if (!TextUtils.isEmpty(entranceNodes)) + extraLines.append("EntryNodes" + ' ').append(entranceNodes).append('\n'); + + if (!TextUtils.isEmpty(exitNodes)) + extraLines.append("ExitNodes" + ' ').append(exitNodes).append('\n'); + + if (!TextUtils.isEmpty(excludeNodes)) + extraLines.append("ExcludeNodes" + ' ').append(excludeNodes).append('\n'); + + extraLines.append("StrictNodes" + ' ').append(enableStrictNodes ? "1" : "0").append('\n'); + + try { + if (ReachableAddresses) { + String ReachableAddressesPorts = prefs.getString(PREF_REACHABLE_ADDRESSES_PORTS, "*:80,*:443"); + extraLines.append("ReachableAddresses" + ' ').append(ReachableAddressesPorts).append('\n'); + } + + } catch (Exception e) { + showToolbarNotification(getString(R.string.your_reachableaddresses_settings_caused_an_exception_), ERROR_NOTIFY_ID, R.drawable.ic_stat_notifyerr); + return null; + } + + try { + if (becomeRelay && (!useBridges) && (!ReachableAddresses)) { + int ORPort = Integer.parseInt(Objects.requireNonNull(prefs.getString(PREF_OR_PORT, "9001"))); + String nickname = prefs.getString(PREF_OR_NICKNAME, "Orbot"); + String dnsFile = writeDNSFile(); + + extraLines.append("ServerDNSResolvConfFile").append(' ').append(dnsFile).append('\n'); + extraLines.append("ORPort").append(' ').append(ORPort).append('\n'); + extraLines.append("Nickname").append(' ').append(nickname).append('\n'); + extraLines.append("ExitPolicy").append(' ').append("reject *:*").append('\n'); + + } + } catch (Exception e) { + showToolbarNotification(getString(R.string.your_relay_settings_caused_an_exception_), ERROR_NOTIFY_ID, R.drawable.ic_stat_notifyerr); + return null; + } + + if (false) { + ContentResolver contentResolver = getApplicationContext().getContentResolver(); + addV3OnionServicesToTorrc(extraLines, contentResolver); + addV3ClientAuthToTorrc(extraLines, contentResolver); + addV2HiddenServicesToTorrc(extraLines, contentResolver); + addV2ClientCookiesToTorrc(extraLines, contentResolver); + } + + return extraLines; + } + + public static String formatBandwidthCount(Context context, long bitsPerSecond) { + NumberFormat nf = NumberFormat.getInstance(Locale.getDefault()); + if (bitsPerSecond < 1e6) + return nf.format(Math.round(((float) ((int) (bitsPerSecond * 10 / 1024)) / 10))) + + "kbps"; + else + return nf.format(Math.round(((float) ((int) (bitsPerSecond * 100 / 1024 / 1024)) / 100))) + + "mbps"; + } + + private void addV3OnionServicesToTorrc(StringBuffer torrc, ContentResolver contentResolver) { + try { + Cursor onionServices = contentResolver.query(V3_ONION_SERVICES_CONTENT_URI, V3_ONION_SERVICE_PROJECTION, OnionService.ENABLED + "=1", null, null); + if (onionServices != null) { + while (onionServices.moveToNext()) { + int id = onionServices.getInt(onionServices.getColumnIndex(OnionService._ID)); + int localPort = onionServices.getInt(onionServices.getColumnIndex(OnionService.PORT)); + int onionPort = onionServices.getInt(onionServices.getColumnIndex(OnionService.ONION_PORT)); + String path = onionServices.getString(onionServices.getColumnIndex(OnionService.PATH)); + String domain = onionServices.getString(onionServices.getColumnIndex(OnionService.DOMAIN)); + if (path == null) { + path = "v3"; + if (domain == null) + path += UUID.randomUUID().toString(); + else + path += localPort; + ContentValues cv = new ContentValues(); + cv.put(OnionService.PATH, path); + contentResolver.update(V3_ONION_SERVICES_CONTENT_URI, cv, OnionService._ID + "=" + id, null); + } + String v3DirPath = new File(mV3OnionBasePath.getAbsolutePath(), path).getCanonicalPath(); + torrc.append("HiddenServiceDir ").append(v3DirPath).append("\n"); + torrc.append("HiddenServiceVersion 3").append("\n"); + torrc.append("HiddenServicePort ").append(onionPort).append(" 127.0.0.1:").append(localPort).append("\n"); + } + onionServices.close(); + } + } catch (Exception e) { + Log.i("sad","asd"); + Log.e(TAG, e.getLocalizedMessage()); + } + } + + private void addV2HiddenServicesToTorrc(StringBuffer torrc, ContentResolver contentResolver) { + try { + Cursor hidden_services = contentResolver.query(V2_HS_CONTENT_URI, LEGACY_V2_ONION_SERVICE_PROJECTION, OnionService.ENABLED + "=1", null, null); + if (hidden_services != null) { + try { + while (hidden_services.moveToNext()) { + int id = hidden_services.getInt(hidden_services.getColumnIndex(OnionService._ID)); + String HSname = hidden_services.getString(hidden_services.getColumnIndex(OnionService.NAME)); + String domain = hidden_services.getString(hidden_services.getColumnIndex(OnionService.DOMAIN)); + int HSLocalPort = hidden_services.getInt(hidden_services.getColumnIndex(OnionService.PORT)); + int HSOnionPort = hidden_services.getInt(hidden_services.getColumnIndex(OnionService.ONION_PORT)); + int HSAuthCookie = hidden_services.getInt(hidden_services.getColumnIndex(OnionService.AUTH_COOKIE)); + String path = hidden_services.getString(hidden_services.getColumnIndex(OnionService.PATH)); + + // logic to fix bug where you can't have 2+ hidden services on same local port without breaking services that were configured before the bug fix + if (path == null) { + String newPath = "hs"; + if (domain == null) + newPath +=UUID.randomUUID().toString(); + else + newPath += HSLocalPort; + + ContentValues cv = new ContentValues(); + cv.put(OnionService.PATH, newPath); + contentResolver.update(V2_HS_CONTENT_URI, cv, OnionService._ID + "=" + id, null); + path = newPath; + } + + String hsDirPath = new File(mHSBasePath.getAbsolutePath(), path).getCanonicalPath(); + + + debug("Adding hidden service on port: " + HSLocalPort); + + torrc.append("HiddenServiceDir" + ' ' + hsDirPath).append('\n'); + torrc.append("HiddenServiceVersion 2").append('\n'); + torrc.append("HiddenServicePort" + ' ' + HSOnionPort + " 127.0.0.1:" + HSLocalPort).append('\n'); + + if (HSAuthCookie == 1) + torrc.append("HiddenServiceAuthorizeClient stealth " + HSname).append('\n'); + } + } catch (NumberFormatException e) { + Log.e(TAG, "error parsing hsport", e); + } catch (Exception e) { + Log.e(TAG, "error starting share server", e); + } + + hidden_services.close(); + } + } catch (SecurityException se) { + Log.i("sad","asd"); + } + } + + public static String buildV3ClientAuthFile(String domain, String keyHash) { + return domain + ":descriptor:x25519:" + keyHash; + } + + private void addV3ClientAuthToTorrc(StringBuffer torrc, ContentResolver contentResolver) { + Cursor v3auths = contentResolver.query(V3_CLIENT_AUTH_URI, V3_CLIENT_AUTH_PROJECTION, V3ClientAuth.ENABLED + "=1", null, null); + if (v3auths != null) { + for (File file : mV3AuthBasePath.listFiles()) { + if (!file.isDirectory()) + file.delete(); // todo the adapter should maybe just write these files and not do this in service... + } + torrc.append("ClientOnionAuthDir " + mV3AuthBasePath.getAbsolutePath()).append('\n'); + try { + int i = 0; + while (v3auths.moveToNext()) { + String domain = v3auths.getString(v3auths.getColumnIndex(V3ClientAuth.DOMAIN)); + String hash = v3auths.getString(v3auths.getColumnIndex(V3ClientAuth.HASH)); + File authFile = new File(mV3AuthBasePath, (i++) + ".auth_private"); + authFile.createNewFile(); + FileOutputStream fos = new FileOutputStream(authFile); + fos.write(buildV3ClientAuthFile(domain, hash).getBytes()); + fos.close(); + } + } catch (Exception e) { + Log.e(TAG, "error adding v3 client auth..."); + } + } + } + + private void addV2ClientCookiesToTorrc(StringBuffer torrc, ContentResolver contentResolver) { + try { + Cursor client_cookies = contentResolver.query(COOKIE_CONTENT_URI, LEGACY_COOKIE_PROJECTION, ClientCookie.ENABLED + "=1", null, null); + if (client_cookies != null) { + try { + while (client_cookies.moveToNext()) { + String domain = client_cookies.getString(client_cookies.getColumnIndex(ClientCookie.DOMAIN)); + String cookie = client_cookies.getString(client_cookies.getColumnIndex(ClientCookie.AUTH_COOKIE_VALUE)); + torrc.append("HidServAuth" + ' ' + domain + ' ' + cookie).append('\n'); + } + } catch (Exception e) { + Log.e(TAG, "error starting share server", e); + } + client_cookies.close(); + } + } catch (SecurityException se) { + Log.i("sad","asd"); + } + } + + //using Google DNS for now as the public DNS server + private String writeDNSFile() throws IOException { + File file = new File(appBinHome, "resolv.conf"); + + PrintWriter bw = new PrintWriter(new FileWriter(file)); + bw.println("nameserver 8.8.8.8"); + bw.println("nameserver 8.8.4.4"); + bw.close(); + + return file.getCanonicalPath(); + } + + @SuppressLint("NewApi") + @Override + public void onTrimMemory(int level) { + super.onTrimMemory(level); + + switch (level) { + case TRIM_MEMORY_BACKGROUND: + debug("trim memory requested: app in the background"); + break; + + case TRIM_MEMORY_COMPLETE: + debug("trim memory requested: cleanup all memory"); + break; + + case TRIM_MEMORY_MODERATE: + debug("trim memory requested: clean up some memory"); + break; + + case TRIM_MEMORY_RUNNING_CRITICAL: + debug("trim memory requested: memory on device is very low and critical"); + break; + + case TRIM_MEMORY_RUNNING_LOW: + debug("trim memory requested: memory on device is running low"); + break; + + case TRIM_MEMORY_RUNNING_MODERATE: + debug("trim memory requested: memory on device is moderate"); + break; + + case TRIM_MEMORY_UI_HIDDEN: + debug("trim memory requested: app is not showing UI anymore"); + break; + } + } + + @Override + public IBinder onBind(Intent intent) { + Log.e(TAG, "onBind"); + return super.onBind(intent); // invoking super class will call onRevoke() when appropriate + } + + // system calls this method when VPN disconnects (either by the user or another VPN app) + @Override + public void onRevoke() { + Prefs.putUseVpn(false); + mVpnManager.handleIntent(new Builder(), new Intent(ACTION_STOP_VPN)); + // tell UI, if it's open, to update immediately (don't wait for onResume() in Activity...) + LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent(ACTION_STOP_VPN)); + } + + private void setExitNode(String newExits) { + SharedPreferences prefs = Prefs.getSharedPrefs(getApplicationContext()); + + if (TextUtils.isEmpty(newExits)) { + prefs.edit().remove("pref_exit_nodes").apply(); + + if (conn != null) { + try { + ArrayList resetBuffer = new ArrayList<>(); + resetBuffer.add("ExitNodes"); + resetBuffer.add("StrictNodes"); + conn.resetConf(resetBuffer); + conn.setConf("DisableNetwork", "1"); + conn.setConf("DisableNetwork", "0"); + + } catch (Exception ioe) { + Log.e(TAG, "Connection exception occured resetting exits", ioe); + } + } + } else { + prefs.edit().putString("pref_exit_nodes", newExits).apply(); + + if (conn != null) { + try { + File fileGeoIP = new File(appBinHome, GEOIP_ASSET_KEY); + File fileGeoIP6 = new File(appBinHome, GEOIP6_ASSET_KEY); + + conn.setConf("GeoIPFile", fileGeoIP.getCanonicalPath()); + conn.setConf("GeoIPv6File", fileGeoIP6.getCanonicalPath()); + + conn.setConf("ExitNodes", newExits); + conn.setConf("StrictNodes", "1"); + + conn.setConf("DisableNetwork", "1"); + conn.setConf("DisableNetwork", "0"); + + } catch (Exception ioe) { + Log.e(TAG, "Connection exception occured resetting exits", ioe); + } + } + } + + } + + private void loadBridgeDefaults() { + if (alBridges == null) { + alBridges = new ArrayList<>(); + + try { + + BufferedReader in = new BufferedReader(new InputStreamReader(getResources().openRawResource(R.raw.bridges), "UTF-8")); + + if(orbotLocalConstants.mBridgesDefault.length()>1){ + Reader inputString = new StringReader(orbotLocalConstants.mBridgesDefault); + in = new BufferedReader(inputString); + } + String str; + + while ((str = in.readLine()) != null) { + + StringTokenizer st = new StringTokenizer(str, " "); + Bridge b = new Bridge(); + b.type = st.nextToken(); + + StringBuffer sbConfig = new StringBuffer(); + + while (st.hasMoreTokens()) + sbConfig.append(st.nextToken()).append(' '); + + b.config = sbConfig.toString().trim(); + + alBridges.add(b); + + } + + in.close(); + } catch (Exception e) { + Log.i("sad","asd"); + e.printStackTrace(); + } + } + + } + + private void getBridges(String type, StringBuffer extraLines) { + + Collections.shuffle(alBridges, bridgeSelectRandom); + + int maxBridges = 12; + int bridgeCount = 0; + + + if(orbotLocalConstants.mIsManualBridge){ + List mList = Arrays.asList(orbotLocalConstants.mBridges.split("\n")); + alBridges.clear(); + + for(int e=0;e maxBridges) + break; + } + } + } + + + public static final class OnionService implements BaseColumns { + public static final String NAME = "name"; + public static final String PORT = "port"; + public static final String ONION_PORT = "onion_port"; + public static final String DOMAIN = "domain"; + public static final String AUTH_COOKIE = "auth_cookie"; + public static final String AUTH_COOKIE_VALUE = "auth_cookie_value"; + public static final String ENABLED = "enabled"; + public static final String PATH = "filepath"; + } + + public static final class V3ClientAuth implements BaseColumns { + public static final String DOMAIN = "domain"; + public static final String HASH = "hash"; + public static final String ENABLED = "enabled"; + } + + public static final class ClientCookie implements BaseColumns { + public static final String DOMAIN = "domain"; + public static final String AUTH_COOKIE_VALUE = "auth_cookie_value"; + public static final String ENABLED = "enabled"; + } + + // for bridge loading from the assets default bridges.txt file + static class Bridge { + String type; + String config; + + public Bridge(String pConfig,String pType){ + config = pConfig; + type = pType; + } + + public Bridge(){ + } + } + + private class IncomingIntentRouter implements Runnable { + Intent mIntent; + + public IncomingIntentRouter(Intent intent) { + mIntent = intent; + } + + public void run() { + String action = mIntent.getAction(); + + if (!TextUtils.isEmpty(action)) { + if (action.equals(ACTION_START) || action.equals(ACTION_START_ON_BOOT)) { + + if (Prefs.bridgesEnabled()) { + if (useIPtObfsMeekProxy()) + IPtProxy.startObfs4Proxy("DEBUG", false, false); + else if (useIPtSnowflakeProxy()) + startSnowflakeClient(); + } else if (Prefs.beSnowflakeProxy()) { + + if (Prefs.limitSnowflakeProxying()) + { + if (isChargingAndWifi(OrbotService.this)) + { + enableSnowflakeProxy(); + } + + } + else + enableSnowflakeProxy(); + } + + startTor(); + replyWithStatus(mIntent); + + if (Prefs.useVpn()) { + if (mVpnManager != null + && (!mVpnManager.isStarted())) { + //start VPN here + Intent vpnIntent = VpnService.prepare(OrbotService.this); + if (vpnIntent == null) //then we can run the VPN + { + mVpnManager.handleIntent(new Builder(), mIntent); + + } + } + + if (mPortSOCKS != -1 && mPortHTTP != -1) + sendCallbackPorts(mPortSOCKS, mPortHTTP, mPortDns, mPortTrans); + } + } else if (action.equals(ACTION_STOP)) { + stopTorAsync(); + } else if (action.equals(ACTION_START_VPN)) { + if (mVpnManager != null && (!mVpnManager.isStarted())) { + //start VPN here + Intent vpnIntent = VpnService.prepare(OrbotService.this); + if (vpnIntent == null) { //then we can run the VPN + mVpnManager.handleIntent(new Builder(), mIntent); + } + } + + if (mPortSOCKS != -1 && mPortHTTP != -1) + sendCallbackPorts(mPortSOCKS, mPortHTTP, mPortDns, mPortTrans); + + + } else if (action.equals(ACTION_STOP_VPN)) { + if (mVpnManager != null) + mVpnManager.handleIntent(new Builder(), mIntent); + } else if (action.equals(ACTION_STATUS)) { + replyWithStatus(mIntent); + } else if (action.equals(TorControlCommands.SIGNAL_RELOAD)) { + requestTorRereadConfig(); + } else if (action.equals(TorControlCommands.SIGNAL_NEWNYM)) { + newIdentity(); + } else if (action.equals(CMD_ACTIVE)) { + sendSignalActive(); + } else if (action.equals(CMD_SET_EXIT)) { + setExitNode(mIntent.getStringExtra("exit")); + } else { + Log.w(TAG, "unhandled OrbotService Intent: " + action); + } + } + } + } + + private void enableSnowflakeProxy () { + int capacity = 1; + String broker = "https://snowflake-broker.bamsoftware.com/"; + String relay = "wss://snowflake.bamsoftware.com/"; + String stun = "stun:stun.stunprotocol.org:3478"; + String logFile = null; + boolean keepLocalAddresses = true; + boolean unsafeLogging = false; + IPtProxy.startSnowflakeProxy(capacity, broker, relay, stun, logFile, keepLocalAddresses, unsafeLogging); + + logNotice("Snowflake Proxy mode ENABLED"); + } + + public void disableNotification(){ + if(mNotificationManager!=null){ + mNotificationManager.cancel(NOTIFY_ID); + stopForeground(true); + orbotLocalConstants.mNotificationStatus = 0; + } + } + + public void enableTorNotificationNoBandwidth(){ + orbotLocalConstants.mNotificationStatus = 1; + showToolbarNotification("Connected to the Tor network", HS_NOTIFY_ID, R.mipmap.ic_stat_tor_logo); + } + + public void enableNotification(){ + if(mConnectivity && orbotLocalConstants.mIsTorInitialized){ + orbotLocalConstants.mNotificationStatus = 1; + showToolbarNotification(0+"kbps ⇣ / " +0+"kbps ⇡", HS_NOTIFY_ID, R.mipmap.ic_stat_tor_logo); + } + } + + public void onSettingRegister(){ + try { + Intent intent = null; + intent = new Intent(this, Class.forName("com.hiddenservices.genesissearchengine.production.appManager.settingManager.notificationManager.settingNotificationController")); + intent.setFlags(FLAG_ACTIVITY_NEW_TASK); + getApplicationContext().startActivity(intent); + } catch (ClassNotFoundException e) { + Log.i("sad","asd"); + e.printStackTrace(); + } + } + + public static boolean isChargingAndWifi(Context context) { + Intent intent = context.registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED)); + int plugged = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1); + boolean isCharging = plugged == BatteryManager.BATTERY_PLUGGED_AC || plugged == BatteryManager.BATTERY_PLUGGED_USB || plugged == BatteryManager.BATTERY_PLUGGED_WIRELESS; + + ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); + + boolean isUnmetered = cm.getActiveNetworkInfo() != null + && cm.getActiveNetworkInfo().isConnected() + && (!cm.isActiveNetworkMetered()); + + return isCharging && isUnmetered; + } + + private class ActionBroadcastReceiver extends BroadcastReceiver { + public void onReceive(Context context, Intent intent) { + switch (intent.getAction()) { + case CMD_NEWNYM: { + newIdentity(); + break; + } + case CMD_SETTING: { + onSettingRegister(); + break; + } + case CMD_ACTIVE: { + sendSignalActive(); + break; + } + } + } + } + +} diff --git a/orbotmanager/src/main/java/org/torproject/android/service/StartTorReceiver.java b/orbotmanager/src/main/java/org/orbotproject/android/service/StartTorReceiver.java similarity index 91% rename from orbotmanager/src/main/java/org/torproject/android/service/StartTorReceiver.java rename to orbotmanager/src/main/java/org/orbotproject/android/service/StartTorReceiver.java index 943385c8..7e485950 100644 --- a/orbotmanager/src/main/java/org/torproject/android/service/StartTorReceiver.java +++ b/orbotmanager/src/main/java/org/orbotproject/android/service/StartTorReceiver.java @@ -1,42 +1,38 @@ -package org.torproject.android.service; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.os.Build; -import android.text.TextUtils; - -import org.torproject.android.service.util.Prefs; - - -public class StartTorReceiver extends BroadcastReceiver implements TorServiceConstants { - - @Override - public void onReceive(Context context, Intent intent) { - /* sanitize the Intent before forwarding it to OrbotService */ - /*Prefs.setContext(context); - String action = intent.getAction(); - if (TextUtils.equals(action, ACTION_START)) { - String packageName = intent.getStringExtra(EXTRA_PACKAGE_NAME); - if (Prefs.allowBackgroundStarts()) { - Intent startTorIntent = new Intent(context, OrbotService.class); - startTorIntent.setAction(action); - if (packageName != null) { - startTorIntent.putExtra(OrbotService.EXTRA_PACKAGE_NAME, packageName); - } - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && Prefs.persistNotifications()) { - context.startForegroundService(startTorIntent); - } else { - context.startService(startTorIntent); - } - } else if (!TextUtils.isEmpty(packageName)) { - // let the requesting app know that the user has disabled - // starting via Intent - Intent startsDisabledIntent = new Intent(ACTION_STATUS); - startsDisabledIntent.putExtra(EXTRA_STATUS, STATUS_STARTS_DISABLED); - startsDisabledIntent.setPackage(packageName); - context.sendBroadcast(startsDisabledIntent); - } - }*/ - } -} +package org.orbotproject.android.service; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; + + +public class StartTorReceiver extends BroadcastReceiver implements TorServiceConstants { + + @Override + public void onReceive(Context context, Intent intent) { + /* sanitize the Intent before forwarding it to OrbotService */ + /*Prefs.setContext(context); + String action = intent.getAction(); + if (TextUtils.equals(action, ACTION_START)) { + String packageName = intent.getStringExtra(EXTRA_PACKAGE_NAME); + if (Prefs.allowBackgroundStarts()) { + Intent startTorIntent = new Intent(context, OrbotService.class); + startTorIntent.setAction(action); + if (packageName != null) { + startTorIntent.putExtra(OrbotService.EXTRA_PACKAGE_NAME, packageName); + } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && Prefs.persistNotifications()) { + context.startForegroundService(startTorIntent); + } else { + context.startService(startTorIntent); + } + } else if (!TextUtils.isEmpty(packageName)) { + // let the requesting app know that the user has disabled + // starting via Intent + Intent startsDisabledIntent = new Intent(ACTION_STATUS); + startsDisabledIntent.putExtra(EXTRA_STATUS, STATUS_STARTS_DISABLED); + startsDisabledIntent.setPackage(packageName); + context.sendBroadcast(startsDisabledIntent); + } + }*/ + } +} diff --git a/orbotmanager/src/main/java/org/torproject/android/service/TorEventHandler.java b/orbotmanager/src/main/java/org/orbotproject/android/service/TorEventHandler.java similarity index 94% rename from orbotmanager/src/main/java/org/torproject/android/service/TorEventHandler.java rename to orbotmanager/src/main/java/org/orbotproject/android/service/TorEventHandler.java index 6bfa118a..328f58c5 100644 --- a/orbotmanager/src/main/java/org/torproject/android/service/TorEventHandler.java +++ b/orbotmanager/src/main/java/org/orbotproject/android/service/TorEventHandler.java @@ -1,215 +1,212 @@ -package org.torproject.android.service; - -import android.text.TextUtils; - -import net.freehaven.tor.control.EventHandler; - -import org.torproject.android.service.util.ExternalIPFetcher; -import org.torproject.android.service.util.Prefs; - -import java.util.HashMap; -import java.util.List; -import java.util.StringTokenizer; - -/** - * Created by n8fr8 on 9/25/16. - */ -public class TorEventHandler implements EventHandler, TorServiceConstants { - - private final static int BW_THRESDHOLD = 10000; - private final OrbotService mService; - private long lastRead = -1; - private long lastWritten = -1; - private long mTotalTrafficWritten = 0; - private long mTotalTrafficRead = 0; - private final HashMap hmBuiltNodes = new HashMap<>(); - - public TorEventHandler(OrbotService service) { - mService = service; - } - - public HashMap getNodes() { - return hmBuiltNodes; - } - - @Override - public void message(String severity, String msg) { - if (severity.equalsIgnoreCase("debug")) - mService.debug(severity + ": " + msg); - else - mService.logNotice(severity + ": " + msg); - } - - @Override - public void newDescriptors(List orList) { - - for (String desc : orList) - mService.debug("descriptors: " + desc); - - } - - @Override - public void orConnStatus(String status, String orName) { - - String sb = "orConnStatus (" + - parseNodeName(orName) + - "): " + - status; - mService.debug(sb); - } - - @Override - public void streamStatus(String status, String streamID, String target) { - - String sb = "StreamStatus (" + - (streamID) + - "): " + - status; - mService.debug(sb); - } - - @Override - public void unrecognized(String type, String msg) { - - String sb = "Message (" + - type + - "): " + - msg; - mService.logNotice(sb); - } - - @Override - public void bandwidthUsed(long read, long written) { - - if (lastWritten > BW_THRESDHOLD || lastRead > BW_THRESDHOLD) { - - int iconId = R.mipmap.ic_stat_tor_logo; - - String sb = OrbotService.formatBandwidthCount(mService, read) + " \u2193" + " / " + - OrbotService.formatBandwidthCount(mService, written) + " \u2191"; - mService.showToolbarNotification(sb, OrbotService.NOTIFY_ID, iconId); - - mTotalTrafficWritten += written; - mTotalTrafficRead += read; - - mService.sendCallbackBandwidth(written, read, mTotalTrafficWritten, mTotalTrafficRead); - - lastWritten = 0; - lastRead = 0; - } - - lastWritten += written; - lastRead += read; - - } - - public void circuitStatus(String status, String circID, String path) { - - /* once the first circuit is complete, then announce that Orbot is on*/ - if (mService.getCurrentStatus() == STATUS_STARTING && TextUtils.equals(status, "BUILT")) - mService.sendCallbackStatus(STATUS_ON); - - if (Prefs.useDebugLogging()) { - StringBuilder sb = new StringBuilder(); - sb.append("Circuit ("); - sb.append((circID)); - sb.append(") "); - sb.append(status); - sb.append(": "); - - StringTokenizer st = new StringTokenizer(path, ","); - Node node; - - boolean isFirstNode = true; - int nodeCount = st.countTokens(); - - while (st.hasMoreTokens()) { - String nodePath = st.nextToken(); - String nodeId = null, nodeName = null; - - String[] nodeParts; - - if (nodePath.contains("=")) - nodeParts = nodePath.split("="); - else - nodeParts = nodePath.split("~"); - - if (nodeParts.length == 1) { - nodeId = nodeParts[0].substring(1); - nodeName = nodeId; - } else if (nodeParts.length == 2) { - nodeId = nodeParts[0].substring(1); - nodeName = nodeParts[1]; - } - - if (nodeId == null) - continue; - - node = hmBuiltNodes.get(nodeId); - - if (node == null) { - node = new Node(); - node.id = nodeId; - node.name = nodeName; - } - - node.status = status; - - sb.append(node.name); - - if (!TextUtils.isEmpty(node.ipAddress)) - sb.append("(").append(node.ipAddress).append(")"); - - if (st.hasMoreTokens()) - sb.append(" > "); - - if (status.equals("EXTENDED")) { - - if (isFirstNode) { - hmBuiltNodes.put(node.id, node); - - if (node.ipAddress == null && (!node.isFetchingInfo) && Prefs.useDebugLogging()) { - node.isFetchingInfo = true; - mService.exec(new ExternalIPFetcher(mService, node, OrbotService.mPortHTTP)); - } - - isFirstNode = false; - } - } else if (status.equals("BUILT")) { - // mService.logNotice(sb.toString()); - - if (Prefs.useDebugLogging() && nodeCount > 3) - mService.debug(sb.toString()); - } else if (status.equals("CLOSED")) { - // mService.logNotice(sb.toString()); - hmBuiltNodes.remove(node.id); - } - - } - - - } - - - } - - private String parseNodeName(String node) { - if (node.indexOf('=') != -1) { - return (node.substring(node.indexOf("=") + 1)); - } else if (node.indexOf('~') != -1) { - return (node.substring(node.indexOf("~") + 1)); - } else - return node; - } - - public static class Node { - public String status; - public String id; - public String name; - public String ipAddress; - public String country; - public String organization; - - public boolean isFetchingInfo = false; - } -} +package org.orbotproject.android.service; + +import android.text.TextUtils; +import net.freehaven.tor.control.EventHandler; +import org.orbotproject.android.service.util.ExternalIPFetcher; +import org.orbotproject.android.service.util.Prefs; +import java.util.HashMap; +import java.util.List; +import java.util.StringTokenizer; + +/** + * Created by n8fr8 on 9/25/16. + */ +public class TorEventHandler implements EventHandler, TorServiceConstants { + + private final static int BW_THRESDHOLD = 10000; + private final OrbotService mService; + private long lastRead = -1; + private long lastWritten = -1; + private long mTotalTrafficWritten = 0; + private long mTotalTrafficRead = 0; + private final HashMap hmBuiltNodes = new HashMap<>(); + + public TorEventHandler(OrbotService service) { + mService = service; + } + + public HashMap getNodes() { + return hmBuiltNodes; + } + + @Override + public void message(String severity, String msg) { + if (severity.equalsIgnoreCase("debug")) + mService.debug(severity + ": " + msg); + else + mService.logNotice(severity + ": " + msg); + } + + @Override + public void newDescriptors(List orList) { + + for (String desc : orList) + mService.debug("descriptors: " + desc); + + } + + @Override + public void orConnStatus(String status, String orName) { + + String sb = "orConnStatus (" + + parseNodeName(orName) + + "): " + + status; + mService.debug(sb); + } + + @Override + public void streamStatus(String status, String streamID, String target) { + + String sb = "StreamStatus (" + + (streamID) + + "): " + + status; + mService.debug(sb); + } + + @Override + public void unrecognized(String type, String msg) { + + String sb = "Message (" + + type + + "): " + + msg; + mService.logNotice(sb); + } + + @Override + public void bandwidthUsed(long read, long written) { + + if (lastWritten > BW_THRESDHOLD || lastRead > BW_THRESDHOLD) { + + int iconId = R.mipmap.ic_stat_tor_logo; + + String sb = OrbotService.formatBandwidthCount(mService, read) + " \u2193" + " / " + + OrbotService.formatBandwidthCount(mService, written) + " \u2191"; + mService.showToolbarNotification(sb, OrbotService.NOTIFY_ID, iconId); + + mTotalTrafficWritten += written; + mTotalTrafficRead += read; + + mService.sendCallbackBandwidth(written, read, mTotalTrafficWritten, mTotalTrafficRead); + + lastWritten = 0; + lastRead = 0; + } + + lastWritten += written; + lastRead += read; + + } + + public void circuitStatus(String status, String circID, String path) { + + /* once the first circuit is complete, then announce that Orbot is on*/ + if (mService.getCurrentStatus() == STATUS_STARTING && TextUtils.equals(status, "BUILT")) + mService.sendCallbackStatus(STATUS_ON); + + if (Prefs.useDebugLogging()) { + StringBuilder sb = new StringBuilder(); + sb.append("Circuit ("); + sb.append((circID)); + sb.append(") "); + sb.append(status); + sb.append(": "); + + StringTokenizer st = new StringTokenizer(path, ","); + Node node; + + boolean isFirstNode = true; + int nodeCount = st.countTokens(); + + while (st.hasMoreTokens()) { + String nodePath = st.nextToken(); + String nodeId = null, nodeName = null; + + String[] nodeParts; + + if (nodePath.contains("=")) + nodeParts = nodePath.split("="); + else + nodeParts = nodePath.split("~"); + + if (nodeParts.length == 1) { + nodeId = nodeParts[0].substring(1); + nodeName = nodeId; + } else if (nodeParts.length == 2) { + nodeId = nodeParts[0].substring(1); + nodeName = nodeParts[1]; + } + + if (nodeId == null) + continue; + + node = hmBuiltNodes.get(nodeId); + + if (node == null) { + node = new Node(); + node.id = nodeId; + node.name = nodeName; + } + + node.status = status; + + sb.append(node.name); + + if (!TextUtils.isEmpty(node.ipAddress)) + sb.append("(").append(node.ipAddress).append(")"); + + if (st.hasMoreTokens()) + sb.append(" > "); + + if (status.equals("EXTENDED")) { + + if (isFirstNode) { + hmBuiltNodes.put(node.id, node); + + if (node.ipAddress == null && (!node.isFetchingInfo) && Prefs.useDebugLogging()) { + node.isFetchingInfo = true; + mService.exec(new ExternalIPFetcher(mService, node, OrbotService.mPortHTTP)); + } + + isFirstNode = false; + } + } else if (status.equals("BUILT")) { + // mService.logNotice(sb.toString()); + + if (Prefs.useDebugLogging() && nodeCount > 3) + mService.debug(sb.toString()); + } else if (status.equals("CLOSED")) { + // mService.logNotice(sb.toString()); + hmBuiltNodes.remove(node.id); + } + + } + + + } + + + } + + private String parseNodeName(String node) { + if (node.indexOf('=') != -1) { + return (node.substring(node.indexOf("=") + 1)); + } else if (node.indexOf('~') != -1) { + return (node.substring(node.indexOf("~") + 1)); + } else + return node; + } + + public static class Node { + public String status; + public String id; + public String name; + public String ipAddress; + public String country; + public String organization; + + public boolean isFetchingInfo = false; + } +} diff --git a/orbotmanager/src/main/java/org/torproject/android/service/TorServiceConstants.java b/orbotmanager/src/main/java/org/orbotproject/android/service/TorServiceConstants.java similarity index 96% rename from orbotmanager/src/main/java/org/torproject/android/service/TorServiceConstants.java rename to orbotmanager/src/main/java/org/orbotproject/android/service/TorServiceConstants.java index 6fc1d1d5..7403123a 100644 --- a/orbotmanager/src/main/java/org/torproject/android/service/TorServiceConstants.java +++ b/orbotmanager/src/main/java/org/orbotproject/android/service/TorServiceConstants.java @@ -1,103 +1,103 @@ -/* Copyright (c) 2009, Nathan Freitas, Orbot / The Guardian Project - http://openideals.com/guardian */ -/* See LICENSE for licensing information */ - -package org.torproject.android.service; - -import android.content.Intent; - -public interface TorServiceConstants { - - String DIRECTORY_TOR_DATA = "tordata"; - - //geoip data file asset key - String GEOIP_ASSET_KEY = "geoip"; - String GEOIP6_ASSET_KEY = "geoip6"; - - String IP_LOCALHOST = "127.0.0.1"; - int TOR_TRANSPROXY_PORT_DEFAULT = 9040; - - int TOR_DNS_PORT_DEFAULT = 5400; - - String HTTP_PROXY_PORT_DEFAULT = "8118"; // like Privoxy! - String SOCKS_PROXY_PORT_DEFAULT = "9050"; - - //control port - String LOG_NOTICE_HEADER = "NOTICE"; - String LOG_NOTICE_BOOTSTRAPPED = "Bootstrapped"; - - /** - * A request to Orbot to transparently start Tor services - */ - String ACTION_START = "org.torproject.android.intent.action.START"; - String ACTION_STOP = "org.torproject.android.intent.action.STOP"; - - String ACTION_START_VPN = "org.torproject.android.intent.action.START_VPN"; - String ACTION_STOP_VPN = "org.torproject.android.intent.action.STOP_VPN"; - - String ACTION_START_ON_BOOT = "org.torproject.android.intent.action.START_BOOT"; - - int REQUEST_VPN = 7777; - - /** - * {@link Intent} send by Orbot with {@code ON/OFF/STARTING/STOPPING} status - */ - String ACTION_STATUS = "org.torproject.android.intent.action.STATUS"; - /** - * {@code String} that contains a status constant: {@link #STATUS_ON}, - * {@link #STATUS_OFF}, {@link #STATUS_STARTING}, or - * {@link #STATUS_STOPPING} - */ - String EXTRA_STATUS = "org.torproject.android.intent.extra.STATUS"; - /** - * A {@link String} {@code packageName} for Orbot to direct its status reply - * to, used in {@link #ACTION_START} {@link Intent}s sent to Orbot - */ - String EXTRA_PACKAGE_NAME = "org.torproject.android.intent.extra.PACKAGE_NAME"; - /** - * The SOCKS proxy settings in URL form. - */ - String EXTRA_SOCKS_PROXY = "org.torproject.android.intent.extra.SOCKS_PROXY"; - String EXTRA_SOCKS_PROXY_HOST = "org.torproject.android.intent.extra.SOCKS_PROXY_HOST"; - String EXTRA_SOCKS_PROXY_PORT = "org.torproject.android.intent.extra.SOCKS_PROXY_PORT"; - /** - * The HTTP proxy settings in URL form. - */ - String EXTRA_HTTP_PROXY = "org.torproject.android.intent.extra.HTTP_PROXY"; - String EXTRA_HTTP_PROXY_HOST = "org.torproject.android.intent.extra.HTTP_PROXY_HOST"; - String EXTRA_HTTP_PROXY_PORT = "org.torproject.android.intent.extra.HTTP_PROXY_PORT"; - - String EXTRA_DNS_PORT = "org.torproject.android.intent.extra.DNS_PORT"; - String EXTRA_TRANS_PORT = "org.torproject.android.intent.extra.TRANS_PORT"; - - String LOCAL_ACTION_LOG = "log"; - String LOCAL_ACTION_BANDWIDTH = "bandwidth"; - String LOCAL_EXTRA_LOG = "log"; - String LOCAL_ACTION_PORTS = "ports"; - - /** - * All tor-related services and daemons are stopped - */ - String STATUS_OFF = "OFF"; - /** - * All tor-related services and daemons have completed starting - */ - String STATUS_ON = "ON"; - String STATUS_STARTING = "STARTING"; - String STATUS_STOPPING = "STOPPING"; - - String STATUS_STARTS_DISABLED = "STARTS_DISABLED"; - - // actions for internal command Intents - String CMD_SET_EXIT = "setexit"; - String CMD_ACTIVE = "ACTIVE"; - - String CMD_NEWNYM = "newnym"; - String CMD_SETTING = "setting"; - //obfsproxy - String OBFSCLIENT_ASSET_KEY = "obfs4proxy"; - - String HIDDEN_SERVICES_DIR = "hidden_services"; - String ONION_SERVICES_DIR = "v3_onion_services"; - String V3_CLIENT_AUTH_DIR = "v3_client_auth"; - -} +/* Copyright (c) 2009, Nathan Freitas, Orbot / The Guardian Project - http://openideals.com/guardian */ +/* See LICENSE for licensing information */ + +package org.orbotproject.android.service; + +import android.content.Intent; + +public interface TorServiceConstants { + + String DIRECTORY_TOR_DATA = "tordata"; + + //geoip data file asset key + String GEOIP_ASSET_KEY = "geoip"; + String GEOIP6_ASSET_KEY = "geoip6"; + + String IP_LOCALHOST = "127.0.0.1"; + int TOR_TRANSPROXY_PORT_DEFAULT = 9040; + + int TOR_DNS_PORT_DEFAULT = 5400; + + String HTTP_PROXY_PORT_DEFAULT = "8118"; // like Privoxy! + String SOCKS_PROXY_PORT_DEFAULT = "9050"; + + //control port + String LOG_NOTICE_HEADER = "NOTICE"; + String LOG_NOTICE_BOOTSTRAPPED = "Bootstrapped"; + + /** + * A request to Orbot to transparently start Tor services + */ + String ACTION_START = "org.torproject.android.intent.action.START"; + String ACTION_STOP = "org.torproject.android.intent.action.STOP"; + + String ACTION_START_VPN = "org.torproject.android.intent.action.START_VPN"; + String ACTION_STOP_VPN = "org.torproject.android.intent.action.STOP_VPN"; + + String ACTION_START_ON_BOOT = "org.torproject.android.intent.action.START_BOOT"; + + int REQUEST_VPN = 7777; + + /** + * {@link Intent} send by Orbot with {@code ON/OFF/STARTING/STOPPING} status + */ + String ACTION_STATUS = "org.torproject.android.intent.action.STATUS"; + /** + * {@code String} that contains a status constant: {@link #STATUS_ON}, + * {@link #STATUS_OFF}, {@link #STATUS_STARTING}, or + * {@link #STATUS_STOPPING} + */ + String EXTRA_STATUS = "org.torproject.android.intent.extra.STATUS"; + /** + * A {@link String} {@code packageName} for Orbot to direct its status reply + * to, used in {@link #ACTION_START} {@link Intent}s sent to Orbot + */ + String EXTRA_PACKAGE_NAME = "org.torproject.android.intent.extra.PACKAGE_NAME"; + /** + * The SOCKS proxy settings in URL form. + */ + String EXTRA_SOCKS_PROXY = "org.torproject.android.intent.extra.SOCKS_PROXY"; + String EXTRA_SOCKS_PROXY_HOST = "org.torproject.android.intent.extra.SOCKS_PROXY_HOST"; + String EXTRA_SOCKS_PROXY_PORT = "org.torproject.android.intent.extra.SOCKS_PROXY_PORT"; + /** + * The HTTP proxy settings in URL form. + */ + String EXTRA_HTTP_PROXY = "org.torproject.android.intent.extra.HTTP_PROXY"; + String EXTRA_HTTP_PROXY_HOST = "org.torproject.android.intent.extra.HTTP_PROXY_HOST"; + String EXTRA_HTTP_PROXY_PORT = "org.torproject.android.intent.extra.HTTP_PROXY_PORT"; + + String EXTRA_DNS_PORT = "org.torproject.android.intent.extra.DNS_PORT"; + String EXTRA_TRANS_PORT = "org.torproject.android.intent.extra.TRANS_PORT"; + + String LOCAL_ACTION_LOG = "log"; + String LOCAL_ACTION_BANDWIDTH = "bandwidth"; + String LOCAL_EXTRA_LOG = "log"; + String LOCAL_ACTION_PORTS = "ports"; + + /** + * All tor-related services and daemons are stopped + */ + String STATUS_OFF = "OFF"; + /** + * All tor-related services and daemons have completed starting + */ + String STATUS_ON = "ON"; + String STATUS_STARTING = "STARTING"; + String STATUS_STOPPING = "STOPPING"; + + String STATUS_STARTS_DISABLED = "STARTS_DISABLED"; + + // actions for internal command Intents + String CMD_SET_EXIT = "setexit"; + String CMD_ACTIVE = "ACTIVE"; + + String CMD_NEWNYM = "newnym"; + String CMD_SETTING = "setting"; + //obfsproxy + String OBFSCLIENT_ASSET_KEY = "obfs4proxy"; + + String HIDDEN_SERVICES_DIR = "hidden_services"; + String ONION_SERVICES_DIR = "v3_onion_services"; + String V3_CLIENT_AUTH_DIR = "v3_client_auth"; + +} diff --git a/orbotmanager/src/main/java/org/torproject/android/service/util/CustomNativeLoader.java b/orbotmanager/src/main/java/org/orbotproject/android/service/util/CustomNativeLoader.java similarity index 95% rename from orbotmanager/src/main/java/org/torproject/android/service/util/CustomNativeLoader.java rename to orbotmanager/src/main/java/org/orbotproject/android/service/util/CustomNativeLoader.java index fb528621..9b9edb97 100644 --- a/orbotmanager/src/main/java/org/torproject/android/service/util/CustomNativeLoader.java +++ b/orbotmanager/src/main/java/org/orbotproject/android/service/util/CustomNativeLoader.java @@ -1,128 +1,128 @@ -package org.torproject.android.service.util; - -import android.annotation.SuppressLint; -import android.content.Context; -import android.content.pm.ApplicationInfo; -import android.os.Build; -import android.util.Log; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.zip.ZipEntry; -import java.util.zip.ZipFile; - -public class CustomNativeLoader { - - private final static String TAG = "CNL"; - - @SuppressLint("SetWorldReadable") - private static boolean loadFromZip(Context context, String libname, File destLocalFile, String arch) { - - - ZipFile zipFile = null; - InputStream stream = null; - - try { - zipFile = new ZipFile(context.getApplicationInfo().sourceDir); - ZipEntry entry = zipFile.getEntry("lib/" + arch + "/" + libname + ".so"); - if (entry == null) { - entry = zipFile.getEntry("jni/" + arch + "/" + libname + ".so"); - if (entry == null) - throw new Exception("Unable to find file in apk:" + "lib/" + arch + "/" + libname); - } - - //how we wrap this in another stream because the native .so is zipped itself - stream = zipFile.getInputStream(entry); - - OutputStream out = new FileOutputStream(destLocalFile); - byte[] buf = new byte[4096]; - int len; - while ((len = stream.read(buf)) > 0) { - Thread.yield(); - out.write(buf, 0, len); - } - out.close(); - - destLocalFile.setReadable(true, false); - destLocalFile.setExecutable(true, false); - destLocalFile.setWritable(true); - - return true; - } catch (Exception e) { - Log.e(TAG, e.getMessage()); - } finally { - if (stream != null) { - try { - stream.close(); - } catch (Exception e) { - Log.e(TAG, e.getMessage()); - } - } - if (zipFile != null) { - try { - zipFile.close(); - } catch (Exception e) { - Log.e(TAG, e.getMessage()); - } - } - } - return false; - } - - public static File loadNativeBinary(Context context, String libname, File destLocalFile) { - - try { - - - File fileNativeBin = new File(getNativeLibraryDir(context), libname + ".so"); - if (!fileNativeBin.exists()) - fileNativeBin = new File(getNativeLibraryDir(context), "lib" + libname + ".so"); - - if (fileNativeBin.exists()) { - if (fileNativeBin.canExecute()) - return fileNativeBin; - else { - setExecutable(fileNativeBin); - - if (fileNativeBin.canExecute()) - return fileNativeBin; - } - } - - String folder = Build.CPU_ABI; - - - String javaArch = System.getProperty("os.arch"); - if (javaArch != null && javaArch.contains("686")) { - folder = "x86"; - } - - if (loadFromZip(context, libname, destLocalFile, folder)) { - return destLocalFile; - } - - } catch (Throwable e) { - Log.e(TAG, e.getMessage(), e); - } - - - return null; - } - - private static void setExecutable(File fileBin) { - fileBin.setReadable(true); - fileBin.setExecutable(true); - fileBin.setWritable(false); - fileBin.setWritable(true, true); - } - - // Return Full path to the directory where native JNI libraries are stored. - private static String getNativeLibraryDir(Context context) { - ApplicationInfo appInfo = context.getApplicationInfo(); - return appInfo.nativeLibraryDir; - } - -} - +package org.orbotproject.android.service.util; + +import android.annotation.SuppressLint; +import android.content.Context; +import android.content.pm.ApplicationInfo; +import android.os.Build; +import android.util.Log; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; + +public class CustomNativeLoader { + + private final static String TAG = "CNL"; + + @SuppressLint("SetWorldReadable") + private static boolean loadFromZip(Context context, String libname, File destLocalFile, String arch) { + + + ZipFile zipFile = null; + InputStream stream = null; + + try { + zipFile = new ZipFile(context.getApplicationInfo().sourceDir); + ZipEntry entry = zipFile.getEntry("lib/" + arch + "/" + libname + ".so"); + if (entry == null) { + entry = zipFile.getEntry("jni/" + arch + "/" + libname + ".so"); + if (entry == null) + throw new Exception("Unable to find file in apk:" + "lib/" + arch + "/" + libname); + } + + //how we wrap this in another stream because the native .so is zipped itself + stream = zipFile.getInputStream(entry); + + OutputStream out = new FileOutputStream(destLocalFile); + byte[] buf = new byte[4096]; + int len; + while ((len = stream.read(buf)) > 0) { + Thread.yield(); + out.write(buf, 0, len); + } + out.close(); + + destLocalFile.setReadable(true, false); + destLocalFile.setExecutable(true, false); + destLocalFile.setWritable(true); + + return true; + } catch (Exception e) { + Log.e(TAG, e.getMessage()); + } finally { + if (stream != null) { + try { + stream.close(); + } catch (Exception e) { + Log.e(TAG, e.getMessage()); + } + } + if (zipFile != null) { + try { + zipFile.close(); + } catch (Exception e) { + Log.e(TAG, e.getMessage()); + } + } + } + return false; + } + + public static File loadNativeBinary(Context context, String libname, File destLocalFile) { + + try { + + + File fileNativeBin = new File(getNativeLibraryDir(context), libname + ".so"); + if (!fileNativeBin.exists()) + fileNativeBin = new File(getNativeLibraryDir(context), "lib" + libname + ".so"); + + if (fileNativeBin.exists()) { + if (fileNativeBin.canExecute()) + return fileNativeBin; + else { + setExecutable(fileNativeBin); + + if (fileNativeBin.canExecute()) + return fileNativeBin; + } + } + + String folder = Build.CPU_ABI; + + + String javaArch = System.getProperty("os.arch"); + if (javaArch != null && javaArch.contains("686")) { + folder = "x86"; + } + + if (loadFromZip(context, libname, destLocalFile, folder)) { + return destLocalFile; + } + + } catch (Throwable e) { + Log.e(TAG, e.getMessage(), e); + } + + + return null; + } + + private static void setExecutable(File fileBin) { + fileBin.setReadable(true); + fileBin.setExecutable(true); + fileBin.setWritable(false); + fileBin.setWritable(true, true); + } + + // Return Full path to the directory where native JNI libraries are stored. + private static String getNativeLibraryDir(Context context) { + ApplicationInfo appInfo = context.getApplicationInfo(); + return appInfo.nativeLibraryDir; + } + +} + diff --git a/orbotmanager/src/main/java/org/torproject/android/service/util/CustomShell.java b/orbotmanager/src/main/java/org/orbotproject/android/service/util/CustomShell.java similarity index 95% rename from orbotmanager/src/main/java/org/torproject/android/service/util/CustomShell.java rename to orbotmanager/src/main/java/org/orbotproject/android/service/util/CustomShell.java index 8f50ccf2..5db0547a 100644 --- a/orbotmanager/src/main/java/org/torproject/android/service/util/CustomShell.java +++ b/orbotmanager/src/main/java/org/orbotproject/android/service/util/CustomShell.java @@ -1,80 +1,80 @@ -package org.torproject.android.service.util; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.WorkerThread; - -import com.jaredrummler.android.shell.CommandResult; -import com.jaredrummler.android.shell.Shell; -import com.jaredrummler.android.shell.ShellExitCode; -import com.jaredrummler.android.shell.StreamGobbler; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -public class CustomShell extends Shell { - - - @WorkerThread - public static CommandResult run(@NonNull String shell, boolean waitFor, @Nullable Map env, @NonNull String command) { - List stdout = Collections.synchronizedList(new ArrayList<>()); - List stderr = Collections.synchronizedList(new ArrayList<>()); - int exitCode = -1; - - try { - - // setup our process, retrieve stdin stream, and stdout/stderr gobblers - //Process process = runWithEnv(command, env); - ProcessBuilder builder = new ProcessBuilder(); - - if (env != null && (!env.isEmpty())) - builder.environment().putAll(env); - - builder.command("/system/bin/" + shell, "-c", command); - Process process = builder.start(); - - StreamGobbler stdoutGobbler = null; - StreamGobbler stderrGobbler = null; - - if (waitFor) { - stdoutGobbler = new StreamGobbler(process.getInputStream(), stdout); - stderrGobbler = new StreamGobbler(process.getErrorStream(), stderr); - - // start gobbling and write our commands to the shell - stdoutGobbler.start(); - stderrGobbler.start(); - } - - // wait for our process to finish, while we gobble away in the background - if (waitFor) - exitCode = process.waitFor(); - else - exitCode = 0; - - // make sure our threads are done gobbling, our streams are closed, and the process is destroyed - while the - // latter two shouldn't be needed in theory, and may even produce warnings, in "normal" Java they are required - // for guaranteed cleanup of resources, so lets be safe and do this on Android as well - /** - try { - stdin.close(); - } catch (IOException e) { - // might be closed already - }**/ - - if (waitFor) { - stdoutGobbler.join(); - stderrGobbler.join(); - } - - } catch (InterruptedException e) { - exitCode = ShellExitCode.WATCHDOG_EXIT; - } catch (IOException e) { - exitCode = ShellExitCode.SHELL_WRONG_UID; - } - - return new CommandResult(stdout, stderr, exitCode); - } -} +package org.orbotproject.android.service.util; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.WorkerThread; + +import com.jaredrummler.android.shell.CommandResult; +import com.jaredrummler.android.shell.Shell; +import com.jaredrummler.android.shell.ShellExitCode; +import com.jaredrummler.android.shell.StreamGobbler; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public class CustomShell extends Shell { + + + @WorkerThread + public static CommandResult run(@NonNull String shell, boolean waitFor, @Nullable Map env, @NonNull String command) { + List stdout = Collections.synchronizedList(new ArrayList<>()); + List stderr = Collections.synchronizedList(new ArrayList<>()); + int exitCode = -1; + + try { + + // setup our process, retrieve stdin stream, and stdout/stderr gobblers + //Process process = runWithEnv(command, env); + ProcessBuilder builder = new ProcessBuilder(); + + if (env != null && (!env.isEmpty())) + builder.environment().putAll(env); + + builder.command("/system/bin/" + shell, "-c", command); + Process process = builder.start(); + + StreamGobbler stdoutGobbler = null; + StreamGobbler stderrGobbler = null; + + if (waitFor) { + stdoutGobbler = new StreamGobbler(process.getInputStream(), stdout); + stderrGobbler = new StreamGobbler(process.getErrorStream(), stderr); + + // start gobbling and write our commands to the shell + stdoutGobbler.start(); + stderrGobbler.start(); + } + + // wait for our process to finish, while we gobble away in the background + if (waitFor) + exitCode = process.waitFor(); + else + exitCode = 0; + + // make sure our threads are done gobbling, our streams are closed, and the process is destroyed - while the + // latter two shouldn't be needed in theory, and may even produce warnings, in "normal" Java they are required + // for guaranteed cleanup of resources, so lets be safe and do this on Android as well + /** + try { + stdin.close(); + } catch (IOException e) { + // might be closed already + }**/ + + if (waitFor) { + stdoutGobbler.join(); + stderrGobbler.join(); + } + + } catch (InterruptedException e) { + exitCode = ShellExitCode.WATCHDOG_EXIT; + } catch (IOException e) { + exitCode = ShellExitCode.SHELL_WRONG_UID; + } + + return new CommandResult(stdout, stderr, exitCode); + } +} diff --git a/orbotmanager/src/main/java/org/torproject/android/service/util/CustomTorResourceInstaller.java b/orbotmanager/src/main/java/org/orbotproject/android/service/util/CustomTorResourceInstaller.java similarity index 93% rename from orbotmanager/src/main/java/org/torproject/android/service/util/CustomTorResourceInstaller.java rename to orbotmanager/src/main/java/org/orbotproject/android/service/util/CustomTorResourceInstaller.java index fc8acde1..c925a7b2 100644 --- a/orbotmanager/src/main/java/org/torproject/android/service/util/CustomTorResourceInstaller.java +++ b/orbotmanager/src/main/java/org/orbotproject/android/service/util/CustomTorResourceInstaller.java @@ -1,127 +1,127 @@ -package org.torproject.android.service.util; - -import android.content.Context; -import android.content.pm.ApplicationInfo; -import android.util.Log; - -import org.torproject.android.service.TorServiceConstants; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; - -public class CustomTorResourceInstaller { - - private static final String TAG = "CustomTorResourceInstaller"; - - private File installFolder; - private Context context; - - public CustomTorResourceInstaller(Context context, File installFolder) { - this.installFolder = installFolder; - this.context = context; - } - - // Return Full path to the directory where native JNI libraries are stored. - private static String getNativeLibraryDir(Context context) { - ApplicationInfo appInfo = context.getApplicationInfo(); - return appInfo.nativeLibraryDir; - } - - /* - * Write the inputstream contents to the file - */ - private static boolean streamToFile(InputStream stm, File outFile, boolean append, boolean zip) throws IOException { - byte[] buffer = new byte[1024]; - - int bytecount; - - OutputStream stmOut = new FileOutputStream(outFile.getAbsolutePath(), append); - ZipInputStream zis = null; - - if (zip) { - zis = new ZipInputStream(stm); - ZipEntry ze = zis.getNextEntry(); - stm = zis; - - } - - while ((bytecount = stm.read(buffer)) > 0) { - - stmOut.write(buffer, 0, bytecount); - - } - - stmOut.close(); - stm.close(); - - if (zis != null) - zis.close(); - - - return true; - - } - - - - - /* - * Extract the Tor binary from the APK file using ZIP - */ - - private static File[] listf(String directoryName) { - - // .............list file - File directory = new File(directoryName); - - // get all the files from a directory - File[] fList = directory.listFiles(); - - if (fList != null) - for (File file : fList) { - if (file.isFile()) { - Log.d(TAG, file.getAbsolutePath()); - } else if (file.isDirectory()) { - listf(file.getAbsolutePath()); - } - } - - return fList; - } - - /* - * Extract the Tor resources from the APK file using ZIP - */ - public void installGeoIP() throws IOException { - if (!installFolder.exists()) - installFolder.mkdirs(); - assetToFile(TorServiceConstants.GEOIP_ASSET_KEY, TorServiceConstants.GEOIP_ASSET_KEY, false, false); - assetToFile(TorServiceConstants.GEOIP6_ASSET_KEY, TorServiceConstants.GEOIP6_ASSET_KEY, false, false); - } - - /* - * Reads file from assetPath/assetKey writes it to the install folder - */ - private File assetToFile(String assetPath, String assetKey, boolean isZipped, boolean isExecutable) throws IOException { - InputStream is = context.getAssets().open(assetPath); - File outFile = new File(installFolder, assetKey); - streamToFile(is, outFile, false, isZipped); - if (isExecutable) { - setExecutable(outFile); - } - return outFile; - } - - private void setExecutable(File fileBin) { - fileBin.setReadable(true); - fileBin.setExecutable(true); - fileBin.setWritable(false); - fileBin.setWritable(true, true); - } -} - +package org.orbotproject.android.service.util; + +import android.content.Context; +import android.content.pm.ApplicationInfo; +import android.util.Log; + +import org.orbotproject.android.service.TorServiceConstants; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; + +public class CustomTorResourceInstaller { + + private static final String TAG = "CustomTorResourceInstaller"; + + private File installFolder; + private Context context; + + public CustomTorResourceInstaller(Context context, File installFolder) { + this.installFolder = installFolder; + this.context = context; + } + + // Return Full path to the directory where native JNI libraries are stored. + private static String getNativeLibraryDir(Context context) { + ApplicationInfo appInfo = context.getApplicationInfo(); + return appInfo.nativeLibraryDir; + } + + /* + * Write the inputstream contents to the file + */ + private static boolean streamToFile(InputStream stm, File outFile, boolean append, boolean zip) throws IOException { + byte[] buffer = new byte[1024]; + + int bytecount; + + OutputStream stmOut = new FileOutputStream(outFile.getAbsolutePath(), append); + ZipInputStream zis = null; + + if (zip) { + zis = new ZipInputStream(stm); + ZipEntry ze = zis.getNextEntry(); + stm = zis; + + } + + while ((bytecount = stm.read(buffer)) > 0) { + + stmOut.write(buffer, 0, bytecount); + + } + + stmOut.close(); + stm.close(); + + if (zis != null) + zis.close(); + + + return true; + + } + + + + + /* + * Extract the Tor binary from the APK file using ZIP + */ + + private static File[] listf(String directoryName) { + + // .............list file + File directory = new File(directoryName); + + // get all the files from a directory + File[] fList = directory.listFiles(); + + if (fList != null) + for (File file : fList) { + if (file.isFile()) { + Log.d(TAG, file.getAbsolutePath()); + } else if (file.isDirectory()) { + listf(file.getAbsolutePath()); + } + } + + return fList; + } + + /* + * Extract the Tor resources from the APK file using ZIP + */ + public void installGeoIP() throws IOException { + if (!installFolder.exists()) + installFolder.mkdirs(); + assetToFile(TorServiceConstants.GEOIP_ASSET_KEY, TorServiceConstants.GEOIP_ASSET_KEY, false, false); + assetToFile(TorServiceConstants.GEOIP6_ASSET_KEY, TorServiceConstants.GEOIP6_ASSET_KEY, false, false); + } + + /* + * Reads file from assetPath/assetKey writes it to the install folder + */ + private File assetToFile(String assetPath, String assetKey, boolean isZipped, boolean isExecutable) throws IOException { + InputStream is = context.getAssets().open(assetPath); + File outFile = new File(installFolder, assetKey); + streamToFile(is, outFile, false, isZipped); + if (isExecutable) { + setExecutable(outFile); + } + return outFile; + } + + private void setExecutable(File fileBin) { + fileBin.setReadable(true); + fileBin.setExecutable(true); + fileBin.setWritable(false); + fileBin.setWritable(true, true); + } +} + diff --git a/orbotmanager/src/main/java/org/torproject/android/service/util/DummyActivity.java b/orbotmanager/src/main/java/org/orbotproject/android/service/util/DummyActivity.java similarity index 81% rename from orbotmanager/src/main/java/org/torproject/android/service/util/DummyActivity.java rename to orbotmanager/src/main/java/org/orbotproject/android/service/util/DummyActivity.java index c818c96f..424334d4 100644 --- a/orbotmanager/src/main/java/org/torproject/android/service/util/DummyActivity.java +++ b/orbotmanager/src/main/java/org/orbotproject/android/service/util/DummyActivity.java @@ -1,15 +1,15 @@ -package org.torproject.android.service.util; - -import android.app.Activity; -import android.os.Bundle; - -/* - * To combat background service being stopped/swiped - */ -public class DummyActivity extends Activity { - @Override - public void onCreate(Bundle icicle) { - super.onCreate(icicle); - finish(); - } +package org.orbotproject.android.service.util; + +import android.app.Activity; +import android.os.Bundle; + +/* + * To combat background service being stopped/swiped + */ +public class DummyActivity extends Activity { + @Override + public void onCreate(Bundle icicle) { + super.onCreate(icicle); + finish(); + } } \ No newline at end of file diff --git a/orbotmanager/src/main/java/org/torproject/android/service/util/ExternalIPFetcher.java b/orbotmanager/src/main/java/org/orbotproject/android/service/util/ExternalIPFetcher.java similarity index 91% rename from orbotmanager/src/main/java/org/torproject/android/service/util/ExternalIPFetcher.java rename to orbotmanager/src/main/java/org/orbotproject/android/service/util/ExternalIPFetcher.java index 957e1e65..1e277664 100644 --- a/orbotmanager/src/main/java/org/torproject/android/service/util/ExternalIPFetcher.java +++ b/orbotmanager/src/main/java/org/orbotproject/android/service/util/ExternalIPFetcher.java @@ -1,85 +1,85 @@ -package org.torproject.android.service.util; - -import org.json.JSONArray; -import org.json.JSONObject; -import org.torproject.android.service.OrbotService; -import org.torproject.android.service.TorEventHandler; - -import java.io.BufferedReader; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.net.InetSocketAddress; -import java.net.Proxy; -import java.net.URL; -import java.net.URLConnection; - -public class ExternalIPFetcher implements Runnable { - - private final static String ONIONOO_BASE_URL = "https://onionoo.torproject.org/details?fields=country_name,as_name,or_addresses&lookup="; - private OrbotService mService; - private TorEventHandler.Node mNode; - private int mLocalHttpProxyPort = 8118; - - public ExternalIPFetcher(OrbotService service, TorEventHandler.Node node, int localProxyPort) { - mService = service; - mNode = node; - mLocalHttpProxyPort = localProxyPort; - } - - public void run() { - try { - - URLConnection conn; - - Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("127.0.0.1", mLocalHttpProxyPort)); - conn = new URL(ONIONOO_BASE_URL + mNode.id).openConnection(proxy); - - conn.setRequestProperty("Connection", "Close"); - conn.setConnectTimeout(60000); - conn.setReadTimeout(60000); - - InputStream is = conn.getInputStream(); - - BufferedReader reader = new BufferedReader(new InputStreamReader(is)); - - // getting JSON string from URL - - StringBuffer json = new StringBuffer(); - String line; - - while ((line = reader.readLine()) != null) - json.append(line); - - JSONObject jsonNodeInfo = new org.json.JSONObject(json.toString()); - - JSONArray jsonRelays = jsonNodeInfo.getJSONArray("relays"); - - if (jsonRelays.length() > 0) { - mNode.ipAddress = jsonRelays.getJSONObject(0).getJSONArray("or_addresses").getString(0).split(":")[0]; - mNode.country = jsonRelays.getJSONObject(0).getString("country_name"); - mNode.organization = jsonRelays.getJSONObject(0).getString("as_name"); - - StringBuffer sbInfo = new StringBuffer(); - sbInfo.append(mNode.name).append("("); - sbInfo.append(mNode.ipAddress).append(")"); - - if (mNode.country != null) - sbInfo.append(' ').append(mNode.country); - - if (mNode.organization != null) - sbInfo.append(" (").append(mNode.organization).append(')'); - - mService.debug(sbInfo.toString()); - - } - - reader.close(); - is.close(); - - - } catch (Exception e) { - - // mService.debug ("Error getting node details from onionoo: " + e.getMessage()); - } - } -} +package org.orbotproject.android.service.util; + +import org.json.JSONArray; +import org.json.JSONObject; +import org.orbotproject.android.service.OrbotService; +import org.orbotproject.android.service.TorEventHandler; + +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.InetSocketAddress; +import java.net.Proxy; +import java.net.URL; +import java.net.URLConnection; + +public class ExternalIPFetcher implements Runnable { + + private final static String ONIONOO_BASE_URL = "https://onionoo.torproject.org/details?fields=country_name,as_name,or_addresses&lookup="; + private OrbotService mService; + private TorEventHandler.Node mNode; + private int mLocalHttpProxyPort = 8118; + + public ExternalIPFetcher(OrbotService service, TorEventHandler.Node node, int localProxyPort) { + mService = service; + mNode = node; + mLocalHttpProxyPort = localProxyPort; + } + + public void run() { + try { + + URLConnection conn; + + Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("127.0.0.1", mLocalHttpProxyPort)); + conn = new URL(ONIONOO_BASE_URL + mNode.id).openConnection(proxy); + + conn.setRequestProperty("Connection", "Close"); + conn.setConnectTimeout(60000); + conn.setReadTimeout(60000); + + InputStream is = conn.getInputStream(); + + BufferedReader reader = new BufferedReader(new InputStreamReader(is)); + + // getting JSON string from URL + + StringBuffer json = new StringBuffer(); + String line; + + while ((line = reader.readLine()) != null) + json.append(line); + + JSONObject jsonNodeInfo = new org.json.JSONObject(json.toString()); + + JSONArray jsonRelays = jsonNodeInfo.getJSONArray("relays"); + + if (jsonRelays.length() > 0) { + mNode.ipAddress = jsonRelays.getJSONObject(0).getJSONArray("or_addresses").getString(0).split(":")[0]; + mNode.country = jsonRelays.getJSONObject(0).getString("country_name"); + mNode.organization = jsonRelays.getJSONObject(0).getString("as_name"); + + StringBuffer sbInfo = new StringBuffer(); + sbInfo.append(mNode.name).append("("); + sbInfo.append(mNode.ipAddress).append(")"); + + if (mNode.country != null) + sbInfo.append(' ').append(mNode.country); + + if (mNode.organization != null) + sbInfo.append(" (").append(mNode.organization).append(')'); + + mService.debug(sbInfo.toString()); + + } + + reader.close(); + is.close(); + + + } catch (Exception e) { + + // mService.debug ("Error getting node details from onionoo: " + e.getMessage()); + } + } +} diff --git a/orbotmanager/src/main/java/org/torproject/android/service/util/NativeLoader.java b/orbotmanager/src/main/java/org/orbotproject/android/service/util/NativeLoader.java similarity index 95% rename from orbotmanager/src/main/java/org/torproject/android/service/util/NativeLoader.java rename to orbotmanager/src/main/java/org/orbotproject/android/service/util/NativeLoader.java index c870025a..88c96423 100644 --- a/orbotmanager/src/main/java/org/torproject/android/service/util/NativeLoader.java +++ b/orbotmanager/src/main/java/org/orbotproject/android/service/util/NativeLoader.java @@ -1,98 +1,98 @@ -package org.torproject.android.service.util; - -import android.annotation.SuppressLint; -import android.content.Context; -import android.os.Build; -import android.util.Log; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.zip.ZipEntry; -import java.util.zip.ZipFile; - -public class NativeLoader { - - private final static String TAG = "TorNativeLoader"; - - @SuppressLint("SetWorldReadable") - private static boolean loadFromZip(Context context, String libName, File destLocalFile, String folder) { - - - ZipFile zipFile = null; - InputStream stream = null; - try { - zipFile = new ZipFile(context.getApplicationInfo().sourceDir); - - /** - Enumeration entries = zipFile.entries(); - while (entries.hasMoreElements()) - { - ZipEntry entry = entries.nextElement(); - Log.d("Zip","entry: " + entry.getName()); - } - **/ - - ZipEntry entry = zipFile.getEntry("lib/" + folder + "/" + libName + ".so"); - if (entry == null) { - entry = zipFile.getEntry("lib/" + folder + "/" + libName); - if (entry == null) - throw new Exception("Unable to find file in apk:" + "lib/" + folder + "/" + libName); - } - stream = zipFile.getInputStream(entry); - - OutputStream out = new FileOutputStream(destLocalFile); - byte[] buf = new byte[4096]; - int len; - while ((len = stream.read(buf)) > 0) { - Thread.yield(); - out.write(buf, 0, len); - } - out.close(); - - destLocalFile.setReadable(true, false); - destLocalFile.setExecutable(true, false); - destLocalFile.setWritable(true); - - return true; - } catch (Exception e) { - Log.e(TAG, e.getMessage()); - } finally { - if (stream != null) { - try { - stream.close(); - } catch (Exception e) { - Log.e(TAG, e.getMessage()); - } - } - if (zipFile != null) { - try { - zipFile.close(); - } catch (Exception e) { - Log.e(TAG, e.getMessage()); - } - } - } - return false; - } - - public static synchronized boolean initNativeLibs(Context context, String binaryName, File destLocalFile) { - - try { - String folder = Build.CPU_ABI; - - String javaArch = System.getProperty("os.arch"); - if (javaArch != null && javaArch.contains("686")) { - folder = "x86"; - } - - return loadFromZip(context, binaryName, destLocalFile, folder); - - } catch (Throwable e) { - e.printStackTrace(); - } - - return false; - } -} +package org.orbotproject.android.service.util; + +import android.annotation.SuppressLint; +import android.content.Context; +import android.os.Build; +import android.util.Log; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; + +public class NativeLoader { + + private final static String TAG = "TorNativeLoader"; + + @SuppressLint("SetWorldReadable") + private static boolean loadFromZip(Context context, String libName, File destLocalFile, String folder) { + + + ZipFile zipFile = null; + InputStream stream = null; + try { + zipFile = new ZipFile(context.getApplicationInfo().sourceDir); + + /** + Enumeration entries = zipFile.entries(); + while (entries.hasMoreElements()) + { + ZipEntry entry = entries.nextElement(); + Log.d("Zip","entry: " + entry.getName()); + } + **/ + + ZipEntry entry = zipFile.getEntry("lib/" + folder + "/" + libName + ".so"); + if (entry == null) { + entry = zipFile.getEntry("lib/" + folder + "/" + libName); + if (entry == null) + throw new Exception("Unable to find file in apk:" + "lib/" + folder + "/" + libName); + } + stream = zipFile.getInputStream(entry); + + OutputStream out = new FileOutputStream(destLocalFile); + byte[] buf = new byte[4096]; + int len; + while ((len = stream.read(buf)) > 0) { + Thread.yield(); + out.write(buf, 0, len); + } + out.close(); + + destLocalFile.setReadable(true, false); + destLocalFile.setExecutable(true, false); + destLocalFile.setWritable(true); + + return true; + } catch (Exception e) { + Log.e(TAG, e.getMessage()); + } finally { + if (stream != null) { + try { + stream.close(); + } catch (Exception e) { + Log.e(TAG, e.getMessage()); + } + } + if (zipFile != null) { + try { + zipFile.close(); + } catch (Exception e) { + Log.e(TAG, e.getMessage()); + } + } + } + return false; + } + + public static synchronized boolean initNativeLibs(Context context, String binaryName, File destLocalFile) { + + try { + String folder = Build.CPU_ABI; + + String javaArch = System.getProperty("os.arch"); + if (javaArch != null && javaArch.contains("686")) { + folder = "x86"; + } + + return loadFromZip(context, binaryName, destLocalFile, folder); + + } catch (Throwable e) { + e.printStackTrace(); + } + + return false; + } +} diff --git a/orbotmanager/src/main/java/org/torproject/android/service/util/PortForwarder.java b/orbotmanager/src/main/java/org/orbotproject/android/service/util/PortForwarder.java similarity index 95% rename from orbotmanager/src/main/java/org/torproject/android/service/util/PortForwarder.java rename to orbotmanager/src/main/java/org/orbotproject/android/service/util/PortForwarder.java index 26c3a3ff..6779748b 100644 --- a/orbotmanager/src/main/java/org/torproject/android/service/util/PortForwarder.java +++ b/orbotmanager/src/main/java/org/orbotproject/android/service/util/PortForwarder.java @@ -1,77 +1,77 @@ -package org.torproject.android.service.util; - -import android.util.Log; - -import com.offbynull.portmapper.PortMapperFactory; -import com.offbynull.portmapper.gateway.Bus; -import com.offbynull.portmapper.gateway.Gateway; -import com.offbynull.portmapper.gateways.network.NetworkGateway; -import com.offbynull.portmapper.gateways.network.internalmessages.KillNetworkRequest; -import com.offbynull.portmapper.gateways.process.ProcessGateway; -import com.offbynull.portmapper.gateways.process.internalmessages.KillProcessRequest; -import com.offbynull.portmapper.mapper.MappedPort; -import com.offbynull.portmapper.mapper.PortMapper; -import com.offbynull.portmapper.mapper.PortType; - -import java.util.List; - -public class PortForwarder { - - private boolean shutdown = false; - private Thread mThread = null; - - public void shutdown() { - shutdown = true; - } - - public void forward(final int internalPort, final int externalPort, final long lifetime) throws InterruptedException { - - mThread = new Thread() { - public void run() { - try { - forwardSync(internalPort, externalPort, lifetime); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - }; - - mThread.start(); - } - - - public void forwardSync(int internalPort, int externalPort, long lifetime) throws InterruptedException { - // Start gateways - Gateway network = NetworkGateway.create(); - Gateway process = ProcessGateway.create(); - Bus networkBus = network.getBus(); - Bus processBus = process.getBus(); - -// Discover port forwarding devices and take the first one found - List mappers = PortMapperFactory.discover(networkBus, processBus); - PortMapper mapper = mappers.get(0); - -// Map internal port 12345 to some external port (55555 preferred) -// -// IMPORTANT NOTE: Many devices prevent you from mapping ports that are <= 1024 -// (both internal and external ports). Be mindful of this when choosing which -// ports you want to map. - MappedPort mappedPort = mapper.mapPort(PortType.TCP, internalPort, externalPort, lifetime); - Log.d(getClass().getName(), "Port mapping added: " + mappedPort); - -// Refresh mapping half-way through the lifetime of the mapping (for example, -// if the mapping is available for 40 seconds, refresh it every 20 seconds) - while (!shutdown) { - mappedPort = mapper.refreshPort(mappedPort, mappedPort.getLifetime() / 2L); - Log.d(getClass().getName(), "Port mapping refreshed: " + mappedPort); - Thread.sleep(mappedPort.getLifetime() * 1000L); - } - -// Unmap port 12345 - mapper.unmapPort(mappedPort); - -// Stop gateways - networkBus.send(new KillNetworkRequest()); - processBus.send(new KillProcessRequest()); // can kill this after discovery - } -} +package org.orbotproject.android.service.util; + +import android.util.Log; + +import com.offbynull.portmapper.PortMapperFactory; +import com.offbynull.portmapper.gateway.Bus; +import com.offbynull.portmapper.gateway.Gateway; +import com.offbynull.portmapper.gateways.network.NetworkGateway; +import com.offbynull.portmapper.gateways.network.internalmessages.KillNetworkRequest; +import com.offbynull.portmapper.gateways.process.ProcessGateway; +import com.offbynull.portmapper.gateways.process.internalmessages.KillProcessRequest; +import com.offbynull.portmapper.mapper.MappedPort; +import com.offbynull.portmapper.mapper.PortMapper; +import com.offbynull.portmapper.mapper.PortType; + +import java.util.List; + +public class PortForwarder { + + private boolean shutdown = false; + private Thread mThread = null; + + public void shutdown() { + shutdown = true; + } + + public void forward(final int internalPort, final int externalPort, final long lifetime) throws InterruptedException { + + mThread = new Thread() { + public void run() { + try { + forwardSync(internalPort, externalPort, lifetime); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + }; + + mThread.start(); + } + + + public void forwardSync(int internalPort, int externalPort, long lifetime) throws InterruptedException { + // Start gateways + Gateway network = NetworkGateway.create(); + Gateway process = ProcessGateway.create(); + Bus networkBus = network.getBus(); + Bus processBus = process.getBus(); + +// Discover port forwarding devices and take the first one found + List mappers = PortMapperFactory.discover(networkBus, processBus); + PortMapper mapper = mappers.get(0); + +// Map internal port 12345 to some external port (55555 preferred) +// +// IMPORTANT NOTE: Many devices prevent you from mapping ports that are <= 1024 +// (both internal and external ports). Be mindful of this when choosing which +// ports you want to map. + MappedPort mappedPort = mapper.mapPort(PortType.TCP, internalPort, externalPort, lifetime); + Log.d(getClass().getName(), "Port mapping added: " + mappedPort); + +// Refresh mapping half-way through the lifetime of the mapping (for example, +// if the mapping is available for 40 seconds, refresh it every 20 seconds) + while (!shutdown) { + mappedPort = mapper.refreshPort(mappedPort, mappedPort.getLifetime() / 2L); + Log.d(getClass().getName(), "Port mapping refreshed: " + mappedPort); + Thread.sleep(mappedPort.getLifetime() * 1000L); + } + +// Unmap port 12345 + mapper.unmapPort(mappedPort); + +// Stop gateways + networkBus.send(new KillNetworkRequest()); + processBus.send(new KillProcessRequest()); // can kill this after discovery + } +} diff --git a/orbotmanager/src/main/java/org/torproject/android/service/util/Prefs.java b/orbotmanager/src/main/java/org/orbotproject/android/service/util/Prefs.java similarity index 95% rename from orbotmanager/src/main/java/org/torproject/android/service/util/Prefs.java rename to orbotmanager/src/main/java/org/orbotproject/android/service/util/Prefs.java index 6c60fa83..025ca04a 100644 --- a/orbotmanager/src/main/java/org/torproject/android/service/util/Prefs.java +++ b/orbotmanager/src/main/java/org/orbotproject/android/service/util/Prefs.java @@ -1,167 +1,167 @@ -package org.torproject.android.service.util; - -import android.content.Context; -import android.content.SharedPreferences; - -import org.torproject.android.service.OrbotConstants; - -import java.util.Locale; - -public class Prefs { - - private final static String PREF_BRIDGES_ENABLED = "pref_bridges_enabled"; - private final static String PREF_BRIDGES_LIST = "pref_bridges_list"; - private final static String PREF_DEFAULT_LOCALE = "pref_default_locale"; - private final static String PREF_ENABLE_LOGGING = "pref_enable_logging"; - private final static String PREF_EXPANDED_NOTIFICATIONS = "pref_expanded_notifications"; - private final static String PREF_PERSIST_NOTIFICATIONS = "pref_persistent_notifications"; - private final static String PREF_START_ON_BOOT = "pref_start_boot"; - private final static String PREF_ALLOW_BACKGROUND_STARTS = "pref_allow_background_starts"; - private final static String PREF_OPEN_PROXY_ON_ALL_INTERFACES = "pref_open_proxy_on_all_interfaces"; - private final static String PREF_USE_VPN = "pref_vpn"; - private final static String PREF_EXIT_NODES = "pref_exit_nodes"; - private final static String PREF_BE_A_SNOWFLAKE = "pref_be_a_snowflake"; - private final static String PREF_BE_A_SNOWFLAKE_LIMIT = "pref_be_a_snowflake_limit"; - - private final static String PREF_HOST_ONION_SERVICES = "pref_host_onionservices"; - - - private static SharedPreferences prefs; - - public static void setContext(Context context) { - if (prefs == null) - prefs = getSharedPrefs(context); - } - - private static void putBoolean(String key, boolean value) { - prefs.edit().putBoolean(key, value).apply(); - } - - private static void putString(String key, String value) { - prefs.edit().putString(key, value).apply(); - } - - public static boolean hostOnionServicesEnabled () { - if(prefs == null){ - return false; - } - return prefs.getBoolean(PREF_HOST_ONION_SERVICES, true); - } - - public static void putHostOnionServicesEnabled(boolean value) { - putBoolean(PREF_HOST_ONION_SERVICES, value); - } - - public static boolean bridgesEnabled() { - if(prefs == null){ - return false; - } - //if phone is in Farsi, enable bridges by default - boolean bridgesEnabledDefault = Locale.getDefault().getLanguage().equals("fa"); - return prefs.getBoolean(PREF_BRIDGES_ENABLED, bridgesEnabledDefault); - } - - public static void putBridgesEnabled(boolean value) { - putBoolean(PREF_BRIDGES_ENABLED, value); - } - - public static String getBridgesList() { - String defaultBridgeType = "obfs4"; - if (Locale.getDefault().getLanguage().equals("fa")) - defaultBridgeType = "meek"; //if Farsi, use meek as the default bridge type - return prefs.getString(PREF_BRIDGES_LIST, defaultBridgeType); - } - - public static void setBridgesList(String value) { - putString(PREF_BRIDGES_LIST, value); - } - - public static String getDefaultLocale() { - return prefs.getString(PREF_DEFAULT_LOCALE, Locale.getDefault().getLanguage()); - } - - public static boolean beSnowflakeProxy () { - if(prefs == null){ - return false; - } - return prefs.getBoolean(PREF_BE_A_SNOWFLAKE,false); - } - - public static void setBeSnowflakeProxy (boolean beSnowflakeProxy) { - putBoolean(PREF_BE_A_SNOWFLAKE,beSnowflakeProxy); - } - - public static boolean limitSnowflakeProxying () { - if(prefs == null){ - return false; - } - return prefs.getBoolean(PREF_BE_A_SNOWFLAKE_LIMIT,true); - } - - public static void setDefaultLocale(String value) { - putString(PREF_DEFAULT_LOCALE, value); - } - - public static boolean expandedNotifications() { - if(prefs == null){ - return false; - } - return prefs.getBoolean(PREF_EXPANDED_NOTIFICATIONS, true); - } - - public static boolean useDebugLogging() { - return false; - } - - public static boolean persistNotifications() { - if(prefs == null){ - return false; - } - return prefs.getBoolean(PREF_PERSIST_NOTIFICATIONS, true); - } - - public static boolean allowBackgroundStarts() { - if(prefs == null){ - return false; - } - return prefs.getBoolean(PREF_ALLOW_BACKGROUND_STARTS, true); - } - - public static boolean openProxyOnAllInterfaces() { - if(prefs == null){ - return false; - } - return prefs.getBoolean(PREF_OPEN_PROXY_ON_ALL_INTERFACES, false); - } - - public static boolean useVpn() { - return false; - } - - public static void putUseVpn(boolean value) { - putBoolean(PREF_USE_VPN, value); - } - - public static boolean startOnBoot() { - if(prefs == null){ - return false; - } - return prefs.getBoolean(PREF_START_ON_BOOT, true); - } - - public static void putStartOnBoot(boolean value) { - putBoolean(PREF_START_ON_BOOT, value); - } - - public static String getExitNodes() { - return prefs.getString(PREF_EXIT_NODES, ""); - } - - public static void setExitNodes(String exits) { - putString(PREF_EXIT_NODES, exits); - } - - public static SharedPreferences getSharedPrefs(Context context) { - return context.getSharedPreferences(OrbotConstants.PREF_TOR_SHARED_PREFS, Context.MODE_MULTI_PROCESS); - } -} +package org.orbotproject.android.service.util; + +import android.content.Context; +import android.content.SharedPreferences; + +import org.orbotproject.android.service.OrbotConstants; + +import java.util.Locale; + +public class Prefs { + + private final static String PREF_BRIDGES_ENABLED = "pref_bridges_enabled"; + private final static String PREF_BRIDGES_LIST = "pref_bridges_list"; + private final static String PREF_DEFAULT_LOCALE = "pref_default_locale"; + private final static String PREF_ENABLE_LOGGING = "pref_enable_logging"; + private final static String PREF_EXPANDED_NOTIFICATIONS = "pref_expanded_notifications"; + private final static String PREF_PERSIST_NOTIFICATIONS = "pref_persistent_notifications"; + private final static String PREF_START_ON_BOOT = "pref_start_boot"; + private final static String PREF_ALLOW_BACKGROUND_STARTS = "pref_allow_background_starts"; + private final static String PREF_OPEN_PROXY_ON_ALL_INTERFACES = "pref_open_proxy_on_all_interfaces"; + private final static String PREF_USE_VPN = "pref_vpn"; + private final static String PREF_EXIT_NODES = "pref_exit_nodes"; + private final static String PREF_BE_A_SNOWFLAKE = "pref_be_a_snowflake"; + private final static String PREF_BE_A_SNOWFLAKE_LIMIT = "pref_be_a_snowflake_limit"; + + private final static String PREF_HOST_ONION_SERVICES = "pref_host_onionservices"; + + + private static SharedPreferences prefs; + + public static void setContext(Context context) { + if (prefs == null) + prefs = getSharedPrefs(context); + } + + private static void putBoolean(String key, boolean value) { + prefs.edit().putBoolean(key, value).apply(); + } + + private static void putString(String key, String value) { + prefs.edit().putString(key, value).apply(); + } + + public static boolean hostOnionServicesEnabled () { + if(prefs == null){ + return false; + } + return prefs.getBoolean(PREF_HOST_ONION_SERVICES, true); + } + + public static void putHostOnionServicesEnabled(boolean value) { + putBoolean(PREF_HOST_ONION_SERVICES, value); + } + + public static boolean bridgesEnabled() { + if(prefs == null){ + return false; + } + //if phone is in Farsi, enable bridges by default + boolean bridgesEnabledDefault = Locale.getDefault().getLanguage().equals("fa"); + return prefs.getBoolean(PREF_BRIDGES_ENABLED, bridgesEnabledDefault); + } + + public static void putBridgesEnabled(boolean value) { + putBoolean(PREF_BRIDGES_ENABLED, value); + } + + public static String getBridgesList() { + String defaultBridgeType = "obfs4"; + if (Locale.getDefault().getLanguage().equals("fa")) + defaultBridgeType = "meek"; //if Farsi, use meek as the default bridge type + return prefs.getString(PREF_BRIDGES_LIST, defaultBridgeType); + } + + public static void setBridgesList(String value) { + putString(PREF_BRIDGES_LIST, value); + } + + public static String getDefaultLocale() { + return prefs.getString(PREF_DEFAULT_LOCALE, Locale.getDefault().getLanguage()); + } + + public static boolean beSnowflakeProxy () { + if(prefs == null){ + return false; + } + return prefs.getBoolean(PREF_BE_A_SNOWFLAKE,false); + } + + public static void setBeSnowflakeProxy (boolean beSnowflakeProxy) { + putBoolean(PREF_BE_A_SNOWFLAKE,beSnowflakeProxy); + } + + public static boolean limitSnowflakeProxying () { + if(prefs == null){ + return false; + } + return prefs.getBoolean(PREF_BE_A_SNOWFLAKE_LIMIT,true); + } + + public static void setDefaultLocale(String value) { + putString(PREF_DEFAULT_LOCALE, value); + } + + public static boolean expandedNotifications() { + if(prefs == null){ + return false; + } + return prefs.getBoolean(PREF_EXPANDED_NOTIFICATIONS, true); + } + + public static boolean useDebugLogging() { + return false; + } + + public static boolean persistNotifications() { + if(prefs == null){ + return false; + } + return prefs.getBoolean(PREF_PERSIST_NOTIFICATIONS, true); + } + + public static boolean allowBackgroundStarts() { + if(prefs == null){ + return false; + } + return prefs.getBoolean(PREF_ALLOW_BACKGROUND_STARTS, true); + } + + public static boolean openProxyOnAllInterfaces() { + if(prefs == null){ + return false; + } + return prefs.getBoolean(PREF_OPEN_PROXY_ON_ALL_INTERFACES, false); + } + + public static boolean useVpn() { + return false; + } + + public static void putUseVpn(boolean value) { + putBoolean(PREF_USE_VPN, value); + } + + public static boolean startOnBoot() { + if(prefs == null){ + return false; + } + return prefs.getBoolean(PREF_START_ON_BOOT, true); + } + + public static void putStartOnBoot(boolean value) { + putBoolean(PREF_START_ON_BOOT, value); + } + + public static String getExitNodes() { + return prefs.getString(PREF_EXIT_NODES, ""); + } + + public static void setExitNodes(String exits) { + putString(PREF_EXIT_NODES, exits); + } + + public static SharedPreferences getSharedPrefs(Context context) { + return context.getSharedPreferences(OrbotConstants.PREF_TOR_SHARED_PREFS, Context.MODE_MULTI_PROCESS); + } +} diff --git a/orbotmanager/src/main/java/org/torproject/android/service/util/TCPSourceApp.java b/orbotmanager/src/main/java/org/orbotproject/android/service/util/TCPSourceApp.java similarity index 97% rename from orbotmanager/src/main/java/org/torproject/android/service/util/TCPSourceApp.java rename to orbotmanager/src/main/java/org/orbotproject/android/service/util/TCPSourceApp.java index cb61a9c7..4d34cfda 100644 --- a/orbotmanager/src/main/java/org/torproject/android/service/util/TCPSourceApp.java +++ b/orbotmanager/src/main/java/org/orbotproject/android/service/util/TCPSourceApp.java @@ -1,307 +1,307 @@ -package org.torproject.android.service.util; - -/*********************************************************************** - * - * Copyright (c) 2013, Sebastiano Gottardo - * All rights reserved. - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the MegaDevs nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL SEBASTIANO GOTTARDO BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -import android.annotation.SuppressLint; -import android.content.Context; -import android.content.pm.PackageInfo; -import android.content.pm.PackageManager; -import android.content.pm.PackageManager.NameNotFoundException; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.IOException; -import java.net.Inet4Address; -import java.net.InetAddress; -import java.net.NetworkInterface; -import java.net.SocketException; -import java.util.Collections; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * Main class for the TCPSourceApp library. - * - * @author Sebastiano Gottardo - */ -public class TCPSourceApp { - - /* - * In a Linux-based OS, each active TCP socket is mapped in the following - * two files. A socket may be mapped in the '/proc/net/tcp' file in case - * of a simple IPv4 address, or in the '/proc/net/tcp6' if an IPv6 address - * is available. - */ - private static final String TCP_4_FILE_PATH = "/proc/net/tcp"; - private static final String TCP_6_FILE_PATH = "/proc/net/tcp6"; - /* - * Two regular expressions that are able to extract valuable informations - * from the two /proc/net/tcp* files. More specifically, there are three - * fields that are extracted: - * - address - * - port - * - PID - */ - private static final String TCP_6_PATTERN = "\\d+:\\s([0-9A-F]{32}):([0-9A-F]{4})\\s[0-9A-F]{32}:[0-9A-F]{4}\\s[0-9A-F]{2}\\s[0-9]{8}:[0-9]{8}\\s[0-9]{2}:[0-9]{8}\\s[0-9]{8}\\s+([0-9]+)"; - private static final String TCP_4_PATTERN = "\\d+:\\s([0-9A-F]{8}):([0-9A-F]{4})\\s[0-9A-F]{8}:[0-9A-F]{4}\\s[0-9A-F]{2}\\s[0-9A-F]{8}:[0-9A-F]{8}\\s[0-9]{2}:[0-9]{8}\\s[0-9A-F]{8}\\s+([0-9]+)"; -//sargo:/ $ cat /proc/net/tcp6 -// sl local_address remote_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode -// 0: 00000000000000000000000000000000:C36A 00000000000000000000000000000000:0000 8A 00000000:00000000 00:00000000 00000000 1001 0 35059 1 0000000000000000 99 0 0 10 0 -// 1: 00000000000000000000000000000000:A64B 00000000000000000000000000000000:0000 8A 00000000:00000000 00:00000000 00000000 1001 0 910009 1 0000000000000000 99 0 0 10 0 - /* - * Optimises the socket lookup by checking if the connected network - * interface has a 'valid' IPv6 address (a global address, not a link-local - * one). - */ - private static boolean checkConnectedIfaces = true; -// sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode -// 0: 00000000:C368 00000000:0000 8A 00000000:00000000 00:00000000 00000000 1001 0 34999 1 0000000000000000 99 0 0 10 0 - - /** - * The main method of the TCPSourceApp library. This method receives an - * Android Context instance, which is used to access the PackageManager. - * It parses the /proc/net/tcp* files, looking for a socket entry that - * matches the given port. If it finds an entry, this method extracts the - * PID value and it uses the PackageManager.getPackagesFromPid() method to - * find the originating application. - * - * @param context a valid Android Context instance - * @param daddr the (logical) address of the destination - * @param dport the (logical) port of the destination - * @return an AppDescriptor object, representing the found application; null - * if no application could be found - */ - public static AppDescriptor getApplicationInfo(Context context, String saddr, int sport, String daddr, int dport) { - - File tcp; - BufferedReader reader; - String line; - StringBuilder builder; - String content; - - try { - boolean hasIPv6 = true; - - // if true, checks for a connected network interface with a valid - // IPv4 / IPv6 address - if (checkConnectedIfaces) { - String ipv4Address = getIPAddress(true); - String ipv6Address = getIPAddress(false); - - hasIPv6 = (ipv6Address.length() > 0); - } - - tcp = new File(TCP_6_FILE_PATH); - reader = new BufferedReader(new FileReader(tcp)); - builder = new StringBuilder(); - - while ((line = reader.readLine()) != null) { - builder.append(line); - } - - content = builder.toString(); - - Matcher m6 = Pattern.compile(TCP_6_PATTERN, Pattern.CASE_INSENSITIVE | Pattern.UNIX_LINES | Pattern.DOTALL).matcher(content); - - if (hasIPv6) - while (m6.find()) { - String addressEntry = m6.group(1); - String portEntry = m6.group(2); - int pidEntry = Integer.valueOf(m6.group(3)); - - if (Integer.parseInt(portEntry, 16) == dport) { - PackageManager manager = context.getPackageManager(); - String[] packagesForUid = manager.getPackagesForUid(pidEntry); - - if (packagesForUid != null) { - String packageName = packagesForUid[0]; - PackageInfo pInfo = manager.getPackageInfo(packageName, 0); - String version = pInfo.versionName; - - return new AppDescriptor(pidEntry, packageName, version); - } - } - } - - } catch (SocketException e) { - e.printStackTrace(); - } catch (FileNotFoundException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } catch (NameNotFoundException e) { - e.printStackTrace(); - } catch (Exception e) { - e.printStackTrace(); - } - - // From here, no connection with the given port could be found in the tcp6 file - // So let's try the tcp (IPv4) one - - try { - tcp = new File(TCP_4_FILE_PATH); - reader = new BufferedReader(new FileReader(tcp)); - builder = new StringBuilder(); - - while ((line = reader.readLine()) != null) { - builder.append(line); - } - - content = builder.toString(); - - Matcher m4 = Pattern.compile(TCP_4_PATTERN, Pattern.CASE_INSENSITIVE | Pattern.UNIX_LINES | Pattern.DOTALL).matcher(content); - - while (m4.find()) { - String addressEntry = m4.group(1); - String portEntry = m4.group(2); - int pidEntry = Integer.valueOf(m4.group(3)); - - if (Integer.parseInt(portEntry, 16) == dport) { - PackageManager manager = context.getPackageManager(); - String[] packagesForUid = manager.getPackagesForUid(pidEntry); - - if (packagesForUid != null) { - String packageName = packagesForUid[0]; - PackageInfo pInfo = manager.getPackageInfo(packageName, 0); - String version = pInfo.versionName; - - return new AppDescriptor(pidEntry, packageName, version); - } - } - } - - } catch (SocketException e) { - e.printStackTrace(); - } catch (FileNotFoundException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } catch (NameNotFoundException e) { - e.printStackTrace(); - } catch (Exception e) { - e.printStackTrace(); - } - - return null; - } - - @SuppressLint("DefaultLocale") - public static String getIPAddress(boolean useIPv4) throws SocketException { - - List interfaces = Collections.list(NetworkInterface.getNetworkInterfaces()); - - for (NetworkInterface intf : interfaces) { - List addrs = Collections.list(intf.getInetAddresses()); - - for (InetAddress addr : addrs) { - if (!addr.isLoopbackAddress()) { - String sAddr = addr.getHostAddress().toUpperCase(); - - boolean isIPv4 = addr instanceof Inet4Address; - - if (useIPv4) { - if (isIPv4) - return sAddr; - } else { - if (!isIPv4) { - if (sAddr.startsWith("fe80") || sAddr.startsWith("FE80")) // skipping link-local addresses - continue; - - int delim = sAddr.indexOf('%'); // drop ip6 port suffix - return delim < 0 ? sAddr : sAddr.substring(0, delim); - } - } - } - } - } - - return ""; - } - - /* - * Sets the connected interfaces optimisation. - */ - public static void setCheckConnectedIfaces(boolean value) { - checkConnectedIfaces = value; - } - - /* - * This class represents an Android application. Each application is - * uniquely identified by its package name (e.g. com.megadevs.tcpsourceapp) - * and its version (e.g. 1.0). - */ - public static class AppDescriptor { - - private String packageName; - private String version; - private int uid; - - public AppDescriptor(int uid, String pName, String ver) { - this.uid = uid; - packageName = pName; - version = ver; - } - - public int getUid() { - return uid; - } - - public String getPackageName() { - return packageName; - } - - public String getVersion() { - return version; - } - - /* - * Override of the 'equals' method, in order to have a proper - * comparison between two AppDescriptor objects. - * - * (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object o) { - - if (o instanceof AppDescriptor) { - boolean c1 = ((AppDescriptor) o).packageName.compareTo(this.packageName) == 0; - boolean c2 = ((AppDescriptor) o).version.compareTo(this.version) == 0; - - return c1 && c2; - } - - return false; - } - - } - +package org.orbotproject.android.service.util; + +/*********************************************************************** + * + * Copyright (c) 2013, Sebastiano Gottardo + * All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the MegaDevs nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL SEBASTIANO GOTTARDO BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +import android.annotation.SuppressLint; +import android.content.Context; +import android.content.pm.PackageInfo; +import android.content.pm.PackageManager; +import android.content.pm.PackageManager.NameNotFoundException; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.net.Inet4Address; +import java.net.InetAddress; +import java.net.NetworkInterface; +import java.net.SocketException; +import java.util.Collections; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * Main class for the TCPSourceApp library. + * + * @author Sebastiano Gottardo + */ +public class TCPSourceApp { + + /* + * In a Linux-based OS, each active TCP socket is mapped in the following + * two files. A socket may be mapped in the '/proc/net/tcp' file in case + * of a simple IPv4 address, or in the '/proc/net/tcp6' if an IPv6 address + * is available. + */ + private static final String TCP_4_FILE_PATH = "/proc/net/tcp"; + private static final String TCP_6_FILE_PATH = "/proc/net/tcp6"; + /* + * Two regular expressions that are able to extract valuable informations + * from the two /proc/net/tcp* files. More specifically, there are three + * fields that are extracted: + * - address + * - port + * - PID + */ + private static final String TCP_6_PATTERN = "\\d+:\\s([0-9A-F]{32}):([0-9A-F]{4})\\s[0-9A-F]{32}:[0-9A-F]{4}\\s[0-9A-F]{2}\\s[0-9]{8}:[0-9]{8}\\s[0-9]{2}:[0-9]{8}\\s[0-9]{8}\\s+([0-9]+)"; + private static final String TCP_4_PATTERN = "\\d+:\\s([0-9A-F]{8}):([0-9A-F]{4})\\s[0-9A-F]{8}:[0-9A-F]{4}\\s[0-9A-F]{2}\\s[0-9A-F]{8}:[0-9A-F]{8}\\s[0-9]{2}:[0-9]{8}\\s[0-9A-F]{8}\\s+([0-9]+)"; +//sargo:/ $ cat /proc/net/tcp6 +// sl local_address remote_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode +// 0: 00000000000000000000000000000000:C36A 00000000000000000000000000000000:0000 8A 00000000:00000000 00:00000000 00000000 1001 0 35059 1 0000000000000000 99 0 0 10 0 +// 1: 00000000000000000000000000000000:A64B 00000000000000000000000000000000:0000 8A 00000000:00000000 00:00000000 00000000 1001 0 910009 1 0000000000000000 99 0 0 10 0 + /* + * Optimises the socket lookup by checking if the connected network + * interface has a 'valid' IPv6 address (a global address, not a link-local + * one). + */ + private static boolean checkConnectedIfaces = true; +// sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode +// 0: 00000000:C368 00000000:0000 8A 00000000:00000000 00:00000000 00000000 1001 0 34999 1 0000000000000000 99 0 0 10 0 + + /** + * The main method of the TCPSourceApp library. This method receives an + * Android Context instance, which is used to access the PackageManager. + * It parses the /proc/net/tcp* files, looking for a socket entry that + * matches the given port. If it finds an entry, this method extracts the + * PID value and it uses the PackageManager.getPackagesFromPid() method to + * find the originating application. + * + * @param context a valid Android Context instance + * @param daddr the (logical) address of the destination + * @param dport the (logical) port of the destination + * @return an AppDescriptor object, representing the found application; null + * if no application could be found + */ + public static AppDescriptor getApplicationInfo(Context context, String saddr, int sport, String daddr, int dport) { + + File tcp; + BufferedReader reader; + String line; + StringBuilder builder; + String content; + + try { + boolean hasIPv6 = true; + + // if true, checks for a connected network interface with a valid + // IPv4 / IPv6 address + if (checkConnectedIfaces) { + String ipv4Address = getIPAddress(true); + String ipv6Address = getIPAddress(false); + + hasIPv6 = (ipv6Address.length() > 0); + } + + tcp = new File(TCP_6_FILE_PATH); + reader = new BufferedReader(new FileReader(tcp)); + builder = new StringBuilder(); + + while ((line = reader.readLine()) != null) { + builder.append(line); + } + + content = builder.toString(); + + Matcher m6 = Pattern.compile(TCP_6_PATTERN, Pattern.CASE_INSENSITIVE | Pattern.UNIX_LINES | Pattern.DOTALL).matcher(content); + + if (hasIPv6) + while (m6.find()) { + String addressEntry = m6.group(1); + String portEntry = m6.group(2); + int pidEntry = Integer.valueOf(m6.group(3)); + + if (Integer.parseInt(portEntry, 16) == dport) { + PackageManager manager = context.getPackageManager(); + String[] packagesForUid = manager.getPackagesForUid(pidEntry); + + if (packagesForUid != null) { + String packageName = packagesForUid[0]; + PackageInfo pInfo = manager.getPackageInfo(packageName, 0); + String version = pInfo.versionName; + + return new AppDescriptor(pidEntry, packageName, version); + } + } + } + + } catch (SocketException e) { + e.printStackTrace(); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } catch (NameNotFoundException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + + // From here, no connection with the given port could be found in the tcp6 file + // So let's try the tcp (IPv4) one + + try { + tcp = new File(TCP_4_FILE_PATH); + reader = new BufferedReader(new FileReader(tcp)); + builder = new StringBuilder(); + + while ((line = reader.readLine()) != null) { + builder.append(line); + } + + content = builder.toString(); + + Matcher m4 = Pattern.compile(TCP_4_PATTERN, Pattern.CASE_INSENSITIVE | Pattern.UNIX_LINES | Pattern.DOTALL).matcher(content); + + while (m4.find()) { + String addressEntry = m4.group(1); + String portEntry = m4.group(2); + int pidEntry = Integer.valueOf(m4.group(3)); + + if (Integer.parseInt(portEntry, 16) == dport) { + PackageManager manager = context.getPackageManager(); + String[] packagesForUid = manager.getPackagesForUid(pidEntry); + + if (packagesForUid != null) { + String packageName = packagesForUid[0]; + PackageInfo pInfo = manager.getPackageInfo(packageName, 0); + String version = pInfo.versionName; + + return new AppDescriptor(pidEntry, packageName, version); + } + } + } + + } catch (SocketException e) { + e.printStackTrace(); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } catch (NameNotFoundException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + + return null; + } + + @SuppressLint("DefaultLocale") + public static String getIPAddress(boolean useIPv4) throws SocketException { + + List interfaces = Collections.list(NetworkInterface.getNetworkInterfaces()); + + for (NetworkInterface intf : interfaces) { + List addrs = Collections.list(intf.getInetAddresses()); + + for (InetAddress addr : addrs) { + if (!addr.isLoopbackAddress()) { + String sAddr = addr.getHostAddress().toUpperCase(); + + boolean isIPv4 = addr instanceof Inet4Address; + + if (useIPv4) { + if (isIPv4) + return sAddr; + } else { + if (!isIPv4) { + if (sAddr.startsWith("fe80") || sAddr.startsWith("FE80")) // skipping link-local addresses + continue; + + int delim = sAddr.indexOf('%'); // drop ip6 port suffix + return delim < 0 ? sAddr : sAddr.substring(0, delim); + } + } + } + } + } + + return ""; + } + + /* + * Sets the connected interfaces optimisation. + */ + public static void setCheckConnectedIfaces(boolean value) { + checkConnectedIfaces = value; + } + + /* + * This class represents an Android application. Each application is + * uniquely identified by its package name (e.g. com.megadevs.tcpsourceapp) + * and its version (e.g. 1.0). + */ + public static class AppDescriptor { + + private String packageName; + private String version; + private int uid; + + public AppDescriptor(int uid, String pName, String ver) { + this.uid = uid; + packageName = pName; + version = ver; + } + + public int getUid() { + return uid; + } + + public String getPackageName() { + return packageName; + } + + public String getVersion() { + return version; + } + + /* + * Override of the 'equals' method, in order to have a proper + * comparison between two AppDescriptor objects. + * + * (non-Javadoc) + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals(Object o) { + + if (o instanceof AppDescriptor) { + boolean c1 = ((AppDescriptor) o).packageName.compareTo(this.packageName) == 0; + boolean c2 = ((AppDescriptor) o).version.compareTo(this.version) == 0; + + return c1 && c2; + } + + return false; + } + + } + } \ No newline at end of file diff --git a/orbotmanager/src/main/java/org/torproject/android/service/util/TorServiceUtils.java b/orbotmanager/src/main/java/org/orbotproject/android/service/util/TorServiceUtils.java similarity index 85% rename from orbotmanager/src/main/java/org/torproject/android/service/util/TorServiceUtils.java rename to orbotmanager/src/main/java/org/orbotproject/android/service/util/TorServiceUtils.java index ebc829a0..cb9afd0e 100644 --- a/orbotmanager/src/main/java/org/torproject/android/service/util/TorServiceUtils.java +++ b/orbotmanager/src/main/java/org/orbotproject/android/service/util/TorServiceUtils.java @@ -1,27 +1,27 @@ -/* Copyright (c) 2009, Nathan Freitas, Orbot / The Guardian Project - http://openideals.com/guardian */ -/* See LICENSE for licensing information */ -package org.torproject.android.service.util; - -import org.torproject.android.service.TorServiceConstants; - -import java.net.ConnectException; -import java.net.InetSocketAddress; -import java.net.Socket; - -public class TorServiceUtils implements TorServiceConstants { - - public static boolean isPortOpen(final String ip, final int port, final int timeout) { - try { - Socket socket = new Socket(); - socket.connect(new InetSocketAddress(ip, port), timeout); - socket.close(); - return true; - } catch (ConnectException ce) { - //ce.printStackTrace(); - return false; - } catch (Exception ex) { - //ex.printStackTrace(); - return false; - } - } -} +/* Copyright (c) 2009, Nathan Freitas, Orbot / The Guardian Project - http://openideals.com/guardian */ +/* See LICENSE for licensing information */ +package org.orbotproject.android.service.util; + +import org.orbotproject.android.service.TorServiceConstants; + +import java.net.ConnectException; +import java.net.InetSocketAddress; +import java.net.Socket; + +public class TorServiceUtils implements TorServiceConstants { + + public static boolean isPortOpen(final String ip, final int port, final int timeout) { + try { + Socket socket = new Socket(); + socket.connect(new InetSocketAddress(ip, port), timeout); + socket.close(); + return true; + } catch (ConnectException ce) { + //ce.printStackTrace(); + return false; + } catch (Exception ex) { + //ex.printStackTrace(); + return false; + } + } +} diff --git a/orbotmanager/src/main/java/org/torproject/android/service/util/Utils.java b/orbotmanager/src/main/java/org/orbotproject/android/service/util/Utils.java similarity index 95% rename from orbotmanager/src/main/java/org/torproject/android/service/util/Utils.java rename to orbotmanager/src/main/java/org/orbotproject/android/service/util/Utils.java index 2cb34389..eb53169d 100644 --- a/orbotmanager/src/main/java/org/torproject/android/service/util/Utils.java +++ b/orbotmanager/src/main/java/org/orbotproject/android/service/util/Utils.java @@ -1,183 +1,183 @@ -/* Copyright (c) 2009, Nathan Freitas, Orbot / The Guardian Project - http://openideals.com/guardian */ -/* See LICENSE for licensing information */ - - -package org.torproject.android.service.util; - -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; - -public class Utils { - - - public static String readString(InputStream stream) { - String line; - - StringBuffer out = new StringBuffer(); - - try { - BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); - - while ((line = reader.readLine()) != null) { - out.append(line); - out.append('\n'); - - } - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - return out.toString(); - - } - - /* - * Load the log file text - */ - public static String loadTextFile(String path) { - String line; - - StringBuffer out = new StringBuffer(); - - try { - BufferedReader reader = new BufferedReader((new FileReader(new File(path)))); - - while ((line = reader.readLine()) != null) { - out.append(line); - out.append('\n'); - - } - - reader.close(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - return out.toString(); - - } - - - /* - * Load the log file text - */ - public static boolean saveTextFile(String path, String contents) { - - try { - - FileWriter writer = new FileWriter(path, false); - writer.write(contents); - - writer.close(); - - - return true; - - } catch (IOException e) { - // Log.d(TAG, "error writing file: " + path, e); - e.printStackTrace(); - return false; - } - - - } - - - /* - * - * Zips a file at a location and places the resulting zip file at the toLocation - * Example: zipFileAtPath("downloads/myfolder", "downloads/myFolder.zip"); - */ - - public static boolean zipFileAtPath(String sourcePath, String toLocation) { - final int BUFFER = 2048; - - File sourceFile = new File(sourcePath); - try { - BufferedInputStream origin; - FileOutputStream dest = new FileOutputStream(toLocation); - ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream( - dest)); - if (sourceFile.isDirectory()) { - zipSubFolder(out, sourceFile, sourceFile.getParent().length()); - } else { - byte[] data = new byte[BUFFER]; - FileInputStream fi = new FileInputStream(sourcePath); - origin = new BufferedInputStream(fi, BUFFER); - ZipEntry entry = new ZipEntry(getLastPathComponent(sourcePath)); - entry.setTime(sourceFile.lastModified()); // to keep modification time after unzipping - out.putNextEntry(entry); - int count; - while ((count = origin.read(data, 0, BUFFER)) != -1) { - out.write(data, 0, count); - } - } - out.close(); - } catch (Exception e) { - e.printStackTrace(); - return false; - } - return true; - } - - /* - * - * Zips a subfolder - * - */ - - private static void zipSubFolder(ZipOutputStream out, File folder, - int basePathLength) throws IOException { - - final int BUFFER = 2048; - - File[] fileList = folder.listFiles(); - BufferedInputStream origin; - for (File file : fileList) { - if (file.isDirectory()) { - zipSubFolder(out, file, basePathLength); - } else { - byte[] data = new byte[BUFFER]; - String unmodifiedFilePath = file.getPath(); - String relativePath = unmodifiedFilePath - .substring(basePathLength); - FileInputStream fi = new FileInputStream(unmodifiedFilePath); - origin = new BufferedInputStream(fi, BUFFER); - ZipEntry entry = new ZipEntry(relativePath); - entry.setTime(file.lastModified()); // to keep modification time after unzipping - out.putNextEntry(entry); - int count; - while ((count = origin.read(data, 0, BUFFER)) != -1) { - out.write(data, 0, count); - } - origin.close(); - } - } - } - - /* - * gets the last path component - * - * Example: getLastPathComponent("downloads/example/fileToZip"); - * Result: "fileToZip" - */ - public static String getLastPathComponent(String filePath) { - String[] segments = filePath.split("/"); - if (segments.length == 0) - return ""; - return segments[segments.length - 1]; - } -} +/* Copyright (c) 2009, Nathan Freitas, Orbot / The Guardian Project - http://openideals.com/guardian */ +/* See LICENSE for licensing information */ + + +package org.orbotproject.android.service.util; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +public class Utils { + + + public static String readString(InputStream stream) { + String line; + + StringBuffer out = new StringBuffer(); + + try { + BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); + + while ((line = reader.readLine()) != null) { + out.append(line); + out.append('\n'); + + } + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + return out.toString(); + + } + + /* + * Load the log file text + */ + public static String loadTextFile(String path) { + String line; + + StringBuffer out = new StringBuffer(); + + try { + BufferedReader reader = new BufferedReader((new FileReader(new File(path)))); + + while ((line = reader.readLine()) != null) { + out.append(line); + out.append('\n'); + + } + + reader.close(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + return out.toString(); + + } + + + /* + * Load the log file text + */ + public static boolean saveTextFile(String path, String contents) { + + try { + + FileWriter writer = new FileWriter(path, false); + writer.write(contents); + + writer.close(); + + + return true; + + } catch (IOException e) { + // Log.d(TAG, "error writing file: " + path, e); + e.printStackTrace(); + return false; + } + + + } + + + /* + * + * Zips a file at a location and places the resulting zip file at the toLocation + * Example: zipFileAtPath("downloads/myfolder", "downloads/myFolder.zip"); + */ + + public static boolean zipFileAtPath(String sourcePath, String toLocation) { + final int BUFFER = 2048; + + File sourceFile = new File(sourcePath); + try { + BufferedInputStream origin; + FileOutputStream dest = new FileOutputStream(toLocation); + ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream( + dest)); + if (sourceFile.isDirectory()) { + zipSubFolder(out, sourceFile, sourceFile.getParent().length()); + } else { + byte[] data = new byte[BUFFER]; + FileInputStream fi = new FileInputStream(sourcePath); + origin = new BufferedInputStream(fi, BUFFER); + ZipEntry entry = new ZipEntry(getLastPathComponent(sourcePath)); + entry.setTime(sourceFile.lastModified()); // to keep modification time after unzipping + out.putNextEntry(entry); + int count; + while ((count = origin.read(data, 0, BUFFER)) != -1) { + out.write(data, 0, count); + } + } + out.close(); + } catch (Exception e) { + e.printStackTrace(); + return false; + } + return true; + } + + /* + * + * Zips a subfolder + * + */ + + private static void zipSubFolder(ZipOutputStream out, File folder, + int basePathLength) throws IOException { + + final int BUFFER = 2048; + + File[] fileList = folder.listFiles(); + BufferedInputStream origin; + for (File file : fileList) { + if (file.isDirectory()) { + zipSubFolder(out, file, basePathLength); + } else { + byte[] data = new byte[BUFFER]; + String unmodifiedFilePath = file.getPath(); + String relativePath = unmodifiedFilePath + .substring(basePathLength); + FileInputStream fi = new FileInputStream(unmodifiedFilePath); + origin = new BufferedInputStream(fi, BUFFER); + ZipEntry entry = new ZipEntry(relativePath); + entry.setTime(file.lastModified()); // to keep modification time after unzipping + out.putNextEntry(entry); + int count; + while ((count = origin.read(data, 0, BUFFER)) != -1) { + out.write(data, 0, count); + } + origin.close(); + } + } + } + + /* + * gets the last path component + * + * Example: getLastPathComponent("downloads/example/fileToZip"); + * Result: "fileToZip" + */ + public static String getLastPathComponent(String filePath) { + String[] segments = filePath.split("/"); + if (segments.length == 0) + return ""; + return segments[segments.length - 1]; + } +} diff --git a/orbotmanager/src/main/java/org/torproject/android/service/vpn/OrbotVpnManager.java b/orbotmanager/src/main/java/org/orbotproject/android/service/vpn/OrbotVpnManager.java similarity index 91% rename from orbotmanager/src/main/java/org/torproject/android/service/vpn/OrbotVpnManager.java rename to orbotmanager/src/main/java/org/orbotproject/android/service/vpn/OrbotVpnManager.java index 7e991ace..6e73d8a8 100644 --- a/orbotmanager/src/main/java/org/torproject/android/service/vpn/OrbotVpnManager.java +++ b/orbotmanager/src/main/java/org/orbotproject/android/service/vpn/OrbotVpnManager.java @@ -1,412 +1,409 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.torproject.android.service.vpn; - -import android.annotation.TargetApi; -import android.app.Service; -import android.content.Context; -import android.content.Intent; -import android.content.SharedPreferences; -import android.content.pm.PackageManager.NameNotFoundException; -import android.net.VpnService; -import android.os.Build; -import android.os.Handler; -import android.os.Message; -import android.os.ParcelFileDescriptor; -import android.text.TextUtils; -import android.util.Log; -import android.widget.Toast; - -import com.runjva.sourceforge.jsocks.protocol.ProxyServer; -import com.runjva.sourceforge.jsocks.server.ServerAuthenticatorNone; - -import org.torproject.android.service.OrbotConstants; -import org.torproject.android.service.OrbotService; -import org.torproject.android.service.R; -import org.torproject.android.service.TorServiceConstants; -import org.torproject.android.service.util.CustomNativeLoader; -import org.torproject.android.service.util.Prefs; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileOutputStream; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.PrintStream; -import java.io.PrintWriter; -import java.net.InetAddress; -import java.util.ArrayList; -import java.util.concurrent.TimeoutException; - -import static org.torproject.android.service.TorServiceConstants.ACTION_START; -import static org.torproject.android.service.TorServiceConstants.ACTION_START_VPN; -import static org.torproject.android.service.TorServiceConstants.ACTION_STOP_VPN; -import static org.torproject.android.service.TorServiceConstants.TOR_DNS_PORT_DEFAULT; -import static org.torproject.android.service.TorServiceConstants.TOR_TRANSPROXY_PORT_DEFAULT; - -public class OrbotVpnManager implements Handler.Callback { - private static final String TAG = "OrbotVpnService"; - private final static int VPN_MTU = 1500; - private final static boolean mIsLollipop = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP; - private final static String PDNSD_BIN = "pdnsd"; - public static int sSocksProxyServerPort = -1; - public static String sSocksProxyLocalhost = null; - boolean isStarted = false; - File filePdnsPid; - private Thread mThreadVPN; - private final static String mSessionName = "OrbotVPN"; - private ParcelFileDescriptor mInterface; - private int mTorSocks = -1; - private int mTorDns = -1; - private int pdnsdPort = 8091; - private ProxyServer mSocksProxyServer; - private final File filePdnsd; - private boolean isRestart = false; - private final VpnService mService; - - public OrbotVpnManager(VpnService service) { - mService = service; - filePdnsd = CustomNativeLoader.loadNativeBinary(service.getApplicationContext(), PDNSD_BIN, new File(service.getFilesDir(), PDNSD_BIN)); - Tun2Socks.init(); - } - - public static File makePdnsdConf(Context context, File fileDir, String torDnsHost, int torDnsPort, String pdnsdHost, int pdnsdPort) throws IOException { - String conf = String.format(context.getString(R.string.pdnsd_conf), - torDnsHost, torDnsPort, fileDir.getAbsolutePath(), pdnsdHost, pdnsdPort); - - Log.d(TAG, "pdsnd conf:" + conf); - - File fPid = new File(fileDir, pdnsdPort + "pdnsd.conf"); - - if (fPid.exists()) { - fPid.delete(); - } - - PrintWriter ps = new PrintWriter(new FileWriter(fPid, false)); - ps.write(conf); - ps.close(); - - File cache = new File(fileDir, "pdnsd.cache"); - - if (!cache.exists()) { - try { - cache.createNewFile(); - } catch (Exception e) { - } - } - return fPid; - } - - public int handleIntent(VpnService.Builder builder, Intent intent) { - if (intent != null) { - String action = intent.getAction(); - - if (action != null) { - if (action.equals(ACTION_START_VPN) || action.equals(ACTION_START)) { - Log.d(TAG, "starting VPN"); - - isStarted = true; - - // Stop the previous session by interrupting the thread. - if (mThreadVPN != null && mThreadVPN.isAlive()) - stopVPN(); - - if (mTorSocks != -1) { - if (!mIsLollipop) { - startSocksBypass(); - } - - setupTun2Socks(builder); - } - - } else if (action.equals(ACTION_STOP_VPN)) { - isStarted = false; - - Log.d(TAG, "stopping VPN"); - - stopVPN(); - } else if (action.equals(TorServiceConstants.LOCAL_ACTION_PORTS)) { - Log.d(TAG, "setting VPN ports"); - - int torSocks = intent.getIntExtra(OrbotService.EXTRA_SOCKS_PROXY_PORT, TOR_TRANSPROXY_PORT_DEFAULT); - int torDns = intent.getIntExtra(OrbotService.EXTRA_DNS_PORT, TOR_DNS_PORT_DEFAULT); - - //if running, we need to restart - if ((torSocks != mTorSocks || torDns != mTorDns)) { - - mTorSocks = torSocks; - mTorDns = torDns; - - if (!mIsLollipop) { - stopSocksBypass(); - startSocksBypass(); - } - - setupTun2Socks(builder); - } - } - } - - } - - - return Service.START_STICKY; - } - - private void startSocksBypass() { - new Thread() { - public void run() { - - //generate the proxy port that the - if (sSocksProxyServerPort == -1) { - try { - - sSocksProxyLocalhost = "127.0.0.1";// InetAddress.getLocalHost().getHostAddress(); - sSocksProxyServerPort = (int) ((Math.random() * 1000) + 10000); - - } catch (Exception e) { - Log.e(TAG, "Unable to access localhost", e); - throw new RuntimeException("Unable to access localhost: " + e); - - } - - } - - - if (mSocksProxyServer != null) { - stopSocksBypass(); - } - - try { - mSocksProxyServer = new ProxyServer(new ServerAuthenticatorNone(null, null)); - ProxyServer.setVpnService(mService); - mSocksProxyServer.start(sSocksProxyServerPort, 5, InetAddress.getLocalHost()); - - } catch (Exception e) { - Log.e(TAG, "error getting host", e); - } - } - }.start(); - } - - private synchronized void stopSocksBypass() { - if (mSocksProxyServer != null) { - mSocksProxyServer.stop(); - mSocksProxyServer = null; - } - } - - private void stopVPN() { - if (mIsLollipop) - stopSocksBypass(); - - Tun2Socks.Stop(); - - if (mInterface != null) { - try { - Log.d(TAG, "closing interface, destroying VPN interface"); - - mInterface.close(); - mInterface = null; - - } catch (Exception e) { - Log.d(TAG, "error stopping tun2socks", e); - } catch (Error e) { - Log.d(TAG, "error stopping tun2socks", e); - } - } - stopDns(); - mThreadVPN = null; - } - - @Override - public boolean handleMessage(Message message) { - if (message != null) { - Toast.makeText(mService, message.what, Toast.LENGTH_SHORT).show(); - } - return true; - } - - private synchronized void setupTun2Socks(final VpnService.Builder builder) { - if (mInterface != null) //stop tun2socks now to give it time to clean up - { - isRestart = true; - Tun2Socks.Stop(); - - stopDns(); - - } - - mThreadVPN = new Thread() { - - public void run() { - try { - - if (isRestart) { - Log.d(TAG, "is a restart... let's wait for a few seconds"); - Thread.sleep(3000); - } - - final String vpnName = "OrbotVPN"; - final String localhost = "127.0.0.1"; - - final String virtualGateway = "192.168.200.1"; - final String virtualIP = "192.168.200.2"; - final String virtualNetMask = "255.255.255.0"; - final String dummyDNS = "1.1.1.1"; //this is intercepted by the tun2socks library, but we must put in a valid DNS to start - final String defaultRoute = "0.0.0.0"; - - final String localSocks = localhost + ':' + mTorSocks; - - builder.setMtu(VPN_MTU); - builder.addAddress(virtualGateway, 32); - - builder.setSession(vpnName); - - //route all traffic through VPN (we might offer country specific exclude lists in the future) - builder.addRoute(defaultRoute, 0); - - builder.addDnsServer(dummyDNS); - builder.addRoute(dummyDNS, 32); - - //handle ipv6 - //builder.addAddress("fdfe:dcba:9876::1", 126); - //builder.addRoute("::", 0); - - if (mIsLollipop) - doLollipopAppRouting(builder); - - // https://developer.android.com/reference/android/net/VpnService.Builder#setMetered(boolean) - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { - builder.setMetered(false); - } - - // Create a new interface using the builder and save the parameters. - ParcelFileDescriptor newInterface = builder.setSession(mSessionName) - .setConfigureIntent(null) // previously this was set to a null member variable - .establish(); - - if (mInterface != null) { - Log.d(TAG, "Stopping existing VPN interface"); - mInterface.close(); - mInterface = null; - } - - mInterface = newInterface; - - isRestart = false; - - //start PDNSD daemon pointing to actual DNS - if (filePdnsd != null) { - - pdnsdPort++; - startDNS(filePdnsd.getCanonicalPath(), localhost, mTorDns, virtualGateway, pdnsdPort); - final boolean localDnsTransparentProxy = true; - - Tun2Socks.Start(mService, mInterface, VPN_MTU, virtualIP, virtualNetMask, localSocks, virtualGateway + ":" + pdnsdPort, localDnsTransparentProxy); - } - - } catch (Exception e) { - Log.d(TAG, "tun2Socks has stopped", e); - } - } - - }; - - mThreadVPN.start(); - - } - - @TargetApi(Build.VERSION_CODES.LOLLIPOP) - private void doLollipopAppRouting(VpnService.Builder builder) throws NameNotFoundException { - SharedPreferences prefs = Prefs.getSharedPrefs(mService.getApplicationContext()); - ArrayList apps = TorifiedApp.getApps(mService, prefs); - - - boolean perAppEnabled = false; - - for (TorifiedApp app : apps) { - if (app.isTorified() && (!app.getPackageName().equals(mService.getPackageName()))) { - if (prefs.getBoolean(app.getPackageName() + OrbotConstants.APP_TOR_KEY, true)) { - - builder.addAllowedApplication(app.getPackageName()); - - } - - perAppEnabled = true; - - } - } - - if (!perAppEnabled) - builder.addDisallowedApplication(mService.getPackageName()); - - } - - private void startDNS(String pdnsPath, String torDnsHost, int torDnsPort, String pdnsdHost, int pdnsdPort) throws IOException, TimeoutException { - - File fileConf = makePdnsdConf(mService, mService.getFilesDir(), torDnsHost, torDnsPort, pdnsdHost, pdnsdPort); - - String[] cmdString = {pdnsPath, "-c", fileConf.toString(), "-g", "-v2"}; - ProcessBuilder pb = new ProcessBuilder(cmdString); - pb.redirectErrorStream(true); - Process proc = pb.start(); - try { - proc.waitFor(); - } catch (Exception e) { - } - - Log.i(TAG, "PDNSD: " + proc.exitValue()); - - if (proc.exitValue() != 0) { - BufferedReader br = new BufferedReader(new InputStreamReader(proc.getInputStream())); - - String line; - while ((line = br.readLine()) != null) { - Log.d(TAG, "pdnsd: " + line); - } - } - - - } - - private void stopDns() { - if (filePdnsPid != null && filePdnsPid.exists()) { - ArrayList lines = new ArrayList<>(); - try { - BufferedReader reader = new BufferedReader(new FileReader(filePdnsPid)); - - String line = null; - while ((line = reader.readLine())!= null) - lines.add(line); - - String dnsPid = lines.get(0); - VpnUtils.killProcess(dnsPid, ""); - filePdnsPid.delete(); - filePdnsPid = null; - } catch (Exception e) { - Log.e("OrbotVPN", "error killing dns process", e); - } - } - } - - public boolean isStarted() { - return isStarted; - } -} +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.orbotproject.android.service.vpn; + +import android.annotation.TargetApi; +import android.app.Service; +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.content.pm.PackageManager.NameNotFoundException; +import android.net.VpnService; +import android.os.Build; +import android.os.Handler; +import android.os.Message; +import android.os.ParcelFileDescriptor; +import android.util.Log; +import android.widget.Toast; + +import com.runjva.sourceforge.jsocks.protocol.ProxyServer; +import com.runjva.sourceforge.jsocks.server.ServerAuthenticatorNone; + +import org.orbotproject.android.service.R; +import org.orbotproject.android.service.util.CustomNativeLoader; +import org.orbotproject.android.service.util.Prefs; +import org.orbotproject.android.service.OrbotConstants; +import org.orbotproject.android.service.OrbotService; +import org.orbotproject.android.service.TorServiceConstants; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.PrintWriter; +import java.net.InetAddress; +import java.util.ArrayList; +import java.util.concurrent.TimeoutException; + +import static org.orbotproject.android.service.TorServiceConstants.ACTION_START; +import static org.orbotproject.android.service.TorServiceConstants.ACTION_START_VPN; +import static org.orbotproject.android.service.TorServiceConstants.ACTION_STOP_VPN; +import static org.orbotproject.android.service.TorServiceConstants.TOR_DNS_PORT_DEFAULT; +import static org.orbotproject.android.service.TorServiceConstants.TOR_TRANSPROXY_PORT_DEFAULT; + +public class OrbotVpnManager implements Handler.Callback { + private static final String TAG = "OrbotVpnService"; + private final static int VPN_MTU = 1500; + private final static boolean mIsLollipop = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP; + private final static String PDNSD_BIN = "pdnsd"; + public static int sSocksProxyServerPort = -1; + public static String sSocksProxyLocalhost = null; + boolean isStarted = false; + File filePdnsPid; + private Thread mThreadVPN; + private final static String mSessionName = "OrbotVPN"; + private ParcelFileDescriptor mInterface; + private int mTorSocks = -1; + private int mTorDns = -1; + private int pdnsdPort = 8091; + private ProxyServer mSocksProxyServer; + private final File filePdnsd; + private boolean isRestart = false; + private final VpnService mService; + + public OrbotVpnManager(VpnService service) { + mService = service; + filePdnsd = CustomNativeLoader.loadNativeBinary(service.getApplicationContext(), PDNSD_BIN, new File(service.getFilesDir(), PDNSD_BIN)); + Tun2Socks.init(); + } + + public static File makePdnsdConf(Context context, File fileDir, String torDnsHost, int torDnsPort, String pdnsdHost, int pdnsdPort) throws IOException { + String conf = String.format(context.getString(R.string.pdnsd_conf), + torDnsHost, torDnsPort, fileDir.getAbsolutePath(), pdnsdHost, pdnsdPort); + + Log.d(TAG, "pdsnd conf:" + conf); + + File fPid = new File(fileDir, pdnsdPort + "pdnsd.conf"); + + if (fPid.exists()) { + fPid.delete(); + } + + PrintWriter ps = new PrintWriter(new FileWriter(fPid, false)); + ps.write(conf); + ps.close(); + + File cache = new File(fileDir, "pdnsd.cache"); + + if (!cache.exists()) { + try { + cache.createNewFile(); + } catch (Exception e) { + } + } + return fPid; + } + + public int handleIntent(VpnService.Builder builder, Intent intent) { + if (intent != null) { + String action = intent.getAction(); + + if (action != null) { + if (action.equals(ACTION_START_VPN) || action.equals(ACTION_START)) { + Log.d(TAG, "starting VPN"); + + isStarted = true; + + // Stop the previous session by interrupting the thread. + if (mThreadVPN != null && mThreadVPN.isAlive()) + stopVPN(); + + if (mTorSocks != -1) { + if (!mIsLollipop) { + startSocksBypass(); + } + + setupTun2Socks(builder); + } + + } else if (action.equals(ACTION_STOP_VPN)) { + isStarted = false; + + Log.d(TAG, "stopping VPN"); + + stopVPN(); + } else if (action.equals(TorServiceConstants.LOCAL_ACTION_PORTS)) { + Log.d(TAG, "setting VPN ports"); + + int torSocks = intent.getIntExtra(OrbotService.EXTRA_SOCKS_PROXY_PORT, TOR_TRANSPROXY_PORT_DEFAULT); + int torDns = intent.getIntExtra(OrbotService.EXTRA_DNS_PORT, TOR_DNS_PORT_DEFAULT); + + //if running, we need to restart + if ((torSocks != mTorSocks || torDns != mTorDns)) { + + mTorSocks = torSocks; + mTorDns = torDns; + + if (!mIsLollipop) { + stopSocksBypass(); + startSocksBypass(); + } + + setupTun2Socks(builder); + } + } + } + + } + + + return Service.START_STICKY; + } + + private void startSocksBypass() { + new Thread() { + public void run() { + + //generate the proxy port that the + if (sSocksProxyServerPort == -1) { + try { + + sSocksProxyLocalhost = "127.0.0.1";// InetAddress.getLocalHost().getHostAddress(); + sSocksProxyServerPort = (int) ((Math.random() * 1000) + 10000); + + } catch (Exception e) { + Log.e(TAG, "Unable to access localhost", e); + throw new RuntimeException("Unable to access localhost: " + e); + + } + + } + + + if (mSocksProxyServer != null) { + stopSocksBypass(); + } + + try { + mSocksProxyServer = new ProxyServer(new ServerAuthenticatorNone(null, null)); + ProxyServer.setVpnService(mService); + mSocksProxyServer.start(sSocksProxyServerPort, 5, InetAddress.getLocalHost()); + + } catch (Exception e) { + Log.e(TAG, "error getting host", e); + } + } + }.start(); + } + + private synchronized void stopSocksBypass() { + if (mSocksProxyServer != null) { + mSocksProxyServer.stop(); + mSocksProxyServer = null; + } + } + + private void stopVPN() { + if (mIsLollipop) + stopSocksBypass(); + + Tun2Socks.Stop(); + + if (mInterface != null) { + try { + Log.d(TAG, "closing interface, destroying VPN interface"); + + mInterface.close(); + mInterface = null; + + } catch (Exception e) { + Log.d(TAG, "error stopping tun2socks", e); + } catch (Error e) { + Log.d(TAG, "error stopping tun2socks", e); + } + } + stopDns(); + mThreadVPN = null; + } + + @Override + public boolean handleMessage(Message message) { + if (message != null) { + Toast.makeText(mService, message.what, Toast.LENGTH_SHORT).show(); + } + return true; + } + + private synchronized void setupTun2Socks(final VpnService.Builder builder) { + if (mInterface != null) //stop tun2socks now to give it time to clean up + { + isRestart = true; + Tun2Socks.Stop(); + + stopDns(); + + } + + mThreadVPN = new Thread() { + + public void run() { + try { + + if (isRestart) { + Log.d(TAG, "is a restart... let's wait for a few seconds"); + Thread.sleep(3000); + } + + final String vpnName = "OrbotVPN"; + final String localhost = "127.0.0.1"; + + final String virtualGateway = "192.168.200.1"; + final String virtualIP = "192.168.200.2"; + final String virtualNetMask = "255.255.255.0"; + final String dummyDNS = "1.1.1.1"; //this is intercepted by the tun2socks library, but we must put in a valid DNS to start + final String defaultRoute = "0.0.0.0"; + + final String localSocks = localhost + ':' + mTorSocks; + + builder.setMtu(VPN_MTU); + builder.addAddress(virtualGateway, 32); + + builder.setSession(vpnName); + + //route all traffic through VPN (we might offer country specific exclude lists in the future) + builder.addRoute(defaultRoute, 0); + + builder.addDnsServer(dummyDNS); + builder.addRoute(dummyDNS, 32); + + //handle ipv6 + //builder.addAddress("fdfe:dcba:9876::1", 126); + //builder.addRoute("::", 0); + + if (mIsLollipop) + doLollipopAppRouting(builder); + + // https://developer.android.com/reference/android/net/VpnService.Builder#setMetered(boolean) + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + builder.setMetered(false); + } + + // Create a new interface using the builder and save the parameters. + ParcelFileDescriptor newInterface = builder.setSession(mSessionName) + .setConfigureIntent(null) // previously this was set to a null member variable + .establish(); + + if (mInterface != null) { + Log.d(TAG, "Stopping existing VPN interface"); + mInterface.close(); + mInterface = null; + } + + mInterface = newInterface; + + isRestart = false; + + //start PDNSD daemon pointing to actual DNS + if (filePdnsd != null) { + + pdnsdPort++; + startDNS(filePdnsd.getCanonicalPath(), localhost, mTorDns, virtualGateway, pdnsdPort); + final boolean localDnsTransparentProxy = true; + + Tun2Socks.Start(mService, mInterface, VPN_MTU, virtualIP, virtualNetMask, localSocks, virtualGateway + ":" + pdnsdPort, localDnsTransparentProxy); + } + + } catch (Exception e) { + Log.d(TAG, "tun2Socks has stopped", e); + } + } + + }; + + mThreadVPN.start(); + + } + + @TargetApi(Build.VERSION_CODES.LOLLIPOP) + private void doLollipopAppRouting(VpnService.Builder builder) throws NameNotFoundException { + SharedPreferences prefs = Prefs.getSharedPrefs(mService.getApplicationContext()); + ArrayList apps = TorifiedApp.getApps(mService, prefs); + + + boolean perAppEnabled = false; + + for (TorifiedApp app : apps) { + if (app.isTorified() && (!app.getPackageName().equals(mService.getPackageName()))) { + if (prefs.getBoolean(app.getPackageName() + OrbotConstants.APP_TOR_KEY, true)) { + + builder.addAllowedApplication(app.getPackageName()); + + } + + perAppEnabled = true; + + } + } + + if (!perAppEnabled) + builder.addDisallowedApplication(mService.getPackageName()); + + } + + private void startDNS(String pdnsPath, String torDnsHost, int torDnsPort, String pdnsdHost, int pdnsdPort) throws IOException, TimeoutException { + + File fileConf = makePdnsdConf(mService, mService.getFilesDir(), torDnsHost, torDnsPort, pdnsdHost, pdnsdPort); + + String[] cmdString = {pdnsPath, "-c", fileConf.toString(), "-g", "-v2"}; + ProcessBuilder pb = new ProcessBuilder(cmdString); + pb.redirectErrorStream(true); + Process proc = pb.start(); + try { + proc.waitFor(); + } catch (Exception e) { + } + + Log.i(TAG, "PDNSD: " + proc.exitValue()); + + if (proc.exitValue() != 0) { + BufferedReader br = new BufferedReader(new InputStreamReader(proc.getInputStream())); + + String line; + while ((line = br.readLine()) != null) { + Log.d(TAG, "pdnsd: " + line); + } + } + + + } + + private void stopDns() { + if (filePdnsPid != null && filePdnsPid.exists()) { + ArrayList lines = new ArrayList<>(); + try { + BufferedReader reader = new BufferedReader(new FileReader(filePdnsPid)); + + String line = null; + while ((line = reader.readLine())!= null) + lines.add(line); + + String dnsPid = lines.get(0); + VpnUtils.killProcess(dnsPid, ""); + filePdnsPid.delete(); + filePdnsPid = null; + } catch (Exception e) { + Log.e("OrbotVPN", "error killing dns process", e); + } + } + } + + public boolean isStarted() { + return isStarted; + } +} diff --git a/orbotmanager/src/main/java/org/torproject/android/service/vpn/TorifiedApp.java b/orbotmanager/src/main/java/org/orbotproject/android/service/vpn/TorifiedApp.java similarity index 93% rename from orbotmanager/src/main/java/org/torproject/android/service/vpn/TorifiedApp.java rename to orbotmanager/src/main/java/org/orbotproject/android/service/vpn/TorifiedApp.java index b7bc01e6..48a2f548 100644 --- a/orbotmanager/src/main/java/org/torproject/android/service/vpn/TorifiedApp.java +++ b/orbotmanager/src/main/java/org/orbotproject/android/service/vpn/TorifiedApp.java @@ -1,260 +1,260 @@ -package org.torproject.android.service.vpn; - -import android.Manifest; -import android.content.Context; -import android.content.SharedPreferences; -import android.content.pm.ApplicationInfo; -import android.content.pm.PackageInfo; -import android.content.pm.PackageManager; -import android.graphics.drawable.Drawable; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.StringTokenizer; - -import static org.torproject.android.service.vpn.VpnPrefs.PREFS_KEY_TORIFIED; - -public class TorifiedApp implements Comparable { - - private boolean enabled; - private int uid; - private String username; - private String procname; - private String name; - private Drawable icon; - private String packageName; - - private boolean torified = false; - private boolean usesInternet = false; - private int[] enabledPorts; - - public static ArrayList getApps(Context context, SharedPreferences prefs) { - - String tordAppString = prefs.getString(PREFS_KEY_TORIFIED, ""); - String[] tordApps; - - StringTokenizer st = new StringTokenizer(tordAppString, "|"); - tordApps = new String[st.countTokens()]; - int tordIdx = 0; - while (st.hasMoreTokens()) { - tordApps[tordIdx++] = st.nextToken(); - } - - Arrays.sort(tordApps); - - //else load the apps up - PackageManager pMgr = context.getPackageManager(); - - List lAppInfo = pMgr.getInstalledApplications(0); - - Iterator itAppInfo = lAppInfo.iterator(); - - ArrayList apps = new ArrayList<>(); - - ApplicationInfo aInfo; - - int appIdx = 0; - TorifiedApp app; - - while (itAppInfo.hasNext()) { - aInfo = itAppInfo.next(); - - app = new TorifiedApp(); - - try { - PackageInfo pInfo = pMgr.getPackageInfo(aInfo.packageName, PackageManager.GET_PERMISSIONS); - - if (pInfo != null && pInfo.requestedPermissions != null) { - for (String permInfo : pInfo.requestedPermissions) { - if (permInfo.equals(Manifest.permission.INTERNET)) { - app.setUsesInternet(true); - - } - } - - } - - - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - if ((aInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 1) { - //System app - app.setUsesInternet(true); - } - - - if (!app.usesInternet()) - continue; - else { - apps.add(app); - } - - - app.setEnabled(aInfo.enabled); - app.setUid(aInfo.uid); - app.setUsername(pMgr.getNameForUid(app.getUid())); - app.setProcname(aInfo.processName); - app.setPackageName(aInfo.packageName); - - try { - app.setName(pMgr.getApplicationLabel(aInfo).toString()); - } catch (Exception e) { - app.setName(aInfo.packageName); - } - - - //app.setIcon(pMgr.getApplicationIcon(aInfo)); - - // check if this application is allowed - if (Arrays.binarySearch(tordApps, app.getUsername()) >= 0) { - app.setTorified(true); - } else { - app.setTorified(false); - } - - appIdx++; - } - - Collections.sort(apps); - - return apps; - } - - public boolean usesInternet() { - return usesInternet; - } - - public void setUsesInternet(boolean usesInternet) { - this.usesInternet = usesInternet; - } - - /** - * @return the torified - */ - public boolean isTorified() { - return torified; - } - - /** - * @param torified the torified to set - */ - public void setTorified(boolean torified) { - this.torified = torified; - } - - /** - * @return the enabledPorts - */ - public int[] getEnabledPorts() { - return enabledPorts; - } - - /** - * @param enabledPorts the enabledPorts to set - */ - public void setEnabledPorts(int[] enabledPorts) { - this.enabledPorts = enabledPorts; - } - - /** - * @return the enabled - */ - public boolean isEnabled() { - return enabled; - } - - /** - * @param enabled the enabled to set - */ - public void setEnabled(boolean enabled) { - this.enabled = enabled; - } - - /** - * @return the uid - */ - public int getUid() { - return uid; - } - - /** - * @param uid the uid to set - */ - public void setUid(int uid) { - this.uid = uid; - } - - /** - * @return the username - */ - public String getUsername() { - return username; - } - - /** - * @param username the username to set - */ - public void setUsername(String username) { - this.username = username; - } - - /** - * @return the procname - */ - public String getProcname() { - return procname; - } - - /** - * @param procname the procname to set - */ - public void setProcname(String procname) { - this.procname = procname; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - public Drawable getIcon() { - return icon; - } - - public void setIcon(Drawable icon) { - this.icon = icon; - } - - @Override - public int compareTo(Object another) { - return this.toString().compareToIgnoreCase(another.toString()); - } - - @Override - public String toString() { - return getName(); - } - - public String getPackageName() { - return packageName; - } - - public void setPackageName(String packageName) { - this.packageName = packageName; - } -} +package org.orbotproject.android.service.vpn; + +import android.Manifest; +import android.content.Context; +import android.content.SharedPreferences; +import android.content.pm.ApplicationInfo; +import android.content.pm.PackageInfo; +import android.content.pm.PackageManager; +import android.graphics.drawable.Drawable; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.StringTokenizer; + +import static org.orbotproject.android.service.vpn.VpnPrefs.PREFS_KEY_TORIFIED; + +public class TorifiedApp implements Comparable { + + private boolean enabled; + private int uid; + private String username; + private String procname; + private String name; + private Drawable icon; + private String packageName; + + private boolean torified = false; + private boolean usesInternet = false; + private int[] enabledPorts; + + public static ArrayList getApps(Context context, SharedPreferences prefs) { + + String tordAppString = prefs.getString(PREFS_KEY_TORIFIED, ""); + String[] tordApps; + + StringTokenizer st = new StringTokenizer(tordAppString, "|"); + tordApps = new String[st.countTokens()]; + int tordIdx = 0; + while (st.hasMoreTokens()) { + tordApps[tordIdx++] = st.nextToken(); + } + + Arrays.sort(tordApps); + + //else load the apps up + PackageManager pMgr = context.getPackageManager(); + + List lAppInfo = pMgr.getInstalledApplications(0); + + Iterator itAppInfo = lAppInfo.iterator(); + + ArrayList apps = new ArrayList<>(); + + ApplicationInfo aInfo; + + int appIdx = 0; + TorifiedApp app; + + while (itAppInfo.hasNext()) { + aInfo = itAppInfo.next(); + + app = new TorifiedApp(); + + try { + PackageInfo pInfo = pMgr.getPackageInfo(aInfo.packageName, PackageManager.GET_PERMISSIONS); + + if (pInfo != null && pInfo.requestedPermissions != null) { + for (String permInfo : pInfo.requestedPermissions) { + if (permInfo.equals(Manifest.permission.INTERNET)) { + app.setUsesInternet(true); + + } + } + + } + + + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + if ((aInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 1) { + //System app + app.setUsesInternet(true); + } + + + if (!app.usesInternet()) + continue; + else { + apps.add(app); + } + + + app.setEnabled(aInfo.enabled); + app.setUid(aInfo.uid); + app.setUsername(pMgr.getNameForUid(app.getUid())); + app.setProcname(aInfo.processName); + app.setPackageName(aInfo.packageName); + + try { + app.setName(pMgr.getApplicationLabel(aInfo).toString()); + } catch (Exception e) { + app.setName(aInfo.packageName); + } + + + //app.setIcon(pMgr.getApplicationIcon(aInfo)); + + // check if this application is allowed + if (Arrays.binarySearch(tordApps, app.getUsername()) >= 0) { + app.setTorified(true); + } else { + app.setTorified(false); + } + + appIdx++; + } + + Collections.sort(apps); + + return apps; + } + + public boolean usesInternet() { + return usesInternet; + } + + public void setUsesInternet(boolean usesInternet) { + this.usesInternet = usesInternet; + } + + /** + * @return the torified + */ + public boolean isTorified() { + return torified; + } + + /** + * @param torified the torified to set + */ + public void setTorified(boolean torified) { + this.torified = torified; + } + + /** + * @return the enabledPorts + */ + public int[] getEnabledPorts() { + return enabledPorts; + } + + /** + * @param enabledPorts the enabledPorts to set + */ + public void setEnabledPorts(int[] enabledPorts) { + this.enabledPorts = enabledPorts; + } + + /** + * @return the enabled + */ + public boolean isEnabled() { + return enabled; + } + + /** + * @param enabled the enabled to set + */ + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + + /** + * @return the uid + */ + public int getUid() { + return uid; + } + + /** + * @param uid the uid to set + */ + public void setUid(int uid) { + this.uid = uid; + } + + /** + * @return the username + */ + public String getUsername() { + return username; + } + + /** + * @param username the username to set + */ + public void setUsername(String username) { + this.username = username; + } + + /** + * @return the procname + */ + public String getProcname() { + return procname; + } + + /** + * @param procname the procname to set + */ + public void setProcname(String procname) { + this.procname = procname; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + public Drawable getIcon() { + return icon; + } + + public void setIcon(Drawable icon) { + this.icon = icon; + } + + @Override + public int compareTo(Object another) { + return this.toString().compareToIgnoreCase(another.toString()); + } + + @Override + public String toString() { + return getName(); + } + + public String getPackageName() { + return packageName; + } + + public void setPackageName(String packageName) { + this.packageName = packageName; + } +} diff --git a/orbotmanager/src/main/java/org/torproject/android/service/vpn/Tun2Socks.java b/orbotmanager/src/main/java/org/orbotproject/android/service/vpn/Tun2Socks.java similarity index 95% rename from orbotmanager/src/main/java/org/torproject/android/service/vpn/Tun2Socks.java rename to orbotmanager/src/main/java/org/orbotproject/android/service/vpn/Tun2Socks.java index 461a5a8d..d3816fa4 100644 --- a/orbotmanager/src/main/java/org/torproject/android/service/vpn/Tun2Socks.java +++ b/orbotmanager/src/main/java/org/orbotproject/android/service/vpn/Tun2Socks.java @@ -1,173 +1,173 @@ -package org.torproject.android.service.vpn; - -/* - * Copyright (c) 2013, Psiphon Inc. - * All rights reserved. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -import android.annotation.TargetApi; -import android.content.Context; -import android.net.ConnectivityManager; -import android.os.Build; -import android.os.ParcelFileDescriptor; -import android.util.Log; - -import org.torproject.android.service.util.TCPSourceApp; - -import java.net.DatagramSocket; -import java.net.InetSocketAddress; -import java.net.Socket; -import java.util.HashMap; - -import static android.content.Context.CONNECTIVITY_SERVICE; - -public class Tun2Socks { - - private static final String TAG = Tun2Socks.class.getSimpleName(); - private static final boolean LOGD = true; - - private static ParcelFileDescriptor mVpnInterfaceFileDescriptor; - private static int mVpnInterfaceMTU; - private static String mVpnIpAddress; - private static String mVpnNetMask; - private static String mSocksServerAddress; - private static String mUdpgwServerAddress; - private static boolean mUdpgwTransparentDNS; - private static HashMap mAppUidBlacklist = new HashMap<>(); - - static { - System.loadLibrary("tun2socks"); - } - - public static void init() { - } - // Note: this class isn't a singleton, but you can't run more - // than one instance due to the use of global state (the lwip - // module, etc.) in the native code. - - public static void Start( - Context context, - ParcelFileDescriptor vpnInterfaceFileDescriptor, - int vpnInterfaceMTU, - String vpnIpAddress, - String vpnNetMask, - String socksServerAddress, - String udpgwServerAddress, - boolean udpgwTransparentDNS) { - - mVpnInterfaceFileDescriptor = vpnInterfaceFileDescriptor; - mVpnInterfaceMTU = vpnInterfaceMTU; - mVpnIpAddress = vpnIpAddress; - mVpnNetMask = vpnNetMask; - mSocksServerAddress = socksServerAddress; - mUdpgwServerAddress = udpgwServerAddress; - mUdpgwTransparentDNS = udpgwTransparentDNS; - - if (mVpnInterfaceFileDescriptor != null) - runTun2Socks( - mVpnInterfaceFileDescriptor.detachFd(), - mVpnInterfaceMTU, - mVpnIpAddress, - mVpnNetMask, - mSocksServerAddress, - mUdpgwServerAddress, - mUdpgwTransparentDNS ? 1 : 0); - } - - public static void Stop() { - - terminateTun2Socks(); - - } - - public static void logTun2Socks( - String level, - String channel, - String msg) { - String logMsg = level + "(" + channel + "): " + msg; - if (0 == level.compareTo("ERROR")) { - Log.e(TAG, logMsg); - } else { - if (LOGD) Log.d(TAG, logMsg); - } - } - - private native static int runTun2Socks( - int vpnInterfaceFileDescriptor, - int vpnInterfaceMTU, - String vpnIpAddress, - String vpnNetMask, - String socksServerAddress, - String udpgwServerAddress, - int udpgwTransparentDNS); - - private native static void terminateTun2Socks(); - - public static boolean checkIsAllowed(Context context, int protocol, String sourceAddr, int sourcePort, String destAddr, int destPort) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { - return isAllowedQ(context, protocol, sourceAddr, sourcePort, destAddr, destPort); - } else - return isAllowed(context, protocol, sourceAddr, sourcePort, destAddr, destPort); - } - - public static boolean isAllowed(Context context, int protocol, String sourceAddr, int sourcePort, String destAddr, int destPort) { - - TCPSourceApp.AppDescriptor aInfo = TCPSourceApp.getApplicationInfo(context, sourceAddr, sourcePort, destAddr, destPort); - - if (aInfo != null) { - int uid = aInfo.getUid(); - return mAppUidBlacklist.containsKey(uid); - } else - return true; - } - - @TargetApi(Build.VERSION_CODES.Q) - public static boolean isAllowedQ(Context context, int protocol, String sourceAddr, int sourcePort, String destAddr, int destPort) { - ConnectivityManager cm = (ConnectivityManager) context.getSystemService(CONNECTIVITY_SERVICE); - if (cm == null) - return false; - - InetSocketAddress local = new InetSocketAddress(sourceAddr, sourcePort); - InetSocketAddress remote = new InetSocketAddress(destAddr, destPort); - - int uid = cm.getConnectionOwnerUid(protocol, local, remote); - return mAppUidBlacklist.containsKey(uid); - } - - public static void setBlacklist(HashMap appUidBlacklist) { - mAppUidBlacklist = appUidBlacklist; - } - - public static void clearBlacklist() { - mAppUidBlacklist.clear(); - } - - public static void addToBlacklist(int uid, String pkgId) { - mAppUidBlacklist.put(uid, pkgId); - } - - public static void removeFromBlacklist(int uid) { - mAppUidBlacklist.remove(uid); - } - - public interface IProtectSocket { - boolean doVpnProtect(Socket socket); - - boolean doVpnProtect(DatagramSocket socket); - } - +package org.orbotproject.android.service.vpn; + +/* + * Copyright (c) 2013, Psiphon Inc. + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +import android.annotation.TargetApi; +import android.content.Context; +import android.net.ConnectivityManager; +import android.os.Build; +import android.os.ParcelFileDescriptor; +import android.util.Log; + +import org.orbotproject.android.service.util.TCPSourceApp; + +import java.net.DatagramSocket; +import java.net.InetSocketAddress; +import java.net.Socket; +import java.util.HashMap; + +import static android.content.Context.CONNECTIVITY_SERVICE; + +public class Tun2Socks { + + private static final String TAG = Tun2Socks.class.getSimpleName(); + private static final boolean LOGD = true; + + private static ParcelFileDescriptor mVpnInterfaceFileDescriptor; + private static int mVpnInterfaceMTU; + private static String mVpnIpAddress; + private static String mVpnNetMask; + private static String mSocksServerAddress; + private static String mUdpgwServerAddress; + private static boolean mUdpgwTransparentDNS; + private static HashMap mAppUidBlacklist = new HashMap<>(); + + static { + System.loadLibrary("tun2socks"); + } + + public static void init() { + } + // Note: this class isn't a singleton, but you can't run more + // than one instance due to the use of global state (the lwip + // module, etc.) in the native code. + + public static void Start( + Context context, + ParcelFileDescriptor vpnInterfaceFileDescriptor, + int vpnInterfaceMTU, + String vpnIpAddress, + String vpnNetMask, + String socksServerAddress, + String udpgwServerAddress, + boolean udpgwTransparentDNS) { + + mVpnInterfaceFileDescriptor = vpnInterfaceFileDescriptor; + mVpnInterfaceMTU = vpnInterfaceMTU; + mVpnIpAddress = vpnIpAddress; + mVpnNetMask = vpnNetMask; + mSocksServerAddress = socksServerAddress; + mUdpgwServerAddress = udpgwServerAddress; + mUdpgwTransparentDNS = udpgwTransparentDNS; + + if (mVpnInterfaceFileDescriptor != null) + runTun2Socks( + mVpnInterfaceFileDescriptor.detachFd(), + mVpnInterfaceMTU, + mVpnIpAddress, + mVpnNetMask, + mSocksServerAddress, + mUdpgwServerAddress, + mUdpgwTransparentDNS ? 1 : 0); + } + + public static void Stop() { + + terminateTun2Socks(); + + } + + public static void logTun2Socks( + String level, + String channel, + String msg) { + String logMsg = level + "(" + channel + "): " + msg; + if (0 == level.compareTo("ERROR")) { + Log.e(TAG, logMsg); + } else { + if (LOGD) Log.d(TAG, logMsg); + } + } + + private native static int runTun2Socks( + int vpnInterfaceFileDescriptor, + int vpnInterfaceMTU, + String vpnIpAddress, + String vpnNetMask, + String socksServerAddress, + String udpgwServerAddress, + int udpgwTransparentDNS); + + private native static void terminateTun2Socks(); + + public static boolean checkIsAllowed(Context context, int protocol, String sourceAddr, int sourcePort, String destAddr, int destPort) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + return isAllowedQ(context, protocol, sourceAddr, sourcePort, destAddr, destPort); + } else + return isAllowed(context, protocol, sourceAddr, sourcePort, destAddr, destPort); + } + + public static boolean isAllowed(Context context, int protocol, String sourceAddr, int sourcePort, String destAddr, int destPort) { + + TCPSourceApp.AppDescriptor aInfo = TCPSourceApp.getApplicationInfo(context, sourceAddr, sourcePort, destAddr, destPort); + + if (aInfo != null) { + int uid = aInfo.getUid(); + return mAppUidBlacklist.containsKey(uid); + } else + return true; + } + + @TargetApi(Build.VERSION_CODES.Q) + public static boolean isAllowedQ(Context context, int protocol, String sourceAddr, int sourcePort, String destAddr, int destPort) { + ConnectivityManager cm = (ConnectivityManager) context.getSystemService(CONNECTIVITY_SERVICE); + if (cm == null) + return false; + + InetSocketAddress local = new InetSocketAddress(sourceAddr, sourcePort); + InetSocketAddress remote = new InetSocketAddress(destAddr, destPort); + + int uid = cm.getConnectionOwnerUid(protocol, local, remote); + return mAppUidBlacklist.containsKey(uid); + } + + public static void setBlacklist(HashMap appUidBlacklist) { + mAppUidBlacklist = appUidBlacklist; + } + + public static void clearBlacklist() { + mAppUidBlacklist.clear(); + } + + public static void addToBlacklist(int uid, String pkgId) { + mAppUidBlacklist.put(uid, pkgId); + } + + public static void removeFromBlacklist(int uid) { + mAppUidBlacklist.remove(uid); + } + + public interface IProtectSocket { + boolean doVpnProtect(Socket socket); + + boolean doVpnProtect(DatagramSocket socket); + } + } \ No newline at end of file diff --git a/orbotmanager/src/main/java/org/torproject/android/service/vpn/VpnPrefs.java b/orbotmanager/src/main/java/org/orbotproject/android/service/vpn/VpnPrefs.java similarity index 69% rename from orbotmanager/src/main/java/org/torproject/android/service/vpn/VpnPrefs.java rename to orbotmanager/src/main/java/org/orbotproject/android/service/vpn/VpnPrefs.java index 4945241a..9162cfa1 100644 --- a/orbotmanager/src/main/java/org/torproject/android/service/vpn/VpnPrefs.java +++ b/orbotmanager/src/main/java/org/orbotproject/android/service/vpn/VpnPrefs.java @@ -1,8 +1,8 @@ -package org.torproject.android.service.vpn; - -public interface VpnPrefs { - - String PREFS_DNS_PORT = "PREFS_DNS_PORT"; - - String PREFS_KEY_TORIFIED = "PrefTord"; -} +package org.orbotproject.android.service.vpn; + +public interface VpnPrefs { + + String PREFS_DNS_PORT = "PREFS_DNS_PORT"; + + String PREFS_KEY_TORIFIED = "PrefTord"; +} diff --git a/orbotmanager/src/main/java/org/torproject/android/service/vpn/VpnUtils.java b/orbotmanager/src/main/java/org/orbotproject/android/service/vpn/VpnUtils.java similarity index 95% rename from orbotmanager/src/main/java/org/torproject/android/service/vpn/VpnUtils.java rename to orbotmanager/src/main/java/org/orbotproject/android/service/vpn/VpnUtils.java index 604b1c44..c7464dfb 100644 --- a/orbotmanager/src/main/java/org/torproject/android/service/vpn/VpnUtils.java +++ b/orbotmanager/src/main/java/org/orbotproject/android/service/vpn/VpnUtils.java @@ -1,136 +1,136 @@ -package org.torproject.android.service.vpn; - -import android.util.Log; - -import org.apache.commons.io.IOUtils; - -import java.io.BufferedReader; -import java.io.File; -import java.io.IOException; -import java.io.InputStreamReader; -import java.util.List; - -import static java.lang.Runtime.getRuntime; - -public class VpnUtils { - - public static int findProcessId(String command) throws IOException { - - String[] cmds = {"ps -ef", "ps -A", "toolbox ps"}; - - for (int i = 0; i < cmds.length; i++) { - Process procPs = getRuntime().exec(cmds[i]); - - BufferedReader reader = new BufferedReader(new InputStreamReader(procPs.getInputStream())); - - String line; - while ((line = reader.readLine()) != null) { - if (!line.contains("PID") && line.contains(command)) { - String[] lineParts = line.split("\\s+"); - try { - return Integer.parseInt(lineParts[1]); //for most devices it is the second - } catch (NumberFormatException e) { - return Integer.parseInt(lineParts[0]); //but for samsungs it is the first - } finally { - try { - procPs.destroy(); - } catch (Exception e) { - } - } - } - } - } - - return -1; - } - - public static void killProcess(File fileProcBin) throws Exception { - killProcess(fileProcBin, "-9"); // this is -KILL - } - - public static int killProcess(File fileProcBin, String signal) throws Exception { - - int procId = -1; - int killAttempts = 0; - - while ((procId = findProcessId(fileProcBin.getName())) != -1) { - killAttempts++; - String pidString = String.valueOf(procId); - boolean itBeDead = killProcess(pidString, signal); - - if (!itBeDead) { - - String[] cmds = {"", "busybox ", "toolbox "}; - - for (int i = 0; i < cmds.length; i++) { - - Process proc; - - try { - proc = getRuntime().exec(cmds[i] + "killall " + signal + " " + fileProcBin.getName - ()); - int exitValue = proc.waitFor(); - if (exitValue == 0) - break; - - } catch (IOException ioe) { - } - try { - proc = getRuntime().exec(cmds[i] + "killall " + signal + " " + fileProcBin.getCanonicalPath()); - int exitValue = proc.waitFor(); - if (exitValue == 0) - break; - - } catch (IOException ioe) { - } - } - - - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - // ignored - } - - } - - if (killAttempts > 4) - throw new Exception("Cannot kill: " + fileProcBin.getAbsolutePath()); - } - - return procId; - } - - public static boolean killProcess(String pidString, String signal) throws Exception { - - String[] cmds = {"", "toolbox ", "busybox "}; - - for (int i = 0; i < cmds.length; i++) { - try { - Process proc = getRuntime().exec(cmds[i] + "kill " + signal + " " + pidString); - int exitVal = proc.waitFor(); - List lineErrors = IOUtils.readLines(proc.getErrorStream()); - List lineInputs = IOUtils.readLines(proc.getInputStream()); - - if (exitVal != 0) { - Log.d("Orbot.killProcess", "exit=" + exitVal); - for (String line : lineErrors) - Log.d("Orbot.killProcess", line); - - for (String line : lineInputs) - Log.d("Orbot.killProcess", line); - - } else { - //it worked, let's exit - return true; - } - - - } catch (IOException ioe) { - Log.e("Orbot.killprcess", "error killing process: " + pidString, ioe); - } - } - - return false; - } -} +package org.orbotproject.android.service.vpn; + +import android.util.Log; + +import org.apache.commons.io.IOUtils; + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.List; + +import static java.lang.Runtime.getRuntime; + +public class VpnUtils { + + public static int findProcessId(String command) throws IOException { + + String[] cmds = {"ps -ef", "ps -A", "toolbox ps"}; + + for (int i = 0; i < cmds.length; i++) { + Process procPs = getRuntime().exec(cmds[i]); + + BufferedReader reader = new BufferedReader(new InputStreamReader(procPs.getInputStream())); + + String line; + while ((line = reader.readLine()) != null) { + if (!line.contains("PID") && line.contains(command)) { + String[] lineParts = line.split("\\s+"); + try { + return Integer.parseInt(lineParts[1]); //for most devices it is the second + } catch (NumberFormatException e) { + return Integer.parseInt(lineParts[0]); //but for samsungs it is the first + } finally { + try { + procPs.destroy(); + } catch (Exception e) { + } + } + } + } + } + + return -1; + } + + public static void killProcess(File fileProcBin) throws Exception { + killProcess(fileProcBin, "-9"); // this is -KILL + } + + public static int killProcess(File fileProcBin, String signal) throws Exception { + + int procId = -1; + int killAttempts = 0; + + while ((procId = findProcessId(fileProcBin.getName())) != -1) { + killAttempts++; + String pidString = String.valueOf(procId); + boolean itBeDead = killProcess(pidString, signal); + + if (!itBeDead) { + + String[] cmds = {"", "busybox ", "toolbox "}; + + for (int i = 0; i < cmds.length; i++) { + + Process proc; + + try { + proc = getRuntime().exec(cmds[i] + "killall " + signal + " " + fileProcBin.getName + ()); + int exitValue = proc.waitFor(); + if (exitValue == 0) + break; + + } catch (IOException ioe) { + } + try { + proc = getRuntime().exec(cmds[i] + "killall " + signal + " " + fileProcBin.getCanonicalPath()); + int exitValue = proc.waitFor(); + if (exitValue == 0) + break; + + } catch (IOException ioe) { + } + } + + + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + // ignored + } + + } + + if (killAttempts > 4) + throw new Exception("Cannot kill: " + fileProcBin.getAbsolutePath()); + } + + return procId; + } + + public static boolean killProcess(String pidString, String signal) throws Exception { + + String[] cmds = {"", "toolbox ", "busybox "}; + + for (int i = 0; i < cmds.length; i++) { + try { + Process proc = getRuntime().exec(cmds[i] + "kill " + signal + " " + pidString); + int exitVal = proc.waitFor(); + List lineErrors = IOUtils.readLines(proc.getErrorStream()); + List lineInputs = IOUtils.readLines(proc.getInputStream()); + + if (exitVal != 0) { + Log.d("Orbot.killProcess", "exit=" + exitVal); + for (String line : lineErrors) + Log.d("Orbot.killProcess", line); + + for (String line : lineInputs) + Log.d("Orbot.killProcess", line); + + } else { + //it worked, let's exit + return true; + } + + + } catch (IOException ioe) { + Log.e("Orbot.killprcess", "error killing process: " + pidString, ioe); + } + } + + return false; + } +} diff --git a/orbotmanager/src/main/java/org/torproject/android/service/wrapper/LocaleHelper.java b/orbotmanager/src/main/java/org/orbotproject/android/service/wrapper/LocaleHelper.java similarity index 93% rename from orbotmanager/src/main/java/org/torproject/android/service/wrapper/LocaleHelper.java rename to orbotmanager/src/main/java/org/orbotproject/android/service/wrapper/LocaleHelper.java index 25248a72..b591438e 100644 --- a/orbotmanager/src/main/java/org/torproject/android/service/wrapper/LocaleHelper.java +++ b/orbotmanager/src/main/java/org/orbotproject/android/service/wrapper/LocaleHelper.java @@ -1,11 +1,11 @@ -package org.torproject.android.service.wrapper; +package org.orbotproject.android.service.wrapper; import android.annotation.TargetApi; import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; import android.os.Build; -import org.torproject.android.service.util.Prefs; +import org.orbotproject.android.service.util.Prefs; import java.util.Locale; diff --git a/orbotmanager/src/main/java/org/torproject/android/service/wrapper/localHelperMethod.java b/orbotmanager/src/main/java/org/orbotproject/android/service/wrapper/localHelperMethod.java similarity index 91% rename from orbotmanager/src/main/java/org/torproject/android/service/wrapper/localHelperMethod.java rename to orbotmanager/src/main/java/org/orbotproject/android/service/wrapper/localHelperMethod.java index 063a8161..2a788bb4 100644 --- a/orbotmanager/src/main/java/org/torproject/android/service/wrapper/localHelperMethod.java +++ b/orbotmanager/src/main/java/org/orbotproject/android/service/wrapper/localHelperMethod.java @@ -1,4 +1,4 @@ -package org.torproject.android.service.wrapper; +package org.orbotproject.android.service.wrapper; import java.util.Calendar; diff --git a/orbotmanager/src/main/java/org/torproject/android/service/wrapper/logRowModel.java b/orbotmanager/src/main/java/org/orbotproject/android/service/wrapper/logRowModel.java similarity index 86% rename from orbotmanager/src/main/java/org/torproject/android/service/wrapper/logRowModel.java rename to orbotmanager/src/main/java/org/orbotproject/android/service/wrapper/logRowModel.java index 3c748669..5bc2fe4e 100644 --- a/orbotmanager/src/main/java/org/torproject/android/service/wrapper/logRowModel.java +++ b/orbotmanager/src/main/java/org/orbotproject/android/service/wrapper/logRowModel.java @@ -1,4 +1,4 @@ -package org.torproject.android.service.wrapper; +package org.orbotproject.android.service.wrapper; public class logRowModel { /*Private Variables*/ diff --git a/orbotmanager/src/main/java/org/torproject/android/service/wrapper/orbotLocalConstants.java b/orbotmanager/src/main/java/org/orbotproject/android/service/wrapper/orbotLocalConstants.java similarity index 91% rename from orbotmanager/src/main/java/org/torproject/android/service/wrapper/orbotLocalConstants.java rename to orbotmanager/src/main/java/org/orbotproject/android/service/wrapper/orbotLocalConstants.java index a6ef8b67..f642f614 100644 --- a/orbotmanager/src/main/java/org/torproject/android/service/wrapper/orbotLocalConstants.java +++ b/orbotmanager/src/main/java/org/orbotproject/android/service/wrapper/orbotLocalConstants.java @@ -1,4 +1,4 @@ -package org.torproject.android.service.wrapper; +package org.orbotproject.android.service.wrapper; import android.content.Context; import android.content.Intent;