Compare commits

15 Commits

Author SHA1 Message Date
dichgrem
467c942b81 chore:misc 2026-01-18 15:08:00 +08:00
dichgrem
3878369ed3 fix:xss&&crontab
update:actions
2026-01-11 13:56:01 +08:00
dichgrem
fa3b2954cd add:mirror_workflow 2025-10-31 10:56:57 +08:00
dichgrem
c056ca8a4b style:format 2025-10-20 15:51:17 +08:00
dichgrem
69ff02fdbb style:readme 2025-10-20 12:51:30 +08:00
dichgrem
e4d1f1b108 feat:mips_actions 2025-10-20 12:38:00 +08:00
dichgrem
ef45a9414b fix:save_logic
chore:add_guide
2025-10-20 10:13:15 +08:00
dichgrem
cd7f41d7a7 feat:add_workflow 2025-10-16 21:35:19 +08:00
dichgrem
e1e0f03143 style:readme 2025-10-16 19:54:33 +08:00
dichgrem
9dd9806fd8 fix:username 2025-09-24 10:43:44 +08:00
dichgrem
290d77183e style:readme&&pic 2025-09-23 13:42:30 +08:00
dichgrem
aa9ce7490c fix:s99_name 2025-09-23 13:29:16 +08:00
dichgrem
e2f0046fef fix:makefile 2025-09-23 13:14:29 +08:00
dichgrem
569ca89fcc fix:use_musl
fix:arch_x86_64
2025-09-23 13:14:24 +08:00
dichgrem
7b76d43741 test:luci_app_zzz 2025-09-22 16:32:42 +08:00
27 changed files with 571 additions and 360 deletions

166
.github/workflows/build-zzz.yml vendored Normal file
View File

@@ -0,0 +1,166 @@
name: Build luci-app-zzz
on:
workflow_dispatch:
inputs:
ramips:
description: 'ramips'
required: false
type: boolean
default: true
filogic:
description: 'filogic'
required: false
type: boolean
default: true
x86_64:
description: 'x86_64'
required: false
type: boolean
default: true
jobs:
matrix-setup:
runs-on: ubuntu-latest
outputs:
architectures: ${{ steps.set-matrix.outputs.architectures }}
steps:
- name: Set matrix
id: set-matrix
run: |
ARCHS='['
if [ "${{ inputs.ramips }}" == "true" ]; then
ARCHS=$ARCHS'"ramips",'
fi
if [ "${{ inputs.filogic }}" == "true" ]; then
ARCHS=$ARCHS'"filogic",'
fi
if [ "${{ inputs.x86_64 }}" == "true" ]; then
ARCHS=$ARCHS'"x86_64",'
fi
ARCHS=${ARCHS%,}
ARCHS=$ARCHS']'
echo "architectures=$ARCHS" >> $GITHUB_OUTPUT
echo "Selected architectures: $ARCHS"
build:
needs: matrix-setup
if: needs.matrix-setup.outputs.architectures != '[]'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sdk: ${{ fromJson(needs.matrix-setup.outputs.architectures) }}
env:
RAMIPS_URL: https://downloads.immortalwrt.org/releases/24.10.3/targets/ramips/mt7621/immortalwrt-sdk-24.10.3-ramips-mt7621_gcc-13.3.0_musl.Linux-x86_64.tar.zst
FILOGIC_URL: https://downloads.immortalwrt.org/releases/24.10.3/targets/mediatek/filogic/immortalwrt-sdk-24.10.3-mediatek-filogic_gcc-13.3.0_musl.Linux-x86_64.tar.zst
X86_URL: https://downloads.immortalwrt.org/releases/24.10.3/targets/x86/64/immortalwrt-sdk-24.10.3-x86-64_gcc-13.3.0_musl.Linux-x86_64.tar.zst
WORK_ROOT: ${{ github.workspace }}/imwrt-sdk
CACHE_DIR: ${{ github.workspace }}/cache
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache SDK
uses: actions/cache@v4
id: sdk-cache
with:
path: ${{ env.WORK_ROOT }}
key: ${{ matrix.sdk }}-sdk-24.10.3
enableCrossOsArchive: true
- name: Install dependencies
if: steps.sdk-cache.outputs.cache-hit != 'true'
run: |
sudo apt-get update -qq
sudo apt-get install -y -qq build-essential git wget python3 rsync zstd g++ make libncurses-dev
- name: Set SDK variables
run: |
if [ "${{ matrix.sdk }}" == "ramips" ]; then
echo "SDK_URL=${{ env.RAMIPS_URL }}" >> $GITHUB_ENV
echo "PACKAGE_ARCH=ramips" >> $GITHUB_ENV
elif [ "${{ matrix.sdk }}" == "filogic" ]; then
echo "SDK_URL=${{ env.FILOGIC_URL }}" >> $GITHUB_ENV
echo "PACKAGE_ARCH=aarch64_cortex-a53" >> $GITHUB_ENV
else
echo "SDK_URL=${{ env.X86_URL }}" >> $GITHUB_ENV
echo "PACKAGE_ARCH=x86_64" >> $GITHUB_ENV
fi
- name: Show build target
run: |
echo "👉 正在编译 ${{ matrix.sdk }} 架构 (${{ env.PACKAGE_ARCH }})"
- name: Download & extract SDK
if: steps.sdk-cache.outputs.cache-hit != 'true'
run: |
set -euo pipefail
mkdir -p "$WORK_ROOT"
cd "$WORK_ROOT"
SDK_TAR="$(basename "$SDK_URL")"
echo "下载SDK: $SDK_TAR"
wget -q --show-progress "$SDK_URL" -O "$SDK_TAR"
echo "解压SDK..."
tar --use-compress-program="zstd -q -d" -xf "$SDK_TAR"
SDK_ROOT="$(find . -maxdepth 1 -type d -name 'immortalwrt-sdk*' | head -n 1)"
SDK_ROOT="$(cd "$SDK_ROOT" && pwd)"
echo "SDK_ROOT=$SDK_ROOT" >> $GITHUB_ENV
- name: Set SDK_ROOT from cache
if: steps.sdk-cache.outputs.cache-hit == 'true'
run: |
SDK_ROOT="$(find "$WORK_ROOT" -maxdepth 1 -type d -name 'immortalwrt-sdk*' | head -n 1)"
SDK_ROOT="$(cd "$SDK_ROOT" && pwd)"
echo "SDK_ROOT=$SDK_ROOT" >> $GITHUB_ENV
echo "使用缓存的SDK: $SDK_ROOT"
- name: Setup feeds
run: |
set -euo pipefail
cd "$SDK_ROOT"
echo "添加 zzz feed"
echo "src-git zzz https://github.com/Dichgrem/luci-app-zzz.git" >> feeds.conf.default
echo "更新 feeds"
./scripts/feeds update -a
./scripts/feeds update luci
./scripts/feeds update zzz
echo "安装 feeds"
./scripts/feeds install -a -p luci
./scripts/feeds install luci-app-zzz zzz
- name: Build packages
run: |
set -euo pipefail
cd "$SDK_ROOT"
make defconfig
echo "编译 luci-app-zzz 和 zzz"
make package/luci-app-zzz/compile V=s
make package/zzz/compile V=s
- name: Collect packages
run: |
set -euo pipefail
OUT="$GITHUB_WORKSPACE/output"
mkdir -p "$OUT"
echo "所有编译的 ipk 文件:"
find "$SDK_ROOT/bin/packages" -name "*.ipk" -type f
echo ""
echo "复制 zzz 和 luci-app-zzz 包:"
find "$SDK_ROOT/bin/packages" \( -name "zzz_*.ipk" -o -name "luci-app-zzz_*.ipk" \) -type f -exec cp {} "$OUT"/ \;
echo "输出目录内容:"
ls -lah "$OUT"
- name: Upload packages
uses: actions/upload-artifact@v4
with:
name: packages-${{ matrix.sdk }}
path: output/*.ipk
if-no-files-found: error

View File

@@ -1,44 +1,56 @@
# luci-app-nyn
# luci-app-zzz
**luci-app-nyn** is a Front-end interface in openwrt for nyn - the modern 802.1x standard authentication client.
**luci-app-zzz** is a Front-end interface in openwrt for zzz - the modern 802.1x standard authentication client.
<p align="center">
<img src="https://github.com/Dichgrem/luci-app-nyn/blob/main/screenshot.png" width="400">
<img src="https://github.com/Dichgrem/luci-app-zzz/blob/main/screenshot.png" width="400">
</p>
## How to use
- Step 0: Make sure you have an ``openwrt router``, ``download the ipk`` in Releases in this project, and ``upload and install`` it in the system-package of the Luci background.
- Step 1Fill in the user name: Student ID@operator. For example, ``212306666@cucc``, China Unicom is cucc, mobile is cmcc, and telecom is ctcc.
- Step 2: Fill in the password. The ``initial password`` is the last six digits of the ID card by default. It can be modified in the official client.
- Step 3: Select your network card; generally speaking, you can use ``ip addr`` to view the network card that has been assigned an IP, such as eth1.
- Step 4: ``Start the service`` and observe whether you can access the Internet, and then enable ``scheduled startup``; because the campus network will be closed from 12:00 to 7:00 the next day.
- Finallyenjoy it!
## How to build
- First clone this repository to the package directory of the openwrt you want to compile:
```
cd ./package
git clone https://github.com/Dichgrem/luci-app-nyn.git
## Add feed
echo "src-git zzz https://github.com/Dichgrem/luci-app-zzz.git" >> feeds.conf.default
## Update and install feed
./scripts/feeds update
./scripts/feeds install luci-app-zzz zzz
```
- Then select ``Network->nyn`` and ``LuCI->Applications->luci-app-nyn`` in make menuconfig and change them to "M" state;
- Then select ``Network->zzz`` and ``LuCI->Applications->luci-app-zzz`` in make menuconfig and change them to "M" state;
- Finally, run
```
make package/luci-app-nyn/clean V=s
make package/luci-app-nyn/compile V=s
make package/luci-app-zzz/clean V=s
make package/luci-app-zzz/compile V=s
```
and
```
make package/nyn/clean V=s
make package/nyn/compile V=s
make package/zzz/clean V=s
make package/zzz/compile V=s
```
to start build.
- You can use this command to find the compiled ipk:
```
find bin/ -name "nyn*.ipk"
bin/packages/x86_64/base/nyn_1.0.0-r1_x86_64.ipk
find bin/ -name "luci-app-nyn*.ipk"
bin/packages/x86_64/base/luci-app-nyn_0_all.ipk
find bin/ -name "zzz*.ipk"
bin/packages/x86_64/base/zzz_1.0.0-r1_x86_64.ipk
find bin/ -name "luci-app-zzz*.ipk"
bin/packages/x86_64/base/luci-app-zzz_0_all.ipk
```
## Acknowledgements
- [diredocks/zzz](https://github.com/diredocks/zzz)
- [diredocks/nyn](https://github.com/diredocks/nyn)
- [bitdust/njit8021xclient](https://github.com/bitdust/njit8021xclient)

View File

@@ -1,9 +0,0 @@
include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI support for NYN 802.1x Authentication Client
LUCI_DEPENDS:=+nyn +luci-base
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@@ -1,73 +0,0 @@
-- /usr/lib/lua/luci/controller/nyn.lua
module("luci.controller.nyn", package.seeall)
function index()
if not nixio.fs.access("/etc/config/nyn") then
return
end
-- Menu
entry({"admin", "network", "nyn"}, cbi("nyn"), "NyN", 60).dependent = false
-- Settings
entry({"admin", "network", "nyn", "service_control"}, call("service_control")).leaf = true
-- Status API
entry({"admin", "network", "nyn", "get_status"}, call("act_status")).leaf = true
end
function service_control()
local sys = require "luci.sys"
local action = luci.http.formvalue("action")
local result = { success = false, message = "" }
if action then
local cmd = ""
if action == "start" then
cmd = "/etc/rc.d/S99nyn start"
elseif action == "stop" then
cmd = "/etc/rc.d/S99nyn stop"
elseif action == "restart" then
cmd = "/etc/rc.d/S99nyn stop && sleep 2 && /etc/rc.d/S99nyn start"
end
if cmd ~= "" then
local ret = sys.call(cmd)
if ret == 0 then
result.success = true
result.message = action .. " 成功"
else
result.success = false
result.message = action .. " 失败"
end
end
end
luci.http.prepare_content("application/json")
luci.http.write_json(result)
end
function act_status()
local sys = require "luci.sys"
local util = require "luci.util"
local status = {}
-- Get status
status.running = (sys.call("pgrep -f nyn >/dev/null") == 0)
-- Get process info
if status.running then
status.process_info = util.trim(sys.exec("ps | grep -v grep | grep nyn"))
end
-- Get log
local log_file = "/tmp/nyn.log"
if nixio.fs.access(log_file) then
status.log = util.trim(sys.exec("tail -20 " .. log_file))
else
status.log = util.trim(sys.exec("logread | grep nyn | tail -10"))
end
luci.http.prepare_content("application/json")
luci.http.write_json(status)
end

View File

@@ -1,117 +0,0 @@
-- /usr/lib/lua/luci/model/cbi/nyn.lua
local m, s, o
local sys = require "luci.sys"
-- control
local start_action = luci.http.formvalue("cbid.nyn.auth.start_service")
local stop_action = luci.http.formvalue("cbid.nyn.auth.stop_service")
local restart_action = luci.http.formvalue("cbid.nyn.auth.restart_service")
if start_action then
sys.call("/etc/rc.d/S99nyn start")
elseif stop_action then
sys.call("/etc/rc.d/S99nyn stop")
elseif restart_action then
sys.call("/etc/rc.d/S99nyn stop; sleep 2; /etc/rc.d/S99nyn start")
end
m = Map("nyn", "NYN 802.1x 认证客户端",
"配置使用 NYN 客户端进行网络访问的 802.1x 认证")
-- Authentication Settings
s = m:section(TypedSection, "auth", "认证设置")
s.anonymous = true
s.addremove = false
-- Service Status
o = s:option(DummyValue, "_status", "当前状态")
o.rawhtml = true
o.cfgvalue = function()
local sys = require "luci.sys"
local running = sys.call("pgrep nyn >/dev/null") == 0
if running then
return "<span style='color:green;font-weight:bold'>✔ 正在运行中</span>"
else
return "<span style='color:red;font-weight:bold'>✘ 未运行</span>"
end
end
-- control buttons
control_buttons = s:option(DummyValue, "_control", "服务控制")
control_buttons.rawhtml = true
control_buttons.cfgvalue = function()
return [[
<div style="display: flex; gap: 10px; align-items: center; flex-wrap: wrap;">
<input type="submit" class="cbi-button cbi-button-apply"
name="cbid.nyn.auth.start_service" value="启动服务" />
<input type="submit" class="cbi-button cbi-button-remove"
name="cbid.nyn.auth.stop_service" value="停止服务" />
<input type="submit" class="cbi-button cbi-button-reload"
name="cbid.nyn.auth.restart_service" value="重启服务" />
</div>
]]
end
-- Username
o = s:option(Value, "user", "用户名", "802.1x 认证用户名")
o.password = true
o.rmempty = false
-- Password
o = s:option(Value, "password", "密码", "802.1x 认证密码")
o.password = true
o.rmempty = false
-- Network Device
o = s:option(ListValue, "device", "网络接口", "用于认证的网络接口")
o.rmempty = false
o:value("eth0", "eth0")
o:value("eth1", "eth1")
o:value("wan", "WAN")
-- Add network interface
local interfaces = sys.net.devices()
for _, iface in ipairs(interfaces) do
if iface ~= "lo" then
o:value(iface, iface)
end
end
-- Auto start
auto_start = s:option(Flag, "auto_start", "启用定时启动")
auto_start.description = "启用后将在每周一至周五的 7:00 自动启动服务"
auto_start.rmempty = false
-- Get Status
auto_start.cfgvalue = function(self, section)
local has_cron = sys.call("crontab -l 2>/dev/null | grep 'S99nyn' >/dev/null") == 0
return has_cron and "1" or "0"
end
-- Crontab
auto_start.write = function(self, section, value)
if value == "1" then
-- 启用定时任务:每周一至周五 7:00 启动
sys.call("(crontab -l 2>/dev/null | grep -v 'S99nyn' | grep -v '# nyn auto') | crontab - 2>/dev/null")
sys.call("(crontab -l 2>/dev/null; echo '0 7 * * 1,2,3,4,5 /etc/rc.d/S99nyn start # nyn auto start') | crontab -")
sys.call("/etc/init.d/cron enable && /etc/init.d/cron restart")
else
-- 禁用定时任务
sys.call("(crontab -l 2>/dev/null | grep -v 'S99nyn' | grep -v '# nyn auto') | crontab - 2>/dev/null")
sys.call("/etc/init.d/cron restart")
end
end
-- Crontab Status
timer_status_display = s:option(DummyValue, "_timer_status_display", "定时任务状态")
timer_status_display.rawhtml = true
timer_status_display.cfgvalue = function()
local cron_output = sys.exec("crontab -l 2>/dev/null | grep 'S99nyn' || echo '未设置'")
if cron_output:match("S99nyn") then
return "<span style='color:green;font-weight:bold'>✔ 已启用 (每周一至周五 7:00 自动启动)</span>"
else
return "<span style='color:red;font-weight:bold'>✘ 未启用</span>"
end
end
return m

10
luci-app-zzz/Makefile Normal file
View File

@@ -0,0 +1,10 @@
include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI support for ZZZ 802.1x Authentication Client
LUCI_DEPENDS:=+zzz +luci-base
PKG_VERSION:=2.0.0
PKG_RELEASE:=1
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@@ -0,0 +1,79 @@
-- /usr/lib/lua/luci/controller/zzz.lua
module("luci.controller.zzz", package.seeall)
function index()
if not nixio.fs.access("/etc/config/zzz") then
return
end
-- Menu
entry({ "admin", "network", "zzz" }, cbi("zzz"), "ZZZ", 60).dependent = false
-- Settings
entry({ "admin", "network", "zzz", "service_control" }, call("service_control")).leaf = true
-- Status API
entry({ "admin", "network", "zzz", "get_status" }, call("act_status")).leaf = true
end
function service_control()
local sys = require("luci.sys")
local util = require("luci.util")
local action = luci.http.formvalue("action")
local result = { success = false, message = "" }
local valid_actions = { start = true, stop = true, restart = true }
if action and valid_actions[action] then
local cmd = ""
if action == "start" then
cmd = "/etc/rc.d/S99zzz start"
elseif action == "stop" then
cmd = "/etc/rc.d/S99zzz stop"
elseif action == "restart" then
cmd = "/etc/rc.d/S99zzz stop && sleep 2 && /etc/rc.d/S99zzz start"
end
if cmd ~= "" then
local ret = sys.call(cmd)
if ret == 0 then
result.success = true
result.message = util.pcdata(action .. " 成功")
else
result.success = false
result.message = util.pcdata(action .. " 失败")
end
end
else
result.message = "无效的操作"
end
luci.http.prepare_content("application/json")
luci.http.write_json(result)
end
function act_status()
local sys = require("luci.sys")
local util = require("luci.util")
local status = {}
status.running = (sys.call("pgrep -f zzz >/dev/null") == 0)
if status.running then
status.process_info = util.trim(sys.exec("ps | grep -v grep | grep zzz"))
end
local log_file = "/tmp/zzz.log"
if nixio.fs.access(log_file) then
status.log = util.trim(sys.exec("tail -20 " .. log_file))
else
status.log = util.trim(sys.exec("logread | grep zzz | tail -10"))
end
if status.log then
status.log = util.pcdata(status.log)
end
luci.http.prepare_content("application/json")
luci.http.write_json(status)
end

View File

@@ -0,0 +1,152 @@
local m, s, o
local sys = require("luci.sys")
local util = require("luci.util")
m = Map("zzz", "ZZZ 802.1x 认证客户端", "配置使用 zzz 客户端进行网络访问的 802.1x 认证")
-- Authentication Settings
s = m:section(TypedSection, "auth", "认证设置")
s.anonymous = true
s.addremove = false
o = s:option(DummyValue, "_status", "当前状态")
o.rawhtml = true
o.cfgvalue = function()
local running = sys.call("pgrep zzz >/dev/null") == 0
if running then
return "<span style='color:green;font-weight:bold'>✔ 正在运行中</span>"
else
return "<span style='color:red;font-weight:bold'>✘ 未运行</span>"
end
end
-- control buttons
control_buttons = s:option(DummyValue, "_control", "服务控制")
control_buttons.rawhtml = true
control_buttons.cfgvalue = function()
return [[
<div style="display: flex; gap: 10px; align-items: center; flex-wrap: wrap;">
<button type="button" class="cbi-button cbi-button-apply" onclick="fetch('/cgi-bin/luci/admin/network/zzz/service_control',{method:'POST',headers:{'Content-Type':'application/x-www-form-urlencoded'},body:'action=start'}).then(r=>r.json()).then(d=>{alert(d.message);if(d.success)location.reload();});return false;">启动服务</button>
<button type="button" class="cbi-button cbi-button-remove" onclick="fetch('/cgi-bin/luci/admin/network/zzz/service_control',{method:'POST',headers:{'Content-Type':'application/x-www-form-urlencoded'},body:'action=stop'}).then(r=>r.json()).then(d=>{alert(d.message);if(d.success)location.reload();});return false;">停止服务</button>
<button type="button" class="cbi-button cbi-button-reload" onclick="fetch('/cgi-bin/luci/admin/network/zzz/service_control',{method:'POST',headers:{'Content-Type':'application/x-www-form-urlencoded'},body:'action=restart'}).then(r=>r.json()).then(d=>{alert(d.message);if(d.success)location.reload();});return false;">重启服务</button>
</div>
]]
end
-- Username
o = s:option(
Value,
"username",
"用户名",
[[802.1x 认证用户名
<span style="cursor: help; color: #007bff; font-weight: bold;" title="用户名为学号@运营商例如212306666@cucc移动为cmcc联通为cucc电信为ctcc">?</span>]]
)
o.rmempty = false
o.rawhtml = true
function o.validate(self, value)
value = value:match("^%s*(.-)%s*$") or value
if #value < 3 or #value > 64 then
return nil, "用户名长度必须在3-64字符之间"
end
if not value:match("^[a-zA-Z0-9@._-]+$") then
return nil, "用户名只能包含字母、数字、@、.、_和-"
end
return value
end
-- Password
o.password = true
o.rmempty = false
o = s:option(
Value,
"password",
"密码",
[[802.1x 认证密码
<span style="cursor: help; color: #007bff; font-weight: bold;" title="密码默认为身份证号后六位可以在官方客户端inode中修改">?</span>]]
)
o.password = true
o.rmempty = false
o.rawhtml = true
function o.validate(self, value)
if #value < 4 or #value > 128 then
return nil, "密码长度必须在4-128字符之间"
end
return value
end
-- Network Device
o = s:option(
Value,
"device",
"网络接口",
[[用于认证的网络接口
<span style="cursor: help; color: #007bff; font-weight: bold;" title="可以用ip addr命令查看有10.38开头ip的接口">?</span>]]
)
o.rmempty = false
o:value("eth0", "eth0")
o:value("eth1", "eth1")
o:value("wan", "WAN")
local interfaces = sys.net.devices()
for _, iface in ipairs(interfaces) do
if iface ~= "lo" and iface:match("^[a-zA-Z0-9]+$") then
o:value(iface, iface)
end
end
function o.validate(self, value)
if not value:match("^[a-zA-Z0-9]+$") then
return nil, "网络接口只能包含字母和数字"
end
return value
end
-- Auto start
auto_start = s:option(Flag, "auto_start", "启用定时启动")
auto_start.description = "启用后将在每周一至周五的 7:00 自动启动服务"
auto_start.rmempty = false
-- Get Status
auto_start.cfgvalue = function(self, section)
local has_cron = sys.call("crontab -l 2>/dev/null | grep 'S99zzz' >/dev/null") == 0
return has_cron and "1" or "0"
end
-- Crontab
auto_start.write = function(self, section, value)
local temp_cron = "/tmp/.zzz_cron_tmp_" .. os.time()
if value == "1" then
sys.call("crontab -l 2>/dev/null > " .. temp_cron)
sys.call("sed -i '/S99zzz/d' " .. temp_cron)
sys.call("sed -i '/# zzz auto/d' " .. temp_cron)
sys.call("echo '0 7 * * 1,2,3,4,5 /etc/rc.d/S99zzz start # zzz auto start' >> " .. temp_cron)
sys.call("crontab " .. temp_cron .. " 2>/dev/null && rm -f " .. temp_cron)
sys.call("/etc/init.d/cron enable && /etc/init.d/cron restart")
else
sys.call("crontab -l 2>/dev/null > " .. temp_cron)
sys.call("sed -i '/S99zzz/d' " .. temp_cron)
sys.call("sed -i '/# zzz auto/d' " .. temp_cron)
sys.call("crontab " .. temp_cron .. " 2>/dev/null && rm -f " .. temp_cron)
sys.call("/etc/init.d/cron restart")
end
end
-- Crontab Status
timer_status_display = s:option(DummyValue, "_timer_status_display", "定时任务状态")
timer_status_display.rawhtml = true
timer_status_display.cfgvalue = function()
local cron_output = sys.exec("crontab -l 2>/dev/null | grep 'S99zzz' || echo '未设置'")
if cron_output:match("S99zzz") then
return "<span style='color:green;font-weight:bold'>✔ 已启用 (每周一至周五 7:00 自动启动)</span>"
else
return "<span style='color:red;font-weight:bold'>✘ 未启用</span>"
end
end
-- 保存后自动重启 zzz 服务
m.on_commit = function(self)
local sys = require("luci.sys")
sys.call("/etc/rc.d/S99zzz restart >/dev/null 2>&1 &")
end
return m

View File

@@ -1,66 +0,0 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=nyn
PKG_VERSION:=0.0.3
PKG_RELEASE:=1
PKG_MAINTAINER:=Dichgrem <brcefy@gmail.com>
PKG_LICENSE:=MIT
include $(INCLUDE_DIR)/package.mk
define Package/nyn
SECTION:=net
CATEGORY:=Network
TITLE:=NYN 802.1x Authentication Client
URL:=https://github.com/diredocks/nyn
DEPENDS:=+libpcap
endef
define Package/nyn/description
A 802.1x authentication client for OpenWrt routers.
Cross-compiled with musl toolchain for optimal compatibility.
endef
define Package/nyn/conffiles
/etc/config/nyn
/etc/nyn/config.toml
endef
define Build/Prepare
endef
define Build/Configure
endef
define Build/Compile
endef
define Package/nyn/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_DIR) $(1)/etc/nyn
# Install precompiled binary based on architecture
$(if $(CONFIG_TARGET_x86_64),$(INSTALL_BIN) ./files/bin/nyn-x86_64 $(1)/usr/bin/nyn)
$(if $(CONFIG_TARGET_armvirt_64),$(INSTALL_BIN) ./files/bin/nyn-aarch64 $(1)/usr/bin/nyn)
$(if $(CONFIG_TARGET_bcm27xx_bcm2711),$(INSTALL_BIN) ./files/bin/nyn-aarch64 $(1)/usr/bin/nyn)
$(if $(CONFIG_TARGET_ath79_generic),$(INSTALL_BIN) ./files/bin/nyn-mips64 $(1)/usr/bin/nyn)
$(if $(CONFIG_TARGET_ramips_mt7621),$(INSTALL_BIN) ./files/bin/nyn-mips64 $(1)/usr/bin/nyn)
$(if $(CONFIG_TARGET_mediatek_mt7622),$(INSTALL_BIN) ./files/bin/nyn-aarch64 $(1)/usr/bin/nyn)
$(if $(CONFIG_TARGET_rockchip_armv8),$(INSTALL_BIN) ./files/bin/nyn-aarch64 $(1)/usr/bin/nyn)
# Fallback - try to detect architecture
$(if $(findstring arm,$(ARCH)),$(INSTALL_BIN) ./files/bin/nyn-armv7 $(1)/usr/bin/nyn)
$(if $(findstring aarch64,$(ARCH)),$(INSTALL_BIN) ./files/bin/nyn-aarch64 $(1)/usr/bin/nyn)
$(if $(findstring mips,$(ARCH)),$(INSTALL_BIN) ./files/bin/nyn-mips64 $(1)/usr/bin/nyn)
$(if $(findstring x86_64,$(ARCH)),$(INSTALL_BIN) ./files/bin/nyn-x86_64 $(1)/usr/bin/nyn)
$(if $(findstring i386,$(ARCH)),$(INSTALL_BIN) ./files/bin/nyn-i686 $(1)/usr/bin/nyn)
$(INSTALL_BIN) ./files/usr/bin/nyn-device-info $(1)/usr/bin/
$(INSTALL_CONF) ./files/etc/config/nyn $(1)/etc/config/
$(INSTALL_CONF) ./files/etc/nyn/config.toml $(1)/etc/nyn/
$(INSTALL_BIN) ./files/etc/init.d/nyn $(1)/etc/init.d/
endef
$(eval $(call BuildPackage,nyn))

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,16 +0,0 @@
config general 'general'
option enabled '0'
option timeout '5'
option retry '5'
option schedule_callback '0'
config crypto 'crypto'
option win_ver 'r70393861'
option client_key 'Oly5D62FaE94W7'
option client_version ''
config auth 'auth'
option user ''
option password ''
option device 'eth0'
option hardware_description ''

View File

@@ -1,41 +0,0 @@
#!/bin/sh /etc/rc.common
START=99
USE_PROCD=1
CONFIG=/etc/nyn/config.toml
start_service() {
generate_config
procd_open_instance
procd_set_param command /usr/bin/nyn -config "$CONFIG"
procd_set_param respawn
procd_close_instance
}
stop_service() {
procd_kill nyn
}
generate_config() {
mkdir -p /etc/nyn
cat >"$CONFIG" <<EOF
# Auto-generated by UCI
[general]
timeout = $(uci -q get nyn.general.timeout)
retry = $(uci -q get nyn.general.retry)
schedule_callback = $([ "$(uci -q get nyn.general.schedule_callback)" = "1" ] && echo "true" || echo "false")
[crypto]
win_ver = "$(uci -q get nyn.crypto.win_ver)"
client_key = "$(uci -q get nyn.crypto.client_key)"
[[auth]]
user = "$(uci -q get nyn.auth.user)"
password = "$(uci -q get nyn.auth.password)"
device = "$(uci -q get nyn.auth.device)"
EOF
}

View File

@@ -1,18 +0,0 @@
# Default configuration for NYN 802.1x client
# This file will be generated by UCI system
[general]
timeout = 5
retry = 5
schedule_callback = false
[crypto]
win_ver = "r70393861"
client_key = "Oly5D62FaE94W7"
# client_version = ""
[[auth]]
user = ""
password = ""
device = "eth0"
# hardware_description = ""

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 KiB

After

Width:  |  Height:  |  Size: 155 KiB

64
zzz/Makefile Normal file
View File

@@ -0,0 +1,64 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=zzz
PKG_VERSION:=2.0.0
PKG_RELEASE:=1
PKG_MAINTAINER:=Dichgrem <brcefy@gmail.com>
PKG_LICENSE:=MIT
include $(INCLUDE_DIR)/package.mk
define Package/zzz
SECTION:=net
CATEGORY:=Network
TITLE:=ZZZ 802.1x Authentication Client
URL:=https://github.com/diredocks/zzz
DEPENDS:=+libpcap
endef
define Package/zzz/description
A 802.1x authentication client for OpenWrt routers.
Cross-compiled C version for optimal performance and compatibility.
endef
define Package/zzz/conffiles
/etc/config/zzz
/etc/zzz/config.ini
endef
define Build/Prepare
endef
define Build/Configure
endef
define Build/Compile
endef
define Package/zzz/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_DIR) $(1)/etc/zzz
# Install precompiled binary based on architecture
$(if $(CONFIG_TARGET_x86_64),$(INSTALL_BIN) ./files/bin/zzz-x86_64-linux-musl $(1)/usr/bin/zzz)
$(if $(CONFIG_TARGET_armvirt_64),$(INSTALL_BIN) ./files/bin/zzz-aarch64-linux-musl $(1)/usr/bin/zzz)
$(if $(CONFIG_TARGET_bcm27xx_bcm2711),$(INSTALL_BIN) ./files/bin/zzz-aarch64-linux-musl $(1)/usr/bin/zzz)
$(if $(CONFIG_TARGET_ath79_generic),$(INSTALL_BIN) ./files/bin/zzz-mipsel-linux-musleabi $(1)/usr/bin/zzz)
$(if $(CONFIG_TARGET_ramips_mt7621),$(INSTALL_BIN) ./files/bin/zzz-mipsel-linux-musleabi $(1)/usr/bin/zzz)
$(if $(CONFIG_TARGET_mediatek_mt7622),$(INSTALL_BIN) ./files/bin/zzz-aarch64-linux-musl $(1)/usr/bin/zzz)
$(if $(CONFIG_TARGET_rockchip_armv8),$(INSTALL_BIN) ./files/bin/zzz-aarch64-linux-musl $(1)/usr/bin/zzz)
# Fallback - try to detect architecture
$(if $(findstring aarch64,$(ARCH)),$(INSTALL_BIN) ./files/bin/zzz-aarch64-linux-musl $(1)/usr/bin/zzz)
$(if $(findstring mips,$(ARCH)),$(INSTALL_BIN) ./files/bin/zzz-mipsel-linux-musleabi $(1)/usr/bin/zzz)
$(if $(findstring x86,$(ARCH)),$(INSTALL_BIN) ./files/bin/zzz-x86_64-linux-musl $(1)/usr/bin/zzz)
$(INSTALL_BIN) ./files/usr/bin/zzz-device-info $(1)/usr/bin/
$(INSTALL_CONF) ./files/etc/config/zzz $(1)/etc/config/
$(INSTALL_CONF) ./files/etc/zzz/config.ini $(1)/etc/zzz/
$(INSTALL_BIN) ./files/etc/init.d/zzz $(1)/etc/init.d/
endef
$(eval $(call BuildPackage,zzz))

Binary file not shown.

Binary file not shown.

Binary file not shown.

7
zzz/files/etc/config/zzz Normal file
View File

@@ -0,0 +1,7 @@
config general 'general'
option enabled '1'
config auth 'auth'
option username ''
option password ''
option device 'eth0'

54
zzz/files/etc/init.d/zzz Normal file
View File

@@ -0,0 +1,54 @@
#!/bin/sh /etc/rc.common
START=99
USE_PROCD=1
CONFIG=/etc/zzz/config.ini
start_service() {
# 检查是否启用
local enabled=$(uci -q get zzz.general.enabled)
[ "$enabled" = "1" ] || {
echo "zzz is disabled"
return 1
}
generate_config
procd_open_instance
procd_set_param command /usr/bin/zzz "$CONFIG"
procd_set_param respawn
procd_close_instance
}
stop_service() {
procd_kill zzz
}
generate_config() {
mkdir -p /etc/zzz
# 获取UCI配置
local username=$(uci -q get zzz.auth.username)
local password=$(uci -q get zzz.auth.password)
local device=$(uci -q get zzz.auth.device)
# 检查必要参数
[ -z "$username" ] && {
logger -t zzz "Error: username not configured"
return 1
}
[ -z "$password" ] && {
logger -t zzz "Error: password not configured"
return 1
}
# 生成INI配置文件
cat >"$CONFIG" <<EOF
[auth]
username = $username
password = $password
device = ${device:-eth0}
EOF
}

View File

@@ -0,0 +1,7 @@
# Default configuration for zzz 802.1x client
# This file will be generated by UCI system
[auth]
username =
password =
device = eth0

View File

@@ -1,16 +1,16 @@
#!/bin/sh
# /usr/bin/nyn-device-info
# Helper script to get device information for NYN configuration
# /usr/bin/zzz-device-info
# Helper script to get device information for zzz configuration
echo "Available network devices:"
echo "=========================="
if command -v nyn >/dev/null 2>&1; then
nyn -mode info 2>/dev/null | grep -E "(Found|device|hardware_description)" | while read line; do
if command -v zzz >/dev/null 2>&1; then
zzz -mode info 2>/dev/null | grep -E "(Found|device|hardware_description)" | while read line; do
echo "$line"
done
else
echo "NYN binary not found. Showing available network interfaces:"
echo "zzz binary not found. Showing available network interfaces:"
for dev in /sys/class/net/*; do
if [ -d "$dev" ]; then
iface=$(basename "$dev")