From a30c0626e12e3d84684c554d0b1b7c7935b117d8 Mon Sep 17 00:00:00 2001 From: Shen Lin Date: Tue, 19 Dec 2017 15:30:09 +0800 Subject: [PATCH] Add 4 security-related commands (#50) --- README.en.md | 43 ++++++++++++++++++++++++++++++++++++++++--- README.md | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 3 deletions(-) diff --git a/README.en.md b/README.en.md index ed29b98..becc06b 100644 --- a/README.en.md +++ b/README.en.md @@ -91,11 +91,14 @@ Other languages: [:cn: Chinese](./README.md) * [Detect whether the device is root](#detect-whether-the-device-is-root) * [Monkey use stress testing](#monkey-use-stress-testing) * [On / off WiFi](#on--off-wifi) -* [Brush related commands](#brush-related-commands) +* [Flashing-Phone related commands](#brush-related-commands) * [Restart to Recovery mode](#restart-to-recovery-mode) * [To restart from the Recovery Android](#to-restart-from-the-recovery-android) * [Restart to Fastboot mode](#restart-to-fastboot-mode) * [Through sideload system update](#through-sideload-system-update) +* [Security related commands](#security-related-commands) + * [Enabled / Disable SELinux](#enabledisable-selinux) + * [Enabled / Disable dm_verity](#enabledisable-dmverity) * [More adb shell command](#more-adb-shell-command) * [See process](#see-process) * [View real-time resource consumption](#view-real-time-resource-consumption) @@ -753,7 +756,7 @@ Dexopt state: ## Interact with Applications -The most used syntax for interacting with applications is : +The most used syntax for interacting with applications is : ```sh am ``` @@ -2086,7 +2089,7 @@ adb shell svc wifi disable If successfully implemented, the output is empty; if not get root privileges to execute this command will fail, output `Killed`. -## Brush related commands +## Flashing-Phone related commands ### Restart to Recovery mode @@ -2138,6 +2141,40 @@ Case in Recovery Mode Update: adb sideload ``` +## Security-related commands + +### Enable / Disable SELinux + +Enable SELinux + +```sh +adb root +adb shell setenforce 1 +``` + +Disable SELinux + +```sh +adb root +adb shell setenforce 0 +``` + +### Enable / Disable dm_verity + +Enable dm_verity + +```sh +adb root +adb enable-verity +``` + +Disable dm_verity + +```sh +adb root +adb disable-verity +``` + ## More adb shell command Android system is based on Linux kernel, so Linux where many commands in Android also has the same or similar implement, in `adb shell` where you can call. Part earlier in this document have been used in the `adb shell` command. diff --git a/README.md b/README.md index 76e6c20..af3bc3b 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,9 @@ Other languages: [:gb: English](./README.en.md) * [从 Recovery 重启到 Android](#从-recovery-重启到-android) * [重启到 Fastboot 模式](#重启到-fastboot-模式) * [通过 sideload 更新系统](#通过-sideload-更新系统) +* [安全相关命令](#安全相关命令) + * [启用/禁用 SELinux](#启用禁用-selinux) + * [启用/禁用 dm_verity](#启用禁用-dmverity) * [更多 adb shell 命令](#更多-adb-shell-命令) * [查看进程](#查看进程) * [查看实时资源占用情况](#查看实时资源占用情况) @@ -2165,6 +2168,40 @@ adb reboot bootloader adb sideload ``` +## 安全相关命令 + +### 启用/禁用 SELinux + +启用 SELinux + +```sh +adb root +adb shell setenforce 1 +``` + +禁用 SELinux + +```sh +adb root +adb shell setenforce 0 +``` + +### 启用/禁用 dm_verity + +启用 dm_verity + +```sh +adb root +adb enable-verity +``` + +禁用 dm_verity + +```sh +adb root +adb disable-verity +``` + ## 更多 adb shell 命令 Android 系统是基于 Linux 内核的,所以 Linux 里的很多命令在 Android 里也有相同或类似的实现,在 `adb shell` 里可以调用。本文档前面的部分内容已经用到了 `adb shell` 命令。