Android 使用adb操作WiFi相关指令

news/2024/5/30 18:36:03/文章来源:https://blog.csdn.net/BOJUE01/article/details/136684847

没有系统原生设置应用又需要调试WiFi功能时,可以使用如下指令来验证WiFi相关功能

最常用的就是 svc wifi enable/disable,再使用wpa_supplicant/wpa_cli来验证,但对于AP功能就没办法验证了,其实Android有组很强大的shell指令集,包含各个方便,这里只记录下平时使用的WiFi相关指令

1、adb shell cmd wifi -h

查看WiFi所有指令以及参数

2、打开关闭WLAN

adb shell cmd wifi set-wifi-enabled enabled

adb shell cmd wifi set-wifi-enabled disabled

3、扫描WiFi

adb shell cmd wifi start-scan             //扫描

adb shell cmd wifi list-scan-results    //查看扫描结果

4、连接WiFi

adb shell cmd wifi connect-network TP-LINK_5G_0FE1 wpa2 12345678

//TP-LINK_5G_0FE1 连接WiFi名称

//wpa2 加密方式

//12345678 密码

5、查看WiFi状态

adb shell cmd wifi status

6、打开关闭热点

adb shell cmd wifi start-softap ap_ssidxx wpa2 12345678 -b5

// ap_ssidxx  热点名称

// wpa2 加密方式

//12345678 密码

//-b5 5G频段

adb shell cmd wifi stop-softap

其他可以指令可以使用adb shell cmd wifi -h查看,如果需要连接WiFi以外的相关指令可以使用adb shell cmd -l(小写L)

Wi-Fi (wifi) commands:help or -hPrint this help text.get-country-codeGets country code as a two-letter stringset-wifi-enabled enabled|disabledEnables/disables Wifi on this device.set-scan-always-available enabled|disabledSets whether scanning should be available even when wifi is off.list-scan-resultsLists the latest scan resultsstart-scanStart a new scanlist-networksLists the saved networksconnect-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 networkopen|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 networkopen|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 networkstatusCurrent wifi statusset-verbose-logging enabled|disabledSet the verbose logging enabled or disabledadd-suggestion <ssid> open|owe|wpa2|wpa3 [<passphrase>] [-u] [-m] [-s] [-d][-b <bssid>]Add a network suggestion with provided paramsUse 'network-suggestions-set-user-approved com.android.shell yes' to approve suggestions added via shell (Needs root access)<ssid> - SSID of the networkopen|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 networkremove-all-suggestionsRemoves all suggestions added via shelllist-suggestionsLists the suggested networks added via shellset-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 - 60reset-connected-scoreTurns 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 paramsNote 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 networkopen|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 preferenceNote: 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 commandstop-softapStop softap (hotspot)set-ipreach-disconnect enabled|disabledSets whether CMD_IP_REACHABILITY_LOST events should trigger disconnects.get-ipreach-disconnectGets setting of CMD_IP_REACHABILITY_LOST events triggering disconnects.set-poll-rssi-interval-msecs <int>Sets the interval between RSSI polls to <int> milliseconds.get-poll-rssi-interval-msecsGets current interval between RSSI polls, in milliseconds.force-hi-perf-mode enabled|disabledSets whether hi-perf mode is forced or left for normal operation.force-low-latency-mode enabled|disabledSets whether low latency mode is forced or left for normal operation.network-suggestions-set-user-approved <package name> yes|noSets whether network suggestions from the app is approved or not.network-suggestions-has-user-approved <package name>Queries whether network suggestions from the app is approved or not.imsi-protection-exemption-set-user-approved-for-carrier <carrier id> yes|noSets whether Imsi protection exemption for carrier is approved or notimsi-protection-exemption-has-user-approved-for-carrier <carrier id>Queries whether Imsi protection exemption for carrier is approved or notimsi-protection-exemption-clear-user-approved-for-carrier <carrier id>Clear the user choice on Imsi protection exemption for carriernetwork-requests-remove-user-approved-access-points <package name>Removes all user approved network requests for the app.clear-user-disabled-networksClears the user disabled networks list.send-link-probeManually triggers a link probe.force-softap-channel enabled <int> | disabledSets whether soft AP channel is forced to <int> MHzor left for normal   operation.force-country-code enabled <two-letter code> | disabledSets country code to <two-letter code> or left for normal valueset-wifi-watchdog enabled|disabledSets whether wifi watchdog should trigger recoveryget-wifi-watchdogGets setting of wifi watchdog trigger recovery.get-softap-supported-featuresGets softap supported features. Will print 'wifi_softap_acs_supported'and/or 'wifi_softap_wpa3_sae_supported', each on a separate line.settings-resetInitiates wifi settings resetadd-request <ssid> open|owe|wpa2|wpa3 [<passphrase>] [-b <bssid>]Add a network request with provided paramsUse 'network-requests-set-user-approved android yes' to pre-approve requests added via rooted shell (Not persisted)<ssid> - SSID of the networkopen|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-b <bssid> - Set specific BSSID.remove-request <ssid>Remove a network request with provided SSID of the networkremove-all-requestsRemoves all active requests added via shelllist-requestsLists the requested networks added via shellnetwork-requests-set-user-approved <package name> yes|noSets whether network requests from the app is approved or not.Note: Only 1 such app can be approved from the shell at a timenetwork-requests-has-user-approved <package name>Queries whether network requests from the app is approved or not.Note: This only returns whether the app was set via the 'network-requests-set-user-approved' shell commandqca-list-ifacesLists active STA/AP interfaces (could be bridge interfaces). Command to set bridge iface will only apply to the first internal ifaceqca-set-txpower <iface> <power in dBm>Sets max txpower in dBm, and <iface> is from 'qca-list-ifaces'qca-set-ani-level <iface> <auto|fixed> [<ofdmlvl>]Sets ani level, and <iface> is from 'qca-list-ifaces'qca-get-thermal-info <iface>Gets thermal info, and <iface> is from 'qca-list-ifaces'qca-dump-thermal-eventsDump thermal events from driver/firmware after bootqca-set-congestion-report <iface> <enable|disable> [<threshold> [interval]]Sets congestion report, and <iface> is AP iface from 'qca-list-ifaces'qca-dump-congestion-eventsDump congestion events from driver/firmware after boot

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.luyixian.cn/news_show_1006385.aspx

如若内容造成侵权/违法违规/事实不符,请联系dt猫网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Linux 之九:CentOS 上 Tomcat 安装、SpringBoot 项目打包和部署

安装 Tomcat 下载 a. 方式一&#xff1a;可以在windows 真机上下载后&#xff0c;再上传到服务器 b. 方式二&#xff1a;可以在服务器端使用 wget 下载命令来下载 登录官网https://tomcat.apache.org/download-90.cgi&#xff0c;选择 linux 版本 右键&#xff0c;获取下载链接…

从政府工作报告探计算机行业发展

从政府工作报告中&#xff0c;我们可以深入洞察计算机行业在未来一年的发展趋势和政策导向。报告中明确提出了数字经济创新发展的重要性&#xff0c;以及制造业数字化转型、服务业数字化、智慧城市和数字乡村建设等关键任务&#xff0c;这些都为计算机行业提供了广阔的发展空间…

C++提高笔记(三)---STL容器(vector、deque)

1、vector容器 1.1vector基本概念 功能&#xff1a;vector数据结构和数组非常相似&#xff0c;也称为单端数组 vector与普通数组区别&#xff1a;不同之处在于数组是静态空间&#xff0c;而vector可以动态扩展 动态扩展&#xff1a;并不是在原空间之后续接新空间&#xff0…

全网最全c++中的system详解

这篇文章是二发&#xff0c;做了些微调&#xff0c;感兴趣的朋友可以看原文&#xff1a;C中的system_一只32汪的博客-CSDN博客 1&#xff0c;简介 system()函数是在C制作中十分常用&#xff0c;有用的一个函数。 其效果类似于系统中"cmd"控制台和"bat"文件…

华为机考:HJ3 明明的随机数

华为机考&#xff1a;HJ3 明明的随机数 描述 代码 set&#xff0c;插入即排序&#xff0c;而且没有重复数字 #include<iostream> #include<vector> #include<algorithm> using namespace std;int main(){int n;while(cin >> n){ //首先输入每次调查…

vue3/vue2若依框架对比,点击新增编辑跳转到新页面(新增编辑共用代码)

vue2若依框架&#xff1a; router里面定义好&#xff0c;编辑里面添加一个id {path: /filmManagement,component: Layout,hidden: true,redirect: noredirect,children: [{path: editFilmDetail,component: () > import(/views/filmManagement/editFilmDetail),name: editFi…

微信小程序如何实现下拉刷新

1.首先在你需要实现下拉刷新页面的json文件中写入"enablePullDownRefresh": true。 2.在js文件的onPullDownRefresh() 事件中实现下拉刷新。 实现代码 onPullDownRefresh() {console.log(开始下拉刷新)wx.showNavigationBarLoading()//在标题栏中显示加载图标this.d…

常用MII接口详解

开放式系统互连 (OSI) 模型 以太网层 位于最底部两层 &#xff0c;物理层(physical)和数据链路层(Date link)。 从百兆以太网接口开始 首先是百兆以太网规定的两种接口 介质无关接口 (MII) Media Independent Interface 介质相关接口 (MDI) Medium Dependent Interfa…

【大厂AI课学习笔记NO.72】AI与云计算

AI项目依靠云计算&#xff0c;借助云的力量&#xff0c;快速的启动业务&#xff0c;是比较好的一种选择。 AI模型训练过程中&#xff0c;出现算力突增&#xff0c;云计算成本低。 云平台提供一站式解决方案&#xff0c;创业公司的选择。 云端AI和边缘端的AI&#xff0c;是我们…

【机器学习】一文掌握逻辑回归全部核心点(上)。

逻辑回归核心点-上 1、引言2、逻辑回归核心点2.1 定义与目的2.2 模型原理2.2.1 定义解析2.2.2 公式2.2.3 代码示例 2.3 损失函数与优化2.3.1 定义解析2.3.2 公式2.3.3 代码示例 2.4 正则化2.4.1 分类2.4.2 L1正则化2.4.3 L2正则化2.4.4 代码示例 3、总结 1、引言 小屌丝&#…

Java高级编程—泛型

文章目录 1.为什么要有泛型 (Generic)1.1 泛型的概念1.2 使用泛型后的好处 2.在集合中使用泛型3.自定义泛型结构3.1 自定义泛型类、泛型接口3.2 自定义泛型方法 4.泛型在继承上的体现5.通配符的使用5.1 基本使用5.2 有限制的通配符的使用 1.为什么要有泛型 (Generic) Java中的…

uniapp h5 部署

uniapp 配置 服务器文件路径 打包文件结构 //nginx 配置 server {listen 8300;server_name bfqcwebsiteapp;charset utf-8;#允许跨域请求的域&#xff0c;* 代表所有add_header Access-Control-Allow-Origin *;#允许带上cookie请求add_header Access-Control-Allow-C…

【Pytorch】进阶学习:深入解析 sklearn.metrics 中的 classification_report 函数---分类性能评估的利器

【Pytorch】进阶学习&#xff1a;深入解析 sklearn.metrics 中的 classification_report 函数—分类性能评估的利器 &#x1f308; 个人主页&#xff1a;高斯小哥 &#x1f525; 高质量专栏&#xff1a;Matplotlib之旅&#xff1a;零基础精通数据可视化、Python基础【高质量合…

Covalent Network (CQT) 通过统一 API 集成,为 Gnosis Chain 的 AI 潜力赋能

作为一个为超 225 个链提供服务的领先多链索引器&#xff0c;Covalent Network (CQT) 正在与知名的 EVM 区块链基础设施提供者 Gnosis Chain 展开一项激动人心的合作。这一战略合作象征着先进的实时数据索引技术的集成&#xff0c;包括 Covalent Network (CQT) 的统一 API 和 G…

前端项目,个人笔记(一)【定制化主题 + 路由设计】

目录 1、项目准备 1.1、项目初始化 1.2、elementPlus按需引入 注&#xff1a;使用cnpm安装elementplus及两个插件&#xff0c;会报错&#xff1a;vueelement-plus报错TypeError: Cannot read properties of null (reading isCE ) &#xff0c;修改&#xff1a; 测试&#…

一站式解决方案:uni-app条件编译及多环境配置,appid动态修改攻略!

前言 这篇文章主要介绍uniapp在Hbuilderx 中&#xff0c;通过工程化&#xff0c;区分不同环境、动态修改小程序appid以及自定义条件编译&#xff0c;解决代码发布和运行时手动切换到问题。 背景 在企业级的应用中&#xff0c;通常会分为&#xff0c;开发、联调、生产等多个环…

基于CNN的图像超分辨率

单图像超分辨率 (Single image super resolution&#xff0c;SR) 是计算机视觉中的一个经典问题&#xff0c; 其目的是从单个低分辨率图像中恢复高分辨率图像。这个问题本质上是不适定的&#xff0c;因为对于任何给定的低分辨率像素都存在解决方案的多重性。换句话说&#xff0…

鸿蒙Harmony应用开发—ArkTS声明式开发(基础手势:DatePicker)

日期选择器组件&#xff0c;用于根据指定日期范围创建日期滑动选择器。 说明&#xff1a; 该组件从API Version 8开始支持。后续版本如有新增内容&#xff0c;则采用上角标单独标记该内容的起始版本。 子组件 无 接口 DatePicker(options?: DatePickerOptions) 根据指定范…

Github 2024-03-13 开源项目日报 Top10

根据Github Trendings的统计,今日(2024-03-13统计)共有10个项目上榜。根据开发语言中项目的数量,汇总情况如下: 开发语言项目数量Rust项目2Python项目2非开发语言项目2HTML项目1CSS项目1Dart项目1TypeScript项目1Go项目1JavaScript项目1《Hello 算法》:动画图解、一键运行的…

利用“定时执行专家”软件的25种任务与12种触发器,提升IT系统管理自动化水平

在IT系统管理中&#xff0c;自动化是提高工作效率、减少人为错误的关键。而《定时执行专家》这款软件&#xff0c;以其强大的功能、易用性和毫秒级的执行精度&#xff0c;成为了IT系统管理员的得力助手。今天&#xff0c;我们就来探讨一下如何利用这款软件的25种任务类型和12种…