当前位置: 首页 > news >正文

openwrt开发包含路由器基本功能的web问题记录

1.这里的扫描怎么实现的先找一些luci代码,在openwrt21版本后,luci用js替换了lua写后台,先找一些代码路径

在openrwt15这部分代码是在这个目录下

feeds/luci/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_join.htm

里面包含了html和lua,我们看一些lua部分是怎么实现的,直接copy代码

#!/usr/bin/luadev = arg[1]
local sys = require "luci.sys"
local utl = require "luci.util"
local iw = luci.sys.wifi.getiwinfo(dev)function scanlist(times)local i, k, vlocal l = { }local s = { }for i = 1, times dofor k, v in ipairs(iw.scanlist or { }) doif not s[v.bssid] thenl[#l+1] = vs[v.bssid] = trueendendendreturn lendfunction format_wifi_encryption(info)if info.wep == true thenreturn "WEP"elseif info.wpa > 0 thenreturn string.format("Pairwise: %s / Group: %s >%s - %s",table.concat(info.pair_ciphers, ", "),table.concat(info.group_ciphers, ", "),(info.wpa == 3) and string.format("mixed WPA/WPA2")or (info.wpa == 2 and "WPA2" or "WPA"),table.concat(info.auth_suites, ", "))elseif info.enabled thenreturn unknownelsereturn openendendfor i, net in ipairs(scanlist(3)) donet.encryption = net.encryption or { }print("channel:",net.channel);print("ssid:",net.ssid);print("bssid:",net.bssid);print("Mode:",net.mode);wep=net.encryption.wep and 1 or 0print("Encryption:",format_wifi_encryption(net.encryption));print("");
end

使用方法:

root@OPENWRT:~# ./test.lua ra0

openwrt21之后代码路径变为了如下:

feeds/luci/modules/luci-base/htdocs/luci-static/resources/network.js

feeds/luci/docs/jsapi/network.js.html

大概代码是这样子,看不懂,截取部分,用过调用ubus命令得到数据

	 */getMeshID: function() {if (this.getMode() != 'mesh')return null;return this.ubus('net', 'config', 'mesh_id') || this.get('mesh_id');},/*** Get the configured BSSID of the wireless network.** @returns {null|string}* Returns the BSSID value or `null` if none has been specified.*/getBSSID: function() {return this.ubus('net', 'config', 'bssid') || this.get('bssid');},

类似这样:ubus call iwinfo info '{ "device": "wlan0" }'

2.虚拟机给路由器开发板传文件,确保虚拟机已安装ssh

scp  + 虚拟机里面要传的文件  + 开发板用户名@开发板ip地址:开发板放文件的路劲

 scp  mongoose root@192.168.1.1:/bin

http://www.lryc.cn/news/329069.html

相关文章:

  • HarmonyOS ArkTS 骨架屏加载显示(二十五)
  • Ruoyi-Cloud-Plus_使用Docker部署分布式微服务系统_环境准备_001---SpringCloud工作笔记200
  • RN封装的底部向上弹出的弹出层组件
  • 基于深度学习YOLOv8+PyQt5的水底海底垃圾生物探测器检测识别系统(源码+数据集+配置说明)
  • SpringBoot集成WebSocket实现简单的多人聊天室
  • 如何使用固定公网地址远程访问内网Axure RP生成的网站原型web页面
  • 蓝桥杯习题
  • AMS概念以及面试相关整理
  • Vmware下减小Ubuntu系统占用系统盘大小
  • 面试题-Elasticsearch集群架构和调优手段(超全面)
  • python基础练习题6
  • Chrome 插件各模块使用 Fetch 进行接口请求
  • 内存可见性
  • Android room 在dao中不能使用挂起suspend 否则会报错
  • 【stable diffusion扩散模型】一篇文章讲透
  • 数据链路层之信道:数字通信的桥梁与守护者
  • SQL109 纠错4(组合查询,order by..)
  • Spring Boot + Vue 实现文件导入导出功能
  • vue watch 深度监听
  • Qt源码调试步骤记录
  • 大数据面试英文自我介绍参考(万字长文)
  • 外包干了5天,技术退步明显.......
  • Docket常见的软件部署1
  • Qt源程序编译及错误问题解决
  • 作业练习(python)
  • Wireshark使用相关
  • 相机标定学习记录
  • CSS 滚动条样式修改
  • 谈谈配置中心?
  • 人工智能(pytorch)搭建模型25-基于pytorch搭建FPN特征金字塔网络的应用场景,模型结构介绍