openwrt luci web解析

路由器:newifi mini
硬件信息:mt7620a +mt7612e+128M DDR+16M flash
固件: Pandorabox
luci theme:lafite
主界面:
这里写图片描述

winSCP登录
securieCRT 串口登录

/www/index.html:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Cache-Control" content="no-cache" />
<meta http-equiv="refresh" content="0; URL=/cgi-bin/luci" />
</head>
<body style="background-color: white">
<a style="color: black; font-family: arial, helvetica, sans-serif;" href="/cgi-bin/luci">LuCI for PandoraBox</a>
</body>
</html>

在 uhttpd web server 中的 cgi-bin 目录下,运行 luci 文件(权限一般是 755 ) , luci 的代码如下:

#!/usr/bin/lua        #lua脚本,lua执行命令的路径
require "luci.cacheloader"     #导入 cacheloader 包
require "luci.sgi.cgi"         # 导入 sgi.cgi 包
luci.dispatcher.indexcache = "/tmp/luci-indexcache"     #cache 缓存路径地址
luci.sgi.cgi.run()         #执行run方法,此方法位于 /usr/lib/lua/luci/sgi/cgi.lua中

找到lcgi.lua运行文件, /usr/lib/lua/luci/sgi/cgi.lua :

exectime=os.clock()
module("luci.sgi.cgi",package.seeall)
local a=require("luci.ltn12")
require("nixio.util")
require("luci.http")
require("luci.sys")
require("luci.dispatcher")
local function o(t,e)
e=e or 0
local a=a.BLOCKSIZE
return function()
if e<1 then
t:close()
return nil
else
local a=(e>a)and
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值