This commit is contained in:
sbwml 2021-12-18 19:26:41 +08:00
commit 5b103dab53
5 changed files with 73 additions and 71 deletions

View File

@ -1,6 +1,8 @@
应用过滤是一款基于OpenWrt的家长管理插件支持游戏、视频、聊天、下载等app过滤
这是5.x源码只对重大bug进行修复。
### 如何编译应用过滤固件
1. 准备OpenWrt源码并编译成功
推荐源码仓库:
@ -22,7 +24,6 @@ https://zhuanlan.zhihu.com/p/419053529
### 固件和特征库下载地址
https://destan19.github.io
如果访问不了可以切换4G网络或者运营商部分网络屏蔽了github.io
### 演示视频
https://www.bilibili.com/video/BV1ZL41137aT/
@ -33,11 +34,9 @@ https://github.com/destan19/openfros
2. 在release中下载ipk文件直接安装
### OpenWrt应用过滤交流群
群号: 943396288
点击链接加入群聊【OpenWrt交流群(OAF)】:
https://jq.qq.com/?_wv=1027&k=TqQ6VvtV
群号: 868508199
点击链接加入群聊【OpenWrt技术交流】https://jq.qq.com/?_wv=1027&k=GRkd86no
App filtering is a parent management plug-in based on OpenWrt, which supports app filtering for games, videos, chats, downloads, etc.
### How to compile application filtering firmware

View File

@ -4,9 +4,23 @@ local dsp = require "luci.dispatcher"
-%>
#display{
display: flex;
display: flex;
flex-direction: row;
flex-wrap: wrap;
padding: 20px;
}
#main{
min-width: 600px;
height: 300px;
display: inline-block;
flex: 2 2 10%;
}
#main2{
min-width: 600px;
height: 300px;
display: inline-block;
flex: 2 2 10%;
}
table.imagetable {
font-family: verdana,arial,sans-serif;
font-size:11px;
@ -14,6 +28,7 @@ table.imagetable {
border-width: 1px;
border-color: #999999;
border-collapse: collapse;
padding-top:10px;
}
<!--
table.imagetable th {
@ -34,7 +49,7 @@ table.imagetable td {
<script type="text/javascript" src="<%=resource%>/echarts.min.js"></script>
<script type="text/javascript" src="<%=resource%>/echarts.min.js?v=5.0"></script>
<script type="text/javascript">//<![CDATA[
window.onload =function(){
@ -297,7 +312,7 @@ table.imagetable td {
hostname=st[i].hostname;
}
var tr = tb.insertRow(-1);
//tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1);
tr.className = 'tr cbi-rowstyle-' + ((i % 2) + 1);
tr.insertCell(-1).innerHTML = st[i].appname;
tr.insertCell(-1).innerHTML = hostname;
tr.insertCell(-1).innerHTML = st[i].mac;
@ -320,6 +335,11 @@ table.imagetable td {
tr.insertCell(-1).innerHTML = total_time_str;
tr.insertCell(-1).innerHTML = action_status;
var childs = tr.childNodes;
Array.prototype.forEach.call(childs,function(child){
child.className = 'td';
});
}
}
@ -329,23 +349,23 @@ table.imagetable td {
//]]></script>
<fieldset class="cbi-section">
<div class="cbi-section cbi-tblsection">
<div id="display">
<div id="main" style="width: 500px;height:300px;"></div>
<div id="main2" style="width: 400px;height:300px;"></div>
<div id="main" class="main left"></div>
<div id="main2" class="main2 left"></div>
</div>
<table class="imagetable" id="user_status_table">
<tr>
<th ><%:App Name%></th>
<th ><%:Hostname%></th>
<th ><%:Mac%></th>
<th><%:Start Time%></th>
<th><%:Visit Time%></th>
<th><%:Filter Status%></th>
<table class="table cbi-section-table" id="user_status_table">
<tr class="tr table-titles">
<th class="th"><%:App Name%></th>
<th class="th"><%:Hostname%></th>
<th class="th"><%:Mac%></th>
<th class="th"><%:Start Time%></th>
<th class="th"><%:Visit Time%></th>
<th class="th"><%:Filter Status%></th>
</tr>
<tr>
<td colspan="8"><em><br /><%:Collecting data...%></em></td>
<tr class="tr table-titles">
<td class="td" colspan="8"><em><br /><%:Collecting data...%></em></td>
</tr>
</table>
</fieldset>
</div>

View File

@ -1,32 +1,6 @@
<style type="text/css">
<%
local dsp = require "luci.dispatcher"
-%>
table.imagetable {
font-family: verdana,arial,sans-serif;
font-size:11px;
color:#333333;
border-width: 1px;
border-color: #999999;
border-collapse: collapse;
}
<!--
table.imagetable th {
background:#f5f5f5
border-width: 0px;
padding: 5px;
border-style: solid;
border-color: #999999;
}
table.imagetable td {
background:#ffffffff
border-width: 0px;
padding: 5px;
border-style: solid;
border-color: #999999;
}-->
</style>
<script type="text/javascript">//<![CDATA[
XHR.poll(5, '<%=url('admin/network/dev_app_status')%>', null,
function(x, st)
@ -48,7 +22,7 @@ table.imagetable td {
hostname=devlist[i].hostname;
}
var tr = tb.insertRow(-1);
//tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1);
tr.className = 'tr cbi-rowstyle-' + ((i % 2) + 1);
tr.insertCell(-1).innerHTML = i + 1;
tr.insertCell(-1).innerHTML = hostname;
tr.insertCell(-1).innerHTML = "<a href='<%=url('admin/network/appfilter/')%>"+devlist[i].mac+"'>"+devlist[i].mac+"</a>";
@ -64,10 +38,16 @@ table.imagetable td {
app_list_str="--"
}
tr.insertCell(-1).innerHTML = app_list_str;
if (devlist[i].online == 1)
if (devlist[i].online == 1){
tr.insertCell(-1).innerHTML = "<%:Online%>";
else
}else{
tr.insertCell(-1).innerHTML = "<%:Offline%>";
}
var childs = tr.childNodes;
Array.prototype.forEach.call(childs,function(child){
child.className = 'td';
});
}
}
}
@ -76,19 +56,19 @@ table.imagetable td {
//]]></script>
<fieldset class="cbi-section">
<legend><%:Client List%></legend>
<table class="imagetable" id="user_status_table">
<tr>
<th ><%:Id%></th>
<th ><%:Hostname%></th>
<th ><%:Mac%></th>
<th ><%:Ip%></th>
<th><%:Common App(TOP5)%></th>
<th><%:Online Status%></th>
<div class="cbi-section cbi-tblsection">
<h3><%:Client List%></h3>
<table class="table cbi-section-table" id="user_status_table">
<tr class="tr table-titles">
<th class="th"><%:Id%></th>
<th class="th"><%:Hostname%></th>
<th class="th"><%:Mac%></th>
<th class="th"><%:Ip%></th>
<th class="th"><%:Common App(TOP5)%></th>
<th class="th"><%:Online Status%></th>
</tr>
<tr>
<td colspan="8"><em><br /><%:Collecting data...%></em></td>
<tr class="tr">
<td class="td" colspan="8"><em><br /><%:Collecting data...%></em></td>
</tr>
</table>
</fieldset>
</div>

View File

@ -134,11 +134,14 @@ int __add_app_feature(int appid,
if (begin != dict) {
strncpy(pos, begin, p - begin);
k_sscanf(pos, "%d:%x",&index, &value);
node->pos_info[node->pos_num].pos = index;
node->pos_info[node->pos_num].value = value;
node->pos_num++;
}
else{
strcpy(pos, dict);
}
k_sscanf(pos, "%d:%x",&index, &value);
node->pos_info[node->pos_num].pos = index;
node->pos_info[node->pos_num].value = value;
node->pos_num++;
feature_list_write_lock();
list_add(&(node->head), &af_feature_head);
feature_list_write_unlock();
@ -659,7 +662,8 @@ int af_match_one(flow_info_t *flow, af_feature_node_t *node)
AF_ERROR("node or flow is NULL\n");
return AF_FALSE;
}
if (node->proto > 0 && flow->l4_protocol != node->proto)
return AF_FALSE;
if (flow->l4_len == 0)
return AF_FALSE;

View File

@ -236,7 +236,6 @@ int af_set_mac_list(cJSON * data_obj)
return -1;
}
if (-1 == mac_to_hex(mac_obj->valuestring, mac_hex)){
AF_ERROR("mac format error: %s\n", mac_obj->valuestring);
continue;
}
af_mac_add(mac_hex);