├── README.md ├── apk ├── Android-Hosts-L.apk ├── README.md └── history │ ├── V8.02.apk │ └── V8.03.apk ├── code ├── LICENSE ├── V3.50 │ ├── MainActivity.java │ └── Shell.java ├── V5.01 │ ├── MainActivity.java │ └── Shell.java ├── V6.00 │ ├── Afterapply.java │ ├── Backup.java │ ├── Checkbusybox.java │ ├── Checkroot.java │ ├── Checkversion.java │ ├── Copy.java │ ├── Del.java │ ├── Downloadhosts.java │ ├── Installbusybox.java │ ├── MainActivity.java │ ├── Reboot.java │ ├── RefreshDNS.java │ ├── Shell.java │ ├── Showchoose.java │ ├── Unzipbusybox.java │ └── Unzipdefault.java ├── V6.10 │ ├── Afterapply.java │ ├── Backup.java │ ├── Checkroot.java │ ├── Checkversion.java │ ├── Constants.java │ ├── Copy.java │ ├── Del.java │ ├── Downloadhosts.java │ ├── Installbusybox.java │ ├── MainActivity.java │ ├── Reboot.java │ ├── RefreshDNS.java │ ├── Shell.java │ ├── Showchoose.java │ ├── Unzipbusybox.java │ ├── Unzipdefault.java │ └── rootcommands │ │ ├── Mount.java │ │ ├── Remounter.java │ │ ├── RootCommands.java │ │ ├── Shell.java │ │ ├── SystemCommands.java │ │ ├── Toolbox.java │ │ ├── command │ │ ├── Command.java │ │ ├── ExecutableCommand.java │ │ ├── SimpleCommand.java │ │ └── SimpleExecutableCommand.java │ │ └── util │ │ ├── BrokenBusyboxException.java │ │ ├── Log.java │ │ ├── RootAccessDeniedException.java │ │ ├── UnsupportedArchitectureException.java │ │ └── Utils.java ├── V6.23 │ ├── Afterapply.java │ ├── Backup.java │ ├── Checkroot.java │ ├── Checkversion.java │ ├── Constants.java │ ├── Copy.java │ ├── Del.java │ ├── Downloadhosts.java │ ├── Installbusybox.java │ ├── MainActivity.java │ ├── Reboot.java │ ├── RefreshDNS.java │ ├── Removemark.java │ ├── Shell.java │ ├── Showchoose.java │ ├── Unzipbusybox.java │ ├── Unzipdefault.java │ ├── enablegooglelocation │ │ ├── EnableGoogleLocation.java │ │ └── EnableShell.java │ ├── permission │ │ └── AskPermission.java │ └── rootcommands │ │ ├── Mount.java │ │ ├── Remounter.java │ │ ├── RootCommands.java │ │ ├── Shell.java │ │ ├── SystemCommands.java │ │ ├── Toolbox.java │ │ ├── command │ │ ├── Command.java │ │ ├── ExecutableCommand.java │ │ ├── SimpleCommand.java │ │ └── SimpleExecutableCommand.java │ │ └── util │ │ ├── BrokenBusyboxException.java │ │ ├── Log.java │ │ ├── RootAccessDeniedException.java │ │ ├── UnsupportedArchitectureException.java │ │ └── Utils.java ├── V7.00 │ ├── .gitignore │ ├── .idea │ │ ├── compiler.xml │ │ ├── copyright │ │ │ └── profiles_settings.xml │ │ ├── dictionaries │ │ │ └── lack.xml │ │ ├── encodings.xml │ │ ├── gradle.xml │ │ ├── misc.xml │ │ ├── modules.xml │ │ └── runConfigurations.xml │ ├── app │ │ ├── .gitignore │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ └── src │ │ │ ├── androidTest │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── lack006 │ │ │ │ └── hosts_l │ │ │ │ └── ApplicationTest.java │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── lack006 │ │ │ │ │ └── hosts_l │ │ │ │ │ ├── About │ │ │ │ │ ├── AboutHelper.java │ │ │ │ │ └── MarketHelper.java │ │ │ │ │ ├── Backup │ │ │ │ │ ├── BackupHostsTaskHelper.java │ │ │ │ │ └── RestoreHostsTaskHelper.java │ │ │ │ │ ├── Busybox │ │ │ │ │ └── ExpressBusyBoxTaskHelper.java │ │ │ │ │ ├── ChangeIp │ │ │ │ │ └── ChangeIpTaskHelper.java │ │ │ │ │ ├── CheckVersion │ │ │ │ │ ├── CheckNetTaskHelper.java │ │ │ │ │ ├── CheckRootTaskHelper.java │ │ │ │ │ ├── CheckVersionTaskHelper.java │ │ │ │ │ ├── GetVersionHelper.java │ │ │ │ │ └── NetHelper.java │ │ │ │ │ ├── Clash │ │ │ │ │ ├── GetClashHelper.java │ │ │ │ │ └── InsertClashTaskHelper.java │ │ │ │ │ ├── CleanCache │ │ │ │ │ └── CleanCacheHelper.java │ │ │ │ │ ├── Consistent │ │ │ │ │ ├── Consistent.java │ │ │ │ │ ├── ConsistentCommands.java │ │ │ │ │ └── ConsistentHtml.java │ │ │ │ │ ├── Copy │ │ │ │ │ └── CopyHelper.java │ │ │ │ │ ├── DNS │ │ │ │ │ ├── ChangeDNSReceiver.java │ │ │ │ │ ├── ChangeDNSService.java │ │ │ │ │ ├── ChangeDNSTaskHelper.java │ │ │ │ │ ├── DNSShellService.java │ │ │ │ │ └── RefreshDNSTaskHelper.java │ │ │ │ │ ├── Delay │ │ │ │ │ └── DelayHelper.java │ │ │ │ │ ├── Dialog │ │ │ │ │ └── HostsChooseHelper.java │ │ │ │ │ ├── Download │ │ │ │ │ ├── CustomDownloadTaskHelper.java │ │ │ │ │ ├── DownloadClashHelper.java │ │ │ │ │ └── DownloadTaskHelper.java │ │ │ │ │ ├── GoogleLocation │ │ │ │ │ ├── GoogleLocationEnableReceiver.java │ │ │ │ │ └── GoogleLocationReportTaskHelper.java │ │ │ │ │ ├── Helper │ │ │ │ │ ├── ObjectAnimatorHelper.java │ │ │ │ │ ├── SnackBarHelper.java │ │ │ │ │ └── SuShellReturnHelper.java │ │ │ │ │ ├── Hosts │ │ │ │ │ └── ApplyHostsTaskHelper.java │ │ │ │ │ ├── MainActivity.java │ │ │ │ │ ├── Reboot │ │ │ │ │ └── RebootHelper.java │ │ │ │ │ └── RemoveMark │ │ │ │ │ └── RemoveMarkTaskHelper.java │ │ │ └── res │ │ │ │ ├── drawable-v21 │ │ │ │ ├── ic_menu_camera.xml │ │ │ │ ├── ic_menu_gallery.xml │ │ │ │ ├── ic_menu_manage.xml │ │ │ │ ├── ic_menu_send.xml │ │ │ │ ├── ic_menu_share.xml │ │ │ │ └── ic_menu_slideshow.xml │ │ │ │ ├── drawable │ │ │ │ └── side_nav_bar.xml │ │ │ │ ├── layout │ │ │ │ ├── about_dialog_layout.xml │ │ │ │ ├── activity_main.xml │ │ │ │ ├── app_bar_main.xml │ │ │ │ ├── change_dns_dialog_layout.xml │ │ │ │ ├── change_ip_dialog_layout.xml │ │ │ │ ├── content_main.xml │ │ │ │ ├── nav_header_main.xml │ │ │ │ ├── re_choose_dialog_layout.xml │ │ │ │ └── remove_mark_dialog_layout.xml │ │ │ │ ├── menu │ │ │ │ ├── activity_main_drawer.xml │ │ │ │ └── main.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ ├── action_help.png │ │ │ │ ├── action_refresh.png │ │ │ │ ├── ic_launcher.png │ │ │ │ └── lack006.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ ├── action_help.png │ │ │ │ ├── action_refresh.png │ │ │ │ ├── ic_launcher.png │ │ │ │ └── lack006.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── action_help.png │ │ │ │ ├── action_refresh.png │ │ │ │ ├── ic_launcher.png │ │ │ │ └── lack006.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── action_help.png │ │ │ │ ├── action_refresh.png │ │ │ │ ├── ic_launcher.png │ │ │ │ └── lack006.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── action_help.png │ │ │ │ ├── action_refresh.png │ │ │ │ ├── ic_launcher.png │ │ │ │ └── lack006.png │ │ │ │ ├── raw │ │ │ │ ├── jttqbcsmwxhxy │ │ │ │ └── lack006 │ │ │ │ ├── values-v21 │ │ │ │ └── styles.xml │ │ │ │ ├── values-w820dp │ │ │ │ └── dimens.xml │ │ │ │ └── values │ │ │ │ ├── colors.xml │ │ │ │ ├── dimens.xml │ │ │ │ ├── drawables.xml │ │ │ │ ├── enableGoogleLoactionReportChooseArray.xml │ │ │ │ ├── strings.xml │ │ │ │ ├── styles.xml │ │ │ │ └── values.xml │ │ │ └── test │ │ │ └── java │ │ │ └── com │ │ │ └── lack006 │ │ │ └── hosts_l │ │ │ └── ExampleUnitTest.java │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle ├── V8.00 │ ├── .gitignore │ ├── app │ │ ├── .gitignore │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ └── src │ │ │ ├── androidTest │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── lack006 │ │ │ │ └── hosts_l │ │ │ │ └── ExampleInstrumentedTest.java │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── ic_launcher-web.png │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── lack006 │ │ │ │ │ └── hosts_l │ │ │ │ │ ├── About │ │ │ │ │ ├── AboutHelper.java │ │ │ │ │ └── MarketHelper.java │ │ │ │ │ ├── Backup │ │ │ │ │ ├── BackupHostsTaskHelper.java │ │ │ │ │ └── RestoreHostsTaskHelper.java │ │ │ │ │ ├── BatteryOptimizations │ │ │ │ │ └── IsIgnoringBatteryOptimizations.java │ │ │ │ │ ├── Busybox │ │ │ │ │ └── ExpressBusyBoxTaskHelper.java │ │ │ │ │ ├── ChangeIp │ │ │ │ │ └── ChangeIpTaskHelper.java │ │ │ │ │ ├── CheckVersion │ │ │ │ │ ├── CheckNetTaskHelper.java │ │ │ │ │ ├── CheckRootTaskHelper.java │ │ │ │ │ ├── CheckVersionTaskHelper.java │ │ │ │ │ ├── GetVersionHelper.java │ │ │ │ │ └── NetHelper.java │ │ │ │ │ ├── Clash │ │ │ │ │ ├── GetClashHelper.java │ │ │ │ │ └── InsertClashTaskHelper.java │ │ │ │ │ ├── CleanCache │ │ │ │ │ └── CleanCacheHelper.java │ │ │ │ │ ├── Consistent │ │ │ │ │ ├── Consistent.java │ │ │ │ │ ├── ConsistentCommands.java │ │ │ │ │ └── ConsistentHtml.java │ │ │ │ │ ├── Copy │ │ │ │ │ └── CopyHelper.java │ │ │ │ │ ├── DNS │ │ │ │ │ ├── ChangeDNSReceiver.java │ │ │ │ │ ├── ChangeDNSService.java │ │ │ │ │ ├── ChangeDNSTaskHelper.java │ │ │ │ │ ├── DNSShellService.java │ │ │ │ │ └── RefreshDNSTaskHelper.java │ │ │ │ │ ├── Delay │ │ │ │ │ └── DelayHelper.java │ │ │ │ │ ├── Dialog │ │ │ │ │ └── HostsChooseHelper.java │ │ │ │ │ ├── Download │ │ │ │ │ ├── CustomDownloadTaskHelper.java │ │ │ │ │ ├── DownloadClashHelper.java │ │ │ │ │ └── DownloadTaskHelper.java │ │ │ │ │ ├── GoogleLocation │ │ │ │ │ ├── BootReceiver.java │ │ │ │ │ ├── GoogleLocationEnableReceiver.java │ │ │ │ │ ├── GoogleLocationEnableService.java │ │ │ │ │ ├── GoogleLocationEnableTaskHelper.java │ │ │ │ │ └── GoogleLocationReportTaskHelper.java │ │ │ │ │ ├── Helper │ │ │ │ │ ├── ObjectAnimatorHelper.java │ │ │ │ │ ├── SnackBarHelper.java │ │ │ │ │ └── SuShellReturnHelper.java │ │ │ │ │ ├── Hosts │ │ │ │ │ └── ApplyHostsTaskHelper.java │ │ │ │ │ ├── MainActivity.java │ │ │ │ │ ├── ProtectMode │ │ │ │ │ └── ProtectModeHelper.java │ │ │ │ │ ├── Reboot │ │ │ │ │ └── RebootHelper.java │ │ │ │ │ └── RemoveMark │ │ │ │ │ ├── RemoveMarkTaskHelper.java │ │ │ │ │ ├── SetCustomServerAfterNougatTask.java │ │ │ │ │ ├── SetCustomServerAtNougatTask.java │ │ │ │ │ ├── SetCustomServerBetweenLollipop2NougatTask.java │ │ │ │ │ ├── SetDefaultServerAfterNougatToOreo27Task.java │ │ │ │ │ ├── SetDefaultServerAtNougatTask.java │ │ │ │ │ └── SetDefaultServerBetweenLollipop2NougatTask.java │ │ │ └── res │ │ │ │ ├── drawable-v21 │ │ │ │ ├── ic_menu_camera.xml │ │ │ │ ├── ic_menu_gallery.xml │ │ │ │ ├── ic_menu_manage.xml │ │ │ │ ├── ic_menu_send.xml │ │ │ │ ├── ic_menu_share.xml │ │ │ │ └── ic_menu_slideshow.xml │ │ │ │ ├── drawable-v24 │ │ │ │ └── ic_launcher_foreground.xml │ │ │ │ ├── drawable │ │ │ │ ├── ic_launcher_background.xml │ │ │ │ ├── ic_launcher_foreground.xml │ │ │ │ └── side_nav_bar.xml │ │ │ │ ├── layout │ │ │ │ ├── about_dialog_layout.xml │ │ │ │ ├── activity_main.xml │ │ │ │ ├── app_bar_main.xml │ │ │ │ ├── change_dns_dialog_layout.xml │ │ │ │ ├── change_ip_dialog_layout.xml │ │ │ │ ├── content_main.xml │ │ │ │ ├── nav_header_main.xml │ │ │ │ ├── re_choose_dialog_layout.xml │ │ │ │ └── remove_mark_dialog_layout.xml │ │ │ │ ├── menu │ │ │ │ ├── activity_main_drawer.xml │ │ │ │ └── main.xml │ │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ ├── action_help.png │ │ │ │ ├── action_protect.png │ │ │ │ ├── action_refresh.png │ │ │ │ ├── backup.png │ │ │ │ ├── change_ip.png │ │ │ │ ├── dns.png │ │ │ │ ├── exit.png │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_background.png │ │ │ │ ├── ic_launcher_foreground.png │ │ │ │ ├── ic_launcher_round.png │ │ │ │ ├── lack006.png │ │ │ │ ├── location.png │ │ │ │ ├── mark.png │ │ │ │ ├── reboot.png │ │ │ │ ├── restore.png │ │ │ │ ├── update.png │ │ │ │ └── update_log.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ ├── action_help.png │ │ │ │ ├── action_protect.png │ │ │ │ ├── action_refresh.png │ │ │ │ ├── backup.png │ │ │ │ ├── change_ip.png │ │ │ │ ├── dns.png │ │ │ │ ├── exit.png │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_background.png │ │ │ │ ├── ic_launcher_foreground.png │ │ │ │ ├── ic_launcher_round.png │ │ │ │ ├── lack006.png │ │ │ │ ├── location.png │ │ │ │ ├── mark.png │ │ │ │ ├── reboot.png │ │ │ │ ├── restore.png │ │ │ │ ├── update.png │ │ │ │ └── update_log.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── action_help.png │ │ │ │ ├── action_protect.png │ │ │ │ ├── action_refresh.png │ │ │ │ ├── backup.png │ │ │ │ ├── change_ip.png │ │ │ │ ├── dns.png │ │ │ │ ├── exit.png │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_background.png │ │ │ │ ├── ic_launcher_foreground.png │ │ │ │ ├── ic_launcher_round.png │ │ │ │ ├── lack006.png │ │ │ │ ├── location.png │ │ │ │ ├── mark.png │ │ │ │ ├── reboot.png │ │ │ │ ├── restore.png │ │ │ │ ├── update.png │ │ │ │ └── update_log.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── action_help.png │ │ │ │ ├── action_protect.png │ │ │ │ ├── action_refresh.png │ │ │ │ ├── backup.png │ │ │ │ ├── change_ip.png │ │ │ │ ├── dns.png │ │ │ │ ├── exit.png │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_background.png │ │ │ │ ├── ic_launcher_foreground.png │ │ │ │ ├── ic_launcher_round.png │ │ │ │ ├── lack006.png │ │ │ │ ├── location.png │ │ │ │ ├── mark.png │ │ │ │ ├── reboot.png │ │ │ │ ├── restore.png │ │ │ │ ├── update.png │ │ │ │ └── update_log.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_background.png │ │ │ │ ├── ic_launcher_foreground.png │ │ │ │ ├── ic_launcher_round.png │ │ │ │ └── lack006.png │ │ │ │ ├── raw │ │ │ │ ├── jttqbcsmwxhxy │ │ │ │ └── lack006 │ │ │ │ ├── values-v21 │ │ │ │ └── styles.xml │ │ │ │ └── values │ │ │ │ ├── colors.xml │ │ │ │ ├── dimens.xml │ │ │ │ ├── drawables.xml │ │ │ │ ├── enableGoogleLoactionReportChooseArray.xml │ │ │ │ ├── ic_launcher_background.xml │ │ │ │ ├── strings.xml │ │ │ │ ├── styles.xml │ │ │ │ ├── update_log.xml │ │ │ │ ├── url.xml │ │ │ │ └── values.xml │ │ │ └── test │ │ │ └── java │ │ │ └── com │ │ │ └── lack006 │ │ │ └── hosts_l │ │ │ └── ExampleUnitTest.java │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle └── about.html ├── hosts_files ├── 2016_hosts │ ├── AD │ ├── AR_full │ ├── AR_map │ ├── RE_full │ ├── RE_map │ ├── clash │ └── version └── 2017_hosts │ ├── AD │ ├── AR_full │ ├── AR_map │ ├── RE_full │ ├── RE_map │ ├── clash │ └── version └── index.html /README.md: -------------------------------------------------------------------------------- 1 | Android-Hosts-L 2 | =============== 3 | 作者:lack006 4 | =============== 5 | 去广告 hosts 误杀\漏杀 软件广告 请在 [这里反馈](https://github.com/lack006/Android-Hosts-L/issues/2) 6 | =============== 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /apk/Android-Hosts-L.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lack006/Android-Hosts-L/6363bb672206c7f19d2974c32ab7cd20e24d476b/apk/Android-Hosts-L.apk -------------------------------------------------------------------------------- /apk/README.md: -------------------------------------------------------------------------------- 1 | 您即将下载最新版的 Android Hosts-L 2 | =============== 3 | [本地下载](https://github.com/lack006/Android-Hosts-L/releases) 4 | =============== 5 | 或 6 | =============== 7 | [Google Play](https://play.google.com/store/apps/details?id=com.lack006.hosts_l) 8 | =============== 9 | 10 | -------------------------------------------------------------------------------- /apk/history/V8.02.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lack006/Android-Hosts-L/6363bb672206c7f19d2974c32ab7cd20e24d476b/apk/history/V8.02.apk -------------------------------------------------------------------------------- /apk/history/V8.03.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lack006/Android-Hosts-L/6363bb672206c7f19d2974c32ab7cd20e24d476b/apk/history/V8.03.apk -------------------------------------------------------------------------------- /code/V6.00/Checkbusybox.java: -------------------------------------------------------------------------------- 1 | package com.lack006.hosts_l; 2 | 3 | import android.content.Context; 4 | import android.widget.Toast; 5 | 6 | import java.io.File; 7 | 8 | /** 9 | * Created by Lack006 on 2015/10/22. 10 | */ 11 | public class Checkbusybox { 12 | private static final String Busybox_xbin = "/system/xbin/busybox"; 13 | public static void checkbusybox(final Context context) { 14 | final File box1 = new File(Busybox_xbin); 15 | if (!box1.exists()) { 16 | Toast.makeText(context, R.string.need_busybox, Toast.LENGTH_LONG).show(); 17 | } 18 | 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /code/V6.00/Checkroot.java: -------------------------------------------------------------------------------- 1 | package com.lack006.hosts_l; 2 | 3 | import java.io.DataOutputStream; 4 | 5 | 6 | /** 7 | * Created by Lack006 on 2015/10/8. 8 | */ 9 | public class Checkroot { 10 | 11 | public static boolean RootCmd(String cmd) { 12 | Process process = null; 13 | DataOutputStream os = null; 14 | try { 15 | 16 | process = Runtime.getRuntime().exec("su"); 17 | 18 | os = new DataOutputStream(process.getOutputStream()); 19 | os.writeBytes(cmd + "\n"); 20 | os.writeBytes("exit\n"); 21 | os.flush(); 22 | process.waitFor(); 23 | 24 | 25 | } catch (Exception e) { 26 | 27 | 28 | return false; 29 | } finally { 30 | try { 31 | if (os != null) { 32 | 33 | os.close(); 34 | } 35 | assert process != null; 36 | process.destroy(); 37 | } catch (Exception ignored) { 38 | 39 | 40 | } 41 | } 42 | return true; 43 | 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /code/V6.00/RefreshDNS.java: -------------------------------------------------------------------------------- 1 | package com.lack006.hosts_l; 2 | 3 | import java.io.BufferedWriter; 4 | import java.io.File; 5 | import java.io.OutputStreamWriter; 6 | import java.io.PrintWriter; 7 | 8 | /** 9 | * Created by Lack006 on 2015/10/8. 10 | */ 11 | public class RefreshDNS { 12 | public static void RefreshDNS() { 13 | 14 | ProcessBuilder pb = new ProcessBuilder("/system/bin/sh"); 15 | pb.directory(new File("/"));// 设置shell的当前目录。 16 | try { 17 | Process proc = pb.start(); 18 | PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(proc.getOutputStream())), true); 19 | out.println("su"); 20 | out.println("export PATH=/data/data/com.lack006.hosts_l/files:/system/xbin:$PATH"); 21 | out.println("ndc resolver flushdefaultif"); 22 | out.println("ndc resolver flushif wlan0"); 23 | out.println("exit"); 24 | out.close(); 25 | proc.waitFor(); 26 | proc.destroy(); 27 | 28 | 29 | } catch (Exception ignored) { 30 | } 31 | 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /code/V6.00/Unzipbusybox.java: -------------------------------------------------------------------------------- 1 | package com.lack006.hosts_l; 2 | 3 | import android.content.Context; 4 | 5 | import java.io.File; 6 | import java.io.FileOutputStream; 7 | import java.io.InputStream; 8 | 9 | /** 10 | * Created by Lack006 on 2015/10/8. 11 | */ 12 | public class Unzipbusybox { 13 | 14 | public static void Unzipbusybox(Context context, InputStream is) { 15 | try { 16 | String DATABASE_FILENAME6 = "busybox"; 17 | File file = context.getFilesDir(); 18 | final String DATABASE_PATH = file.getAbsolutePath(); 19 | String databaseFilename = DATABASE_PATH + "/" + DATABASE_FILENAME6; 20 | File dir = new File(DATABASE_PATH); 21 | 22 | if (!dir.exists()) 23 | dir.mkdir(); 24 | 25 | if (!(new File(databaseFilename)).exists()) { 26 | 27 | 28 | FileOutputStream fos = new FileOutputStream( 29 | databaseFilename); 30 | byte[] buffer = new byte[8192]; 31 | int count; 32 | 33 | while ((count = is.read(buffer)) > 0) { 34 | fos.write(buffer, 0, count); 35 | } 36 | 37 | fos.close(); 38 | is.close(); 39 | 40 | } 41 | 42 | 43 | } catch (Exception ignored) { 44 | } 45 | 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /code/V6.00/Unzipdefault.java: -------------------------------------------------------------------------------- 1 | package com.lack006.hosts_l; 2 | 3 | import android.content.Context; 4 | import android.widget.Button; 5 | 6 | import java.io.File; 7 | import java.io.FileOutputStream; 8 | import java.io.InputStream; 9 | 10 | import static com.lack006.hosts_l.Copy.Copy_download2hosts; 11 | 12 | /** 13 | * Created by Lack006 on 2015/10/9. 14 | */ 15 | public class Unzipdefault { 16 | public static void UnzipDefault(Context context, InputStream is, Button btn_AD, Button btn_RE, Button btn_AR) { 17 | try { 18 | final String Default_hosts = "hosts"; 19 | File file = context.getFilesDir(); 20 | final String DATABASE_PATH = file.getAbsolutePath(); 21 | String databaseFilename = DATABASE_PATH + "/" + Default_hosts; 22 | File dir = new File(DATABASE_PATH); 23 | 24 | if (!dir.exists()) 25 | dir.mkdir(); 26 | 27 | if (!(new File(databaseFilename)).exists()) { 28 | 29 | 30 | FileOutputStream fos = new FileOutputStream( 31 | databaseFilename); 32 | byte[] buffer = new byte[8192]; 33 | int count; 34 | 35 | while ((count = is.read(buffer)) > 0) { 36 | fos.write(buffer, 0, count); 37 | } 38 | 39 | fos.close(); 40 | is.close(); 41 | 42 | } 43 | Copy_download2hosts(context, btn_AD, btn_RE, btn_AR); 44 | 45 | 46 | } catch (Exception ignored) { 47 | } 48 | 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /code/V6.10/Checkroot.java: -------------------------------------------------------------------------------- 1 | package com.lack006.hosts_l; 2 | 3 | import java.io.DataOutputStream; 4 | 5 | 6 | /** 7 | * Created by Lack006 on 2015/10/8. 8 | */ 9 | public class Checkroot { 10 | 11 | public static boolean RootCmd(String cmd) { 12 | Process process = null; 13 | DataOutputStream os = null; 14 | try { 15 | 16 | process = Runtime.getRuntime().exec("su"); 17 | 18 | os = new DataOutputStream(process.getOutputStream()); 19 | os.writeBytes(cmd + "\n"); 20 | os.writeBytes("exit\n"); 21 | os.flush(); 22 | process.waitFor(); 23 | 24 | 25 | } catch (Exception e) { 26 | 27 | 28 | return false; 29 | } finally { 30 | try { 31 | if (os != null) { 32 | 33 | os.close(); 34 | } 35 | assert process != null; 36 | process.destroy(); 37 | } catch (Exception ignored) { 38 | 39 | 40 | } 41 | } 42 | return true; 43 | 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /code/V6.10/Constants.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package com.lack006.hosts_l; 4 | 5 | public class Constants { 6 | 7 | 8 | public static final String HOSTS_FILENAME = "hosts"; 9 | public static final String BACKUP_FILENAME = "backup"; 10 | public static final String CHECK_FILENAME = "check"; 11 | public static final String BUSYBOX_FILENAME = "busybox"; 12 | public static final String FILE_SEPERATOR = System.getProperty("file.separator", "/"); 13 | 14 | public static final String COMMAND_CHOWN = "chown 0:0"; 15 | public static final String COMMAND_CHMOD_644 = "chmod 644"; 16 | 17 | public static final String COMMAND_CHMOD_755 = "chmod 755"; 18 | 19 | public static final String COMMAND_RM = "rm -f"; 20 | 21 | 22 | public static final String ANDROID_SYSTEM_PATH = System.getProperty("java.home", "/system"); 23 | public static final String ANDROID_SYSTEM_ETC_HOSTS = ANDROID_SYSTEM_PATH + FILE_SEPERATOR 24 | + "etc" + FILE_SEPERATOR + HOSTS_FILENAME; 25 | 26 | public static final String ANDROID_SYSTEM_XBIN = ANDROID_SYSTEM_PATH + FILE_SEPERATOR 27 | + "xbin" + FILE_SEPERATOR + BUSYBOX_FILENAME; 28 | public static final String ANDROID_DATA_DATA_HOSTS = FILE_SEPERATOR + "data" + FILE_SEPERATOR 29 | + "data" + FILE_SEPERATOR + HOSTS_FILENAME; 30 | public static final String ANDROID_DATA_HOSTS = FILE_SEPERATOR 31 | + "data" + FILE_SEPERATOR + HOSTS_FILENAME; 32 | 33 | 34 | public static final String Refresh_DNS_1 = "ndc resolver flushdefaultif"; 35 | public static final String Refresh_DNS_2 = "ndc resolver flushif wlan0"; 36 | } 37 | -------------------------------------------------------------------------------- /code/V6.10/Reboot.java: -------------------------------------------------------------------------------- 1 | package com.lack006.hosts_l; 2 | 3 | import android.content.DialogInterface; 4 | import android.support.v7.app.AlertDialog; 5 | 6 | import com.lack006.hosts_l.rootcommands.command.SimpleCommand; 7 | 8 | import java.io.BufferedWriter; 9 | import java.io.File; 10 | import java.io.OutputStreamWriter; 11 | import java.io.PrintWriter; 12 | 13 | /** 14 | * Created by Lack006 on 2015/10/9. 15 | */ 16 | public class Reboot { 17 | 18 | public static void Reboot_switch(final AlertDialog.Builder builder) { 19 | builder.setTitle(R.string.Reboot); 20 | builder.setMessage(R.string.Tip_reboot); 21 | builder.setPositiveButton(R.string.Cancel, new DialogInterface.OnClickListener() { 22 | public void onClick(DialogInterface dialog, int whichButton) { 23 | 24 | } 25 | }); 26 | builder.setNegativeButton(R.string.Reboot_simple, new DialogInterface.OnClickListener() { 27 | public void onClick(DialogInterface dialog, int whichButton) { 28 | 29 | Reboot(); 30 | 31 | } 32 | }); 33 | builder.setNeutralButton(R.string.Reboot_quick, new DialogInterface.OnClickListener() { 34 | public void onClick(DialogInterface dialog, int whichButton) { 35 | 36 | Reboot_quit(); 37 | 38 | 39 | } 40 | }); 41 | 42 | builder.create().show(); 43 | } 44 | 45 | public static void Reboot() { 46 | 47 | 48 | try { 49 | com.lack006.hosts_l.rootcommands.Shell rootShell = null; 50 | rootShell = com.lack006.hosts_l.rootcommands.Shell.startRootShell(); 51 | 52 | 53 | SimpleCommand command = new SimpleCommand("reboot"); 54 | rootShell.add(command).waitForFinish(); 55 | 56 | 57 | } catch (Exception ignored) { 58 | } 59 | 60 | } 61 | 62 | public static void Reboot_quit() { 63 | 64 | try { 65 | com.lack006.hosts_l.rootcommands.Shell rootShell = null; 66 | rootShell = com.lack006.hosts_l.rootcommands.Shell.startRootShell(); 67 | 68 | 69 | SimpleCommand command = new SimpleCommand("killall system_server"); 70 | rootShell.add(command).waitForFinish(); 71 | 72 | 73 | } catch (Exception ignored) { 74 | } 75 | 76 | 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /code/V6.10/RefreshDNS.java: -------------------------------------------------------------------------------- 1 | package com.lack006.hosts_l; 2 | 3 | import com.lack006.hosts_l.rootcommands.Shell; 4 | import com.lack006.hosts_l.rootcommands.command.SimpleCommand; 5 | 6 | /** 7 | * Created by Lack006 on 2015/10/8. 8 | */ 9 | public class RefreshDNS { 10 | public static void RefreshDNS() { 11 | 12 | try { 13 | Shell rootShell = null; 14 | rootShell = Shell.startRootShell(); 15 | SimpleCommand command = new SimpleCommand(Constants.Refresh_DNS_1); 16 | rootShell.add(command).waitForFinish(); 17 | command = new SimpleCommand(Constants.Refresh_DNS_2); 18 | rootShell.add(command).waitForFinish(); 19 | 20 | 21 | } catch (Exception ignored) { 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /code/V6.10/Unzipbusybox.java: -------------------------------------------------------------------------------- 1 | package com.lack006.hosts_l; 2 | 3 | import android.content.Context; 4 | 5 | import java.io.File; 6 | import java.io.FileOutputStream; 7 | import java.io.InputStream; 8 | 9 | /** 10 | * Created by Lack006 on 2015/10/8. 11 | */ 12 | public class Unzipbusybox { 13 | 14 | public static void Unzipbusybox(Context context, InputStream is) { 15 | try { 16 | String DATABASE_FILENAME6 = "busybox"; 17 | File file = context.getFilesDir(); 18 | final String DATABASE_PATH = file.getAbsolutePath(); 19 | String databaseFilename = DATABASE_PATH + "/" + DATABASE_FILENAME6; 20 | File dir = new File(DATABASE_PATH); 21 | 22 | if (!dir.exists()) 23 | dir.mkdir(); 24 | 25 | if (!(new File(databaseFilename)).exists()) { 26 | 27 | 28 | FileOutputStream fos = new FileOutputStream( 29 | databaseFilename); 30 | byte[] buffer = new byte[8192]; 31 | int count; 32 | 33 | while ((count = is.read(buffer)) > 0) { 34 | fos.write(buffer, 0, count); 35 | } 36 | 37 | fos.close(); 38 | is.close(); 39 | 40 | } 41 | 42 | 43 | } catch (Exception ignored) { 44 | } 45 | 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /code/V6.10/Unzipdefault.java: -------------------------------------------------------------------------------- 1 | package com.lack006.hosts_l; 2 | 3 | import android.content.Context; 4 | import android.widget.Button; 5 | 6 | import java.io.File; 7 | import java.io.FileOutputStream; 8 | import java.io.InputStream; 9 | 10 | import static com.lack006.hosts_l.Copy.Copy_download2hosts; 11 | 12 | /** 13 | * Created by Lack006 on 2015/10/9. 14 | */ 15 | public class Unzipdefault { 16 | public static void UnzipDefault(Context context, InputStream is, Button btn_AD, Button btn_RE, Button btn_AR) { 17 | try { 18 | final String Default_hosts = "hosts"; 19 | File file = context.getFilesDir(); 20 | final String DATABASE_PATH = file.getAbsolutePath(); 21 | String databaseFilename = DATABASE_PATH + "/" + Default_hosts; 22 | File dir = new File(DATABASE_PATH); 23 | 24 | if (!dir.exists()) 25 | dir.mkdir(); 26 | 27 | if (!(new File(databaseFilename)).exists()) { 28 | 29 | 30 | FileOutputStream fos = new FileOutputStream( 31 | databaseFilename); 32 | byte[] buffer = new byte[8192]; 33 | int count; 34 | 35 | while ((count = is.read(buffer)) > 0) { 36 | fos.write(buffer, 0, count); 37 | } 38 | 39 | fos.close(); 40 | is.close(); 41 | 42 | } 43 | Copy_download2hosts(context, btn_AD, btn_RE, btn_AR); 44 | 45 | 46 | } catch (Exception ignored) { 47 | } 48 | 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /code/V6.10/rootcommands/Mount.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 Dominik Schürmann 3 | * Copyright (c) 2012 Stephen Erickson, Chris Ravenscroft, Adam Shanks (RootTools) 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.lack006.hosts_l.rootcommands; 19 | 20 | import java.io.File; 21 | import java.util.Arrays; 22 | import java.util.HashSet; 23 | import java.util.Set; 24 | 25 | public class Mount { 26 | protected final File mDevice; 27 | protected final File mMountPoint; 28 | protected final String mType; 29 | protected final Set mFlags; 30 | 31 | Mount(File device, File path, String type, String flagsStr) { 32 | mDevice = device; 33 | mMountPoint = path; 34 | mType = type; 35 | mFlags = new HashSet(Arrays.asList(flagsStr.split(","))); 36 | } 37 | 38 | public File getDevice() { 39 | return mDevice; 40 | } 41 | 42 | public File getMountPoint() { 43 | return mMountPoint; 44 | } 45 | 46 | public String getType() { 47 | return mType; 48 | } 49 | 50 | public Set getFlags() { 51 | return mFlags; 52 | } 53 | 54 | @Override 55 | public String toString() { 56 | return String.format("%s on %s type %s %s", mDevice, mMountPoint, mType, mFlags); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /code/V6.10/rootcommands/RootCommands.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 Dominik Schürmann 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.lack006.hosts_l.rootcommands; 18 | 19 | import com.lack006.hosts_l.rootcommands.util.Log; 20 | 21 | public class RootCommands { 22 | public static boolean DEBUG = false; 23 | public static int DEFAULT_TIMEOUT = 50000; 24 | 25 | public static final String TAG = "RootCommands"; 26 | 27 | /** 28 | * General method to check if user has su binary and accepts root access for this program! 29 | * 30 | * @return true if everything worked 31 | */ 32 | public static boolean rootAccessGiven() { 33 | boolean rootAccess = false; 34 | 35 | try { 36 | Shell rootShell = Shell.startRootShell(); 37 | 38 | Toolbox tb = new Toolbox(rootShell); 39 | if (tb.isRootAccessGiven()) { 40 | rootAccess = true; 41 | } 42 | 43 | rootShell.close(); 44 | } catch (Exception e) { 45 | Log.e(TAG, "Problem while checking for root access!", e); 46 | } 47 | 48 | return rootAccess; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /code/V6.10/rootcommands/command/ExecutableCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 Dominik Schürmann 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.lack006.hosts_l.rootcommands.command; 18 | 19 | import java.io.File; 20 | 21 | import android.annotation.SuppressLint; 22 | import android.content.Context; 23 | import android.os.Build; 24 | 25 | public abstract class ExecutableCommand extends Command { 26 | public static final String EXECUTABLE_PREFIX = "lib"; 27 | public static final String EXECUTABLE_SUFFIX = "_exec.so"; 28 | 29 | /** 30 | * This class provides a way to use your own binaries! 31 | * 32 | * Include your own executables, renamed from * to lib*_exec.so, in your libs folder under the 33 | * architecture directories. Now they will be deployed by Android the same way libraries are 34 | * deployed! 35 | * 36 | * See README for more information how to use your own executables! 37 | * 38 | * @param context 39 | * @param executableName 40 | * @param parameters 41 | */ 42 | public ExecutableCommand(Context context, String executableName, String parameters) { 43 | super(getLibDirectory(context) + File.separator + EXECUTABLE_PREFIX + executableName 44 | + EXECUTABLE_SUFFIX + " " + parameters); 45 | } 46 | 47 | /** 48 | * Get full path to lib directory of app 49 | * 50 | * @return dir as String 51 | */ 52 | @SuppressLint("NewApi") 53 | private static String getLibDirectory(Context context) { 54 | if (Build.VERSION.SDK_INT >= 9) { 55 | return context.getApplicationInfo().nativeLibraryDir; 56 | } else { 57 | return context.getApplicationInfo().dataDir + File.separator + "lib"; 58 | } 59 | } 60 | 61 | public abstract void output(int id, String line); 62 | 63 | public abstract void afterExecution(int id, int exitCode); 64 | 65 | } -------------------------------------------------------------------------------- /code/V6.10/rootcommands/command/SimpleCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 Dominik Schürmann 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.lack006.hosts_l.rootcommands.command; 18 | 19 | public class SimpleCommand extends Command { 20 | private StringBuilder sb = new StringBuilder(); 21 | 22 | public SimpleCommand(String... command) { 23 | super(command); 24 | } 25 | 26 | @Override 27 | public void output(int id, String line) { 28 | sb.append(line).append('\n'); 29 | } 30 | 31 | @Override 32 | public void afterExecution(int id, int exitCode) { 33 | } 34 | 35 | public String getOutput() { 36 | return sb.toString(); 37 | } 38 | 39 | public int getExitCode() { 40 | return exitCode; 41 | } 42 | 43 | } -------------------------------------------------------------------------------- /code/V6.10/rootcommands/command/SimpleExecutableCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 Dominik Schürmann 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.lack006.hosts_l.rootcommands.command; 18 | 19 | import android.content.Context; 20 | 21 | public class SimpleExecutableCommand extends ExecutableCommand { 22 | private StringBuilder sb = new StringBuilder(); 23 | 24 | public SimpleExecutableCommand(Context context, String executableName, String parameters) { 25 | super(context, executableName, parameters); 26 | } 27 | 28 | @Override 29 | public void output(int id, String line) { 30 | sb.append(line).append('\n'); 31 | } 32 | 33 | @Override 34 | public void afterExecution(int id, int exitCode) { 35 | } 36 | 37 | public String getOutput() { 38 | return sb.toString(); 39 | } 40 | 41 | public int getExitCode() { 42 | return exitCode; 43 | } 44 | 45 | } -------------------------------------------------------------------------------- /code/V6.10/rootcommands/util/BrokenBusyboxException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 Dominik Schürmann 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.lack006.hosts_l.rootcommands.util; 18 | 19 | import java.io.IOException; 20 | 21 | public class BrokenBusyboxException extends IOException { 22 | private static final long serialVersionUID = 8337358201589488409L; 23 | 24 | public BrokenBusyboxException() { 25 | super(); 26 | } 27 | 28 | public BrokenBusyboxException(String detailMessage) { 29 | super(detailMessage); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /code/V6.10/rootcommands/util/RootAccessDeniedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 Dominik Schürmann 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.lack006.hosts_l.rootcommands.util; 18 | 19 | import java.io.IOException; 20 | 21 | public class RootAccessDeniedException extends IOException { 22 | private static final long serialVersionUID = 9088998884166225540L; 23 | 24 | public RootAccessDeniedException() { 25 | super(); 26 | } 27 | 28 | public RootAccessDeniedException(String detailMessage) { 29 | super(detailMessage); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /code/V6.10/rootcommands/util/UnsupportedArchitectureException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 Dominik Schürmann 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.lack006.hosts_l.rootcommands.util; 18 | 19 | public class UnsupportedArchitectureException extends Exception { 20 | private static final long serialVersionUID = 7826528799780001655L; 21 | 22 | public UnsupportedArchitectureException() { 23 | super(); 24 | } 25 | 26 | public UnsupportedArchitectureException(String detailMessage) { 27 | super(detailMessage); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /code/V6.23/Checkroot.java: -------------------------------------------------------------------------------- 1 | package com.lack006.hosts_l; 2 | 3 | import java.io.DataOutputStream; 4 | 5 | 6 | /** 7 | * Created by Lack006 on 2015/10/8. 8 | */ 9 | public class Checkroot { 10 | 11 | public static boolean RootCmd(String cmd) { 12 | Process process = null; 13 | DataOutputStream os = null; 14 | try { 15 | 16 | process = Runtime.getRuntime().exec("su"); 17 | 18 | os = new DataOutputStream(process.getOutputStream()); 19 | os.writeBytes(cmd + "\n"); 20 | os.writeBytes("exit\n"); 21 | os.flush(); 22 | process.waitFor(); 23 | 24 | 25 | } catch (Exception e) { 26 | 27 | 28 | return false; 29 | } finally { 30 | try { 31 | if (os != null) { 32 | 33 | os.close(); 34 | } 35 | assert process != null; 36 | process.destroy(); 37 | } catch (Exception ignored) { 38 | 39 | 40 | } 41 | } 42 | return true; 43 | 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /code/V6.23/Constants.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package com.lack006.hosts_l; 4 | 5 | public class Constants { 6 | 7 | 8 | public static final String HOSTS_FILENAME = "hosts"; 9 | public static final String BACKUP_FILENAME = "backup"; 10 | public static final String CHECK_FILENAME = "check"; 11 | public static final String BUSYBOX_FILENAME = "busybox"; 12 | public static final String FILE_SEPERATOR = System.getProperty("file.separator", "/"); 13 | 14 | public static final String COMMAND_CHOWN = "chown 0:0"; 15 | public static final String COMMAND_CHMOD_644 = "chmod 644"; 16 | 17 | public static final String COMMAND_CHMOD_755 = "chmod 755"; 18 | 19 | public static final String COMMAND_RM = "rm -f"; 20 | 21 | 22 | public static final String ANDROID_SYSTEM_PATH = System.getProperty("java.home", "/system"); 23 | public static final String ANDROID_SYSTEM_ETC_HOSTS = ANDROID_SYSTEM_PATH + FILE_SEPERATOR 24 | + "etc" + FILE_SEPERATOR + HOSTS_FILENAME; 25 | 26 | public static final String ANDROID_SYSTEM_XBIN = ANDROID_SYSTEM_PATH + FILE_SEPERATOR 27 | + "xbin" + FILE_SEPERATOR + BUSYBOX_FILENAME; 28 | public static final String ANDROID_DATA_DATA_HOSTS = FILE_SEPERATOR + "data" + FILE_SEPERATOR 29 | + "data" + FILE_SEPERATOR + HOSTS_FILENAME; 30 | public static final String ANDROID_DATA_HOSTS = FILE_SEPERATOR 31 | + "data" + FILE_SEPERATOR + HOSTS_FILENAME; 32 | 33 | 34 | public static final String Refresh_DNS_1 = "ndc resolver flushdefaultif"; 35 | public static final String Refresh_DNS_2 = "ndc resolver flushif wlan0"; 36 | public static final String Remove_mark = "settings put global captive_portal_server 1.lack00006.applinzi.com"; 37 | public static final String Default_mark = "settings delete global captive_portal_server"; 38 | public static final String Enable_Google_Loaction = "setprop gsm.sim.operator.numeric 310030"; 39 | } 40 | -------------------------------------------------------------------------------- /code/V6.23/Reboot.java: -------------------------------------------------------------------------------- 1 | package com.lack006.hosts_l; 2 | 3 | import android.content.DialogInterface; 4 | import android.support.v7.app.AlertDialog; 5 | 6 | import com.lack006.hosts_l.rootcommands.command.SimpleCommand; 7 | 8 | import java.io.BufferedWriter; 9 | import java.io.File; 10 | import java.io.OutputStreamWriter; 11 | import java.io.PrintWriter; 12 | 13 | /** 14 | * Created by Lack006 on 2015/10/9. 15 | */ 16 | public class Reboot { 17 | 18 | public static void Reboot_switch(final AlertDialog.Builder builder) { 19 | builder.setTitle(R.string.Reboot); 20 | builder.setMessage(R.string.Tip_reboot); 21 | builder.setPositiveButton(R.string.Cancel, new DialogInterface.OnClickListener() { 22 | public void onClick(DialogInterface dialog, int whichButton) { 23 | 24 | } 25 | }); 26 | builder.setNegativeButton(R.string.Reboot_simple, new DialogInterface.OnClickListener() { 27 | public void onClick(DialogInterface dialog, int whichButton) { 28 | 29 | Reboot(); 30 | 31 | } 32 | }); 33 | builder.setNeutralButton(R.string.Reboot_quick, new DialogInterface.OnClickListener() { 34 | public void onClick(DialogInterface dialog, int whichButton) { 35 | 36 | Reboot_quit(); 37 | 38 | 39 | } 40 | }); 41 | 42 | builder.create().show(); 43 | } 44 | 45 | public static void Reboot() { 46 | 47 | 48 | try { 49 | com.lack006.hosts_l.rootcommands.Shell rootShell = null; 50 | rootShell = com.lack006.hosts_l.rootcommands.Shell.startRootShell(); 51 | 52 | 53 | SimpleCommand command = new SimpleCommand("reboot"); 54 | rootShell.add(command).waitForFinish(); 55 | 56 | 57 | } catch (Exception ignored) { 58 | } 59 | 60 | } 61 | 62 | public static void Reboot_quit() { 63 | 64 | try { 65 | com.lack006.hosts_l.rootcommands.Shell rootShell = null; 66 | rootShell = com.lack006.hosts_l.rootcommands.Shell.startRootShell(); 67 | 68 | 69 | SimpleCommand command = new SimpleCommand("killall system_server"); 70 | rootShell.add(command).waitForFinish(); 71 | 72 | 73 | } catch (Exception ignored) { 74 | } 75 | 76 | 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /code/V6.23/RefreshDNS.java: -------------------------------------------------------------------------------- 1 | package com.lack006.hosts_l; 2 | 3 | import com.lack006.hosts_l.rootcommands.Shell; 4 | import com.lack006.hosts_l.rootcommands.command.SimpleCommand; 5 | 6 | /** 7 | * Created by Lack006 on 2015/10/8. 8 | */ 9 | public class RefreshDNS { 10 | public static void RefreshDNS() { 11 | 12 | try { 13 | Shell rootShell = null; 14 | rootShell = Shell.startRootShell(); 15 | SimpleCommand command = new SimpleCommand(Constants.Refresh_DNS_1); 16 | rootShell.add(command).waitForFinish(); 17 | command = new SimpleCommand(Constants.Refresh_DNS_2); 18 | rootShell.add(command).waitForFinish(); 19 | 20 | 21 | } catch (Exception ignored) { 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /code/V6.23/Unzipbusybox.java: -------------------------------------------------------------------------------- 1 | package com.lack006.hosts_l; 2 | 3 | import android.content.Context; 4 | 5 | import java.io.File; 6 | import java.io.FileOutputStream; 7 | import java.io.InputStream; 8 | 9 | /** 10 | * Created by Lack006 on 2015/10/8. 11 | */ 12 | public class Unzipbusybox { 13 | 14 | public static void Unzipbusybox(Context context, InputStream is) { 15 | try { 16 | String DATABASE_FILENAME6 = "busybox"; 17 | File file = context.getFilesDir(); 18 | final String DATABASE_PATH = file.getAbsolutePath(); 19 | String databaseFilename = DATABASE_PATH + "/" + DATABASE_FILENAME6; 20 | File dir = new File(DATABASE_PATH); 21 | 22 | if (!dir.exists()) 23 | dir.mkdir(); 24 | 25 | if (!(new File(databaseFilename)).exists()) { 26 | 27 | 28 | FileOutputStream fos = new FileOutputStream( 29 | databaseFilename); 30 | byte[] buffer = new byte[8192]; 31 | int count; 32 | 33 | while ((count = is.read(buffer)) > 0) { 34 | fos.write(buffer, 0, count); 35 | } 36 | 37 | fos.close(); 38 | is.close(); 39 | 40 | } 41 | 42 | 43 | } catch (Exception ignored) { 44 | } 45 | 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /code/V6.23/Unzipdefault.java: -------------------------------------------------------------------------------- 1 | package com.lack006.hosts_l; 2 | 3 | import android.content.Context; 4 | import android.widget.Button; 5 | 6 | import java.io.File; 7 | import java.io.FileOutputStream; 8 | import java.io.InputStream; 9 | 10 | import static com.lack006.hosts_l.Copy.Copy_download2hosts; 11 | 12 | /** 13 | * Created by Lack006 on 2015/10/9. 14 | */ 15 | public class Unzipdefault { 16 | public static void UnzipDefault(Context context, InputStream is, Button btn_AD, Button btn_RE, Button btn_AR) { 17 | try { 18 | final String Default_hosts = "hosts"; 19 | File file = context.getFilesDir(); 20 | final String DATABASE_PATH = file.getAbsolutePath(); 21 | String databaseFilename = DATABASE_PATH + "/" + Default_hosts; 22 | File dir = new File(DATABASE_PATH); 23 | 24 | if (!dir.exists()) 25 | dir.mkdir(); 26 | 27 | if (!(new File(databaseFilename)).exists()) { 28 | 29 | 30 | FileOutputStream fos = new FileOutputStream( 31 | databaseFilename); 32 | byte[] buffer = new byte[8192]; 33 | int count; 34 | 35 | while ((count = is.read(buffer)) > 0) { 36 | fos.write(buffer, 0, count); 37 | } 38 | 39 | fos.close(); 40 | is.close(); 41 | 42 | } 43 | Copy_download2hosts(context, btn_AD, btn_RE, btn_AR); 44 | 45 | 46 | } catch (Exception ignored) { 47 | } 48 | 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /code/V6.23/enablegooglelocation/EnableGoogleLocation.java: -------------------------------------------------------------------------------- 1 | package com.lack006.hosts_l.enablegooglelocation; 2 | 3 | import android.content.BroadcastReceiver; 4 | import android.content.Context; 5 | import android.content.ContextWrapper; 6 | import android.content.Intent; 7 | import android.content.SharedPreferences; 8 | 9 | import com.lack006.hosts_l.R; 10 | 11 | /** 12 | * Created by Lack006 on 2016/1/20. 13 | */ 14 | public class EnableGoogleLocation extends BroadcastReceiver { 15 | public EnableGoogleLocation() { 16 | } 17 | 18 | 19 | public void onReceive(Context context, Intent intent) { 20 | SharedPreferences mPreferences; 21 | mPreferences = context.getSharedPreferences(context.getString(R.string.Config_file), 22 | ContextWrapper.MODE_PRIVATE); 23 | int Z = mPreferences.getInt(context.getString(R.string.Config_file_AutoStart),0); 24 | if (Z==1){ 25 | EnableShell.enableshell(context); 26 | } 27 | 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /code/V6.23/enablegooglelocation/EnableShell.java: -------------------------------------------------------------------------------- 1 | package com.lack006.hosts_l.enablegooglelocation; 2 | 3 | import android.content.Context; 4 | import android.widget.Toast; 5 | 6 | import com.lack006.hosts_l.Constants; 7 | import com.lack006.hosts_l.R; 8 | import com.lack006.hosts_l.rootcommands.command.SimpleCommand; 9 | 10 | /** 11 | * Created by Lack006 on 2016/1/20. 12 | */ 13 | public class EnableShell { 14 | public static void enableshell(Context context) { 15 | try { 16 | com.lack006.hosts_l.rootcommands.Shell rootShell; 17 | rootShell = com.lack006.hosts_l.rootcommands.Shell.startRootShell(); 18 | SimpleCommand command = new SimpleCommand(Constants.Enable_Google_Loaction); 19 | rootShell.add(command).waitForFinish(); 20 | Toast.makeText(context, R.string.Enable_Location, Toast.LENGTH_SHORT).show(); 21 | 22 | 23 | } catch (Exception ignored) { 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /code/V6.23/permission/AskPermission.java: -------------------------------------------------------------------------------- 1 | package com.lack006.hosts_l.permission; 2 | 3 | /** 4 | * Created by Lack006 on 2016/1/20. 5 | */ 6 | public class AskPermission { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /code/V6.23/rootcommands/Mount.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 Dominik Schürmann 3 | * Copyright (c) 2012 Stephen Erickson, Chris Ravenscroft, Adam Shanks (RootTools) 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.lack006.hosts_l.rootcommands; 19 | 20 | import java.io.File; 21 | import java.util.Arrays; 22 | import java.util.HashSet; 23 | import java.util.Set; 24 | 25 | public class Mount { 26 | protected final File mDevice; 27 | protected final File mMountPoint; 28 | protected final String mType; 29 | protected final Set mFlags; 30 | 31 | Mount(File device, File path, String type, String flagsStr) { 32 | mDevice = device; 33 | mMountPoint = path; 34 | mType = type; 35 | mFlags = new HashSet(Arrays.asList(flagsStr.split(","))); 36 | } 37 | 38 | public File getDevice() { 39 | return mDevice; 40 | } 41 | 42 | public File getMountPoint() { 43 | return mMountPoint; 44 | } 45 | 46 | public String getType() { 47 | return mType; 48 | } 49 | 50 | public Set getFlags() { 51 | return mFlags; 52 | } 53 | 54 | @Override 55 | public String toString() { 56 | return String.format("%s on %s type %s %s", mDevice, mMountPoint, mType, mFlags); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /code/V6.23/rootcommands/RootCommands.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 Dominik Schürmann 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.lack006.hosts_l.rootcommands; 18 | 19 | import com.lack006.hosts_l.rootcommands.util.Log; 20 | 21 | public class RootCommands { 22 | public static boolean DEBUG = false; 23 | public static int DEFAULT_TIMEOUT = 50000; 24 | 25 | public static final String TAG = "RootCommands"; 26 | 27 | /** 28 | * General method to check if user has su binary and accepts root access for this program! 29 | * 30 | * @return true if everything worked 31 | */ 32 | public static boolean rootAccessGiven() { 33 | boolean rootAccess = false; 34 | 35 | try { 36 | Shell rootShell = Shell.startRootShell(); 37 | 38 | Toolbox tb = new Toolbox(rootShell); 39 | if (tb.isRootAccessGiven()) { 40 | rootAccess = true; 41 | } 42 | 43 | rootShell.close(); 44 | } catch (Exception e) { 45 | Log.e(TAG, "Problem while checking for root access!", e); 46 | } 47 | 48 | return rootAccess; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /code/V6.23/rootcommands/command/ExecutableCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 Dominik Schürmann 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.lack006.hosts_l.rootcommands.command; 18 | 19 | import java.io.File; 20 | 21 | import android.annotation.SuppressLint; 22 | import android.content.Context; 23 | import android.os.Build; 24 | 25 | public abstract class ExecutableCommand extends Command { 26 | public static final String EXECUTABLE_PREFIX = "lib"; 27 | public static final String EXECUTABLE_SUFFIX = "_exec.so"; 28 | 29 | /** 30 | * This class provides a way to use your own binaries! 31 | * 32 | * Include your own executables, renamed from * to lib*_exec.so, in your libs folder under the 33 | * architecture directories. Now they will be deployed by Android the same way libraries are 34 | * deployed! 35 | * 36 | * See README for more information how to use your own executables! 37 | * 38 | * @param context 39 | * @param executableName 40 | * @param parameters 41 | */ 42 | public ExecutableCommand(Context context, String executableName, String parameters) { 43 | super(getLibDirectory(context) + File.separator + EXECUTABLE_PREFIX + executableName 44 | + EXECUTABLE_SUFFIX + " " + parameters); 45 | } 46 | 47 | /** 48 | * Get full path to lib directory of app 49 | * 50 | * @return dir as String 51 | */ 52 | @SuppressLint("NewApi") 53 | private static String getLibDirectory(Context context) { 54 | if (Build.VERSION.SDK_INT >= 9) { 55 | return context.getApplicationInfo().nativeLibraryDir; 56 | } else { 57 | return context.getApplicationInfo().dataDir + File.separator + "lib"; 58 | } 59 | } 60 | 61 | public abstract void output(int id, String line); 62 | 63 | public abstract void afterExecution(int id, int exitCode); 64 | 65 | } -------------------------------------------------------------------------------- /code/V6.23/rootcommands/command/SimpleCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 Dominik Schürmann 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.lack006.hosts_l.rootcommands.command; 18 | 19 | public class SimpleCommand extends Command { 20 | private StringBuilder sb = new StringBuilder(); 21 | 22 | public SimpleCommand(String... command) { 23 | super(command); 24 | } 25 | 26 | @Override 27 | public void output(int id, String line) { 28 | sb.append(line).append('\n'); 29 | } 30 | 31 | @Override 32 | public void afterExecution(int id, int exitCode) { 33 | } 34 | 35 | public String getOutput() { 36 | return sb.toString(); 37 | } 38 | 39 | public int getExitCode() { 40 | return exitCode; 41 | } 42 | 43 | } -------------------------------------------------------------------------------- /code/V6.23/rootcommands/command/SimpleExecutableCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 Dominik Schürmann 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.lack006.hosts_l.rootcommands.command; 18 | 19 | import android.content.Context; 20 | 21 | public class SimpleExecutableCommand extends ExecutableCommand { 22 | private StringBuilder sb = new StringBuilder(); 23 | 24 | public SimpleExecutableCommand(Context context, String executableName, String parameters) { 25 | super(context, executableName, parameters); 26 | } 27 | 28 | @Override 29 | public void output(int id, String line) { 30 | sb.append(line).append('\n'); 31 | } 32 | 33 | @Override 34 | public void afterExecution(int id, int exitCode) { 35 | } 36 | 37 | public String getOutput() { 38 | return sb.toString(); 39 | } 40 | 41 | public int getExitCode() { 42 | return exitCode; 43 | } 44 | 45 | } -------------------------------------------------------------------------------- /code/V6.23/rootcommands/util/BrokenBusyboxException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 Dominik Schürmann 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.lack006.hosts_l.rootcommands.util; 18 | 19 | import java.io.IOException; 20 | 21 | public class BrokenBusyboxException extends IOException { 22 | private static final long serialVersionUID = 8337358201589488409L; 23 | 24 | public BrokenBusyboxException() { 25 | super(); 26 | } 27 | 28 | public BrokenBusyboxException(String detailMessage) { 29 | super(detailMessage); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /code/V6.23/rootcommands/util/RootAccessDeniedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 Dominik Schürmann 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.lack006.hosts_l.rootcommands.util; 18 | 19 | import java.io.IOException; 20 | 21 | public class RootAccessDeniedException extends IOException { 22 | private static final long serialVersionUID = 9088998884166225540L; 23 | 24 | public RootAccessDeniedException() { 25 | super(); 26 | } 27 | 28 | public RootAccessDeniedException(String detailMessage) { 29 | super(detailMessage); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /code/V6.23/rootcommands/util/UnsupportedArchitectureException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 Dominik Schürmann 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.lack006.hosts_l.rootcommands.util; 18 | 19 | public class UnsupportedArchitectureException extends Exception { 20 | private static final long serialVersionUID = 7826528799780001655L; 21 | 22 | public UnsupportedArchitectureException() { 23 | super(); 24 | } 25 | 26 | public UnsupportedArchitectureException(String detailMessage) { 27 | super(detailMessage); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /code/V7.00/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /code/V7.00/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | -------------------------------------------------------------------------------- /code/V7.00/.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /code/V7.00/.idea/dictionaries/lack.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | applinzi 5 | clearnetdns 6 | flushdefaultif 7 | flushif 8 | flushnet 9 | github 10 | killall 11 | setprop 12 | 13 | 14 | -------------------------------------------------------------------------------- /code/V7.00/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /code/V7.00/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | -------------------------------------------------------------------------------- /code/V7.00/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /code/V7.00/.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /code/V7.00/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /code/V7.00/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 25 5 | buildToolsVersion "24.0.3" 6 | 7 | defaultConfig { 8 | applicationId "com.lack006.hosts_l" 9 | minSdkVersion 14 10 | targetSdkVersion 25 11 | versionCode 64 12 | versionName "7.02" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | testCompile 'junit:junit:4.12' 25 | compile 'com.android.support:appcompat-v7:23.2.0' 26 | compile 'com.android.support:design:23.2.0' 27 | compile 'eu.chainfire:libsuperuser:1.0.0.201608240809' 28 | } 29 | -------------------------------------------------------------------------------- /code/V7.00/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in D:\Android-sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /code/V7.00/app/src/androidTest/java/com/lack006/hosts_l/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.lack006.hosts_l; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /code/V7.00/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 16 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /code/V7.00/app/src/main/java/com/lack006/hosts_l/About/MarketHelper.java: -------------------------------------------------------------------------------- 1 | package com.lack006.hosts_l.About; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.net.Uri; 6 | 7 | import com.lack006.hosts_l.Consistent.Consistent; 8 | 9 | /** 10 | * Created by lack on 2016/12/11. 11 | * AndroidHosts-LV7 12 | */ 13 | 14 | public class MarketHelper { 15 | public void openApplicationMarket(Context context) { 16 | // Toast.makeText(context, context.getString(R.string.market_hint), Toast.LENGTH_LONG).show(); 17 | if (Consistent.PLAY_VERSION) { 18 | Intent intent = new Intent(Intent.ACTION_VIEW); 19 | String uri = Consistent.MARKET_URI + context.getPackageName(); 20 | intent.setData(Uri.parse(uri)); 21 | context.startActivity(intent); 22 | } else { 23 | openLinkBySystem(context); 24 | } 25 | 26 | } 27 | 28 | private void openLinkBySystem(Context context) { 29 | String url = Consistent.PROJECT_URL; 30 | Intent intent = new Intent(Intent.ACTION_VIEW); 31 | intent.setData(Uri.parse(url)); 32 | context.startActivity(intent); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /code/V7.00/app/src/main/java/com/lack006/hosts_l/CheckVersion/NetHelper.java: -------------------------------------------------------------------------------- 1 | package com.lack006.hosts_l.CheckVersion; 2 | 3 | import android.content.Context; 4 | import android.net.ConnectivityManager; 5 | import android.net.NetworkInfo; 6 | 7 | /** 8 | * Created by lack006 on 2016/10/3. 9 | * AndroidHosts-LV7 10 | */ 11 | 12 | public class NetHelper { 13 | 14 | public static boolean isNetworkConnected(Context context) { 15 | ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); 16 | NetworkInfo ni = cm.getActiveNetworkInfo(); 17 | return ni != null && ni.isConnectedOrConnecting(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /code/V7.00/app/src/main/java/com/lack006/hosts_l/Clash/GetClashHelper.java: -------------------------------------------------------------------------------- 1 | package com.lack006.hosts_l.Clash; 2 | 3 | import android.content.Context; 4 | 5 | import com.lack006.hosts_l.Consistent.Consistent; 6 | 7 | import java.io.BufferedReader; 8 | import java.io.File; 9 | import java.io.FileReader; 10 | import java.util.HashMap; 11 | import java.util.Map; 12 | 13 | import static com.lack006.hosts_l.Consistent.Consistent.CLASH_SPLIT; 14 | 15 | /** 16 | * Created by lack on 2016/12/3. 17 | * AndroidHosts-LV7 18 | */ 19 | 20 | public class GetClashHelper { 21 | public Map getClash(Context context) { 22 | Map clashMap = new HashMap<>(); 23 | String[] text; 24 | String[] hosts; 25 | String arrayString[]; 26 | File file = context.getCacheDir(); 27 | final String CACHE_PATH = file.getAbsolutePath(); 28 | try { 29 | 30 | BufferedReader in; 31 | in = new BufferedReader(new FileReader(CACHE_PATH + Consistent.CLASH_FILE)); 32 | String lineText; 33 | int count = 0; 34 | while ((in.readLine()) != null) { 35 | count++; 36 | } 37 | text = new String[count]; 38 | hosts = new String[count]; 39 | 40 | count = 0; 41 | in.close(); 42 | in = new BufferedReader(new FileReader(CACHE_PATH + Consistent.CLASH_FILE)); 43 | while ((lineText = in.readLine()) != null) { 44 | 45 | arrayString = lineText.split(CLASH_SPLIT); 46 | text[count] = arrayString[0].replace(";", "\n"); 47 | hosts[count] = arrayString[1].replace(";", "\n"); 48 | count++; 49 | 50 | 51 | } 52 | in.close(); 53 | clashMap.put(text, hosts); 54 | 55 | } catch (Exception e) { 56 | e.printStackTrace(); 57 | } 58 | 59 | 60 | return clashMap; 61 | 62 | } 63 | } 64 | 65 | -------------------------------------------------------------------------------- /code/V7.00/app/src/main/java/com/lack006/hosts_l/Consistent/ConsistentHtml.java: -------------------------------------------------------------------------------- 1 | package com.lack006.hosts_l.Consistent; 2 | 3 | /** 4 | * Created by lack on 2016/12/11. 5 | * AndroidHosts-LV7 6 | */ 7 | 8 | public class ConsistentHtml { 9 | public final static String EXPLANATION_HTML = "

\n" + 10 | "\u3000\u3000这是一个以修改 Android 手机内置 hosts 文件为主功能,集“快速替换重定向 IP”、 “去除网络图标符号”、“激活谷歌位置报告”和“自动修改 DNS 服务器”等子功能于一体的软件。\n" + 11 | "

\n" + 12 | "

\n" + 13 | "\u3000\u3000本软件包含一个“广播接收器”(用于“激活谷歌位置报告”)与两个“服务”(用于“自动修改 DNS 服务器”),若希望正常使用以上两个功能请不要禁用他们。\n" + 14 | "

\n" + 15 | "

\n" + 16 | "开源地址:Github\n" + 17 | "

\n" + 18 | "

\n" + 19 | "代码参考:\n" + 20 | "

\n" + 21 | "

\n" + 22 | "LocationReportEnabler\n" + 23 | "

\n" + 24 | "

\n" + 25 | "关于 android 5.0 网络图标上的感叹号及其解决办法\n" + 26 | "

\n" + 27 | "

\n" + 28 | "DNSSetter\n" + 29 | "

\n" + 30 | "

\n" + 31 | "第三方库:libsuperuser\n" + 32 | "

\n" + 33 | "

\n" + 34 | "Open Source Licenses:GPL V3\n" + 35 | "

"; 36 | } 37 | -------------------------------------------------------------------------------- /code/V7.00/app/src/main/java/com/lack006/hosts_l/Copy/CopyHelper.java: -------------------------------------------------------------------------------- 1 | package com.lack006.hosts_l.Copy; 2 | 3 | import java.io.File; 4 | import java.io.FileInputStream; 5 | import java.io.FileOutputStream; 6 | import java.io.InputStream; 7 | 8 | /** 9 | * Created by lack on 2016/12/7. 10 | * AndroidHosts-LV7 11 | */ 12 | 13 | public class CopyHelper { 14 | public boolean copyFile(String oldPath, String newPath) { 15 | boolean completeFlag = false; 16 | try { 17 | int byteRead; 18 | File oldFile = new File(oldPath); 19 | if (oldFile.exists()) { //文件存在时 20 | InputStream inStream = new FileInputStream(oldPath); //读入原文件 21 | FileOutputStream fs = new FileOutputStream(newPath); 22 | byte[] buffer = new byte[1024]; 23 | while ((byteRead = inStream.read(buffer)) != -1) { 24 | fs.write(buffer, 0, byteRead); 25 | } 26 | fs.flush(); 27 | fs.close(); 28 | inStream.close(); 29 | completeFlag = true; 30 | } 31 | } catch (Exception e) { 32 | e.printStackTrace(); 33 | } 34 | return completeFlag; 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /code/V7.00/app/src/main/java/com/lack006/hosts_l/DNS/ChangeDNSReceiver.java: -------------------------------------------------------------------------------- 1 | package com.lack006.hosts_l.DNS; 2 | 3 | import android.content.BroadcastReceiver; 4 | import android.content.Context; 5 | import android.content.Intent; 6 | import android.net.ConnectivityManager; 7 | import android.net.NetworkInfo; 8 | 9 | /** 10 | * Created by lack on 2016/12/10. 11 | * AndroidHosts-LV7 12 | */ 13 | 14 | public class ChangeDNSReceiver extends BroadcastReceiver { 15 | @Override 16 | public void onReceive(Context context, Intent intent) { 17 | 18 | ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); 19 | 20 | NetworkInfo mActiveNetInfo = connectivityManager.getActiveNetworkInfo(); 21 | if (mActiveNetInfo != null) { 22 | Intent startIntent = new Intent(context, DNSShellService.class); 23 | context.startService(startIntent); 24 | } 25 | 26 | 27 | } 28 | 29 | 30 | } 31 | 32 | -------------------------------------------------------------------------------- /code/V7.00/app/src/main/java/com/lack006/hosts_l/DNS/ChangeDNSService.java: -------------------------------------------------------------------------------- 1 | package com.lack006.hosts_l.DNS; 2 | 3 | import android.app.Service; 4 | import android.content.Intent; 5 | import android.content.IntentFilter; 6 | import android.os.IBinder; 7 | 8 | import com.lack006.hosts_l.Consistent.Consistent; 9 | 10 | /** 11 | * Created by lack on 2016/12/10. 12 | * AndroidHosts-LV7 13 | */ 14 | 15 | public class ChangeDNSService extends Service { 16 | private ChangeDNSReceiver mChangeDNSReceiver; 17 | 18 | @Override 19 | public void onCreate() { 20 | super.onCreate(); 21 | } 22 | 23 | @Override 24 | public int onStartCommand(Intent intent, int flags, int startId) { 25 | IntentFilter intentFilter; 26 | intentFilter = new IntentFilter(); 27 | intentFilter.addAction(Consistent.NETWORK_CONNECT_CHANGE_ACTION); 28 | intentFilter.setPriority(Integer.MAX_VALUE); 29 | mChangeDNSReceiver = new ChangeDNSReceiver(); 30 | registerReceiver(mChangeDNSReceiver, intentFilter); 31 | 32 | 33 | return super.onStartCommand(intent, flags, startId); 34 | } 35 | 36 | 37 | @Override 38 | public IBinder onBind(Intent intent) { 39 | return null; 40 | } 41 | 42 | 43 | @Override 44 | public void onDestroy() { 45 | IntentFilter intentFilter; 46 | intentFilter = new IntentFilter(); 47 | intentFilter.addAction(Consistent.NETWORK_CONNECT_CHANGE_ACTION); 48 | intentFilter.setPriority(Integer.MAX_VALUE); 49 | 50 | try { 51 | unregisterReceiver(mChangeDNSReceiver); 52 | } catch (Exception ignored) { 53 | 54 | } 55 | 56 | super.onDestroy(); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /code/V7.00/app/src/main/java/com/lack006/hosts_l/DNS/DNSShellService.java: -------------------------------------------------------------------------------- 1 | package com.lack006.hosts_l.DNS; 2 | 3 | import android.app.Service; 4 | import android.content.Context; 5 | import android.content.Intent; 6 | import android.os.AsyncTask; 7 | import android.os.IBinder; 8 | 9 | /** 10 | * Created by lack on 2016/12/11. 11 | * AndroidHosts-LV7 12 | */ 13 | 14 | public class DNSShellService extends Service { 15 | private Context mContext = null; 16 | 17 | @Override 18 | public void onCreate() { 19 | super.onCreate(); 20 | DNSShellTask dnsShellTask = new DNSShellTask(); 21 | dnsShellTask.execute(); 22 | mContext = this; 23 | 24 | } 25 | 26 | @Override 27 | public int onStartCommand(Intent intent, int flags, int startId) { 28 | 29 | return super.onStartCommand(intent, flags, startId); 30 | } 31 | 32 | @Override 33 | public IBinder onBind(Intent intent) { 34 | return null; 35 | } 36 | 37 | @Override 38 | public void onDestroy() { 39 | super.onDestroy(); 40 | } 41 | 42 | private class DNSShellTask extends AsyncTask { 43 | 44 | 45 | @Override 46 | protected Boolean doInBackground(Object... objects) { 47 | ChangeDNSTaskHelper changeDNSTaskHelper = new ChangeDNSTaskHelper(); 48 | changeDNSTaskHelper.changeDNSShell(changeDNSTaskHelper.getLocalNetworkInterfaceName(), mContext); 49 | 50 | 51 | return null; 52 | } 53 | 54 | @Override 55 | protected void onPostExecute(Boolean result) { 56 | stopSelf(); 57 | 58 | } 59 | 60 | 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /code/V7.00/app/src/main/java/com/lack006/hosts_l/DNS/RefreshDNSTaskHelper.java: -------------------------------------------------------------------------------- 1 | package com.lack006.hosts_l.DNS; 2 | 3 | /** 4 | * Created by lack on 2016/11/19. 5 | * AndroidHosts-LV7 6 | * 新版本 Android 系统失效 7 | */ 8 | 9 | public class RefreshDNSTaskHelper { 10 | 11 | 12 | // public static class RefreshDNSTask extends AsyncTask { 13 | // private ProgressDialog mProgressDialog = null; 14 | // private Context mContext = null; 15 | // private List mCmdResult = null; 16 | 17 | // void refreshDNS(Context context) { 18 | // mProgressDialog = new ProgressDialog(mContext); 19 | // mProgressDialog.setMessage(getString(R.string.refreshing_dns)); 20 | // mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); 21 | // mProgressDialog.setIndeterminate(true); 22 | // mProgressDialog.setCancelable(false); 23 | // mProgressDialog.show(); 24 | // mRefreshDNSTask = new RefreshDNSTaskHelper.RefreshDNSTask(); 25 | // mRefreshDNSTask.execute(mContext, mProgressDialog); 26 | // } 27 | // 28 | // 29 | // @Override 30 | // protected Boolean doInBackground(Object... objects) { 31 | // mContext = (Context) objects[0]; 32 | // mProgressDialog = (ProgressDialog) objects[1]; 33 | // 34 | // mCmdResult = Shell.SU.run(new String[]{ 35 | // ConsistentCommands.REFRESH_DNS_COMMAND_1, 36 | // ConsistentCommands.REFRESH_DNS_COMMAND_2 37 | // }); 38 | // return null; 39 | // } 40 | // 41 | // @Override 42 | // protected void onPostExecute(Boolean result) { 43 | // StringBuilder errorLog = (new StringBuilder()); 44 | // mProgressDialog.cancel(); 45 | // if (mCmdResult != null) { 46 | // for (String line : mCmdResult) { 47 | // errorLog.append(line).append((char) 10); 48 | // } 49 | // Toast.makeText(mContext, mContext.getString(R.string.refresh_dns_error) + errorLog.toString(), Toast.LENGTH_LONG).show(); 50 | // } else { 51 | // Toast.makeText(mContext, R.string.refresh_dns_success, Toast.LENGTH_SHORT).show(); 52 | // } 53 | // 54 | // } 55 | // 56 | // 57 | // } 58 | } 59 | -------------------------------------------------------------------------------- /code/V7.00/app/src/main/java/com/lack006/hosts_l/Delay/DelayHelper.java: -------------------------------------------------------------------------------- 1 | package com.lack006.hosts_l.Delay; 2 | 3 | import android.support.design.widget.Snackbar; 4 | 5 | import java.util.Timer; 6 | import java.util.TimerTask; 7 | 8 | /** 9 | * Created by lack006 on 2016/9/17. 10 | * AndroidHosts-LV7 11 | */ 12 | public class DelayHelper { 13 | public static void snackBarShowDelay(final Snackbar snackbar) { 14 | Timer timer = new Timer(); 15 | TimerTask task = new TimerTask() { 16 | @Override 17 | public void run() { 18 | snackbar.show(); 19 | } 20 | }; 21 | timer.schedule(task, 500); 22 | } 23 | 24 | 25 | } 26 | -------------------------------------------------------------------------------- /code/V7.00/app/src/main/java/com/lack006/hosts_l/GoogleLocation/GoogleLocationEnableReceiver.java: -------------------------------------------------------------------------------- 1 | package com.lack006.hosts_l.GoogleLocation; 2 | 3 | import android.content.BroadcastReceiver; 4 | import android.content.Context; 5 | import android.content.Intent; 6 | import android.content.SharedPreferences; 7 | 8 | import com.lack006.hosts_l.Consistent.Consistent; 9 | import com.lack006.hosts_l.DNS.ChangeDNSService; 10 | 11 | /** 12 | * Created by lack on 2016/12/9. 13 | * AndroidHosts-LV7 14 | */ 15 | 16 | public class GoogleLocationEnableReceiver extends BroadcastReceiver { 17 | @Override 18 | public void onReceive(Context context, Intent intent) { 19 | SharedPreferences sharedPreferences = context.getSharedPreferences(Consistent.SHARED_PREFERENCES_FILE, Context.MODE_PRIVATE); 20 | if (sharedPreferences.getBoolean(Consistent.SHARED_PREFERENCES_ENABLE_LOCAL, false)) { 21 | GoogleLocationReportTaskHelper googleLocationReportTaskHelper = new GoogleLocationReportTaskHelper(); 22 | googleLocationReportTaskHelper.enableGoogleLocalShell(); 23 | } 24 | if (sharedPreferences.getBoolean(Consistent.SHARED_PREFERENCES_ENABLE_DNS, false)) { 25 | Intent startIntent = new Intent(context, ChangeDNSService.class); 26 | context.startService(startIntent); 27 | } 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /code/V7.00/app/src/main/java/com/lack006/hosts_l/Helper/ObjectAnimatorHelper.java: -------------------------------------------------------------------------------- 1 | package com.lack006.hosts_l.Helper; 2 | 3 | import android.animation.ObjectAnimator; 4 | import android.animation.PropertyValuesHolder; 5 | import android.view.View; 6 | import android.view.animation.LinearInterpolator; 7 | 8 | /** 9 | * Created by lack006 on 2016/9/17. 10 | * AndroidHosts-LV7 11 | */ 12 | public class ObjectAnimatorHelper { 13 | public static void ShowView(View view, int duration, int times) { 14 | view.setRotation(0); 15 | PropertyValuesHolder propertyValuesHolder = PropertyValuesHolder.ofFloat(View.ROTATION, 180); 16 | ObjectAnimator objectAnimator = ObjectAnimator.ofPropertyValuesHolder(view, propertyValuesHolder); 17 | objectAnimator.setRepeatCount(times); 18 | objectAnimator.setDuration(duration); 19 | objectAnimator.setInterpolator(new LinearInterpolator()); 20 | objectAnimator.start(); 21 | 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /code/V7.00/app/src/main/java/com/lack006/hosts_l/Helper/SnackBarHelper.java: -------------------------------------------------------------------------------- 1 | package com.lack006.hosts_l.Helper; 2 | 3 | import android.support.design.widget.Snackbar; 4 | import android.view.View; 5 | 6 | import com.lack006.hosts_l.Delay.DelayHelper; 7 | import com.lack006.hosts_l.R; 8 | 9 | /** 10 | * Created by lack006 on 2016/9/17. 11 | * AndroidHosts-LV7 12 | */ 13 | public class SnackBarHelper { 14 | public static Snackbar showSnackBar(Snackbar snackbar, View view, String text) { 15 | if (null != snackbar && snackbar.isShown()) { 16 | snackbar.dismiss(); 17 | } 18 | snackbar = Snackbar.make(view, text, Snackbar.LENGTH_LONG); 19 | snackbar.setAction(R.string.confirm, new View.OnClickListener() { 20 | @Override 21 | public void onClick(View v) { 22 | 23 | } 24 | }); 25 | DelayHelper.snackBarShowDelay(snackbar); 26 | return snackbar; 27 | } 28 | 29 | public static Snackbar showSnackBar(Snackbar snackbar, View view, int resId) { 30 | if (null != snackbar && snackbar.isShown()) { 31 | snackbar.dismiss(); 32 | } 33 | snackbar = Snackbar.make(view, resId, Snackbar.LENGTH_INDEFINITE); 34 | snackbar.setAction(R.string.confirm, new View.OnClickListener() { 35 | @Override 36 | public void onClick(View v) { 37 | 38 | } 39 | }); 40 | DelayHelper.snackBarShowDelay(snackbar); 41 | return snackbar; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /code/V7.00/app/src/main/java/com/lack006/hosts_l/Helper/SuShellReturnHelper.java: -------------------------------------------------------------------------------- 1 | package com.lack006.hosts_l.Helper; 2 | 3 | import java.util.List; 4 | 5 | import eu.chainfire.libsuperuser.Shell; 6 | 7 | /** 8 | * Created by lack on 2016/12/4. 9 | * AndroidHosts-LV7 10 | */ 11 | 12 | public class SuShellReturnHelper { 13 | /** 14 | * @param commands shell commands 15 | * @return all shell output 16 | */ 17 | public List run(String[] commands) { 18 | return Shell.run("su", commands, null, true); 19 | } 20 | 21 | public List run(List listCmd) { 22 | int size = listCmd.size(); 23 | String[] commands = new String[size]; 24 | for (int i = 0; i < listCmd.size(); i++) { 25 | commands[i] = listCmd.get(i); 26 | } 27 | return Shell.run("su", commands, null, true); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /code/V7.00/app/src/main/java/com/lack006/hosts_l/Reboot/RebootHelper.java: -------------------------------------------------------------------------------- 1 | package com.lack006.hosts_l.Reboot; 2 | 3 | import android.app.AlertDialog; 4 | import android.content.Context; 5 | import android.content.DialogInterface; 6 | 7 | import com.lack006.hosts_l.Consistent.ConsistentCommands; 8 | import com.lack006.hosts_l.Helper.SuShellReturnHelper; 9 | import com.lack006.hosts_l.R; 10 | 11 | /** 12 | * Created by lack on 2016/12/11. 13 | * AndroidHosts-LV7 14 | */ 15 | 16 | public class RebootHelper { 17 | private boolean mIsHotReboot = false; 18 | 19 | public void reboot(Context context) { 20 | AlertDialog.Builder dialog = new AlertDialog.Builder(context); 21 | dialog.setTitle(R.string.reboot_title); 22 | dialog.setMessage(R.string.reboot_msg); 23 | dialog.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { 24 | @Override 25 | public void onClick(DialogInterface dialog, int which) { 26 | } 27 | }); 28 | dialog.setPositiveButton(R.string.reboot, new DialogInterface.OnClickListener() { 29 | public void onClick(DialogInterface dialog, int whichButton) { 30 | mIsHotReboot = false; 31 | reboot(); 32 | } 33 | }); 34 | dialog.setNeutralButton(R.string.hot_reboot, new DialogInterface.OnClickListener() { 35 | public void onClick(DialogInterface dialog, int whichButton) { 36 | mIsHotReboot = true; 37 | reboot(); 38 | } 39 | }); 40 | 41 | dialog.create().show(); 42 | } 43 | 44 | private void reboot() { 45 | SuShellReturnHelper suShellReturnHelper = new SuShellReturnHelper(); 46 | 47 | if (mIsHotReboot) { 48 | suShellReturnHelper.run(new String[]{ 49 | ConsistentCommands.HOT_REBOOT 50 | }); 51 | } else { 52 | suShellReturnHelper.run(new String[]{ 53 | ConsistentCommands.REBOOT 54 | }); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/drawable-v21/ic_menu_camera.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 12 | 13 | -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/drawable-v21/ic_menu_gallery.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/drawable-v21/ic_menu_manage.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/drawable-v21/ic_menu_send.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/drawable-v21/ic_menu_share.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/drawable-v21/ic_menu_slideshow.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/drawable/side_nav_bar.xml: -------------------------------------------------------------------------------- 1 | 3 | 9 | -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/layout/about_dialog_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 15 | 16 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/layout/app_bar_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 15 | 16 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/layout/change_dns_dialog_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 19 | 20 | 24 | 25 | 34 | 35 | 36 | 40 | 41 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/layout/change_ip_dialog_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 19 | 20 | 21 | 25 | 26 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/layout/nav_header_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 20 | 21 | 27 | 28 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/menu/activity_main_drawer.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 10 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 26 | 27 | 31 | 35 | 39 | 43 | 44 | 45 | 46 | 47 | 51 | 55 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/menu/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 10 | 11 | -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/mipmap-hdpi/action_help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lack006/Android-Hosts-L/6363bb672206c7f19d2974c32ab7cd20e24d476b/code/V7.00/app/src/main/res/mipmap-hdpi/action_help.png -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/mipmap-hdpi/action_refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lack006/Android-Hosts-L/6363bb672206c7f19d2974c32ab7cd20e24d476b/code/V7.00/app/src/main/res/mipmap-hdpi/action_refresh.png -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lack006/Android-Hosts-L/6363bb672206c7f19d2974c32ab7cd20e24d476b/code/V7.00/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/mipmap-hdpi/lack006.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lack006/Android-Hosts-L/6363bb672206c7f19d2974c32ab7cd20e24d476b/code/V7.00/app/src/main/res/mipmap-hdpi/lack006.png -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/mipmap-mdpi/action_help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lack006/Android-Hosts-L/6363bb672206c7f19d2974c32ab7cd20e24d476b/code/V7.00/app/src/main/res/mipmap-mdpi/action_help.png -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/mipmap-mdpi/action_refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lack006/Android-Hosts-L/6363bb672206c7f19d2974c32ab7cd20e24d476b/code/V7.00/app/src/main/res/mipmap-mdpi/action_refresh.png -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lack006/Android-Hosts-L/6363bb672206c7f19d2974c32ab7cd20e24d476b/code/V7.00/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/mipmap-mdpi/lack006.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lack006/Android-Hosts-L/6363bb672206c7f19d2974c32ab7cd20e24d476b/code/V7.00/app/src/main/res/mipmap-mdpi/lack006.png -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/mipmap-xhdpi/action_help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lack006/Android-Hosts-L/6363bb672206c7f19d2974c32ab7cd20e24d476b/code/V7.00/app/src/main/res/mipmap-xhdpi/action_help.png -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/mipmap-xhdpi/action_refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lack006/Android-Hosts-L/6363bb672206c7f19d2974c32ab7cd20e24d476b/code/V7.00/app/src/main/res/mipmap-xhdpi/action_refresh.png -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lack006/Android-Hosts-L/6363bb672206c7f19d2974c32ab7cd20e24d476b/code/V7.00/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/mipmap-xhdpi/lack006.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lack006/Android-Hosts-L/6363bb672206c7f19d2974c32ab7cd20e24d476b/code/V7.00/app/src/main/res/mipmap-xhdpi/lack006.png -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/mipmap-xxhdpi/action_help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lack006/Android-Hosts-L/6363bb672206c7f19d2974c32ab7cd20e24d476b/code/V7.00/app/src/main/res/mipmap-xxhdpi/action_help.png -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/mipmap-xxhdpi/action_refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lack006/Android-Hosts-L/6363bb672206c7f19d2974c32ab7cd20e24d476b/code/V7.00/app/src/main/res/mipmap-xxhdpi/action_refresh.png -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lack006/Android-Hosts-L/6363bb672206c7f19d2974c32ab7cd20e24d476b/code/V7.00/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/mipmap-xxhdpi/lack006.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lack006/Android-Hosts-L/6363bb672206c7f19d2974c32ab7cd20e24d476b/code/V7.00/app/src/main/res/mipmap-xxhdpi/lack006.png -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/mipmap-xxxhdpi/action_help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lack006/Android-Hosts-L/6363bb672206c7f19d2974c32ab7cd20e24d476b/code/V7.00/app/src/main/res/mipmap-xxxhdpi/action_help.png -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/mipmap-xxxhdpi/action_refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lack006/Android-Hosts-L/6363bb672206c7f19d2974c32ab7cd20e24d476b/code/V7.00/app/src/main/res/mipmap-xxxhdpi/action_refresh.png -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lack006/Android-Hosts-L/6363bb672206c7f19d2974c32ab7cd20e24d476b/code/V7.00/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/mipmap-xxxhdpi/lack006.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lack006/Android-Hosts-L/6363bb672206c7f19d2974c32ab7cd20e24d476b/code/V7.00/app/src/main/res/mipmap-xxxhdpi/lack006.png -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/raw/jttqbcsmwxhxy: -------------------------------------------------------------------------------- 1 | 127.0.0.1 localhost 2 | ::1 localhost -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/raw/lack006: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lack006/Android-Hosts-L/6363bb672206c7f19d2974c32ab7cd20e24d476b/code/V7.00/app/src/main/res/raw/lack006 -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #673ab7 4 | #512da8 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 160dp 5 | 6 | 16dp 7 | 16dp 8 | 16dp 9 | 10 | -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/values/drawables.xml: -------------------------------------------------------------------------------- 1 | 2 | @android:drawable/ic_menu_camera 3 | @android:drawable/ic_menu_gallery 4 | @android:drawable/ic_menu_slideshow 5 | @android:drawable/ic_menu_manage 6 | @android:drawable/ic_menu_share 7 | @android:drawable/ic_menu_send 8 | 9 | -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/values/enableGoogleLoactionReportChooseArray.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 清除 Play Service 数据 5 | 清除 Google Maps 数据 6 | 立即重启 7 | 8 | -------------------------------------------------------------------------------- /code/V7.00/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 15 | 16 | 8 | 9 | 15 | 16 | -------------------------------------------------------------------------------- /code/V8.00/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3f51b5 4 | #303F9F 5 | #FF4081 6 | #4070ff 7 | 8 | -------------------------------------------------------------------------------- /code/V8.00/app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 160dp 5 | 6 | 16dp 7 | 16dp 8 | 16dp 9 | 10 | -------------------------------------------------------------------------------- /code/V8.00/app/src/main/res/values/drawables.xml: -------------------------------------------------------------------------------- 1 | 2 | @android:drawable/ic_menu_camera 3 | @android:drawable/ic_menu_gallery 4 | @android:drawable/ic_menu_slideshow 5 | @android:drawable/ic_menu_manage 6 | @android:drawable/ic_menu_share 7 | @android:drawable/ic_menu_send 8 | 9 | -------------------------------------------------------------------------------- /code/V8.00/app/src/main/res/values/enableGoogleLoactionReportChooseArray.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 清除 Play Service 数据 5 | 清除 Google Maps 数据 6 | 立即重启 7 | 8 | -------------------------------------------------------------------------------- /code/V8.00/app/src/main/res/values/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFFFFF 4 | -------------------------------------------------------------------------------- /code/V8.00/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 15 | 16 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /code/V8.00/app/src/main/res/values/url.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | https://raw.githubusercontent.com/lack006/Android-Hosts-L/master/hosts_files/2017_hosts/version 4 | https://raw.githubusercontent.com/lack006/Android-Hosts-L/master/hosts_files/2017_hosts/clash 5 | https://raw.githubusercontent.com/lack006/Android-Hosts-L/master/hosts_files/2017_hosts/AD 6 | https://raw.githubusercontent.com/lack006/Android-Hosts-L/master/hosts_files/2017_hosts/RE_full 7 | https://raw.githubusercontent.com/lack006/Android-Hosts-L/master/hosts_files/2017_hosts/RE_map 8 | https://raw.githubusercontent.com/lack006/Android-Hosts-L/master/hosts_files/2017_hosts/AR_full 9 | https://raw.githubusercontent.com/lack006/Android-Hosts-L/master/hosts_files/2017_hosts/AR_map 10 | -------------------------------------------------------------------------------- /code/V8.00/app/src/main/res/values/values.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #c45b5b 4 | -------------------------------------------------------------------------------- /code/V8.00/app/src/test/java/com/lack006/hosts_l/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.lack006.hosts_l; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /code/V8.00/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | 5 | repositories { 6 | google() 7 | jcenter() 8 | } 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:3.2.1' 11 | 12 | 13 | // NOTE: Do not place your application dependencies here; they belong 14 | // in the individual module build.gradle files 15 | } 16 | } 17 | 18 | allprojects { 19 | repositories { 20 | google() 21 | jcenter() 22 | } 23 | } 24 | 25 | task clean(type: Delete) { 26 | delete rootProject.buildDir 27 | } 28 | -------------------------------------------------------------------------------- /code/V8.00/gradle.properties: -------------------------------------------------------------------------------- 1 | ## Project-wide Gradle settings. 2 | # 3 | # For more details on how to configure your build environment visit 4 | # http://www.gradle.org/docs/current/userguide/build_environment.html 5 | # 6 | # Specifies the JVM arguments used for the daemon process. 7 | # The setting is particularly useful for tweaking memory settings. 8 | # Default value: -Xmx1024m -XX:MaxPermSize=256m 9 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 10 | # 11 | # When configured, Gradle will run in incubating parallel mode. 12 | # This option should only be used with decoupled projects. More details, visit 13 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 14 | # org.gradle.parallel=true 15 | #Mon Dec 04 21:25:21 CST 2017 16 | systemProp.http.proxyHost=127.0.0.1 17 | org.gradle.jvmargs=-Xmx1536m 18 | systemProp.http.proxyPort=1080 19 | -------------------------------------------------------------------------------- /code/V8.00/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lack006/Android-Hosts-L/6363bb672206c7f19d2974c32ab7cd20e24d476b/code/V8.00/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /code/V8.00/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Dec 19 21:37:44 CST 2018 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip 7 | -------------------------------------------------------------------------------- /code/V8.00/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /code/about.html: -------------------------------------------------------------------------------- 1 |

2 | Android Hosts-L V7.00 3 |

4 |

5 | 这是一个以修改 Android 手机内置 hosts 文件为主功能,集“快速替换重定向 IP”、 “去除网络图标符号”、“激活谷歌位置报告”和“自动修改 DNS 服务器”等子功能于一体的软件。 6 |

7 |

8 | 本软件包含一个“广播接收器”(用于“激活谷歌位置报告”)与两个“服务”(用于“自动修改 DNS 服务器”),若希望正常使用以上两个功能请不要禁用他们。 9 |

10 |

11 | 开源地址:Github 12 |

13 |

14 | 代码参考:LocationReportEnabler关于 android 5.0 网络图标上的感叹号及其解决办法DNSSetter 15 |

16 |

17 | 第三方库: libsuperuser 18 |

19 |

20 | Open Source Licenses: GPL V3 21 |

-------------------------------------------------------------------------------- /hosts_files/2016_hosts/RE_map: -------------------------------------------------------------------------------- 1 | #V201701010000RE 2 | #作者lack006_CN 3 | #转载请留下此行,谢谢 4 | ######################请注意 !###################### 5 | # Android hosts 文件 默认换行符为 LF! 6 | # 本文档默认编码为 UTF-8! 7 | 8 | ##############PAY ATTENTION PLEASE !################# 9 | # Android hosts default line break is LF! 10 | # This hosts default encoding is UTF-8! 11 | 12 | 127.0.0.1 localhost 13 | ::1 localhost 14 | 127.0.0.1 Lack006-PC 15 | #Google Map START 16 | #1 17 | #219.76.4.11 android.clients.google.com 18 | #2 19 | 219.76.4.11 clients1.google.com 20 | 219.76.4.11 clients2.google.com 21 | 219.76.4.11 clients3.google.com 22 | 219.76.4.11 clients4.google.com 23 | 219.76.4.11 clients5.google.com 24 | 219.76.4.11 clients6.google.com 25 | 219.76.4.11 clients7.google.com 26 | #3 27 | #219.76.4.11 clients1.googleusercontent.com 28 | #219.76.4.11 clients2.googleusercontent.com 29 | #219.76.4.11 clients3.googleusercontent.com 30 | #219.76.4.11 clients4.googleusercontent.com 31 | #219.76.4.11 clients5.googleusercontent.com 32 | #219.76.4.11 clients6.googleusercontent.com 33 | #219.76.4.11 clients7.googleusercontent.com 34 | #219.76.4.11 lh0.googleusercontent.com 35 | #219.76.4.11 lh1.googleusercontent.com 36 | #219.76.4.11 lh2.googleusercontent.com 37 | #219.76.4.11 lh3.googleusercontent.com 38 | #219.76.4.11 lh4.googleusercontent.com 39 | #219.76.4.11 lh5.googleusercontent.com 40 | #219.76.4.11 lh6.googleusercontent.com 41 | #4 42 | 219.76.4.11 geo0.ggpht.com 43 | 219.76.4.11 geo1.ggpht.com 44 | 219.76.4.11 geo2.ggpht.com 45 | 219.76.4.11 geo3.ggpht.com 46 | 219.76.4.11 geo4.ggpht.com 47 | 219.76.4.11 geo5.ggpht.com 48 | 219.76.4.11 geo6.ggpht.com 49 | 219.76.4.11 gm0.ggpht.com 50 | 219.76.4.11 gm1.ggpht.com 51 | 219.76.4.11 gm2.ggpht.com 52 | 219.76.4.11 gm3.ggpht.com 53 | 219.76.4.11 gm4.ggpht.com 54 | #5 55 | 219.76.4.11 lh1.ggpht.com 56 | 219.76.4.11 lh2.ggpht.com 57 | 219.76.4.11 lh3.ggpht.com 58 | 219.76.4.11 lh4.ggpht.com 59 | 219.76.4.11 lh5.ggpht.com 60 | 219.76.4.11 lh6.ggpht.com 61 | 219.76.4.11 lh0.ggpht.com 62 | #Google Map END -------------------------------------------------------------------------------- /hosts_files/2016_hosts/clash: -------------------------------------------------------------------------------- 1 | tb1.bdstatic.com;(能够去除百度贴吧类客户端的广告与后台下载,但可能严重影响电脑版百度贴吧网页的浏览):;#tieba start;127.0.0.1 tb1.bdstatic.com;#tieba end 2 | au.umeng.*;(可能会影响一些软件更新如:bilibili客户端):;#umeng start;127.0.0.1 au.umeng.co;127.0.0.1 au.umeng.com;#umeng end 3 | 0591.mygolbs.com;(会导致掌上公交福州区域无法正常使用):;#mybus start;127.0.0.1 0591.mygolbs.com;#mybus end 4 | api.mofang.com;(会导致无法使用某些游戏中的“加加”模块):;#jiajia start;127.0.0.1 api.mofang.com;127.0.0.1 spapi.i-moible.co.jp;#jiajia end 5 | nj.bs.baidu.com;(会导致百度的某些“不正常”软件的正常下载):;#nj start;127.0.0.1 nj.bs.baidu.com;#nj end 6 | *.map.baidu.com;(保证百度普通定位服务以及地图功能的前提下,屏蔽百度高精度定位以及数据上传):;#baidu map start;127.0.0.1 api.map.baidu.com;127.0.0.1 ps.map.baidu.com;127.0.0.1 sv.map.baidu.com;127.0.0.1 offnavi.map.baidu.com;127.0.0.1 newvector.map.baidu.com;127.0.0.1 ulog.imap.baidu.com;127.0.0.1 newloc.map.n.shifen.com;#baidu map end 7 | mclick.simba.taobao.com;(会导致淘宝链接跳转失败):;#simba.taobao start;127.0.0.1 mclick.simba.taobao.com;#simba.taobao end -------------------------------------------------------------------------------- /hosts_files/2016_hosts/version: -------------------------------------------------------------------------------- 1 | V201701010000AD 2 | V201701010000RE 3 | V201701010000AR 4 | 52061471 5 | 更新:旧版本已停止维护,请尽快更新到最新版本! -------------------------------------------------------------------------------- /hosts_files/2017_hosts/RE_map: -------------------------------------------------------------------------------- 1 | #V201710112348RE 2 | #lack006 3 | ######################请注意 !###################### 4 | # Android hosts 文件 默认换行符为 LF! 5 | # 本文档默认编码为 UTF-8! 6 | 7 | ##############PAY ATTENTION PLEASE !################# 8 | # The default line break of Android hosts is LF! 9 | # The default encoding of hosts is UTF-8! 10 | 11 | 127.0.0.1 localhost 12 | ::1 localhost 13 | #Google Map START 14 | #1 15 | #223.197.123.2 android.clients.google.com 16 | #2 17 | 223.197.123.2 clients1.google.com 18 | 223.197.123.2 clients2.google.com 19 | 223.197.123.2 clients3.google.com 20 | 223.197.123.2 clients4.google.com 21 | 223.197.123.2 clients5.google.com 22 | 223.197.123.2 clients6.google.com 23 | 223.197.123.2 clients7.google.com 24 | #3 25 | #223.197.123.2 clients1.googleusercontent.com 26 | #223.197.123.2 clients2.googleusercontent.com 27 | #223.197.123.2 clients3.googleusercontent.com 28 | #223.197.123.2 clients4.googleusercontent.com 29 | #223.197.123.2 clients5.googleusercontent.com 30 | #223.197.123.2 clients6.googleusercontent.com 31 | #223.197.123.2 clients7.googleusercontent.com 32 | #223.197.123.2 lh0.googleusercontent.com 33 | #223.197.123.2 lh1.googleusercontent.com 34 | #223.197.123.2 lh2.googleusercontent.com 35 | #223.197.123.2 lh3.googleusercontent.com 36 | #223.197.123.2 lh4.googleusercontent.com 37 | #223.197.123.2 lh5.googleusercontent.com 38 | #223.197.123.2 lh6.googleusercontent.com 39 | #4 40 | 223.197.123.2 geo0.ggpht.com 41 | 223.197.123.2 geo1.ggpht.com 42 | 223.197.123.2 geo2.ggpht.com 43 | 223.197.123.2 geo3.ggpht.com 44 | 223.197.123.2 geo4.ggpht.com 45 | 223.197.123.2 geo5.ggpht.com 46 | 223.197.123.2 geo6.ggpht.com 47 | 223.197.123.2 gm0.ggpht.com 48 | 223.197.123.2 gm1.ggpht.com 49 | 223.197.123.2 gm2.ggpht.com 50 | 223.197.123.2 gm3.ggpht.com 51 | 223.197.123.2 gm4.ggpht.com 52 | #5 53 | 223.197.123.2 lh1.ggpht.com 54 | 223.197.123.2 lh2.ggpht.com 55 | 223.197.123.2 lh3.ggpht.com 56 | 223.197.123.2 lh4.ggpht.com 57 | 223.197.123.2 lh5.ggpht.com 58 | 223.197.123.2 lh6.ggpht.com 59 | 223.197.123.2 lh0.ggpht.com 60 | #6 61 | #223.197.123.2 maps.gstatic.com 62 | #223.197.123.2 ssl.panoramio.com 63 | #Google Map END -------------------------------------------------------------------------------- /hosts_files/2017_hosts/clash: -------------------------------------------------------------------------------- 1 | #account.zhihu.com;(屏蔽“知乎隐私政策”,可能影响部分功能):;#privacy zhihu start;127.0.0.1 account.zhihu.com;#privacy zhihu end 2 | #微信小程序游戏广告;(不能通过看广告交换游戏内利益):;#wx game start;127.0.0.1 wxgm-res.u14.com;127.0.0.1 wxsnsdy.wxs.qq.com;127.0.0.1 wxsnsdythumb.wxs.qq.com;#wx game end 3 | #高手游;(屏蔽“高手游”广告脚本,会导“高手游”致主页无法访问):;#gaoshouyou start;127.0.0.1 www.gaoshouyou.com;#gaoshouyou end 4 | #alicdn.sgame.lilithcdn.com;(会导致阿里CDN游戏推广无法下载):;#alicdn.sgame start;127.0.0.1 alicdn.sgame.lilithcdn.com;#alicdn.sgame end 5 | #au.umeng.*;(可能会影响一些基于“友盟”平台的软件更新):;#umeng start;127.0.0.1 au.umeng.co;127.0.0.1 au.umeng.com;#umeng end 6 | #sqimg.qq.com;(手机QQ的启动广告,屏蔽后可能会影响腾讯其他图片显示):;#QQ sqimg start;127.0.0.1 sqimg.qq.com;#QQ sqimg end 7 | #api.mofang.com;(会导致无法使用某些游戏中的“加加”模块):;#jiajia start;127.0.0.1 api.mofang.com;127.0.0.1 spapi.i-moible.co.jp;#jiajia end 8 | #nj.bs.baidu.com;(会导致百度的某些“不正常”软件的正常下载):;#nj start;127.0.0.1 nj.bs.baidu.com;#nj end 9 | #*.map.baidu.com;(保证百度普通定位服务以及地图功能的前提下,屏蔽百度高精度定位以及数据上传):;#baidu map start;127.0.0.1 ps.map.baidu.com;127.0.0.1 sv.map.baidu.com;127.0.0.1 offnavi.map.baidu.com;127.0.0.1 newvector.map.baidu.com;127.0.0.1 ulog.imap.baidu.com;127.0.0.1 newloc.map.n.shifen.com;#baidu map end 10 | #m.360buyimg.com;(去除“京东”开屏广告,但影响部分图片加载。需要手动清除“京东”的缓存):;#jd startimg start;127.0.0.1 m.360buyimg.com;127.0.0.1 1251412368.vod2.myqcloud.com;#jd startimg end 11 | #返利网站;(屏蔽部分返利网站跳转,可能会导致某些返利网站无法跳转成功):;#shop start;127.0.0.1 click.linktech.cn;127.0.0.1 c.duomai.com;127.0.0.1 p.yiqifa.com;127.0.0.1 union.dangdang.com;127.0.0.1 acs4baichuan.m.taobao.com;#shop end 12 | #pages.ctrip.com;(会影响某些订票软件部分功能):;#ctrip start;127.0.0.1 pages.ctrip.com;#ctrip end 13 | #网龙教育企宣图片;(会影响网龙教育部分图片显示):;#91yong start;127.0.0.1 cdnf.91yong.com;#91yong end 14 | #res.cc.cmbimg.com;(会影响招商银行“掌上生活”软件图片显示):;#cmbimg start;127.0.0.1 res.cc.cmbimg.com;#cmbimg end 15 | #api.map.baidu.com;(屏蔽百度高精度定位以及数据上传,但会影响某些使用百度地图 api 的程序无法使用):;#baidu api map start;127.0.0.1 api.map.baidu.com;#baidu api map end 16 | #tb1.bdstatic.com;(能够去除百度贴吧类客户端的广告与后台下载,但可能严重影响电脑版百度贴吧网页的浏览):;#tieba start;127.0.0.1 tb1.bdstatic.com;#tieba end 17 | #mclick.simba.taobao.com;(会导致淘宝手机网页链接跳转失败):;#mobile simba.taobao start;127.0.0.1 mclick.simba.taobao.com;#simba.taobao end 18 | #click.simba.taobao.com;(会导致淘宝电脑网页链接跳转失败):;#pc simba.taobao start;127.0.0.1 click.simba.taobao.com;#pc simba.taobao end 19 | #image1.chinatelecom-ec.com;(会导致电信营业厅大部分图片不显示,不影响正常使用):;#chinatelecom start;127.0.0.1 image1.chinatelecom-ec.com;#chinatelecom end 20 | -------------------------------------------------------------------------------- /hosts_files/2017_hosts/version: -------------------------------------------------------------------------------- 1 | #Version 2 | V202002151230AD 3 | V201710112348RE 4 | V202002151230AR 5 | 52061482 6 | 更新:去广告2020年2月15日更新。 -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lack006/Android-Hosts-L/6363bb672206c7f19d2974c32ab7cd20e24d476b/index.html --------------------------------------------------------------------------------