網站首頁 編程語言 正文
1 需求
- 查詢Wi-Fi狀態
- adb shell cmd wifi status
- adb shell settings get global wifi_on
- 打開WLAN
- adb shell cmd wifi set-wifi-enabled enabled
adb shell svc wifi enable
- 關閉WLAN
- adb shell cmd wifi set-wifi-enabled disabled
adb shell svc wifi enable
- x
- set-scan-always-available enabled|disabled
- 連接某個WLAN網絡
- connect-network <ssid> open|owe|wpa2|wpa3 [<passphrase>] [-m] [-d] [-b <bssid>]
- 打開WLAN熱點
-
start-softap <ssid> (open|wpa2) <passphrase> [-b 2|5|6|any]
-
-
關閉WLAN熱點
-
stop-softap
-
2 語法
Wi-Fi (wifi) commands:
help or -h
Print this help text.
get-country-code
Gets country code as a two-letter string
set-wifi-enabled enabled|disabled
Enables/disables Wifi on this device.
set-scan-always-available enabled|disabled
Sets whether scanning should be available even when wifi is off.
list-scan-results
Lists the latest scan results
start-scan
Start a new scan
list-networks
Lists the saved networks
connect-network <ssid> open|owe|wpa2|wpa3 [<passphrase>] [-m] [-d] [-b <bssid>]
Connect to a network with provided params and add to saved networks list
<ssid> - SSID of the network
open|owe|wpa2|wpa3 - Security type of the network.
- Use 'open' or 'owe' for networks with no passphrase
- 'open' - Open networks (Most prevalent)
- 'owe' - Enhanced open networks
- Use 'wpa2' or 'wpa3' for networks with passphrase
- 'wpa2' - WPA-2 PSK networks (Most prevalent)
- 'wpa3' - WPA-3 PSK networks
-m - Mark the network metered.
-d - Mark the network autojoin disabled.
-b <bssid> - Set specific BSSID.
add-network <ssid> open|owe|wpa2|wpa3 [<passphrase>] [-m] [-d] [-b <bssid>]
Add/update saved network with provided params
<ssid> - SSID of the network
open|owe|wpa2|wpa3 - Security type of the network.
- Use 'open' or 'owe' for networks with no passphrase
- 'open' - Open networks (Most prevalent)
- 'owe' - Enhanced open networks
- Use 'wpa2' or 'wpa3' for networks with passphrase
- 'wpa2' - WPA-2 PSK networks (Most prevalent)
- 'wpa3' - WPA-3 PSK networks
-m - Mark the network metered.
-d - Mark the network autojoin disabled.
-b <bssid> - Set specific BSSID.
forget-network <networkId>
Remove the network mentioned by <networkId>
- Use list-networks to retrieve <networkId> for the network
status
Current wifi status
set-verbose-logging enabled|disabled
Set the verbose logging enabled or disabled
add-suggestion <ssid> open|owe|wpa2|wpa3 [<passphrase>] [-u] [-m] [-s] [-d][-b <bssid>]
Add a network suggestion with provided params
Use 'network-suggestions-set-user-approved com.android.shell yes' to approve suggestions added via shell (Needs root access)
<ssid> - SSID of the network
open|owe|wpa2|wpa3 - Security type of the network.
- Use 'open' or 'owe' for networks with no passphrase
- 'open' - Open networks (Most prevalent)
- 'owe' - Enhanced open networks
- Use 'wpa2' or 'wpa3' for networks with passphrase
- 'wpa2' - WPA-2 PSK networks (Most prevalent)
- 'wpa3' - WPA-3 PSK networks
-u - Mark the suggestion untrusted.
-m - Mark the suggestion metered.
-s - Share the suggestion with user.
-d - Mark the suggestion autojoin disabled.
-b <bssid> - Set specific BSSID.
remove-suggestion <ssid>
Remove a network suggestion with provided SSID of the network
remove-all-suggestions
Removes all suggestions added via shell
list-suggestions
Lists the suggested networks added via shell
set-connected-score <score>
Set connected wifi network score (to choose between LTE & Wifi for default route).
This turns off the active connected scorer (default or external).
Only works while connected to a wifi network. This score will stay in effect until you call reset-connected-score or the device disconnects from the current network.
<score> - Integer score should be in the range of 0 - 60
reset-connected-score
Turns on the default connected scorer.
Note: Will clear any external scorer set.
start-softap <ssid> (open|wpa2) <passphrase> [-b 2|5|6|any]
Start softap with provided params
Note that the shell command doesn't activate internet tethering. In some devices, internet sharing is possible when Wi-Fi STA is also enabled and isassociated to another AP with internet access.
<ssid> - SSID of the network
open|wpa2 - Security type of the network.
- Use 'open' for networks with no passphrase
- Use 'wpa2' for networks with passphrase
-b 2|5|6|any - select the preferred band.
- Use '2' to select 2.4GHz band as the preferred band
- Use '5' to select 5GHz band as the preferred band
- Use '6' to select 6GHz band as the preferred band
- Use 'any' to indicate no band preference
Note: If the band option is not provided, 2.4GHz is the preferred band.
The exact channel is auto-selected by FW unless overridden by force-softap-channel command
stop-softap
Stop softap (hotspot)
3.X 示例:查詢Wi-Fi狀態
adb shell cmd wifi status
3.X 示例:打開WLAN
adb shell cmd wifi set-wifi-enabled enabled
3.X 示例:關閉WLAN
adb shell cmd wifi set-wifi-enabled disabled
4 參考資料
Android6.0 adb操作wifi/bluetooth/gps/apn 指令_木葉風的博客-CSDN博客
原文鏈接:https://deepsecurity.blog.csdn.net/article/details/126286159
- 上一篇:沒有了
- 下一篇:沒有了
相關推薦
- 2022-03-17 sqlsever2019文件創建與變量示例_數據庫其它
- 2022-05-29 Python實現灰色關聯分析與結果可視化的詳細代碼_python
- 2022-10-03 Pandas數據集的分塊讀取的實現_python
- 2022-11-17 Android自定義一個view?ViewRootImpl繪制流程示例_Android
- 2022-11-08 hooks中useEffect()使用案例詳解_React
- 2022-12-23 Mariadb數據庫主從復制同步配置過程實例_mariadb
- 2024-03-08 Spring 事務失效的場景
- 2022-04-28 教你如何在Centos8-stream安裝PostgreSQL13_PostgreSQL
- 欄目分類
-
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支