├── .gitattributes ├── LICENSE ├── README.md ├── WJ_firewall ├── WJ_firewall.pro ├── WJ_firewall.pro.user ├── aboutdialog.cpp ├── aboutdialog.h ├── aboutdialog.ui ├── common.cpp ├── common.h ├── main.cpp ├── mainwindow.cpp ├── mainwindow.h ├── mainwindow.ui ├── messagedialog.cpp ├── messagedialog.h ├── messagedialog.ui ├── ruledialog.cpp ├── ruledialog.h ├── ruledialog.ui ├── ruledialog_m.cpp ├── ruledialog_m.h └── ruledialog_m.ui ├── bin ├── WJ_firewall.ko ├── ckmod.sh ├── insmod.sh ├── log.sh ├── main.sh └── rmmod.sh ├── build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Debug ├── .qmake.stash ├── Makefile ├── WJ_firewall ├── aboutdialog.o ├── common.o ├── main.o ├── mainwindow.o ├── messagedialog.o ├── moc_aboutdialog.cpp ├── moc_aboutdialog.o ├── moc_mainwindow.cpp ├── moc_mainwindow.o ├── moc_messagedialog.cpp ├── moc_messagedialog.o ├── moc_predefs.h ├── moc_ruledialog.cpp ├── moc_ruledialog.o ├── moc_ruledialog_m.cpp ├── moc_ruledialog_m.o ├── ruledialog.o ├── ruledialog_m.o ├── ui_aboutdialog.h ├── ui_mainwindow.h ├── ui_messagedialog.h ├── ui_ruledialog.h └── ui_ruledialog_m.h ├── data ├── log.txt ├── rule.txt ├── rule_new └── rule_out ├── image ├── About.png ├── AddRule.png ├── DeleteRule.png ├── ExportRule.png ├── ImportRule.png ├── Log.png ├── MainWindow.png └── ModifyRule.png └── my_mod ├── Makefile └── WJ_firewall.c /.gitattributes: -------------------------------------------------------------------------------- 1 | *.o linguist-language=c 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 MR.YUAN 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | - 开发环境: 2 | - 操作系统:Ubuntu 15.10 3 | - 内核版本:4.2.0-16-generic 4 | - 开发软件:Qt 5.9.0 5 | - 编译器:gcc version 5.2.1 6 | 7 | - 项目内容: 8 | ``` 9 | |--WJ_firewall文件夹(应用层:使用Qt开发的用户界面) 10 | |--…… 11 | 12 | |--build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Debug文件夹(Qt编译产生的可执行程序,sudo ./WJ_firewall 可运行) 13 | |--WJ_firewall(可执行程序) 14 | |--…… 15 | 16 | |--my_mod文件夹(内核模块代码:在NF_INET_POST_ROUTING结点挂在钩子函数,接收规则并过滤报文) 17 | |--WJ_firewall.c 18 | |--Makefile(sudo make 编译得到内核模块WJ_firewall.ko,并自动复制到bin文件夹) 19 | 20 | |--bin文件夹 21 | |--main.sh(在应用层代码中被调用,通过调用其他shell脚本进行内核模块的插入、检查、移除和报文过滤日志的采集) 22 | |--insmod.sh(内核模块插入) 23 | |--ckmod.sh(检查内核模块是否插入) 24 | |--rmmod.sh(内核模块移除) 25 | |--log.sh(报文过滤日志的采集) 26 | |--data文件夹 27 | |--rule.txt(保存正在运行的过滤规则) 28 | |--log.txt(保存报文过滤日志记录) 29 | |--rule_new(待导入的过滤规则,格式:SrcIP%DstIP%SPort%DPort%Time_Flag%Start_Hour%Start_Min%Stop_Hour%Stop_Min%Protocol) 30 | |--rule_out(导出的过滤规则) 31 | |--image文件夹(软件运行界面截图) 32 | |--…… 33 | |--doc文件夹(项目开发文档) 34 | ``` 35 | 36 | - 说明: 37 | ``` 38 | - 防火墙为黑名单模式,符合规则之一报文即被Reject 39 | - 对于所有被Reject的报文都自动进行日志记录 40 | - 对于一些新版本内核需要修改内核部分代码,WJ_firewall.c文件中: 41 | - nf_register_hook(&myhook)函数 需改为 nf_register_net_hook(&init_net,&myhook) 42 | - nf_unregister_hook(&myhook)函数 需改为 nf_unregister_net_hook(&init_net,&myhook) 43 | - 使用前需安装Qt5并配置好环境: 44 | - 修改/usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf文件为新安装Qt路径 45 | - 使用Qt前还需安装libGL库:sudo apt-get install libgl1-mesa-dev 46 | ``` 47 | 48 | - 运行界面: 49 | - 主界面 50 | 51 | ![Image text](/image/MainWindow.png) 52 | - 添加规则 53 | 54 | ![Image text](/image/AddRule.png) 55 | - 修改规则 56 | 57 | ![Image text](/image/ModifyRule.png) 58 | - 删除规则 59 | 60 | ![Image text](/image/DeleteRule.png) 61 | - 导入规则 62 | 63 | ![Image text](/image/ImportRule.png) 64 | - 导出规则 65 | 66 | ![Image text](/image/ExportRule.png) 67 | - 过滤日志记录 68 | 69 | ![Image text](/image/Log.png) 70 | - 关于 71 | 72 | ![Image text](/image/About.png) 73 | 74 | -------------------------------------------------------------------------------- /WJ_firewall/WJ_firewall.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2018-12-03T20:29:24 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += core gui 8 | 9 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 10 | 11 | TARGET = WJ_firewall 12 | TEMPLATE = app 13 | 14 | # The following define makes your compiler emit warnings if you use 15 | # any feature of Qt which as been marked as deprecated (the exact warnings 16 | # depend on your compiler). Please consult the documentation of the 17 | # deprecated API in order to know how to port your code away from it. 18 | DEFINES += QT_DEPRECATED_WARNINGS 19 | 20 | # You can also make your code fail to compile if you use deprecated APIs. 21 | # In order to do so, uncomment the following line. 22 | # You can also select to disable deprecated APIs only up to a certain version of Qt. 23 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 24 | 25 | 26 | SOURCES += \ 27 | main.cpp \ 28 | mainwindow.cpp \ 29 | common.cpp \ 30 | messagedialog.cpp \ 31 | ruledialog.cpp \ 32 | ruledialog_m.cpp \ 33 | aboutdialog.cpp 34 | 35 | HEADERS += \ 36 | mainwindow.h \ 37 | common.h \ 38 | messagedialog.h \ 39 | ruledialog.h \ 40 | ruledialog_m.h \ 41 | aboutdialog.h 42 | 43 | FORMS += \ 44 | mainwindow.ui \ 45 | messagedialog.ui \ 46 | ruledialog.ui \ 47 | ruledialog_m.ui \ 48 | aboutdialog.ui 49 | 50 | -------------------------------------------------------------------------------- /WJ_firewall/WJ_firewall.pro.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | EnvironmentId 7 | {d0ebe77c-9352-4865-9a80-312853b2798a} 8 | 9 | 10 | ProjectExplorer.Project.ActiveTarget 11 | 0 12 | 13 | 14 | ProjectExplorer.Project.EditorSettings 15 | 16 | true 17 | false 18 | true 19 | 20 | Cpp 21 | 22 | CppGlobal 23 | 24 | 25 | 26 | QmlJS 27 | 28 | QmlJSGlobal 29 | 30 | 31 | 2 32 | UTF-8 33 | false 34 | 4 35 | false 36 | 80 37 | true 38 | true 39 | 1 40 | true 41 | false 42 | 0 43 | true 44 | true 45 | 0 46 | 8 47 | true 48 | 1 49 | true 50 | true 51 | true 52 | false 53 | 54 | 55 | 56 | ProjectExplorer.Project.PluginSettings 57 | 58 | 59 | 60 | ProjectExplorer.Project.Target.0 61 | 62 | Desktop Qt 5.9.0 GCC 64bit 63 | Desktop Qt 5.9.0 GCC 64bit 64 | qt.59.gcc_64_kit 65 | 0 66 | 0 67 | 0 68 | 69 | /home/virgil/Firewall/build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Debug 70 | 71 | 72 | true 73 | qmake 74 | 75 | QtProjectManager.QMakeBuildStep 76 | true 77 | 78 | false 79 | false 80 | false 81 | 82 | 83 | true 84 | Make 85 | 86 | Qt4ProjectManager.MakeStep 87 | 88 | -w 89 | -r 90 | 91 | false 92 | 93 | 94 | 95 | 2 96 | 构建 97 | 98 | ProjectExplorer.BuildSteps.Build 99 | 100 | 101 | 102 | true 103 | Make 104 | 105 | Qt4ProjectManager.MakeStep 106 | 107 | -w 108 | -r 109 | 110 | true 111 | clean 112 | 113 | 114 | 1 115 | 清理 116 | 117 | ProjectExplorer.BuildSteps.Clean 118 | 119 | 2 120 | false 121 | 122 | Debug 123 | 124 | Qt4ProjectManager.Qt4BuildConfiguration 125 | 2 126 | true 127 | 128 | 129 | /home/virgil/Firewall/build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Release 130 | 131 | 132 | true 133 | qmake 134 | 135 | QtProjectManager.QMakeBuildStep 136 | false 137 | 138 | false 139 | false 140 | false 141 | 142 | 143 | true 144 | Make 145 | 146 | Qt4ProjectManager.MakeStep 147 | 148 | -w 149 | -r 150 | 151 | false 152 | 153 | 154 | 155 | 2 156 | 构建 157 | 158 | ProjectExplorer.BuildSteps.Build 159 | 160 | 161 | 162 | true 163 | Make 164 | 165 | Qt4ProjectManager.MakeStep 166 | 167 | -w 168 | -r 169 | 170 | true 171 | clean 172 | 173 | 174 | 1 175 | 清理 176 | 177 | ProjectExplorer.BuildSteps.Clean 178 | 179 | 2 180 | false 181 | 182 | Release 183 | 184 | Qt4ProjectManager.Qt4BuildConfiguration 185 | 0 186 | true 187 | 188 | 189 | /home/virgil/Firewall/build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Profile 190 | 191 | 192 | true 193 | qmake 194 | 195 | QtProjectManager.QMakeBuildStep 196 | true 197 | 198 | false 199 | true 200 | false 201 | 202 | 203 | true 204 | Make 205 | 206 | Qt4ProjectManager.MakeStep 207 | 208 | -w 209 | -r 210 | 211 | false 212 | 213 | 214 | 215 | 2 216 | 构建 217 | 218 | ProjectExplorer.BuildSteps.Build 219 | 220 | 221 | 222 | true 223 | Make 224 | 225 | Qt4ProjectManager.MakeStep 226 | 227 | -w 228 | -r 229 | 230 | true 231 | clean 232 | 233 | 234 | 1 235 | 清理 236 | 237 | ProjectExplorer.BuildSteps.Clean 238 | 239 | 2 240 | false 241 | 242 | Profile 243 | 244 | Qt4ProjectManager.Qt4BuildConfiguration 245 | 0 246 | true 247 | 248 | 3 249 | 250 | 251 | 0 252 | 部署 253 | 254 | ProjectExplorer.BuildSteps.Deploy 255 | 256 | 1 257 | 在本地部署 258 | 259 | ProjectExplorer.DefaultDeployConfiguration 260 | 261 | 1 262 | 263 | 264 | false 265 | false 266 | 1000 267 | 268 | true 269 | 270 | false 271 | false 272 | false 273 | false 274 | true 275 | 0.01 276 | 10 277 | true 278 | 1 279 | 25 280 | 281 | 1 282 | true 283 | false 284 | true 285 | valgrind 286 | 287 | 0 288 | 1 289 | 2 290 | 3 291 | 4 292 | 5 293 | 6 294 | 7 295 | 8 296 | 9 297 | 10 298 | 11 299 | 12 300 | 13 301 | 14 302 | 303 | 2 304 | 305 | WJ_firewall 306 | 307 | Qt4ProjectManager.Qt4RunConfiguration:/home/virgil/Firewall/WJ_firewall/WJ_firewall.pro 308 | true 309 | 310 | WJ_firewall.pro 311 | false 312 | 313 | /home/virgil/Firewall/build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Debug 314 | 3768 315 | false 316 | true 317 | false 318 | false 319 | true 320 | 321 | 1 322 | 323 | 324 | 325 | ProjectExplorer.Project.TargetCount 326 | 1 327 | 328 | 329 | ProjectExplorer.Project.Updater.FileVersion 330 | 18 331 | 332 | 333 | Version 334 | 18 335 | 336 | 337 | -------------------------------------------------------------------------------- /WJ_firewall/aboutdialog.cpp: -------------------------------------------------------------------------------- 1 | #include "aboutdialog.h" 2 | #include "ui_aboutdialog.h" 3 | 4 | aboutdialog::aboutdialog(QWidget *parent) : 5 | QDialog(parent), 6 | ui(new Ui::aboutdialog) 7 | { 8 | ui->setupUi(this); 9 | } 10 | 11 | void aboutdialog::setMessage(QString message) 12 | { 13 | QFont ft; 14 | ft.setPointSize(11); 15 | ui->label->setFont(ft); 16 | ui->label->setText(message); 17 | } 18 | 19 | aboutdialog::~aboutdialog() 20 | { 21 | delete ui; 22 | } 23 | 24 | void aboutdialog::on_pushButton_ok_clicked() 25 | { 26 | this->close(); 27 | } 28 | -------------------------------------------------------------------------------- /WJ_firewall/aboutdialog.h: -------------------------------------------------------------------------------- 1 | #ifndef ABOUTDIALOG_H 2 | #define ABOUTDIALOG_H 3 | 4 | #include 5 | #include 6 | 7 | namespace Ui { 8 | class aboutdialog; 9 | } 10 | 11 | class aboutdialog : public QDialog 12 | { 13 | Q_OBJECT 14 | 15 | public: 16 | explicit aboutdialog(QWidget *parent = 0); 17 | void setMessage(QString message); 18 | ~aboutdialog(); 19 | 20 | private slots: 21 | void on_pushButton_ok_clicked(); 22 | 23 | private: 24 | Ui::aboutdialog *ui; 25 | }; 26 | 27 | #endif // ABOUTDIALOG_H 28 | -------------------------------------------------------------------------------- /WJ_firewall/aboutdialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | aboutdialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 420 10 | 300 11 | 12 | 13 | 14 | About 15 | 16 | 17 | 18 | 19 | 170 20 | 250 21 | 80 22 | 30 23 | 24 | 25 | 26 | 27 | 80 28 | 30 29 | 30 | 31 | 32 | 33 | 80 34 | 30 35 | 36 | 37 | 38 | 确定 39 | 40 | 41 | 42 | 43 | 44 | 60 45 | 30 46 | 300 47 | 201 48 | 49 | 50 | 51 | 52 | 300 53 | 0 54 | 55 | 56 | 57 | 58 | 300 59 | 16777215 60 | 61 | 62 | 63 | TextLabel 64 | 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /WJ_firewall/common.cpp: -------------------------------------------------------------------------------- 1 | #include "common.h" 2 | 3 | QList ruleStringList; 4 | 5 | bool ruleFromString_new(rule_str_tp ruleString, char *p_controlinfo) 6 | { 7 | unsigned int controlled_protocol = 0; 8 | unsigned short controlled_srcport = 0; 9 | unsigned short controlled_dstport = 0; 10 | unsigned int controlled_saddr = 0; 11 | unsigned int controlled_daddr = 0; 12 | unsigned int controlled_time_flag = 0; 13 | unsigned int controlled_time_begin = 0; 14 | unsigned int controlled_time_end = 0; 15 | 16 | //协议 17 | if (strncmp(ruleString.protocol.toStdString().data(), "icmp",4) == 0 ) 18 | controlled_protocol = 1; 19 | else if ( strncmp(ruleString.protocol.toStdString().data(), "tcp",3) == 0 ) 20 | controlled_protocol = 6; 21 | else if ( strncmp(ruleString.protocol.toStdString().data(), "udp",3) == 0 ) 22 | controlled_protocol = 17; 23 | else if (strncmp( ruleString.protocol.toStdString().data(), "any",3) == 0 ) 24 | controlled_protocol = 0; 25 | else { 26 | printf("Unkonwn protocol! please check and try again! \n"); 27 | return false; 28 | } 29 | 30 | //源地址 31 | if (strncmp(ruleString.src_addr.toStdString().data(),"any",3) == 0) 32 | controlled_saddr = 0; 33 | else if ( inet_aton(ruleString.src_addr.toStdString().data(), (struct in_addr* )&controlled_saddr) == 0){ 34 | printf("Invalid source ip address! please check and try again! \n "); 35 | return false; 36 | } 37 | 38 | //目的地址 39 | if (strncmp(ruleString.dst_addr.toStdString().data(),"any",3) == 0) 40 | controlled_daddr = 0; 41 | else if ( inet_aton(ruleString.dst_addr.toStdString().data(), (struct in_addr* )&controlled_daddr) == 0){ 42 | printf("Invalid destination ip address! please check and try again! \n "); 43 | return false; 44 | } 45 | 46 | //源端口 47 | unsigned short tmpport; 48 | if (strncmp(ruleString.src_port.toStdString().data(),"any",3) == 0) 49 | controlled_srcport = 0; 50 | else { 51 | tmpport = atoi(ruleString.src_port.toStdString().data()); 52 | if (tmpport == 0){ 53 | printf("Invalid source port! please check and try again! \n "); 54 | return false; 55 | } 56 | controlled_srcport = htons(tmpport); 57 | } 58 | 59 | //目的端口 60 | if (strncmp(ruleString.dst_port.toStdString().data(),"any",3) == 0) 61 | controlled_dstport = 0; 62 | else { 63 | tmpport = atoi(ruleString.dst_port.toStdString().data()); 64 | if (tmpport == 0){ 65 | printf("Invalid dst port! please check and try again! \n "); 66 | return false; 67 | } 68 | controlled_dstport = htons(tmpport); 69 | } 70 | 71 | //Time_Flag 72 | if (strncmp(ruleString.time_flag.toStdString().data(), "yes",3) == 0 ) 73 | controlled_time_flag = 1; 74 | else if ( strncmp(ruleString.time_flag.toStdString().data(), "no",2) == 0 ) 75 | controlled_time_flag = 0; 76 | else { 77 | printf("Time Flag Wrong! \n"); 78 | return false; 79 | } 80 | 81 | //Time_Begin 82 | controlled_time_begin = ruleString.hour_begin.toInt()*60 + ruleString.min_begin.toInt(); 83 | //Time_End 84 | controlled_time_end = ruleString.hour_end.toInt()*60 + ruleString.min_end.toInt(); 85 | 86 | //放入字符串中 87 | *(int *)p_controlinfo = controlled_protocol; 88 | *(int *)(p_controlinfo + 4) = controlled_saddr; 89 | *(int *)(p_controlinfo + 8) = controlled_daddr; 90 | *(int *)(p_controlinfo + 12) = controlled_srcport; 91 | *(int *)(p_controlinfo + 16) = controlled_dstport; 92 | *(int *)(p_controlinfo + 20) = controlled_time_flag; 93 | *(int *)(p_controlinfo + 24) = controlled_time_begin; 94 | *(int *)(p_controlinfo + 28) = controlled_time_end; 95 | 96 | return true; 97 | } 98 | 99 | bool ruleAddrCheck(QString addrString) 100 | { 101 | //check ip 102 | QRegExp ip_reg("^([1-9]?\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\." 103 | "([1-9]?\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\." 104 | "([1-9]?\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\." 105 | "([1-9]?\\d|1\\d\\d|2[0-4]\\d|25[0-5])$"); 106 | if (addrString == "any"){ 107 | return true; 108 | } else{ 109 | QStringList addrStringSpilt = addrString.split("/"); 110 | //mask 111 | if (addrStringSpilt.length() == 2){ 112 | bool ok; 113 | int mask = addrStringSpilt[1].toInt(&ok); 114 | if (!ok || mask < 0 || mask > 32){ 115 | return false; 116 | } 117 | } else if (addrStringSpilt.length() != 1){ 118 | return false; 119 | } 120 | //addr 121 | if (!ip_reg.exactMatch(addrStringSpilt[0])){ 122 | return false; 123 | } 124 | } 125 | return true; 126 | } 127 | 128 | bool rulePortCheck(QString portString) 129 | { 130 | if (portString == "any"){ 131 | return true; 132 | } else{ 133 | bool ok; 134 | int port = portString.toInt(&ok); 135 | if (!ok || port < 0 || port > 65535){ 136 | return false; 137 | } 138 | } 139 | return true; 140 | } 141 | -------------------------------------------------------------------------------- /WJ_firewall/common.h: -------------------------------------------------------------------------------- 1 | #ifndef COMMON_H 2 | #define COMMON_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | 33 | #define RULE_COUNT_MAX 50 //最大规则数 34 | #define LOG_UPDATE_TIME 100 //ms 35 | 36 | 37 | struct rule_str_tp //保存规则信息 38 | { 39 | QString src_addr; //0 4B 40 | QString dst_addr; //1 4B 41 | QString src_port; //2 4B 42 | QString dst_port; //3 4B 43 | QString time_flag; //4 4B 44 | QString hour_begin;//5 4B 45 | QString min_begin; //6 46 | QString hour_end; //7 4B 47 | QString min_end; //8 48 | QString protocol; //9 4B 49 | }; 50 | 51 | bool ruleFromString_new(rule_str_tp ruleString, char *p_controlinfo); 52 | bool ruleAddrCheck(QString addrString); 53 | bool rulePortCheck(QString portString); 54 | 55 | #endif // COMMON_H 56 | -------------------------------------------------------------------------------- /WJ_firewall/main.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | #include 3 | 4 | rule_str_tp modrule; 5 | int main(int argc, char *argv[]) 6 | { 7 | QApplication a(argc, argv); 8 | MainWindow w; 9 | w.move(QApplication::desktop()->screenGeometry().center()- w.rect().center()); 10 | w.show(); 11 | 12 | return a.exec(); 13 | } 14 | -------------------------------------------------------------------------------- /WJ_firewall/mainwindow.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | #include "ui_mainwindow.h" 3 | char controlinfo[1600]; 4 | int numa=0; 5 | 6 | MainWindow::MainWindow(QWidget *parent) : 7 | QMainWindow(parent), 8 | ui(new Ui::MainWindow) 9 | { 10 | //主窗口初始化设置 11 | ui->setupUi(this); 12 | addRuleDialog = new RuleDialog(this); 13 | delRuleDialog = new MessageDialog(this); 14 | aboutDialog = new aboutdialog(this); 15 | delRuleDialog->setMessage("确定要删除吗?"); 16 | label_runStatus = new QLabel(); 17 | label_runStatus->setAlignment(Qt::AlignHCenter); 18 | label_runStatus->setMinimumHeight(25); 19 | ui->statusBar->addWidget(label_runStatus); 20 | rulesTable = ui->tableWidget; 21 | rulesTable->horizontalHeader()->setMinimumHeight(30); 22 | rulesTable->setColumnWidth(1, 150); 23 | rulesTable->setColumnWidth(3, 150); 24 | rulesTable->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch); 25 | rulesTable->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Fixed); 26 | rulesTable->horizontalHeader()->setSectionResizeMode(2, QHeaderView::Stretch); 27 | rulesTable->horizontalHeader()->setSectionResizeMode(3, QHeaderView::Fixed); 28 | rulesTable->horizontalHeader()->setSectionResizeMode(4, QHeaderView::Stretch); 29 | rulesTable->horizontalHeader()->setSectionResizeMode(5, QHeaderView::Stretch); 30 | rulesTable->horizontalHeader()->setSectionResizeMode(6, QHeaderView::Stretch); 31 | rulesTable->horizontalHeader()->setSectionResizeMode(7, QHeaderView::Stretch); 32 | rulesTable->horizontalHeader()->setSectionResizeMode(8, QHeaderView::Stretch); 33 | rulesTable->horizontalHeader()->setSectionResizeMode(9, QHeaderView::Stretch); 34 | rulesTable->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); 35 | logTimer = new QTimer(this); 36 | 37 | //check mod 38 | if (isModLoaded()){ 39 | ui->pushButton_fiterOn->setEnabled(false); 40 | label_runStatus->setText("运行状态:已启动"); 41 | logTimer->start(LOG_UPDATE_TIME); //every 100ms fresh the log 42 | }else{ 43 | ui->pushButton_fiterOff->setEnabled(false); 44 | label_runStatus->setText("运行状态:未启动"); 45 | } 46 | 47 | //connect 48 | connect(addRuleDialog, SIGNAL(addNewRuleSignal(rule_str_tp)), 49 | this, SLOT(addRuleString(rule_str_tp))); 50 | connect(delRuleDialog, SIGNAL(actionSignal(bool)), 51 | this, SLOT(delRuleString(bool))); 52 | 53 | connect(logTimer, SIGNAL(timeout()), this, SLOT(updateLog())); 54 | 55 | //set table 56 | getRuleStringFile(); 57 | } 58 | 59 | MainWindow::~MainWindow() 60 | { 61 | delete ui; 62 | } 63 | 64 | QString MainWindow::runShell(QString cmd) 65 | { 66 | //执行shell命令,调用脚本 67 | QProcess *shell = new QProcess(this); 68 | shell->start(cmd); 69 | shell->waitForFinished(); 70 | return shell->readAll(); 71 | } 72 | 73 | bool MainWindow::isModLoaded() 74 | { 75 | return runShell("bash ../bin/main.sh ckmod") == "true"; 76 | } 77 | 78 | bool MainWindow::sendRuleToFirewall() 79 | { 80 | //将ruleStringList发送个防火墙内核模块 81 | if (!isModLoaded()){ 82 | return false; 83 | } 84 | 85 | int count = 0; //记录规则数量 86 | //规则转化为字符串再发送 87 | foreach(rule_str_tp ruleString, ruleStringList){ 88 | if (ruleFromString_new(ruleString, (controlinfo+(count*32)))){ 89 | count++; 90 | } 91 | if (count > RULE_COUNT_MAX){ 92 | return false; 93 | } 94 | } 95 | int fp; 96 | fp =open("/dev/controlinfo",O_RDWR,S_IRUSR|S_IWUSR); 97 | if (fp > 0) 98 | { 99 | write(fp,controlinfo,count*32); 100 | } 101 | else { 102 | QMessageBox::critical(this, "错误", "无法打开controlinfo!"); 103 | return false; 104 | } 105 | ::close(fp); 106 | 107 | return true; 108 | } 109 | 110 | bool MainWindow::setRuleStringFile() 111 | { 112 | //将有改动的ruleStringList更新到rule.txt文档 113 | QDir dir("../data/"); 114 | if (!dir.exists()){ 115 | dir.mkdir("../data/"); 116 | } 117 | QFile f("../data/rule.txt"); 118 | if (!f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)){ 119 | QMessageBox::critical(this, "错误", "无法打开rule.txt!"); 120 | return false; 121 | } 122 | QTextStream stream(&f); 123 | foreach (rule_str_tp ruleString, ruleStringList) { 124 | QString temp = ruleString.src_addr + "%" 125 | + ruleString.dst_addr + "%" 126 | + ruleString.src_port + "%" 127 | + ruleString.dst_port + "%" 128 | + ruleString.time_flag + "%" 129 | + ruleString.hour_begin + "%" 130 | + ruleString.min_begin + "%" 131 | + ruleString.hour_end + "%" 132 | + ruleString.min_end + "%" 133 | + ruleString.protocol; 134 | stream << temp << endl; 135 | } 136 | f.close(); 137 | return true; 138 | } 139 | 140 | bool MainWindow::getRuleStringFile() 141 | { 142 | //打开规则文件 143 | QFile f("../data/rule.txt"); 144 | if (!f.exists()){ 145 | return false; 146 | } 147 | if (!f.open(QIODevice::ReadOnly | QIODevice::Text)){ 148 | QMessageBox::critical(this, "错误", "无法打开rule.txt!"); 149 | return false; 150 | } 151 | QTextStream stream(&f); 152 | 153 | //逐条取规则并显示,存储在ruleStringList 154 | while (!stream.atEnd()){ 155 | QString lineStr = stream.readLine(); 156 | QStringList lineSpilt = lineStr.split("%"); 157 | if (lineSpilt.length() != 10){ 158 | continue; 159 | } 160 | rule_str_tp ruleString; 161 | ruleString.src_addr = lineSpilt[0]; 162 | ruleString.dst_addr = lineSpilt[1]; 163 | ruleString.src_port = lineSpilt[2]; 164 | ruleString.dst_port = lineSpilt[3]; 165 | ruleString.time_flag = lineSpilt[4]; 166 | ruleString.hour_begin = lineSpilt[5]; 167 | ruleString.min_begin = lineSpilt[6]; 168 | ruleString.hour_end = lineSpilt[7]; 169 | ruleString.min_end = lineSpilt[8]; 170 | ruleString.protocol = lineSpilt[9]; 171 | 172 | if (ruleAddrCheck(ruleString.src_addr) &&ruleAddrCheck(ruleString.dst_addr) && 173 | rulePortCheck(ruleString.src_port) &&rulePortCheck(ruleString.dst_port)) 174 | {addRuleString(ruleString);} 175 | } 176 | return true; 177 | } 178 | 179 | void MainWindow::updateRuleNo() 180 | { 181 | for (int i=0; irowCount(); i++){ 182 | rulesTable->item(i, 0)->setText(QString::number(i+1)); 183 | } 184 | } 185 | 186 | void MainWindow::on_pushButton_addRule_clicked() 187 | { 188 | if (ruleStringList.length() >= 50){ 189 | QMessageBox::information(this, "提示", "规则数量已达上限!"); 190 | return; 191 | } 192 | addRuleDialog->exec(); 193 | setRuleStringFile(); 194 | sendRuleToFirewall(); 195 | } 196 | 197 | void MainWindow::on_pushButton_delRule_clicked() 198 | { 199 | if (rulesTable->currentRow() < 0){ 200 | QMessageBox::information(this, "提示", "请先选中要删除的规则!"); 201 | return; 202 | } 203 | delRuleDialog->exec(); 204 | setRuleStringFile(); 205 | sendRuleToFirewall(); 206 | } 207 | 208 | void MainWindow::on_pushButton_fiterOn_clicked() 209 | { 210 | QString ret = runShell("bash ../bin/main.sh insmod"); 211 | if (ret == "pkexec"){ 212 | QMessageBox::critical(this, "错误", "请先安装pkexec"); 213 | } 214 | if (isModLoaded()){ 215 | if (!logTimer->isActive()){ 216 | logTimer->start(LOG_UPDATE_TIME); 217 | } 218 | label_runStatus->setText("运行状态:已启动"); 219 | ui->pushButton_fiterOn->setEnabled(false); 220 | ui->pushButton_fiterOff->setEnabled(true); 221 | } 222 | sendRuleToFirewall(); 223 | } 224 | 225 | void MainWindow::on_pushButton_fiterOff_clicked() 226 | { 227 | QString ret = runShell("bash ../bin/main.sh rmmod"); 228 | if (ret == "pkexec"){ 229 | QMessageBox::critical(this, "错误", "请先安装pkexec!"); 230 | } 231 | if (!isModLoaded()){ 232 | if (logTimer->isActive()){ 233 | logTimer->stop(); 234 | } 235 | ui->pushButton_fiterOn->setEnabled(true); 236 | ui->pushButton_fiterOff->setEnabled(false); 237 | label_runStatus->setText("运行状态:未启动"); 238 | } 239 | } 240 | 241 | void MainWindow::addRuleString(rule_str_tp ruleString) 242 | { 243 | //将单条规则添加至ruleStringList 244 | ruleStringList.append(ruleString); 245 | int row = ruleStringList.length(); 246 | rulesTable->setRowCount(row); 247 | rulesTable->setItem(row - 1, 0, new QTableWidgetItem("")); 248 | rulesTable->setItem(row - 1, 1, new QTableWidgetItem(ruleString.src_addr)); 249 | rulesTable->setItem(row - 1, 2, new QTableWidgetItem(ruleString.src_port)); 250 | rulesTable->setItem(row - 1, 3, new QTableWidgetItem(ruleString.dst_addr)); 251 | rulesTable->setItem(row - 1, 4, new QTableWidgetItem(ruleString.dst_port)); 252 | rulesTable->setItem(row - 1, 5, new QTableWidgetItem(ruleString.time_flag)); 253 | rulesTable->setItem(row - 1, 6, new QTableWidgetItem(ruleString.hour_begin+':'+ruleString.min_begin)); 254 | rulesTable->setItem(row - 1, 7, new QTableWidgetItem(ruleString.hour_end+':'+ruleString.min_end)); 255 | rulesTable->setItem(row - 1, 8, new QTableWidgetItem(ruleString.protocol)); 256 | rulesTable->setItem(row - 1, 9, new QTableWidgetItem("reject")); 257 | for (int i=0; icolumnCount(); ++i){ 258 | rulesTable->item(row - 1, i)->setTextAlignment(Qt::AlignCenter); 259 | } 260 | updateRuleNo(); 261 | } 262 | 263 | void MainWindow::modRuleString(rule_str_tp ruleString) 264 | { 265 | ruleStringList[numa]=ruleString; 266 | rulesTable->setItem(numa, 0, new QTableWidgetItem("")); 267 | rulesTable->setItem(numa, 1, new QTableWidgetItem(ruleString.src_addr)); 268 | rulesTable->setItem(numa, 2, new QTableWidgetItem(ruleString.src_port)); 269 | rulesTable->setItem(numa, 3, new QTableWidgetItem(ruleString.dst_addr)); 270 | rulesTable->setItem(numa, 4, new QTableWidgetItem(ruleString.dst_port)); 271 | rulesTable->setItem(numa, 5, new QTableWidgetItem(ruleString.time_flag)); 272 | rulesTable->setItem(numa, 6, new QTableWidgetItem(ruleString.hour_begin+':'+ruleString.min_begin)); 273 | rulesTable->setItem(numa, 7, new QTableWidgetItem(ruleString.hour_end+':'+ruleString.min_end)); 274 | rulesTable->setItem(numa, 8, new QTableWidgetItem(ruleString.protocol)); 275 | rulesTable->setItem(numa, 9, new QTableWidgetItem("reject")); 276 | for (int i=0; icolumnCount(); ++i){ 277 | rulesTable->item(numa, i)->setTextAlignment(Qt::AlignCenter); 278 | } 279 | updateRuleNo(); 280 | } 281 | 282 | void MainWindow::delRuleString(bool action) 283 | { 284 | //从ruleStringList和rulesTable中删除规则 285 | if (action){ 286 | int rowIndex = rulesTable->currentRow(); 287 | if (rowIndex >= 0){ 288 | rulesTable->removeRow(rowIndex); 289 | ruleStringList.removeAt(rowIndex); 290 | } 291 | rulesTable->setRowCount(ruleStringList.length()); 292 | } 293 | updateRuleNo(); 294 | } 295 | 296 | void MainWindow::updateLog() 297 | { 298 | QStringList ret = runShell("bash ../bin/log.sh").split("\n"); 299 | QDir dir("../data/"); 300 | if (!dir.exists()){ 301 | dir.mkdir("../data/"); 302 | } 303 | QFile f("../data/log.txt"); 304 | if (!f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)){ 305 | QMessageBox::critical(this, "错误", "无法打开log.txt!"); 306 | } 307 | QTextStream stream(&f); 308 | foreach (QString line, ret) { 309 | if (line.split(">").length() < 2){ 310 | continue; 311 | } 312 | ui->plainTextEdit->appendPlainText(line.split(">")[1] + "\n"); 313 | stream << line.split(">")[1] << endl; 314 | } 315 | f.close(); 316 | } 317 | 318 | void MainWindow::on_pushButton_logClean_clicked() 319 | { 320 | ui->plainTextEdit->clear(); 321 | } 322 | 323 | void MainWindow::on_pushButton_modRule_clicked() 324 | { 325 | numa=rulesTable->currentRow(); 326 | if (numa < 0){ 327 | QMessageBox::information(this, "提示", "请先选中要修改的规则!"); 328 | return; 329 | } 330 | 331 | modrule=ruleStringList[numa]; 332 | modRuleDialog = new ruledialog_m(this); 333 | connect(modRuleDialog, SIGNAL(modRuleSignal(rule_str_tp)), 334 | this, SLOT(modRuleString(rule_str_tp))); 335 | modRuleDialog->exec(); 336 | setRuleStringFile(); 337 | sendRuleToFirewall(); 338 | } 339 | 340 | void MainWindow::on_action_importRules_triggered() 341 | { 342 | //---获取文件名 343 | QString fileName = QFileDialog :: getOpenFileName(this,tr("导入规则"),"/home",""); 344 | if(fileName.isNull()) return; 345 | 346 | //---打开文件并读取文件内容 347 | QFile file(fileName); 348 | 349 | //--打开文件成功 350 | if (file.open(QIODevice ::ReadOnly | QIODevice ::Text)) 351 | { 352 | QTextStream textStream(&file); 353 | QString line=textStream.readAll(); 354 | //---写入防火墙rule.txt 355 | QFile f("../data/rule.txt"); 356 | if (!f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)){ 357 | QMessageBox::critical(this, "错误", "无法打开rule.txt!"); 358 | return; 359 | } 360 | QTextStream stream(&f); 361 | stream << line << endl; 362 | file.close(); //success ro XieRu 363 | f.close(); 364 | 365 | //更新rulelist 366 | QFile fn("../data/rule.txt"); 367 | if (!fn.open(QIODevice::ReadOnly | QIODevice::Text)){ 368 | QMessageBox::critical(this, "错误", "无法打开rule.txt!"); 369 | return; 370 | } 371 | QTextStream instream(&fn); 372 | QList ruleStringList_tmp; 373 | 374 | rulesTable->setRowCount(0); 375 | rulesTable->clearContents(); 376 | 377 | while (!instream.atEnd()){ 378 | QString lineStr = instream.readLine(); 379 | QStringList lineSpilt = lineStr.split("%"); 380 | if (lineSpilt.length() != 10){ 381 | continue; 382 | } 383 | rule_str_tp ruleString; 384 | ruleString.src_addr = lineSpilt[0]; 385 | ruleString.dst_addr = lineSpilt[1]; 386 | ruleString.src_port = lineSpilt[2]; 387 | ruleString.dst_port = lineSpilt[3]; 388 | ruleString.time_flag = lineSpilt[4]; 389 | ruleString.hour_begin = lineSpilt[5]; 390 | ruleString.min_begin = lineSpilt[6]; 391 | ruleString.hour_end = lineSpilt[7]; 392 | ruleString.min_end = lineSpilt[8]; 393 | ruleString.protocol = lineSpilt[9]; 394 | 395 | if (ruleAddrCheck(ruleString.src_addr) &&ruleAddrCheck(ruleString.dst_addr) && 396 | rulePortCheck(ruleString.src_port) &&rulePortCheck(ruleString.dst_port)) 397 | { 398 | ruleStringList_tmp.append(ruleString); 399 | int row = ruleStringList_tmp.length(); 400 | rulesTable->setRowCount(row); 401 | rulesTable->setItem(row - 1, 0, new QTableWidgetItem("")); 402 | rulesTable->setItem(row - 1, 1, new QTableWidgetItem(ruleString.src_addr)); 403 | rulesTable->setItem(row - 1, 2, new QTableWidgetItem(ruleString.src_port)); 404 | rulesTable->setItem(row - 1, 3, new QTableWidgetItem(ruleString.dst_addr)); 405 | rulesTable->setItem(row - 1, 4, new QTableWidgetItem(ruleString.dst_port)); 406 | rulesTable->setItem(row - 1, 5, new QTableWidgetItem(ruleString.time_flag)); 407 | rulesTable->setItem(row - 1, 6, new QTableWidgetItem(ruleString.hour_begin+':'+ruleString.min_begin)); 408 | rulesTable->setItem(row - 1, 7, new QTableWidgetItem(ruleString.hour_end+':'+ruleString.min_end)); 409 | rulesTable->setItem(row - 1, 8, new QTableWidgetItem(ruleString.protocol)); 410 | rulesTable->setItem(row - 1, 9, new QTableWidgetItem("reject")); 411 | for (int i=0; icolumnCount(); ++i){ 412 | rulesTable->item(row - 1, i)->setTextAlignment(Qt::AlignCenter); 413 | } 414 | updateRuleNo(); 415 | } 416 | } //rulelist和ruletable更新完成 417 | ruleStringList = ruleStringList_tmp; 418 | fn.close(); 419 | 420 | } 421 | else //---打开文件失败 422 | { 423 | QMessageBox ::information(NULL, NULL, "open file error"); 424 | } 425 | sendRuleToFirewall(); 426 | 427 | } 428 | 429 | void MainWindow::on_action_exportRules_triggered() 430 | { 431 | QFileDialog fileDialog; 432 | QString fileName = fileDialog.getSaveFileName(this,tr("导出规则"),"/home",""); 433 | if(fileName.isNull()) return; 434 | if(fileName == "") 435 | return; 436 | QFile file(fileName); 437 | if(!file.open(QIODevice::WriteOnly | QIODevice::Text)) 438 | { 439 | QMessageBox::warning(this,tr("错误"),tr("打开文件失败")); 440 | return; 441 | } 442 | else 443 | { 444 | QTextStream textStream(&file); 445 | 446 | foreach (rule_str_tp ruleString, ruleStringList) { 447 | QString temp = ruleString.src_addr + "%" 448 | + ruleString.dst_addr + "%" 449 | + ruleString.src_port + "%" 450 | + ruleString.dst_port + "%" 451 | + ruleString.time_flag + "%" 452 | + ruleString.hour_begin + "%" 453 | + ruleString.min_begin + "%" 454 | + ruleString.hour_end + "%" 455 | + ruleString.min_end + "%" 456 | + ruleString.protocol; 457 | textStream <close(); 484 | } 485 | 486 | void MainWindow::on_action_about_triggered() 487 | { 488 | aboutDialog->setMessage("- 开发环境:\n" 489 | " 操作系统:Ubuntu 15.10 \n" 490 | " 内核版本:4.2.0-16-generic \n" 491 | " 开发软件:Qt 5.9.0 \n" 492 | " 编译器:gcc version 5.2.1 \n\n" 493 | "- 作者:WJ_Yuan \n" 494 | " mryuan0428@sjtu.edu.cn \n\n" 495 | " Copyright (c) 2018 WJ_YUAN"); 496 | aboutDialog->exec(); 497 | } 498 | -------------------------------------------------------------------------------- /WJ_firewall/mainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | 4 | #include 5 | #include 6 | #include "common.h" 7 | #include "ruledialog.h" 8 | #include "aboutdialog.h" 9 | #include "messagedialog.h" 10 | #include "ruledialog_m.h" 11 | extern char controlinfo[1600]; 12 | 13 | namespace Ui { 14 | class MainWindow; 15 | } 16 | 17 | class MainWindow : public QMainWindow 18 | { 19 | Q_OBJECT 20 | 21 | public: 22 | explicit MainWindow(QWidget *parent = 0); 23 | ~MainWindow(); 24 | QString runShell(QString cmd); 25 | bool isModLoaded(); 26 | bool sendRuleToFirewall(); 27 | bool setRuleStringFile(); 28 | bool getRuleStringFile(); 29 | void updateRuleNo(); 30 | 31 | private slots: 32 | void on_pushButton_addRule_clicked(); 33 | void on_pushButton_delRule_clicked(); 34 | void on_pushButton_fiterOn_clicked(); 35 | void on_pushButton_fiterOff_clicked(); 36 | void addRuleString(rule_str_tp ruleString); 37 | void modRuleString(rule_str_tp ruleString); 38 | void delRuleString(bool action); 39 | void updateLog(); 40 | void on_pushButton_logClean_clicked(); 41 | void on_pushButton_modRule_clicked(); 42 | 43 | void on_action_importRules_triggered(); 44 | 45 | void on_action_exportRules_triggered(); 46 | 47 | void on_action_exitAPP_triggered(); 48 | 49 | void on_action_about_triggered(); 50 | 51 | private: 52 | Ui::MainWindow *ui; 53 | QLabel *label_runStatus; 54 | RuleDialog *addRuleDialog; 55 | MessageDialog *delRuleDialog; 56 | aboutdialog *aboutDialog; 57 | ruledialog_m *modRuleDialog; 58 | QTableWidget *rulesTable; 59 | QList ruleStringList; 60 | QTimer *logTimer; 61 | }; 62 | 63 | #endif // MAINWINDOW_H 64 | -------------------------------------------------------------------------------- /WJ_firewall/mainwindow.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 1000 10 | 600 11 | 12 | 13 | 14 | 15 | 1000 16 | 600 17 | 18 | 19 | 20 | 21 | 1000 22 | 600 23 | 24 | 25 | 26 | WJ firewall 27 | 28 | 29 | 30 | 31 | 10 32 | 33 | 34 | 20 35 | 36 | 37 | 20 38 | 39 | 40 | 20 41 | 42 | 43 | 5 44 | 45 | 46 | 47 | 48 | 20 49 | 50 | 51 | 52 | 53 | 54 | 100 55 | 30 56 | 57 | 58 | 59 | 60 | 100 61 | 30 62 | 63 | 64 | 65 | 添加规则 66 | 67 | 68 | 69 | 70 | 71 | 72 | Qt::Horizontal 73 | 74 | 75 | 76 | 40 77 | 20 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 100 87 | 30 88 | 89 | 90 | 91 | 92 | 100 93 | 30 94 | 95 | 96 | 97 | 修改规则 98 | 99 | 100 | 101 | 102 | 103 | 104 | Qt::Horizontal 105 | 106 | 107 | 108 | 40 109 | 20 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 100 119 | 30 120 | 121 | 122 | 123 | 124 | 100 125 | 30 126 | 127 | 128 | 129 | 删除规则 130 | 131 | 132 | 133 | 134 | 135 | 136 | Qt::Horizontal 137 | 138 | 139 | 140 | 40 141 | 20 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 100 151 | 30 152 | 153 | 154 | 155 | 156 | 100 157 | 30 158 | 159 | 160 | 161 | 开启过滤 162 | 163 | 164 | 165 | 166 | 167 | 168 | Qt::Horizontal 169 | 170 | 171 | 172 | 40 173 | 20 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 100 183 | 30 184 | 185 | 186 | 187 | 188 | 100 189 | 30 190 | 191 | 192 | 193 | 停止过滤 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | QTabBar::tab:selected{background-color: white;} 205 | QTabBar::tab:!selected{background-color: rgb(239, 235, 231);} 206 | QTabBar::tab{min-width:80px; min-height:28px; border: 1px solid rgb(188, 185, 181); margin-bottom:1px;} 207 | 208 | 209 | 0 210 | 211 | 212 | 213 | Qt::NoFocus 214 | 215 | 216 | 217 | 218 | 219 | 规则 220 | 221 | 222 | 223 | 0 224 | 225 | 226 | 0 227 | 228 | 229 | 0 230 | 231 | 232 | 0 233 | 234 | 235 | 0 236 | 237 | 238 | 239 | 240 | margin:-1px; 241 | 242 | 243 | QAbstractItemView::NoEditTriggers 244 | 245 | 246 | QAbstractItemView::SingleSelection 247 | 248 | 249 | QAbstractItemView::SelectRows 250 | 251 | 252 | 85 253 | 254 | 255 | false 256 | 257 | 258 | 60 259 | 260 | 261 | true 262 | 263 | 264 | false 265 | 266 | 267 | false 268 | 269 | 270 | 30 271 | 272 | 273 | 274 | NO 275 | 276 | 277 | AlignCenter 278 | 279 | 280 | 281 | 282 | SADDR 283 | 284 | 285 | AlignCenter 286 | 287 | 288 | 289 | 290 | SPORT 291 | 292 | 293 | AlignCenter 294 | 295 | 296 | 297 | 298 | DADDR 299 | 300 | 301 | AlignCenter 302 | 303 | 304 | 305 | 306 | DPORT 307 | 308 | 309 | AlignCenter 310 | 311 | 312 | 313 | 314 | TIME_FLAG 315 | 316 | 317 | AlignCenter 318 | 319 | 320 | 321 | 322 | TIME_BEGIN 323 | 324 | 325 | AlignCenter 326 | 327 | 328 | 329 | 330 | TIME_END 331 | 332 | 333 | AlignCenter 334 | 335 | 336 | 337 | 338 | PROTOCOL 339 | 340 | 341 | AlignCenter 342 | 343 | 344 | 345 | 346 | ACTION 347 | 348 | 349 | AlignCenter 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 日志 359 | 360 | 361 | 362 | 0 363 | 364 | 365 | 0 366 | 367 | 368 | 0 369 | 370 | 371 | 0 372 | 373 | 374 | 0 375 | 376 | 377 | 378 | 379 | 清除日志 380 | 381 | 382 | 383 | 384 | 385 | 386 | margin:-1px; 387 | 388 | 389 | true 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 0 405 | 0 406 | 1000 407 | 25 408 | 409 | 410 | 411 | 412 | 文件 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 帮助 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | padding-left:20px; 430 | 431 | 432 | 433 | 434 | 导入规则 435 | 436 | 437 | 438 | 439 | 导出规则 440 | 441 | 442 | 443 | 444 | 退出 445 | 446 | 447 | 448 | 449 | 关于 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | -------------------------------------------------------------------------------- /WJ_firewall/messagedialog.cpp: -------------------------------------------------------------------------------- 1 | #include "messagedialog.h" 2 | #include "ui_messagedialog.h" 3 | 4 | MessageDialog::MessageDialog(QWidget *parent) : 5 | QDialog(parent), 6 | ui(new Ui::MessageDialog) 7 | { 8 | ui->setupUi(this); 9 | this->setFixedSize(340, 150); 10 | } 11 | 12 | MessageDialog::~MessageDialog() 13 | { 14 | delete ui; 15 | } 16 | 17 | void MessageDialog::setMessage(QString message) 18 | { 19 | ui->label->setText(message); 20 | } 21 | 22 | void MessageDialog::on_pushButton_ok_clicked() 23 | { 24 | emit actionSignal(true); 25 | this->close(); 26 | } 27 | 28 | void MessageDialog::on_pushButton_cancel_clicked() 29 | { 30 | emit actionSignal(false); 31 | this->close(); 32 | } 33 | -------------------------------------------------------------------------------- /WJ_firewall/messagedialog.h: -------------------------------------------------------------------------------- 1 | #ifndef MESSAGEDIALOG_H 2 | #define MESSAGEDIALOG_H 3 | 4 | #include 5 | 6 | 7 | namespace Ui { 8 | class MessageDialog; 9 | } 10 | 11 | class MessageDialog : public QDialog 12 | { 13 | Q_OBJECT 14 | 15 | public: 16 | explicit MessageDialog(QWidget *parent = 0); 17 | ~MessageDialog(); 18 | void setMessage(QString message); 19 | 20 | private: 21 | Ui::MessageDialog *ui; 22 | 23 | signals: 24 | void actionSignal(bool); 25 | private slots: 26 | void on_pushButton_ok_clicked(); 27 | void on_pushButton_cancel_clicked(); 28 | }; 29 | 30 | #endif // MESSAGEDIALOG_H 31 | -------------------------------------------------------------------------------- /WJ_firewall/messagedialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MessageDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 340 10 | 150 11 | 12 | 13 | 14 | 删除规则 15 | 16 | 17 | 18 | 19 | 50 20 | 30 21 | 300 22 | 51 23 | 24 | 25 | 26 | 27 | 300 28 | 0 29 | 30 | 31 | 32 | 33 | 300 34 | 16777215 35 | 36 | 37 | 38 | TextLabel 39 | 40 | 41 | 42 | 43 | 44 | 130 45 | 100 46 | 80 47 | 30 48 | 49 | 50 | 51 | 52 | 80 53 | 30 54 | 55 | 56 | 57 | 58 | 80 59 | 30 60 | 61 | 62 | 63 | 确定 64 | 65 | 66 | 67 | 68 | 69 | 230 70 | 100 71 | 80 72 | 30 73 | 74 | 75 | 76 | 77 | 80 78 | 30 79 | 80 | 81 | 82 | 83 | 80 84 | 30 85 | 86 | 87 | 88 | 取消 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /WJ_firewall/ruledialog.cpp: -------------------------------------------------------------------------------- 1 | #include "ruledialog.h" 2 | #include "ui_ruledialog.h" 3 | 4 | RuleDialog::RuleDialog(QWidget *parent) : 5 | QDialog(parent), 6 | ui(new Ui::RuleDialog) 7 | { 8 | ui->setupUi(this); 9 | ui->comboBox_protocol->addItem("tcp"); 10 | ui->comboBox_protocol->addItem("udp"); 11 | ui->comboBox_protocol->addItem("icmp"); 12 | ui->comboBox_time->addItem("yes"); 13 | ui->comboBox_time->addItem("no"); 14 | ui->timeEdit->setDisplayFormat("HH:mm"); 15 | ui->timeEdit_2->setDisplayFormat("HH:mm"); 16 | } 17 | 18 | RuleDialog::~RuleDialog() 19 | { 20 | delete ui; 21 | } 22 | 23 | void RuleDialog::on_pushButton_ok_clicked() 24 | { 25 | rule_str_tp rule_str; 26 | 27 | //获取规则IP地址 28 | rule_str.src_addr = ui->lineEdit_src_ip->text().trimmed(); 29 | rule_str.dst_addr = ui->lineEdit_dst_ip->text().trimmed(); 30 | if (!ruleAddrCheck(rule_str.src_addr) || !ruleAddrCheck(rule_str.dst_addr)){ 31 | QMessageBox::critical(this, "错误", "请输入正确的ip地址!"); 32 | return; 33 | } 34 | 35 | //获取规则端口 36 | rule_str.src_port = ui->lineEdit_src_port->text().trimmed(); 37 | rule_str.dst_port = ui->lineEdit_dst_port->text().trimmed(); 38 | if (!rulePortCheck(rule_str.src_port) || !rulePortCheck(rule_str.dst_port)){ 39 | QMessageBox::critical(this, "错误", "请输入正确的端口号(0-65535)!"); 40 | return; 41 | } 42 | 43 | //获取时间设置信息以及报文类型 44 | rule_str.time_flag = ui->comboBox_time->currentText(); 45 | rule_str.hour_begin = ui->timeEdit->sectionText(QTimeEdit::HourSection); 46 | rule_str.min_begin = ui->timeEdit->sectionText(QTimeEdit::MinuteSection); 47 | rule_str.hour_end = ui->timeEdit_2->sectionText(QTimeEdit::HourSection); 48 | rule_str.min_end = ui->timeEdit_2->sectionText(QTimeEdit::MinuteSection); 49 | rule_str.protocol = ui->comboBox_protocol->currentText(); 50 | 51 | emit addNewRuleSignal(rule_str); 52 | this->close(); 53 | 54 | return; 55 | } 56 | 57 | void RuleDialog::on_comboBox_protocol_currentTextChanged(const QString &text) 58 | { 59 | if (text == "icmp"){ 60 | ui->lineEdit_src_port->setText("any"); 61 | ui->lineEdit_dst_port->setText("any"); 62 | ui->lineEdit_src_port->setEnabled(false); 63 | ui->lineEdit_dst_port->setEnabled(false); 64 | } else{ 65 | ui->lineEdit_src_port->setEnabled(true); 66 | ui->lineEdit_dst_port->setEnabled(true); 67 | } 68 | } 69 | 70 | void RuleDialog::on_pushButton_cancel_clicked() 71 | { 72 | this->close(); 73 | } 74 | 75 | void RuleDialog::on_comboBox_time_currentTextChanged(const QString &text) 76 | { 77 | if(text == "no"){ 78 | ui->timeEdit->setEnabled(false); 79 | ui->timeEdit_2->setEnabled(false); 80 | } 81 | else{ 82 | ui->timeEdit->setEnabled(true); 83 | ui->timeEdit_2->setEnabled(true); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /WJ_firewall/ruledialog.h: -------------------------------------------------------------------------------- 1 | #ifndef RULEDIALOG_H 2 | #define RULEDIALOG_H 3 | 4 | #include 5 | #include "common.h" 6 | 7 | 8 | namespace Ui { 9 | class RuleDialog; 10 | } 11 | 12 | class RuleDialog : public QDialog 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | explicit RuleDialog(QWidget *parent = 0); 18 | ~RuleDialog(); 19 | 20 | private slots: 21 | void on_pushButton_ok_clicked(); 22 | 23 | void on_comboBox_protocol_currentTextChanged(const QString &text); 24 | 25 | void on_pushButton_cancel_clicked(); 26 | 27 | void on_comboBox_time_currentTextChanged(const QString &text); 28 | 29 | private: 30 | Ui::RuleDialog *ui; 31 | 32 | signals: 33 | void addNewRuleSignal(rule_str_tp); 34 | }; 35 | 36 | #endif // RULEDIALOG_H 37 | -------------------------------------------------------------------------------- /WJ_firewall/ruledialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | RuleDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 600 10 | 250 11 | 12 | 13 | 14 | 15 | 0 16 | 0 17 | 18 | 19 | 20 | 21 | 600 22 | 250 23 | 24 | 25 | 26 | 27 | 600 28 | 250 29 | 30 | 31 | 32 | 添加规则 33 | 34 | 35 | 36 | 37 | 400 38 | 200 39 | 60 40 | 25 41 | 42 | 43 | 44 | 确定 45 | 46 | 47 | 48 | 49 | 50 | 490 51 | 200 52 | 60 53 | 25 54 | 55 | 56 | 57 | 取消 58 | 59 | 60 | 61 | 62 | 63 | 40 64 | 20 65 | 67 66 | 25 67 | 68 | 69 | 70 | 源地址: 71 | 72 | 73 | 74 | 75 | 76 | 40 77 | 60 78 | 67 79 | 25 80 | 81 | 82 | 83 | 源端口: 84 | 85 | 86 | 87 | 88 | 89 | 320 90 | 20 91 | 71 92 | 25 93 | 94 | 95 | 96 | 目的地址: 97 | 98 | 99 | 100 | 101 | 102 | 320 103 | 60 104 | 71 105 | 25 106 | 107 | 108 | 109 | 目的端口: 110 | 111 | 112 | 113 | 114 | 115 | 110 116 | 20 117 | 150 118 | 25 119 | 120 | 121 | 122 | any 123 | 124 | 125 | 126 | 127 | 128 | 110 129 | 60 130 | 150 131 | 25 132 | 133 | 134 | 135 | any 136 | 137 | 138 | 139 | 140 | 141 | 400 142 | 60 143 | 150 144 | 25 145 | 146 | 147 | 148 | any 149 | 150 | 151 | 152 | 153 | 154 | 399 155 | 20 156 | 151 157 | 25 158 | 159 | 160 | 161 | any 162 | 163 | 164 | 165 | 166 | 167 | 110 168 | 110 169 | 150 170 | 25 171 | 172 | 173 | 174 | 175 | 0 176 | 0 177 | 178 | 179 | 180 | 181 | 182 | 183 | 40 184 | 110 185 | 67 186 | 25 187 | 188 | 189 | 190 | 时间: 191 | 192 | 193 | 194 | 195 | 196 | 320 197 | 110 198 | 67 199 | 25 200 | 201 | 202 | 203 | 协议: 204 | 205 | 206 | 207 | 208 | 209 | 400 210 | 110 211 | 150 212 | 25 213 | 214 | 215 | 216 | 217 | 0 218 | 0 219 | 220 | 221 | 222 | 223 | 224 | 225 | 40 226 | 150 227 | 80 228 | 25 229 | 230 | 231 | 232 | 开始时间: 233 | 234 | 235 | 236 | 237 | 238 | 130 239 | 150 240 | 130 241 | 26 242 | 243 | 244 | 245 | Qt::AlignCenter 246 | 247 | 248 | 249 | 250 | 251 | 320 252 | 150 253 | 80 254 | 25 255 | 256 | 257 | 258 | 结束时间: 259 | 260 | 261 | 262 | 263 | 264 | 420 265 | 150 266 | 130 267 | 26 268 | 269 | 270 | 271 | Qt::AlignCenter 272 | 273 | 274 | 275 | 276 | 277 | 278 | -------------------------------------------------------------------------------- /WJ_firewall/ruledialog_m.cpp: -------------------------------------------------------------------------------- 1 | #include "ruledialog_m.h" 2 | #include "ui_ruledialog_m.h" 3 | 4 | ruledialog_m::ruledialog_m(QWidget *parent) : 5 | QDialog(parent), 6 | ui(new Ui::ruledialog_m) 7 | { 8 | ui->setupUi(this); 9 | ui->comboBox_protocol->addItem("tcp"); 10 | ui->comboBox_protocol->addItem("udp"); 11 | ui->comboBox_protocol->addItem("icmp"); 12 | ui->comboBox_time->addItem("yes"); 13 | ui->comboBox_time->addItem("no"); 14 | ui->timeEdit->setDisplayFormat("HH:mm"); 15 | ui->timeEdit_2->setDisplayFormat("HH:mm"); 16 | ui->lineEdit_src_ip->setText(modrule.src_addr); 17 | ui->lineEdit_dst_ip->setText(modrule.dst_addr); 18 | ui->lineEdit_src_port->setText(modrule.src_port); 19 | ui->lineEdit_dst_port->setText(modrule.dst_port); 20 | ui->comboBox_time->setCurrentText(modrule.time_flag); 21 | ui->comboBox_protocol->setCurrentText(modrule.protocol); 22 | QTime ti ; 23 | ui->timeEdit->setTime(ti.fromString(modrule.hour_begin+':'+modrule.min_begin,"hh:mm")); 24 | ui->timeEdit_2->setTime(ti.fromString(modrule.hour_end+':'+modrule.min_end,"hh:mm")); 25 | } 26 | 27 | ruledialog_m::~ruledialog_m() 28 | { 29 | delete ui; 30 | } 31 | 32 | void ruledialog_m::on_pushButton_ok_clicked() 33 | { 34 | rule_str_tp rule_str; 35 | 36 | //获取规则IP地址 37 | rule_str.src_addr = ui->lineEdit_src_ip->text().trimmed(); 38 | rule_str.dst_addr = ui->lineEdit_dst_ip->text().trimmed(); 39 | if (!ruleAddrCheck(rule_str.src_addr) || !ruleAddrCheck(rule_str.dst_addr)){ 40 | QMessageBox::critical(this, "错误", "请输入正确的ip地址!"); 41 | return; 42 | } 43 | 44 | //获取规则端口 45 | rule_str.src_port = ui->lineEdit_src_port->text().trimmed(); 46 | rule_str.dst_port = ui->lineEdit_dst_port->text().trimmed(); 47 | if (!rulePortCheck(rule_str.src_port) || !rulePortCheck(rule_str.dst_port)){ 48 | QMessageBox::critical(this, "错误", "请输入正确的端口号(0-65535)!"); 49 | return; 50 | } 51 | 52 | //获取时间设置信息以及报文类型 53 | rule_str.time_flag = ui->comboBox_time->currentText(); 54 | rule_str.hour_begin = ui->timeEdit->sectionText(QTimeEdit::HourSection); 55 | rule_str.min_begin = ui->timeEdit->sectionText(QTimeEdit::MinuteSection); 56 | rule_str.hour_end = ui->timeEdit_2->sectionText(QTimeEdit::HourSection); 57 | rule_str.min_end = ui->timeEdit_2->sectionText(QTimeEdit::MinuteSection); 58 | rule_str.protocol = ui->comboBox_protocol->currentText(); 59 | 60 | emit modRuleSignal(rule_str); 61 | this->close(); 62 | 63 | return; 64 | } 65 | 66 | void ruledialog_m::on_comboBox_protocol_currentTextChanged(const QString &text) 67 | { 68 | if (text == "icmp"){ 69 | ui->lineEdit_src_port->setText("any"); 70 | ui->lineEdit_dst_port->setText("any"); 71 | ui->lineEdit_src_port->setEnabled(false); 72 | ui->lineEdit_dst_port->setEnabled(false); 73 | } else{ 74 | ui->lineEdit_src_port->setEnabled(true); 75 | ui->lineEdit_dst_port->setEnabled(true); 76 | } 77 | } 78 | 79 | void ruledialog_m::on_pushButton_cancel_clicked() 80 | { 81 | this->close(); 82 | } 83 | 84 | void ruledialog_m::on_comboBox_time_currentTextChanged(const QString &text) 85 | { 86 | if(text == "no"){ 87 | ui->timeEdit->setEnabled(false); 88 | ui->timeEdit_2->setEnabled(false); 89 | } 90 | else{ 91 | ui->timeEdit->setEnabled(true); 92 | ui->timeEdit_2->setEnabled(true); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /WJ_firewall/ruledialog_m.h: -------------------------------------------------------------------------------- 1 | #ifndef RULEDIALOG_M_H 2 | #define RULEDIALOG_M_H 3 | 4 | #include 5 | #include 6 | #include "common.h" 7 | extern rule_str_tp modrule; 8 | 9 | namespace Ui { 10 | class ruledialog_m; 11 | } 12 | 13 | class ruledialog_m : public QDialog 14 | { 15 | Q_OBJECT 16 | 17 | public: 18 | explicit ruledialog_m(QWidget *parent = 0); 19 | ~ruledialog_m(); 20 | 21 | private: 22 | Ui::ruledialog_m *ui; 23 | signals: 24 | void modRuleSignal(rule_str_tp); 25 | 26 | private slots: 27 | void on_pushButton_ok_clicked(); 28 | void on_pushButton_cancel_clicked(); 29 | void on_comboBox_protocol_currentTextChanged(const QString &text); 30 | void on_comboBox_time_currentTextChanged(const QString &text); 31 | }; 32 | 33 | #endif // RULEDIALOG_M_H 34 | -------------------------------------------------------------------------------- /WJ_firewall/ruledialog_m.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | ruledialog_m 4 | 5 | 6 | 7 | 0 8 | 0 9 | 600 10 | 250 11 | 12 | 13 | 14 | 修改规则 15 | 16 | 17 | 18 | 19 | 40 20 | 70 21 | 67 22 | 25 23 | 24 | 25 | 26 | 源端口: 27 | 28 | 29 | 30 | 31 | 32 | 400 33 | 210 34 | 60 35 | 25 36 | 37 | 38 | 39 | 确定 40 | 41 | 42 | 43 | 44 | 45 | 130 46 | 160 47 | 130 48 | 26 49 | 50 | 51 | 52 | 53 | 54 | 55 | 490 56 | 210 57 | 60 58 | 25 59 | 60 | 61 | 62 | 取消 63 | 64 | 65 | 66 | 67 | 68 | 40 69 | 120 70 | 67 71 | 25 72 | 73 | 74 | 75 | 时间: 76 | 77 | 78 | 79 | 80 | 81 | 420 82 | 160 83 | 130 84 | 26 85 | 86 | 87 | 88 | 89 | 90 | 91 | 320 92 | 70 93 | 71 94 | 25 95 | 96 | 97 | 98 | 目的端口: 99 | 100 | 101 | 102 | 103 | 104 | 320 105 | 30 106 | 71 107 | 25 108 | 109 | 110 | 111 | 目的地址: 112 | 113 | 114 | 115 | 116 | 117 | 40 118 | 160 119 | 80 120 | 25 121 | 122 | 123 | 124 | 开始时间: 125 | 126 | 127 | 128 | 129 | 130 | 110 131 | 70 132 | 150 133 | 25 134 | 135 | 136 | 137 | any 138 | 139 | 140 | 141 | 142 | 143 | 110 144 | 120 145 | 150 146 | 25 147 | 148 | 149 | 150 | 151 | 0 152 | 0 153 | 154 | 155 | 156 | 157 | 158 | 159 | 399 160 | 30 161 | 151 162 | 25 163 | 164 | 165 | 166 | any 167 | 168 | 169 | 170 | 171 | 172 | 320 173 | 160 174 | 80 175 | 25 176 | 177 | 178 | 179 | 结束时间: 180 | 181 | 182 | 183 | 184 | 185 | 400 186 | 70 187 | 150 188 | 25 189 | 190 | 191 | 192 | any 193 | 194 | 195 | 196 | 197 | 198 | 110 199 | 30 200 | 150 201 | 25 202 | 203 | 204 | 205 | any 206 | 207 | 208 | 209 | 210 | 211 | 320 212 | 120 213 | 67 214 | 25 215 | 216 | 217 | 218 | 协议: 219 | 220 | 221 | 222 | 223 | 224 | 400 225 | 120 226 | 150 227 | 25 228 | 229 | 230 | 231 | 232 | 0 233 | 0 234 | 235 | 236 | 237 | 238 | 239 | 240 | 40 241 | 30 242 | 67 243 | 25 244 | 245 | 246 | 247 | 源地址: 248 | 249 | 250 | 251 | 252 | 253 | 254 | -------------------------------------------------------------------------------- /bin/WJ_firewall.ko: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mryuan0428/Firewall-Based-on-Netfilter/902149e65a9a289c0c6e13441cd8af678654e432/bin/WJ_firewall.ko -------------------------------------------------------------------------------- /bin/ckmod.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | MOD_NAME="WJ_firewall" 4 | 5 | if [ "$(lsmod | grep -c "$MOD_NAME")" == "1" ] 6 | then 7 | echo "true" 8 | else 9 | echo "false" 10 | fi 11 | 12 | -------------------------------------------------------------------------------- /bin/insmod.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | CUR_DIR=$(cd "$(dirname "${BASH_SOURCE-$0}")"; pwd) 4 | MOD_NAME="WJ_firewall.ko" 5 | DEV_PATH="/dev/controlinfo" 6 | 7 | if [ "$(bash $CUR_DIR/ckmod.sh)" == "true" ] 8 | then 9 | echo "success" 10 | elif [ "$(which pkexec)" == "" ] 11 | then 12 | echo "pkexec" 13 | else 14 | insmod $CUR_DIR/$MOD_NAME 15 | if [ "$?" == "0" ] 16 | then 17 | mknod ${DEV_PATH} c 124 0 18 | chmod 0666 ${DEV_PATH} 19 | echo "success" 20 | else 21 | echo "failure" 22 | fi 23 | fi 24 | -------------------------------------------------------------------------------- /bin/log.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | LOG=$(echo 'change' | sudo -p '' -S dmesg -c | grep '') 3 | echo "$LOG" 4 | -------------------------------------------------------------------------------- /bin/main.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | CUR_DIR=$(cd "$(dirname "${BASH_SOURCE-$0}")"; pwd) 4 | 5 | case "$1" in 6 | "insmod") 7 | result=$(pkexec bash $CUR_DIR/insmod.sh) 8 | ;; 9 | "rmmod") 10 | result=$(pkexec bash $CUR_DIR/rmmod.sh) 11 | ;; 12 | "ckmod") 13 | result=$(bash $CUR_DIR/ckmod.sh) 14 | ;; 15 | *) 16 | result="error command" 17 | esac 18 | 19 | echo -n "$result" 20 | -------------------------------------------------------------------------------- /bin/rmmod.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | CUR_DIR=$(cd "$(dirname "${BASH_SOURCE-$0}")"; pwd) 4 | MOD_NAME="WJ_firewall" 5 | DEV_PATH="/dev/controlinfo" 6 | 7 | if [ "$(bash $CUR_DIR/ckmod.sh)" == "false" ] 8 | then 9 | echo "success" 10 | elif [ "$(which pkexec)" == "" ] 11 | then 12 | echo "pkexec" 13 | else 14 | rm ${DEV_PATH} 15 | rmmod $MOD_NAME 16 | if [ "$?" == "0" ] 17 | then 18 | echo "success" 19 | else 20 | echo "failure" 21 | fi 22 | fi 23 | -------------------------------------------------------------------------------- /build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Debug/.qmake.stash: -------------------------------------------------------------------------------- 1 | QMAKE_CXX.INCDIRS = \ 2 | /usr/include/c++/5 \ 3 | /usr/include/x86_64-linux-gnu/c++/5 \ 4 | /usr/include/c++/5/backward \ 5 | /usr/lib/gcc/x86_64-linux-gnu/5/include \ 6 | /usr/local/include \ 7 | /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed \ 8 | /usr/include/x86_64-linux-gnu \ 9 | /usr/include 10 | QMAKE_CXX.LIBDIRS = \ 11 | /usr/lib/gcc/x86_64-linux-gnu/5 \ 12 | /usr/lib/x86_64-linux-gnu \ 13 | /usr/lib \ 14 | /lib/x86_64-linux-gnu \ 15 | /lib 16 | QMAKE_CXX.QT_COMPILER_STDCXX = 199711L 17 | QMAKE_CXX.QT_GCC_MAJOR_VERSION = 5 18 | QMAKE_CXX.QT_GCC_MINOR_VERSION = 4 19 | QMAKE_CXX.QT_GCC_PATCH_VERSION = 0 20 | QMAKE_CXX.COMPILER_MACROS = \ 21 | QT_COMPILER_STDCXX \ 22 | QT_GCC_MAJOR_VERSION \ 23 | QT_GCC_MINOR_VERSION \ 24 | QT_GCC_PATCH_VERSION 25 | -------------------------------------------------------------------------------- /build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Debug/WJ_firewall: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mryuan0428/Firewall-Based-on-Netfilter/902149e65a9a289c0c6e13441cd8af678654e432/build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Debug/WJ_firewall -------------------------------------------------------------------------------- /build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Debug/aboutdialog.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mryuan0428/Firewall-Based-on-Netfilter/902149e65a9a289c0c6e13441cd8af678654e432/build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Debug/aboutdialog.o -------------------------------------------------------------------------------- /build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Debug/common.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mryuan0428/Firewall-Based-on-Netfilter/902149e65a9a289c0c6e13441cd8af678654e432/build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Debug/common.o -------------------------------------------------------------------------------- /build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mryuan0428/Firewall-Based-on-Netfilter/902149e65a9a289c0c6e13441cd8af678654e432/build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Debug/main.o -------------------------------------------------------------------------------- /build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Debug/mainwindow.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mryuan0428/Firewall-Based-on-Netfilter/902149e65a9a289c0c6e13441cd8af678654e432/build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Debug/mainwindow.o -------------------------------------------------------------------------------- /build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Debug/messagedialog.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mryuan0428/Firewall-Based-on-Netfilter/902149e65a9a289c0c6e13441cd8af678654e432/build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Debug/messagedialog.o -------------------------------------------------------------------------------- /build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Debug/moc_aboutdialog.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Meta object code from reading C++ file 'aboutdialog.h' 3 | ** 4 | ** Created by: The Qt Meta Object Compiler version 67 (Qt 5.9.0) 5 | ** 6 | ** WARNING! All changes made in this file will be lost! 7 | *****************************************************************************/ 8 | 9 | #include "../WJ_firewall/aboutdialog.h" 10 | #include 11 | #include 12 | #if !defined(Q_MOC_OUTPUT_REVISION) 13 | #error "The header file 'aboutdialog.h' doesn't include ." 14 | #elif Q_MOC_OUTPUT_REVISION != 67 15 | #error "This file was generated using the moc from 5.9.0. It" 16 | #error "cannot be used with the include files from this version of Qt." 17 | #error "(The moc has changed too much.)" 18 | #endif 19 | 20 | QT_BEGIN_MOC_NAMESPACE 21 | QT_WARNING_PUSH 22 | QT_WARNING_DISABLE_DEPRECATED 23 | struct qt_meta_stringdata_aboutdialog_t { 24 | QByteArrayData data[3]; 25 | char stringdata0[38]; 26 | }; 27 | #define QT_MOC_LITERAL(idx, ofs, len) \ 28 | Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ 29 | qptrdiff(offsetof(qt_meta_stringdata_aboutdialog_t, stringdata0) + ofs \ 30 | - idx * sizeof(QByteArrayData)) \ 31 | ) 32 | static const qt_meta_stringdata_aboutdialog_t qt_meta_stringdata_aboutdialog = { 33 | { 34 | QT_MOC_LITERAL(0, 0, 11), // "aboutdialog" 35 | QT_MOC_LITERAL(1, 12, 24), // "on_pushButton_ok_clicked" 36 | QT_MOC_LITERAL(2, 37, 0) // "" 37 | 38 | }, 39 | "aboutdialog\0on_pushButton_ok_clicked\0" 40 | "" 41 | }; 42 | #undef QT_MOC_LITERAL 43 | 44 | static const uint qt_meta_data_aboutdialog[] = { 45 | 46 | // content: 47 | 7, // revision 48 | 0, // classname 49 | 0, 0, // classinfo 50 | 1, 14, // methods 51 | 0, 0, // properties 52 | 0, 0, // enums/sets 53 | 0, 0, // constructors 54 | 0, // flags 55 | 0, // signalCount 56 | 57 | // slots: name, argc, parameters, tag, flags 58 | 1, 0, 19, 2, 0x08 /* Private */, 59 | 60 | // slots: parameters 61 | QMetaType::Void, 62 | 63 | 0 // eod 64 | }; 65 | 66 | void aboutdialog::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) 67 | { 68 | if (_c == QMetaObject::InvokeMetaMethod) { 69 | aboutdialog *_t = static_cast(_o); 70 | Q_UNUSED(_t) 71 | switch (_id) { 72 | case 0: _t->on_pushButton_ok_clicked(); break; 73 | default: ; 74 | } 75 | } 76 | Q_UNUSED(_a); 77 | } 78 | 79 | const QMetaObject aboutdialog::staticMetaObject = { 80 | { &QDialog::staticMetaObject, qt_meta_stringdata_aboutdialog.data, 81 | qt_meta_data_aboutdialog, qt_static_metacall, nullptr, nullptr} 82 | }; 83 | 84 | 85 | const QMetaObject *aboutdialog::metaObject() const 86 | { 87 | return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; 88 | } 89 | 90 | void *aboutdialog::qt_metacast(const char *_clname) 91 | { 92 | if (!_clname) return nullptr; 93 | if (!strcmp(_clname, qt_meta_stringdata_aboutdialog.stringdata0)) 94 | return static_cast(const_cast< aboutdialog*>(this)); 95 | return QDialog::qt_metacast(_clname); 96 | } 97 | 98 | int aboutdialog::qt_metacall(QMetaObject::Call _c, int _id, void **_a) 99 | { 100 | _id = QDialog::qt_metacall(_c, _id, _a); 101 | if (_id < 0) 102 | return _id; 103 | if (_c == QMetaObject::InvokeMetaMethod) { 104 | if (_id < 1) 105 | qt_static_metacall(this, _c, _id, _a); 106 | _id -= 1; 107 | } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { 108 | if (_id < 1) 109 | *reinterpret_cast(_a[0]) = -1; 110 | _id -= 1; 111 | } 112 | return _id; 113 | } 114 | QT_WARNING_POP 115 | QT_END_MOC_NAMESPACE 116 | -------------------------------------------------------------------------------- /build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Debug/moc_aboutdialog.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mryuan0428/Firewall-Based-on-Netfilter/902149e65a9a289c0c6e13441cd8af678654e432/build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Debug/moc_aboutdialog.o -------------------------------------------------------------------------------- /build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Debug/moc_mainwindow.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Meta object code from reading C++ file 'mainwindow.h' 3 | ** 4 | ** Created by: The Qt Meta Object Compiler version 67 (Qt 5.9.0) 5 | ** 6 | ** WARNING! All changes made in this file will be lost! 7 | *****************************************************************************/ 8 | 9 | #include "../WJ_firewall/mainwindow.h" 10 | #include 11 | #include 12 | #if !defined(Q_MOC_OUTPUT_REVISION) 13 | #error "The header file 'mainwindow.h' doesn't include ." 14 | #elif Q_MOC_OUTPUT_REVISION != 67 15 | #error "This file was generated using the moc from 5.9.0. It" 16 | #error "cannot be used with the include files from this version of Qt." 17 | #error "(The moc has changed too much.)" 18 | #endif 19 | 20 | QT_BEGIN_MOC_NAMESPACE 21 | QT_WARNING_PUSH 22 | QT_WARNING_DISABLE_DEPRECATED 23 | struct qt_meta_stringdata_MainWindow_t { 24 | QByteArrayData data[19]; 25 | char stringdata0[394]; 26 | }; 27 | #define QT_MOC_LITERAL(idx, ofs, len) \ 28 | Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ 29 | qptrdiff(offsetof(qt_meta_stringdata_MainWindow_t, stringdata0) + ofs \ 30 | - idx * sizeof(QByteArrayData)) \ 31 | ) 32 | static const qt_meta_stringdata_MainWindow_t qt_meta_stringdata_MainWindow = { 33 | { 34 | QT_MOC_LITERAL(0, 0, 10), // "MainWindow" 35 | QT_MOC_LITERAL(1, 11, 29), // "on_pushButton_addRule_clicked" 36 | QT_MOC_LITERAL(2, 41, 0), // "" 37 | QT_MOC_LITERAL(3, 42, 29), // "on_pushButton_delRule_clicked" 38 | QT_MOC_LITERAL(4, 72, 29), // "on_pushButton_fiterOn_clicked" 39 | QT_MOC_LITERAL(5, 102, 30), // "on_pushButton_fiterOff_clicked" 40 | QT_MOC_LITERAL(6, 133, 13), // "addRuleString" 41 | QT_MOC_LITERAL(7, 147, 11), // "rule_str_tp" 42 | QT_MOC_LITERAL(8, 159, 10), // "ruleString" 43 | QT_MOC_LITERAL(9, 170, 13), // "modRuleString" 44 | QT_MOC_LITERAL(10, 184, 13), // "delRuleString" 45 | QT_MOC_LITERAL(11, 198, 6), // "action" 46 | QT_MOC_LITERAL(12, 205, 9), // "updateLog" 47 | QT_MOC_LITERAL(13, 215, 30), // "on_pushButton_logClean_clicked" 48 | QT_MOC_LITERAL(14, 246, 29), // "on_pushButton_modRule_clicked" 49 | QT_MOC_LITERAL(15, 276, 31), // "on_action_importRules_triggered" 50 | QT_MOC_LITERAL(16, 308, 31), // "on_action_exportRules_triggered" 51 | QT_MOC_LITERAL(17, 340, 27), // "on_action_exitAPP_triggered" 52 | QT_MOC_LITERAL(18, 368, 25) // "on_action_about_triggered" 53 | 54 | }, 55 | "MainWindow\0on_pushButton_addRule_clicked\0" 56 | "\0on_pushButton_delRule_clicked\0" 57 | "on_pushButton_fiterOn_clicked\0" 58 | "on_pushButton_fiterOff_clicked\0" 59 | "addRuleString\0rule_str_tp\0ruleString\0" 60 | "modRuleString\0delRuleString\0action\0" 61 | "updateLog\0on_pushButton_logClean_clicked\0" 62 | "on_pushButton_modRule_clicked\0" 63 | "on_action_importRules_triggered\0" 64 | "on_action_exportRules_triggered\0" 65 | "on_action_exitAPP_triggered\0" 66 | "on_action_about_triggered" 67 | }; 68 | #undef QT_MOC_LITERAL 69 | 70 | static const uint qt_meta_data_MainWindow[] = { 71 | 72 | // content: 73 | 7, // revision 74 | 0, // classname 75 | 0, 0, // classinfo 76 | 14, 14, // methods 77 | 0, 0, // properties 78 | 0, 0, // enums/sets 79 | 0, 0, // constructors 80 | 0, // flags 81 | 0, // signalCount 82 | 83 | // slots: name, argc, parameters, tag, flags 84 | 1, 0, 84, 2, 0x08 /* Private */, 85 | 3, 0, 85, 2, 0x08 /* Private */, 86 | 4, 0, 86, 2, 0x08 /* Private */, 87 | 5, 0, 87, 2, 0x08 /* Private */, 88 | 6, 1, 88, 2, 0x08 /* Private */, 89 | 9, 1, 91, 2, 0x08 /* Private */, 90 | 10, 1, 94, 2, 0x08 /* Private */, 91 | 12, 0, 97, 2, 0x08 /* Private */, 92 | 13, 0, 98, 2, 0x08 /* Private */, 93 | 14, 0, 99, 2, 0x08 /* Private */, 94 | 15, 0, 100, 2, 0x08 /* Private */, 95 | 16, 0, 101, 2, 0x08 /* Private */, 96 | 17, 0, 102, 2, 0x08 /* Private */, 97 | 18, 0, 103, 2, 0x08 /* Private */, 98 | 99 | // slots: parameters 100 | QMetaType::Void, 101 | QMetaType::Void, 102 | QMetaType::Void, 103 | QMetaType::Void, 104 | QMetaType::Void, 0x80000000 | 7, 8, 105 | QMetaType::Void, 0x80000000 | 7, 8, 106 | QMetaType::Void, QMetaType::Bool, 11, 107 | QMetaType::Void, 108 | QMetaType::Void, 109 | QMetaType::Void, 110 | QMetaType::Void, 111 | QMetaType::Void, 112 | QMetaType::Void, 113 | QMetaType::Void, 114 | 115 | 0 // eod 116 | }; 117 | 118 | void MainWindow::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) 119 | { 120 | if (_c == QMetaObject::InvokeMetaMethod) { 121 | MainWindow *_t = static_cast(_o); 122 | Q_UNUSED(_t) 123 | switch (_id) { 124 | case 0: _t->on_pushButton_addRule_clicked(); break; 125 | case 1: _t->on_pushButton_delRule_clicked(); break; 126 | case 2: _t->on_pushButton_fiterOn_clicked(); break; 127 | case 3: _t->on_pushButton_fiterOff_clicked(); break; 128 | case 4: _t->addRuleString((*reinterpret_cast< rule_str_tp(*)>(_a[1]))); break; 129 | case 5: _t->modRuleString((*reinterpret_cast< rule_str_tp(*)>(_a[1]))); break; 130 | case 6: _t->delRuleString((*reinterpret_cast< bool(*)>(_a[1]))); break; 131 | case 7: _t->updateLog(); break; 132 | case 8: _t->on_pushButton_logClean_clicked(); break; 133 | case 9: _t->on_pushButton_modRule_clicked(); break; 134 | case 10: _t->on_action_importRules_triggered(); break; 135 | case 11: _t->on_action_exportRules_triggered(); break; 136 | case 12: _t->on_action_exitAPP_triggered(); break; 137 | case 13: _t->on_action_about_triggered(); break; 138 | default: ; 139 | } 140 | } 141 | } 142 | 143 | const QMetaObject MainWindow::staticMetaObject = { 144 | { &QMainWindow::staticMetaObject, qt_meta_stringdata_MainWindow.data, 145 | qt_meta_data_MainWindow, qt_static_metacall, nullptr, nullptr} 146 | }; 147 | 148 | 149 | const QMetaObject *MainWindow::metaObject() const 150 | { 151 | return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; 152 | } 153 | 154 | void *MainWindow::qt_metacast(const char *_clname) 155 | { 156 | if (!_clname) return nullptr; 157 | if (!strcmp(_clname, qt_meta_stringdata_MainWindow.stringdata0)) 158 | return static_cast(const_cast< MainWindow*>(this)); 159 | return QMainWindow::qt_metacast(_clname); 160 | } 161 | 162 | int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a) 163 | { 164 | _id = QMainWindow::qt_metacall(_c, _id, _a); 165 | if (_id < 0) 166 | return _id; 167 | if (_c == QMetaObject::InvokeMetaMethod) { 168 | if (_id < 14) 169 | qt_static_metacall(this, _c, _id, _a); 170 | _id -= 14; 171 | } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { 172 | if (_id < 14) 173 | *reinterpret_cast(_a[0]) = -1; 174 | _id -= 14; 175 | } 176 | return _id; 177 | } 178 | QT_WARNING_POP 179 | QT_END_MOC_NAMESPACE 180 | -------------------------------------------------------------------------------- /build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Debug/moc_mainwindow.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mryuan0428/Firewall-Based-on-Netfilter/902149e65a9a289c0c6e13441cd8af678654e432/build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Debug/moc_mainwindow.o -------------------------------------------------------------------------------- /build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Debug/moc_messagedialog.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Meta object code from reading C++ file 'messagedialog.h' 3 | ** 4 | ** Created by: The Qt Meta Object Compiler version 67 (Qt 5.9.0) 5 | ** 6 | ** WARNING! All changes made in this file will be lost! 7 | *****************************************************************************/ 8 | 9 | #include "../WJ_firewall/messagedialog.h" 10 | #include 11 | #include 12 | #if !defined(Q_MOC_OUTPUT_REVISION) 13 | #error "The header file 'messagedialog.h' doesn't include ." 14 | #elif Q_MOC_OUTPUT_REVISION != 67 15 | #error "This file was generated using the moc from 5.9.0. It" 16 | #error "cannot be used with the include files from this version of Qt." 17 | #error "(The moc has changed too much.)" 18 | #endif 19 | 20 | QT_BEGIN_MOC_NAMESPACE 21 | QT_WARNING_PUSH 22 | QT_WARNING_DISABLE_DEPRECATED 23 | struct qt_meta_stringdata_MessageDialog_t { 24 | QByteArrayData data[5]; 25 | char stringdata0[82]; 26 | }; 27 | #define QT_MOC_LITERAL(idx, ofs, len) \ 28 | Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ 29 | qptrdiff(offsetof(qt_meta_stringdata_MessageDialog_t, stringdata0) + ofs \ 30 | - idx * sizeof(QByteArrayData)) \ 31 | ) 32 | static const qt_meta_stringdata_MessageDialog_t qt_meta_stringdata_MessageDialog = { 33 | { 34 | QT_MOC_LITERAL(0, 0, 13), // "MessageDialog" 35 | QT_MOC_LITERAL(1, 14, 12), // "actionSignal" 36 | QT_MOC_LITERAL(2, 27, 0), // "" 37 | QT_MOC_LITERAL(3, 28, 24), // "on_pushButton_ok_clicked" 38 | QT_MOC_LITERAL(4, 53, 28) // "on_pushButton_cancel_clicked" 39 | 40 | }, 41 | "MessageDialog\0actionSignal\0\0" 42 | "on_pushButton_ok_clicked\0" 43 | "on_pushButton_cancel_clicked" 44 | }; 45 | #undef QT_MOC_LITERAL 46 | 47 | static const uint qt_meta_data_MessageDialog[] = { 48 | 49 | // content: 50 | 7, // revision 51 | 0, // classname 52 | 0, 0, // classinfo 53 | 3, 14, // methods 54 | 0, 0, // properties 55 | 0, 0, // enums/sets 56 | 0, 0, // constructors 57 | 0, // flags 58 | 1, // signalCount 59 | 60 | // signals: name, argc, parameters, tag, flags 61 | 1, 1, 29, 2, 0x06 /* Public */, 62 | 63 | // slots: name, argc, parameters, tag, flags 64 | 3, 0, 32, 2, 0x08 /* Private */, 65 | 4, 0, 33, 2, 0x08 /* Private */, 66 | 67 | // signals: parameters 68 | QMetaType::Void, QMetaType::Bool, 2, 69 | 70 | // slots: parameters 71 | QMetaType::Void, 72 | QMetaType::Void, 73 | 74 | 0 // eod 75 | }; 76 | 77 | void MessageDialog::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) 78 | { 79 | if (_c == QMetaObject::InvokeMetaMethod) { 80 | MessageDialog *_t = static_cast(_o); 81 | Q_UNUSED(_t) 82 | switch (_id) { 83 | case 0: _t->actionSignal((*reinterpret_cast< bool(*)>(_a[1]))); break; 84 | case 1: _t->on_pushButton_ok_clicked(); break; 85 | case 2: _t->on_pushButton_cancel_clicked(); break; 86 | default: ; 87 | } 88 | } else if (_c == QMetaObject::IndexOfMethod) { 89 | int *result = reinterpret_cast(_a[0]); 90 | void **func = reinterpret_cast(_a[1]); 91 | { 92 | typedef void (MessageDialog::*_t)(bool ); 93 | if (*reinterpret_cast<_t *>(func) == static_cast<_t>(&MessageDialog::actionSignal)) { 94 | *result = 0; 95 | return; 96 | } 97 | } 98 | } 99 | } 100 | 101 | const QMetaObject MessageDialog::staticMetaObject = { 102 | { &QDialog::staticMetaObject, qt_meta_stringdata_MessageDialog.data, 103 | qt_meta_data_MessageDialog, qt_static_metacall, nullptr, nullptr} 104 | }; 105 | 106 | 107 | const QMetaObject *MessageDialog::metaObject() const 108 | { 109 | return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; 110 | } 111 | 112 | void *MessageDialog::qt_metacast(const char *_clname) 113 | { 114 | if (!_clname) return nullptr; 115 | if (!strcmp(_clname, qt_meta_stringdata_MessageDialog.stringdata0)) 116 | return static_cast(const_cast< MessageDialog*>(this)); 117 | return QDialog::qt_metacast(_clname); 118 | } 119 | 120 | int MessageDialog::qt_metacall(QMetaObject::Call _c, int _id, void **_a) 121 | { 122 | _id = QDialog::qt_metacall(_c, _id, _a); 123 | if (_id < 0) 124 | return _id; 125 | if (_c == QMetaObject::InvokeMetaMethod) { 126 | if (_id < 3) 127 | qt_static_metacall(this, _c, _id, _a); 128 | _id -= 3; 129 | } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { 130 | if (_id < 3) 131 | *reinterpret_cast(_a[0]) = -1; 132 | _id -= 3; 133 | } 134 | return _id; 135 | } 136 | 137 | // SIGNAL 0 138 | void MessageDialog::actionSignal(bool _t1) 139 | { 140 | void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)) }; 141 | QMetaObject::activate(this, &staticMetaObject, 0, _a); 142 | } 143 | QT_WARNING_POP 144 | QT_END_MOC_NAMESPACE 145 | -------------------------------------------------------------------------------- /build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Debug/moc_messagedialog.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mryuan0428/Firewall-Based-on-Netfilter/902149e65a9a289c0c6e13441cd8af678654e432/build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Debug/moc_messagedialog.o -------------------------------------------------------------------------------- /build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Debug/moc_predefs.h: -------------------------------------------------------------------------------- 1 | #define __SSP_STRONG__ 3 2 | #define __DBL_MIN_EXP__ (-1021) 3 | #define __cpp_attributes 200809 4 | #define __UINT_LEAST16_MAX__ 0xffff 5 | #define __ATOMIC_ACQUIRE 2 6 | #define __FLT_MIN__ 1.17549435082228750797e-38F 7 | #define __GCC_IEC_559_COMPLEX 2 8 | #define __UINT_LEAST8_TYPE__ unsigned char 9 | #define __SIZEOF_FLOAT80__ 16 10 | #define __INTMAX_C(c) c ## L 11 | #define __CHAR_BIT__ 8 12 | #define __UINT8_MAX__ 0xff 13 | #define __WINT_MAX__ 0xffffffffU 14 | #define __cpp_static_assert 200410 15 | #define __ORDER_LITTLE_ENDIAN__ 1234 16 | #define __SIZE_MAX__ 0xffffffffffffffffUL 17 | #define __WCHAR_MAX__ 0x7fffffff 18 | #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1 19 | #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1 20 | #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1 21 | #define __DBL_DENORM_MIN__ double(4.94065645841246544177e-324L) 22 | #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1 23 | #define __GCC_ATOMIC_CHAR_LOCK_FREE 2 24 | #define __GCC_IEC_559 2 25 | #define __FLT_EVAL_METHOD__ 0 26 | #define __unix__ 1 27 | #define __cpp_binary_literals 201304 28 | #define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 2 29 | #define __x86_64 1 30 | #define __cpp_variadic_templates 200704 31 | #define __UINT_FAST64_MAX__ 0xffffffffffffffffUL 32 | #define __SIG_ATOMIC_TYPE__ int 33 | #define __DBL_MIN_10_EXP__ (-307) 34 | #define __FINITE_MATH_ONLY__ 0 35 | #define __GNUC_PATCHLEVEL__ 0 36 | #define __UINT_FAST8_MAX__ 0xff 37 | #define __has_include(STR) __has_include__(STR) 38 | #define __DEC64_MAX_EXP__ 385 39 | #define __INT8_C(c) c 40 | #define __UINT_LEAST64_MAX__ 0xffffffffffffffffUL 41 | #define __SHRT_MAX__ 0x7fff 42 | #define __LDBL_MAX__ 1.18973149535723176502e+4932L 43 | #define __UINT_LEAST8_MAX__ 0xff 44 | #define __GCC_ATOMIC_BOOL_LOCK_FREE 2 45 | #define __UINTMAX_TYPE__ long unsigned int 46 | #define __linux 1 47 | #define __DEC32_EPSILON__ 1E-6DF 48 | #define __unix 1 49 | #define __UINT32_MAX__ 0xffffffffU 50 | #define __GXX_EXPERIMENTAL_CXX0X__ 1 51 | #define __LDBL_MAX_EXP__ 16384 52 | #define __WINT_MIN__ 0U 53 | #define __linux__ 1 54 | #define __SCHAR_MAX__ 0x7f 55 | #define __WCHAR_MIN__ (-__WCHAR_MAX__ - 1) 56 | #define __INT64_C(c) c ## L 57 | #define __DBL_DIG__ 15 58 | #define __GCC_ATOMIC_POINTER_LOCK_FREE 2 59 | #define __SIZEOF_INT__ 4 60 | #define __SIZEOF_POINTER__ 8 61 | #define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 2 62 | #define __USER_LABEL_PREFIX__ 63 | #define __STDC_HOSTED__ 1 64 | #define __LDBL_HAS_INFINITY__ 1 65 | #define __FLT_EPSILON__ 1.19209289550781250000e-7F 66 | #define __GXX_WEAK__ 1 67 | #define __LDBL_MIN__ 3.36210314311209350626e-4932L 68 | #define __DEC32_MAX__ 9.999999E96DF 69 | #define __INT32_MAX__ 0x7fffffff 70 | #define __SIZEOF_LONG__ 8 71 | #define __STDC_IEC_559__ 1 72 | #define __STDC_ISO_10646__ 201505L 73 | #define __UINT16_C(c) c 74 | #define __DECIMAL_DIG__ 21 75 | #define __gnu_linux__ 1 76 | #define __has_include_next(STR) __has_include_next__(STR) 77 | #define __LDBL_HAS_QUIET_NAN__ 1 78 | #define __GNUC__ 5 79 | #define __GXX_RTTI 1 80 | #define __MMX__ 1 81 | #define __cpp_delegating_constructors 200604 82 | #define __FLT_HAS_DENORM__ 1 83 | #define __SIZEOF_LONG_DOUBLE__ 16 84 | #define __BIGGEST_ALIGNMENT__ 16 85 | #define __STDC_UTF_16__ 1 86 | #define __DBL_MAX__ double(1.79769313486231570815e+308L) 87 | #define __cpp_raw_strings 200710 88 | #define __INT_FAST32_MAX__ 0x7fffffffffffffffL 89 | #define __DBL_HAS_INFINITY__ 1 90 | #define __INT64_MAX__ 0x7fffffffffffffffL 91 | #define __DEC32_MIN_EXP__ (-94) 92 | #define __INT_FAST16_TYPE__ long int 93 | #define __LDBL_HAS_DENORM__ 1 94 | #define __cplusplus 201103L 95 | #define __cpp_ref_qualifiers 200710 96 | #define __DEC128_MAX__ 9.999999999999999999999999999999999E6144DL 97 | #define __INT_LEAST32_MAX__ 0x7fffffff 98 | #define __DEC32_MIN__ 1E-95DF 99 | #define __DEPRECATED 1 100 | #define __DBL_MAX_EXP__ 1024 101 | #define __DEC128_EPSILON__ 1E-33DL 102 | #define __SSE2_MATH__ 1 103 | #define __ATOMIC_HLE_RELEASE 131072 104 | #define __PTRDIFF_MAX__ 0x7fffffffffffffffL 105 | #define __amd64 1 106 | #define __STDC_NO_THREADS__ 1 107 | #define __ATOMIC_HLE_ACQUIRE 65536 108 | #define __GNUG__ 5 109 | #define __LONG_LONG_MAX__ 0x7fffffffffffffffLL 110 | #define __SIZEOF_SIZE_T__ 8 111 | #define __cpp_rvalue_reference 200610 112 | #define __cpp_nsdmi 200809 113 | #define __SIZEOF_WINT_T__ 4 114 | #define __cpp_initializer_lists 200806 115 | #define __GCC_HAVE_DWARF2_CFI_ASM 1 116 | #define __GXX_ABI_VERSION 1009 117 | #define __FLT_MIN_EXP__ (-125) 118 | #define __cpp_lambdas 200907 119 | #define __INT_FAST64_TYPE__ long int 120 | #define __DBL_MIN__ double(2.22507385850720138309e-308L) 121 | #define __LP64__ 1 122 | #define __DECIMAL_BID_FORMAT__ 1 123 | #define __DEC128_MIN__ 1E-6143DL 124 | #define __REGISTER_PREFIX__ 125 | #define __UINT16_MAX__ 0xffff 126 | #define __DBL_HAS_DENORM__ 1 127 | #define __UINT8_TYPE__ unsigned char 128 | #define __NO_INLINE__ 1 129 | #define __FLT_MANT_DIG__ 24 130 | #define __VERSION__ "5.4.0 20160609" 131 | #define __UINT64_C(c) c ## UL 132 | #define __cpp_unicode_characters 200704 133 | #define _STDC_PREDEF_H 1 134 | #define __GCC_ATOMIC_INT_LOCK_FREE 2 135 | #define __FLOAT_WORD_ORDER__ __ORDER_LITTLE_ENDIAN__ 136 | #define __STDC_IEC_559_COMPLEX__ 1 137 | #define __INT32_C(c) c 138 | #define __DEC64_EPSILON__ 1E-15DD 139 | #define __ORDER_PDP_ENDIAN__ 3412 140 | #define __DEC128_MIN_EXP__ (-6142) 141 | #define __INT_FAST32_TYPE__ long int 142 | #define __UINT_LEAST16_TYPE__ short unsigned int 143 | #define unix 1 144 | #define __INT16_MAX__ 0x7fff 145 | #define __cpp_rtti 199711 146 | #define __SIZE_TYPE__ long unsigned int 147 | #define __UINT64_MAX__ 0xffffffffffffffffUL 148 | #define __INT8_TYPE__ signed char 149 | #define __ELF__ 1 150 | #define __FLT_RADIX__ 2 151 | #define __INT_LEAST16_TYPE__ short int 152 | #define __LDBL_EPSILON__ 1.08420217248550443401e-19L 153 | #define __UINTMAX_C(c) c ## UL 154 | #define __GLIBCXX_BITSIZE_INT_N_0 128 155 | #define __k8 1 156 | #define __SIG_ATOMIC_MAX__ 0x7fffffff 157 | #define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 2 158 | #define __SIZEOF_PTRDIFF_T__ 8 159 | #define __x86_64__ 1 160 | #define __DEC32_SUBNORMAL_MIN__ 0.000001E-95DF 161 | #define __INT_FAST16_MAX__ 0x7fffffffffffffffL 162 | #define __UINT_FAST32_MAX__ 0xffffffffffffffffUL 163 | #define __UINT_LEAST64_TYPE__ long unsigned int 164 | #define __FLT_HAS_QUIET_NAN__ 1 165 | #define __FLT_MAX_10_EXP__ 38 166 | #define __LONG_MAX__ 0x7fffffffffffffffL 167 | #define __DEC128_SUBNORMAL_MIN__ 0.000000000000000000000000000000001E-6143DL 168 | #define __FLT_HAS_INFINITY__ 1 169 | #define __cpp_unicode_literals 200710 170 | #define __UINT_FAST16_TYPE__ long unsigned int 171 | #define __DEC64_MAX__ 9.999999999999999E384DD 172 | #define __CHAR16_TYPE__ short unsigned int 173 | #define __PRAGMA_REDEFINE_EXTNAME 1 174 | #define __INT_LEAST16_MAX__ 0x7fff 175 | #define __DEC64_MANT_DIG__ 16 176 | #define __UINT_LEAST32_MAX__ 0xffffffffU 177 | #define __GCC_ATOMIC_LONG_LOCK_FREE 2 178 | #define __INT_LEAST64_TYPE__ long int 179 | #define __INT16_TYPE__ short int 180 | #define __INT_LEAST8_TYPE__ signed char 181 | #define __DEC32_MAX_EXP__ 97 182 | #define __INT_FAST8_MAX__ 0x7f 183 | #define __INTPTR_MAX__ 0x7fffffffffffffffL 184 | #define linux 1 185 | #define __cpp_range_based_for 200907 186 | #define __SSE2__ 1 187 | #define __EXCEPTIONS 1 188 | #define __LDBL_MANT_DIG__ 64 189 | #define __DBL_HAS_QUIET_NAN__ 1 190 | #define __SIG_ATOMIC_MIN__ (-__SIG_ATOMIC_MAX__ - 1) 191 | #define __code_model_small__ 1 192 | #define __k8__ 1 193 | #define __INTPTR_TYPE__ long int 194 | #define __UINT16_TYPE__ short unsigned int 195 | #define __WCHAR_TYPE__ int 196 | #define __SIZEOF_FLOAT__ 4 197 | #define __UINTPTR_MAX__ 0xffffffffffffffffUL 198 | #define __DEC64_MIN_EXP__ (-382) 199 | #define __cpp_decltype 200707 200 | #define __INT_FAST64_MAX__ 0x7fffffffffffffffL 201 | #define __GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1 202 | #define __FLT_DIG__ 6 203 | #define __UINT_FAST64_TYPE__ long unsigned int 204 | #define __INT_MAX__ 0x7fffffff 205 | #define __amd64__ 1 206 | #define __INT64_TYPE__ long int 207 | #define __FLT_MAX_EXP__ 128 208 | #define __ORDER_BIG_ENDIAN__ 4321 209 | #define __DBL_MANT_DIG__ 53 210 | #define __cpp_inheriting_constructors 200802 211 | #define __SIZEOF_FLOAT128__ 16 212 | #define __INT_LEAST64_MAX__ 0x7fffffffffffffffL 213 | #define __DEC64_MIN__ 1E-383DD 214 | #define __WINT_TYPE__ unsigned int 215 | #define __UINT_LEAST32_TYPE__ unsigned int 216 | #define __SIZEOF_SHORT__ 2 217 | #define __SSE__ 1 218 | #define __LDBL_MIN_EXP__ (-16381) 219 | #define __INT_LEAST8_MAX__ 0x7f 220 | #define __SIZEOF_INT128__ 16 221 | #define __LDBL_MAX_10_EXP__ 4932 222 | #define __ATOMIC_RELAXED 0 223 | #define __DBL_EPSILON__ double(2.22044604925031308085e-16L) 224 | #define _LP64 1 225 | #define __UINT8_C(c) c 226 | #define __INT_LEAST32_TYPE__ int 227 | #define __SIZEOF_WCHAR_T__ 4 228 | #define __UINT64_TYPE__ long unsigned int 229 | #define __INT_FAST8_TYPE__ signed char 230 | #define __GNUC_STDC_INLINE__ 1 231 | #define __DBL_DECIMAL_DIG__ 17 232 | #define __STDC_UTF_32__ 1 233 | #define __FXSR__ 1 234 | #define __DEC_EVAL_METHOD__ 2 235 | #define __cpp_runtime_arrays 198712 236 | #define __UINT32_C(c) c ## U 237 | #define __INTMAX_MAX__ 0x7fffffffffffffffL 238 | #define __cpp_alias_templates 200704 239 | #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ 240 | #define __FLT_DENORM_MIN__ 1.40129846432481707092e-45F 241 | #define __INT8_MAX__ 0x7f 242 | #define __UINT_FAST32_TYPE__ long unsigned int 243 | #define __CHAR32_TYPE__ unsigned int 244 | #define __FLT_MAX__ 3.40282346638528859812e+38F 245 | #define __cpp_constexpr 200704 246 | #define __INT32_TYPE__ int 247 | #define __SIZEOF_DOUBLE__ 8 248 | #define __cpp_exceptions 199711 249 | #define __INTMAX_TYPE__ long int 250 | #define __DEC128_MAX_EXP__ 6145 251 | #define __ATOMIC_CONSUME 1 252 | #define __GNUC_MINOR__ 4 253 | #define __GLIBCXX_TYPE_INT_N_0 __int128 254 | #define __UINTMAX_MAX__ 0xffffffffffffffffUL 255 | #define __DEC32_MANT_DIG__ 7 256 | #define __DBL_MAX_10_EXP__ 308 257 | #define __LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L 258 | #define __INT16_C(c) c 259 | #define __STDC__ 1 260 | #define __PTRDIFF_TYPE__ long int 261 | #define __ATOMIC_SEQ_CST 5 262 | #define __UINT32_TYPE__ unsigned int 263 | #define __UINTPTR_TYPE__ long unsigned int 264 | #define __DEC64_SUBNORMAL_MIN__ 0.000000000000001E-383DD 265 | #define __DEC128_MANT_DIG__ 34 266 | #define __LDBL_MIN_10_EXP__ (-4931) 267 | #define __SSE_MATH__ 1 268 | #define __SIZEOF_LONG_LONG__ 8 269 | #define __cpp_user_defined_literals 200809 270 | #define __GCC_ATOMIC_LLONG_LOCK_FREE 2 271 | #define __LDBL_DIG__ 18 272 | #define __FLT_DECIMAL_DIG__ 9 273 | #define __UINT_FAST16_MAX__ 0xffffffffffffffffUL 274 | #define __FLT_MIN_10_EXP__ (-37) 275 | #define __GCC_ATOMIC_SHORT_LOCK_FREE 2 276 | #define __UINT_FAST8_TYPE__ unsigned char 277 | #define _GNU_SOURCE 1 278 | #define __ATOMIC_ACQ_REL 4 279 | #define __ATOMIC_RELEASE 3 280 | -------------------------------------------------------------------------------- /build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Debug/moc_ruledialog.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Meta object code from reading C++ file 'ruledialog.h' 3 | ** 4 | ** Created by: The Qt Meta Object Compiler version 67 (Qt 5.9.0) 5 | ** 6 | ** WARNING! All changes made in this file will be lost! 7 | *****************************************************************************/ 8 | 9 | #include "../WJ_firewall/ruledialog.h" 10 | #include 11 | #include 12 | #if !defined(Q_MOC_OUTPUT_REVISION) 13 | #error "The header file 'ruledialog.h' doesn't include ." 14 | #elif Q_MOC_OUTPUT_REVISION != 67 15 | #error "This file was generated using the moc from 5.9.0. It" 16 | #error "cannot be used with the include files from this version of Qt." 17 | #error "(The moc has changed too much.)" 18 | #endif 19 | 20 | QT_BEGIN_MOC_NAMESPACE 21 | QT_WARNING_PUSH 22 | QT_WARNING_DISABLE_DEPRECATED 23 | struct qt_meta_stringdata_RuleDialog_t { 24 | QByteArrayData data[9]; 25 | char stringdata0[176]; 26 | }; 27 | #define QT_MOC_LITERAL(idx, ofs, len) \ 28 | Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ 29 | qptrdiff(offsetof(qt_meta_stringdata_RuleDialog_t, stringdata0) + ofs \ 30 | - idx * sizeof(QByteArrayData)) \ 31 | ) 32 | static const qt_meta_stringdata_RuleDialog_t qt_meta_stringdata_RuleDialog = { 33 | { 34 | QT_MOC_LITERAL(0, 0, 10), // "RuleDialog" 35 | QT_MOC_LITERAL(1, 11, 16), // "addNewRuleSignal" 36 | QT_MOC_LITERAL(2, 28, 0), // "" 37 | QT_MOC_LITERAL(3, 29, 11), // "rule_str_tp" 38 | QT_MOC_LITERAL(4, 41, 24), // "on_pushButton_ok_clicked" 39 | QT_MOC_LITERAL(5, 66, 39), // "on_comboBox_protocol_currentT..." 40 | QT_MOC_LITERAL(6, 106, 4), // "text" 41 | QT_MOC_LITERAL(7, 111, 28), // "on_pushButton_cancel_clicked" 42 | QT_MOC_LITERAL(8, 140, 35) // "on_comboBox_time_currentTextC..." 43 | 44 | }, 45 | "RuleDialog\0addNewRuleSignal\0\0rule_str_tp\0" 46 | "on_pushButton_ok_clicked\0" 47 | "on_comboBox_protocol_currentTextChanged\0" 48 | "text\0on_pushButton_cancel_clicked\0" 49 | "on_comboBox_time_currentTextChanged" 50 | }; 51 | #undef QT_MOC_LITERAL 52 | 53 | static const uint qt_meta_data_RuleDialog[] = { 54 | 55 | // content: 56 | 7, // revision 57 | 0, // classname 58 | 0, 0, // classinfo 59 | 5, 14, // methods 60 | 0, 0, // properties 61 | 0, 0, // enums/sets 62 | 0, 0, // constructors 63 | 0, // flags 64 | 1, // signalCount 65 | 66 | // signals: name, argc, parameters, tag, flags 67 | 1, 1, 39, 2, 0x06 /* Public */, 68 | 69 | // slots: name, argc, parameters, tag, flags 70 | 4, 0, 42, 2, 0x08 /* Private */, 71 | 5, 1, 43, 2, 0x08 /* Private */, 72 | 7, 0, 46, 2, 0x08 /* Private */, 73 | 8, 1, 47, 2, 0x08 /* Private */, 74 | 75 | // signals: parameters 76 | QMetaType::Void, 0x80000000 | 3, 2, 77 | 78 | // slots: parameters 79 | QMetaType::Void, 80 | QMetaType::Void, QMetaType::QString, 6, 81 | QMetaType::Void, 82 | QMetaType::Void, QMetaType::QString, 6, 83 | 84 | 0 // eod 85 | }; 86 | 87 | void RuleDialog::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) 88 | { 89 | if (_c == QMetaObject::InvokeMetaMethod) { 90 | RuleDialog *_t = static_cast(_o); 91 | Q_UNUSED(_t) 92 | switch (_id) { 93 | case 0: _t->addNewRuleSignal((*reinterpret_cast< rule_str_tp(*)>(_a[1]))); break; 94 | case 1: _t->on_pushButton_ok_clicked(); break; 95 | case 2: _t->on_comboBox_protocol_currentTextChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break; 96 | case 3: _t->on_pushButton_cancel_clicked(); break; 97 | case 4: _t->on_comboBox_time_currentTextChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break; 98 | default: ; 99 | } 100 | } else if (_c == QMetaObject::IndexOfMethod) { 101 | int *result = reinterpret_cast(_a[0]); 102 | void **func = reinterpret_cast(_a[1]); 103 | { 104 | typedef void (RuleDialog::*_t)(rule_str_tp ); 105 | if (*reinterpret_cast<_t *>(func) == static_cast<_t>(&RuleDialog::addNewRuleSignal)) { 106 | *result = 0; 107 | return; 108 | } 109 | } 110 | } 111 | } 112 | 113 | const QMetaObject RuleDialog::staticMetaObject = { 114 | { &QDialog::staticMetaObject, qt_meta_stringdata_RuleDialog.data, 115 | qt_meta_data_RuleDialog, qt_static_metacall, nullptr, nullptr} 116 | }; 117 | 118 | 119 | const QMetaObject *RuleDialog::metaObject() const 120 | { 121 | return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; 122 | } 123 | 124 | void *RuleDialog::qt_metacast(const char *_clname) 125 | { 126 | if (!_clname) return nullptr; 127 | if (!strcmp(_clname, qt_meta_stringdata_RuleDialog.stringdata0)) 128 | return static_cast(const_cast< RuleDialog*>(this)); 129 | return QDialog::qt_metacast(_clname); 130 | } 131 | 132 | int RuleDialog::qt_metacall(QMetaObject::Call _c, int _id, void **_a) 133 | { 134 | _id = QDialog::qt_metacall(_c, _id, _a); 135 | if (_id < 0) 136 | return _id; 137 | if (_c == QMetaObject::InvokeMetaMethod) { 138 | if (_id < 5) 139 | qt_static_metacall(this, _c, _id, _a); 140 | _id -= 5; 141 | } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { 142 | if (_id < 5) 143 | *reinterpret_cast(_a[0]) = -1; 144 | _id -= 5; 145 | } 146 | return _id; 147 | } 148 | 149 | // SIGNAL 0 150 | void RuleDialog::addNewRuleSignal(rule_str_tp _t1) 151 | { 152 | void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)) }; 153 | QMetaObject::activate(this, &staticMetaObject, 0, _a); 154 | } 155 | QT_WARNING_POP 156 | QT_END_MOC_NAMESPACE 157 | -------------------------------------------------------------------------------- /build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Debug/moc_ruledialog.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mryuan0428/Firewall-Based-on-Netfilter/902149e65a9a289c0c6e13441cd8af678654e432/build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Debug/moc_ruledialog.o -------------------------------------------------------------------------------- /build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Debug/moc_ruledialog_m.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Meta object code from reading C++ file 'ruledialog_m.h' 3 | ** 4 | ** Created by: The Qt Meta Object Compiler version 67 (Qt 5.9.0) 5 | ** 6 | ** WARNING! All changes made in this file will be lost! 7 | *****************************************************************************/ 8 | 9 | #include "../WJ_firewall/ruledialog_m.h" 10 | #include 11 | #include 12 | #if !defined(Q_MOC_OUTPUT_REVISION) 13 | #error "The header file 'ruledialog_m.h' doesn't include ." 14 | #elif Q_MOC_OUTPUT_REVISION != 67 15 | #error "This file was generated using the moc from 5.9.0. It" 16 | #error "cannot be used with the include files from this version of Qt." 17 | #error "(The moc has changed too much.)" 18 | #endif 19 | 20 | QT_BEGIN_MOC_NAMESPACE 21 | QT_WARNING_PUSH 22 | QT_WARNING_DISABLE_DEPRECATED 23 | struct qt_meta_stringdata_ruledialog_m_t { 24 | QByteArrayData data[9]; 25 | char stringdata0[175]; 26 | }; 27 | #define QT_MOC_LITERAL(idx, ofs, len) \ 28 | Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ 29 | qptrdiff(offsetof(qt_meta_stringdata_ruledialog_m_t, stringdata0) + ofs \ 30 | - idx * sizeof(QByteArrayData)) \ 31 | ) 32 | static const qt_meta_stringdata_ruledialog_m_t qt_meta_stringdata_ruledialog_m = { 33 | { 34 | QT_MOC_LITERAL(0, 0, 12), // "ruledialog_m" 35 | QT_MOC_LITERAL(1, 13, 13), // "modRuleSignal" 36 | QT_MOC_LITERAL(2, 27, 0), // "" 37 | QT_MOC_LITERAL(3, 28, 11), // "rule_str_tp" 38 | QT_MOC_LITERAL(4, 40, 24), // "on_pushButton_ok_clicked" 39 | QT_MOC_LITERAL(5, 65, 28), // "on_pushButton_cancel_clicked" 40 | QT_MOC_LITERAL(6, 94, 39), // "on_comboBox_protocol_currentT..." 41 | QT_MOC_LITERAL(7, 134, 4), // "text" 42 | QT_MOC_LITERAL(8, 139, 35) // "on_comboBox_time_currentTextC..." 43 | 44 | }, 45 | "ruledialog_m\0modRuleSignal\0\0rule_str_tp\0" 46 | "on_pushButton_ok_clicked\0" 47 | "on_pushButton_cancel_clicked\0" 48 | "on_comboBox_protocol_currentTextChanged\0" 49 | "text\0on_comboBox_time_currentTextChanged" 50 | }; 51 | #undef QT_MOC_LITERAL 52 | 53 | static const uint qt_meta_data_ruledialog_m[] = { 54 | 55 | // content: 56 | 7, // revision 57 | 0, // classname 58 | 0, 0, // classinfo 59 | 5, 14, // methods 60 | 0, 0, // properties 61 | 0, 0, // enums/sets 62 | 0, 0, // constructors 63 | 0, // flags 64 | 1, // signalCount 65 | 66 | // signals: name, argc, parameters, tag, flags 67 | 1, 1, 39, 2, 0x06 /* Public */, 68 | 69 | // slots: name, argc, parameters, tag, flags 70 | 4, 0, 42, 2, 0x08 /* Private */, 71 | 5, 0, 43, 2, 0x08 /* Private */, 72 | 6, 1, 44, 2, 0x08 /* Private */, 73 | 8, 1, 47, 2, 0x08 /* Private */, 74 | 75 | // signals: parameters 76 | QMetaType::Void, 0x80000000 | 3, 2, 77 | 78 | // slots: parameters 79 | QMetaType::Void, 80 | QMetaType::Void, 81 | QMetaType::Void, QMetaType::QString, 7, 82 | QMetaType::Void, QMetaType::QString, 7, 83 | 84 | 0 // eod 85 | }; 86 | 87 | void ruledialog_m::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) 88 | { 89 | if (_c == QMetaObject::InvokeMetaMethod) { 90 | ruledialog_m *_t = static_cast(_o); 91 | Q_UNUSED(_t) 92 | switch (_id) { 93 | case 0: _t->modRuleSignal((*reinterpret_cast< rule_str_tp(*)>(_a[1]))); break; 94 | case 1: _t->on_pushButton_ok_clicked(); break; 95 | case 2: _t->on_pushButton_cancel_clicked(); break; 96 | case 3: _t->on_comboBox_protocol_currentTextChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break; 97 | case 4: _t->on_comboBox_time_currentTextChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break; 98 | default: ; 99 | } 100 | } else if (_c == QMetaObject::IndexOfMethod) { 101 | int *result = reinterpret_cast(_a[0]); 102 | void **func = reinterpret_cast(_a[1]); 103 | { 104 | typedef void (ruledialog_m::*_t)(rule_str_tp ); 105 | if (*reinterpret_cast<_t *>(func) == static_cast<_t>(&ruledialog_m::modRuleSignal)) { 106 | *result = 0; 107 | return; 108 | } 109 | } 110 | } 111 | } 112 | 113 | const QMetaObject ruledialog_m::staticMetaObject = { 114 | { &QDialog::staticMetaObject, qt_meta_stringdata_ruledialog_m.data, 115 | qt_meta_data_ruledialog_m, qt_static_metacall, nullptr, nullptr} 116 | }; 117 | 118 | 119 | const QMetaObject *ruledialog_m::metaObject() const 120 | { 121 | return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; 122 | } 123 | 124 | void *ruledialog_m::qt_metacast(const char *_clname) 125 | { 126 | if (!_clname) return nullptr; 127 | if (!strcmp(_clname, qt_meta_stringdata_ruledialog_m.stringdata0)) 128 | return static_cast(const_cast< ruledialog_m*>(this)); 129 | return QDialog::qt_metacast(_clname); 130 | } 131 | 132 | int ruledialog_m::qt_metacall(QMetaObject::Call _c, int _id, void **_a) 133 | { 134 | _id = QDialog::qt_metacall(_c, _id, _a); 135 | if (_id < 0) 136 | return _id; 137 | if (_c == QMetaObject::InvokeMetaMethod) { 138 | if (_id < 5) 139 | qt_static_metacall(this, _c, _id, _a); 140 | _id -= 5; 141 | } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { 142 | if (_id < 5) 143 | *reinterpret_cast(_a[0]) = -1; 144 | _id -= 5; 145 | } 146 | return _id; 147 | } 148 | 149 | // SIGNAL 0 150 | void ruledialog_m::modRuleSignal(rule_str_tp _t1) 151 | { 152 | void *_a[] = { nullptr, const_cast(reinterpret_cast(&_t1)) }; 153 | QMetaObject::activate(this, &staticMetaObject, 0, _a); 154 | } 155 | QT_WARNING_POP 156 | QT_END_MOC_NAMESPACE 157 | -------------------------------------------------------------------------------- /build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Debug/moc_ruledialog_m.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mryuan0428/Firewall-Based-on-Netfilter/902149e65a9a289c0c6e13441cd8af678654e432/build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Debug/moc_ruledialog_m.o -------------------------------------------------------------------------------- /build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Debug/ruledialog.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mryuan0428/Firewall-Based-on-Netfilter/902149e65a9a289c0c6e13441cd8af678654e432/build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Debug/ruledialog.o -------------------------------------------------------------------------------- /build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Debug/ruledialog_m.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mryuan0428/Firewall-Based-on-Netfilter/902149e65a9a289c0c6e13441cd8af678654e432/build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Debug/ruledialog_m.o -------------------------------------------------------------------------------- /build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Debug/ui_aboutdialog.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | ** Form generated from reading UI file 'aboutdialog.ui' 3 | ** 4 | ** Created by: Qt User Interface Compiler version 5.9.0 5 | ** 6 | ** WARNING! All changes made in this file will be lost when recompiling UI file! 7 | ********************************************************************************/ 8 | 9 | #ifndef UI_ABOUTDIALOG_H 10 | #define UI_ABOUTDIALOG_H 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | QT_BEGIN_NAMESPACE 22 | 23 | class Ui_aboutdialog 24 | { 25 | public: 26 | QPushButton *pushButton_ok; 27 | QLabel *label; 28 | 29 | void setupUi(QDialog *aboutdialog) 30 | { 31 | if (aboutdialog->objectName().isEmpty()) 32 | aboutdialog->setObjectName(QStringLiteral("aboutdialog")); 33 | aboutdialog->resize(420, 300); 34 | pushButton_ok = new QPushButton(aboutdialog); 35 | pushButton_ok->setObjectName(QStringLiteral("pushButton_ok")); 36 | pushButton_ok->setGeometry(QRect(170, 250, 80, 30)); 37 | pushButton_ok->setMinimumSize(QSize(80, 30)); 38 | pushButton_ok->setMaximumSize(QSize(80, 30)); 39 | label = new QLabel(aboutdialog); 40 | label->setObjectName(QStringLiteral("label")); 41 | label->setGeometry(QRect(60, 30, 300, 201)); 42 | label->setMinimumSize(QSize(300, 0)); 43 | label->setMaximumSize(QSize(300, 16777215)); 44 | 45 | retranslateUi(aboutdialog); 46 | 47 | QMetaObject::connectSlotsByName(aboutdialog); 48 | } // setupUi 49 | 50 | void retranslateUi(QDialog *aboutdialog) 51 | { 52 | aboutdialog->setWindowTitle(QApplication::translate("aboutdialog", "About", Q_NULLPTR)); 53 | pushButton_ok->setText(QApplication::translate("aboutdialog", "\347\241\256\345\256\232", Q_NULLPTR)); 54 | label->setText(QApplication::translate("aboutdialog", "TextLabel", Q_NULLPTR)); 55 | } // retranslateUi 56 | 57 | }; 58 | 59 | namespace Ui { 60 | class aboutdialog: public Ui_aboutdialog {}; 61 | } // namespace Ui 62 | 63 | QT_END_NAMESPACE 64 | 65 | #endif // UI_ABOUTDIALOG_H 66 | -------------------------------------------------------------------------------- /build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Debug/ui_mainwindow.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | ** Form generated from reading UI file 'mainwindow.ui' 3 | ** 4 | ** Created by: Qt User Interface Compiler version 5.9.0 5 | ** 6 | ** WARNING! All changes made in this file will be lost when recompiling UI file! 7 | ********************************************************************************/ 8 | 9 | #ifndef UI_MAINWINDOW_H 10 | #define UI_MAINWINDOW_H 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | QT_BEGIN_NAMESPACE 31 | 32 | class Ui_MainWindow 33 | { 34 | public: 35 | QAction *action_importRules; 36 | QAction *action_exportRules; 37 | QAction *action_exitAPP; 38 | QAction *action_about; 39 | QWidget *centralWidget; 40 | QVBoxLayout *verticalLayout; 41 | QHBoxLayout *horizontalLayout_2; 42 | QPushButton *pushButton_addRule; 43 | QSpacerItem *horizontalSpacer; 44 | QPushButton *pushButton_modRule; 45 | QSpacerItem *horizontalSpacer_4; 46 | QPushButton *pushButton_delRule; 47 | QSpacerItem *horizontalSpacer_3; 48 | QPushButton *pushButton_fiterOn; 49 | QSpacerItem *horizontalSpacer_2; 50 | QPushButton *pushButton_fiterOff; 51 | QHBoxLayout *horizontalLayout; 52 | QTabWidget *tabWidget; 53 | QWidget *tab_1; 54 | QVBoxLayout *verticalLayout_2; 55 | QTableWidget *tableWidget; 56 | QWidget *tab_2; 57 | QVBoxLayout *verticalLayout_3; 58 | QPushButton *pushButton_logClean; 59 | QPlainTextEdit *plainTextEdit; 60 | QMenuBar *menuBar; 61 | QMenu *menu_file; 62 | QMenu *menu_help; 63 | QStatusBar *statusBar; 64 | 65 | void setupUi(QMainWindow *MainWindow) 66 | { 67 | if (MainWindow->objectName().isEmpty()) 68 | MainWindow->setObjectName(QStringLiteral("MainWindow")); 69 | MainWindow->resize(1000, 600); 70 | MainWindow->setMinimumSize(QSize(1000, 600)); 71 | MainWindow->setMaximumSize(QSize(1000, 600)); 72 | action_importRules = new QAction(MainWindow); 73 | action_importRules->setObjectName(QStringLiteral("action_importRules")); 74 | action_exportRules = new QAction(MainWindow); 75 | action_exportRules->setObjectName(QStringLiteral("action_exportRules")); 76 | action_exitAPP = new QAction(MainWindow); 77 | action_exitAPP->setObjectName(QStringLiteral("action_exitAPP")); 78 | action_about = new QAction(MainWindow); 79 | action_about->setObjectName(QStringLiteral("action_about")); 80 | centralWidget = new QWidget(MainWindow); 81 | centralWidget->setObjectName(QStringLiteral("centralWidget")); 82 | verticalLayout = new QVBoxLayout(centralWidget); 83 | verticalLayout->setSpacing(10); 84 | verticalLayout->setContentsMargins(11, 11, 11, 11); 85 | verticalLayout->setObjectName(QStringLiteral("verticalLayout")); 86 | verticalLayout->setContentsMargins(20, 20, 20, 5); 87 | horizontalLayout_2 = new QHBoxLayout(); 88 | horizontalLayout_2->setSpacing(20); 89 | horizontalLayout_2->setObjectName(QStringLiteral("horizontalLayout_2")); 90 | pushButton_addRule = new QPushButton(centralWidget); 91 | pushButton_addRule->setObjectName(QStringLiteral("pushButton_addRule")); 92 | pushButton_addRule->setMinimumSize(QSize(100, 30)); 93 | pushButton_addRule->setMaximumSize(QSize(100, 30)); 94 | 95 | horizontalLayout_2->addWidget(pushButton_addRule); 96 | 97 | horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); 98 | 99 | horizontalLayout_2->addItem(horizontalSpacer); 100 | 101 | pushButton_modRule = new QPushButton(centralWidget); 102 | pushButton_modRule->setObjectName(QStringLiteral("pushButton_modRule")); 103 | pushButton_modRule->setMinimumSize(QSize(100, 30)); 104 | pushButton_modRule->setMaximumSize(QSize(100, 30)); 105 | 106 | horizontalLayout_2->addWidget(pushButton_modRule); 107 | 108 | horizontalSpacer_4 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); 109 | 110 | horizontalLayout_2->addItem(horizontalSpacer_4); 111 | 112 | pushButton_delRule = new QPushButton(centralWidget); 113 | pushButton_delRule->setObjectName(QStringLiteral("pushButton_delRule")); 114 | pushButton_delRule->setMinimumSize(QSize(100, 30)); 115 | pushButton_delRule->setMaximumSize(QSize(100, 30)); 116 | 117 | horizontalLayout_2->addWidget(pushButton_delRule); 118 | 119 | horizontalSpacer_3 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); 120 | 121 | horizontalLayout_2->addItem(horizontalSpacer_3); 122 | 123 | pushButton_fiterOn = new QPushButton(centralWidget); 124 | pushButton_fiterOn->setObjectName(QStringLiteral("pushButton_fiterOn")); 125 | pushButton_fiterOn->setMinimumSize(QSize(100, 30)); 126 | pushButton_fiterOn->setMaximumSize(QSize(100, 30)); 127 | 128 | horizontalLayout_2->addWidget(pushButton_fiterOn); 129 | 130 | horizontalSpacer_2 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); 131 | 132 | horizontalLayout_2->addItem(horizontalSpacer_2); 133 | 134 | pushButton_fiterOff = new QPushButton(centralWidget); 135 | pushButton_fiterOff->setObjectName(QStringLiteral("pushButton_fiterOff")); 136 | pushButton_fiterOff->setMinimumSize(QSize(100, 30)); 137 | pushButton_fiterOff->setMaximumSize(QSize(100, 30)); 138 | 139 | horizontalLayout_2->addWidget(pushButton_fiterOff); 140 | 141 | 142 | verticalLayout->addLayout(horizontalLayout_2); 143 | 144 | horizontalLayout = new QHBoxLayout(); 145 | horizontalLayout->setSpacing(6); 146 | horizontalLayout->setObjectName(QStringLiteral("horizontalLayout")); 147 | tabWidget = new QTabWidget(centralWidget); 148 | tabWidget->setObjectName(QStringLiteral("tabWidget")); 149 | tabWidget->setStyleSheet(QLatin1String("QTabBar::tab:selected{background-color: white;}\n" 150 | "QTabBar::tab:!selected{background-color: rgb(239, 235, 231);}\n" 151 | "QTabBar::tab{min-width:80px; min-height:28px; border: 1px solid rgb(188, 185, 181); margin-bottom:1px;}")); 152 | tab_1 = new QWidget(); 153 | tab_1->setObjectName(QStringLiteral("tab_1")); 154 | tab_1->setFocusPolicy(Qt::NoFocus); 155 | tab_1->setStyleSheet(QStringLiteral("")); 156 | verticalLayout_2 = new QVBoxLayout(tab_1); 157 | verticalLayout_2->setSpacing(0); 158 | verticalLayout_2->setContentsMargins(11, 11, 11, 11); 159 | verticalLayout_2->setObjectName(QStringLiteral("verticalLayout_2")); 160 | verticalLayout_2->setContentsMargins(0, 0, 0, 0); 161 | tableWidget = new QTableWidget(tab_1); 162 | if (tableWidget->columnCount() < 10) 163 | tableWidget->setColumnCount(10); 164 | QTableWidgetItem *__qtablewidgetitem = new QTableWidgetItem(); 165 | __qtablewidgetitem->setTextAlignment(Qt::AlignCenter); 166 | tableWidget->setHorizontalHeaderItem(0, __qtablewidgetitem); 167 | QTableWidgetItem *__qtablewidgetitem1 = new QTableWidgetItem(); 168 | __qtablewidgetitem1->setTextAlignment(Qt::AlignCenter); 169 | tableWidget->setHorizontalHeaderItem(1, __qtablewidgetitem1); 170 | QTableWidgetItem *__qtablewidgetitem2 = new QTableWidgetItem(); 171 | __qtablewidgetitem2->setTextAlignment(Qt::AlignCenter); 172 | tableWidget->setHorizontalHeaderItem(2, __qtablewidgetitem2); 173 | QTableWidgetItem *__qtablewidgetitem3 = new QTableWidgetItem(); 174 | __qtablewidgetitem3->setTextAlignment(Qt::AlignCenter); 175 | tableWidget->setHorizontalHeaderItem(3, __qtablewidgetitem3); 176 | QTableWidgetItem *__qtablewidgetitem4 = new QTableWidgetItem(); 177 | __qtablewidgetitem4->setTextAlignment(Qt::AlignCenter); 178 | tableWidget->setHorizontalHeaderItem(4, __qtablewidgetitem4); 179 | QTableWidgetItem *__qtablewidgetitem5 = new QTableWidgetItem(); 180 | __qtablewidgetitem5->setTextAlignment(Qt::AlignCenter); 181 | tableWidget->setHorizontalHeaderItem(5, __qtablewidgetitem5); 182 | QTableWidgetItem *__qtablewidgetitem6 = new QTableWidgetItem(); 183 | __qtablewidgetitem6->setTextAlignment(Qt::AlignCenter); 184 | tableWidget->setHorizontalHeaderItem(6, __qtablewidgetitem6); 185 | QTableWidgetItem *__qtablewidgetitem7 = new QTableWidgetItem(); 186 | __qtablewidgetitem7->setTextAlignment(Qt::AlignCenter); 187 | tableWidget->setHorizontalHeaderItem(7, __qtablewidgetitem7); 188 | QTableWidgetItem *__qtablewidgetitem8 = new QTableWidgetItem(); 189 | __qtablewidgetitem8->setTextAlignment(Qt::AlignCenter); 190 | tableWidget->setHorizontalHeaderItem(8, __qtablewidgetitem8); 191 | QTableWidgetItem *__qtablewidgetitem9 = new QTableWidgetItem(); 192 | __qtablewidgetitem9->setTextAlignment(Qt::AlignCenter); 193 | tableWidget->setHorizontalHeaderItem(9, __qtablewidgetitem9); 194 | tableWidget->setObjectName(QStringLiteral("tableWidget")); 195 | tableWidget->setStyleSheet(QStringLiteral("margin:-1px;")); 196 | tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers); 197 | tableWidget->setSelectionMode(QAbstractItemView::SingleSelection); 198 | tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); 199 | tableWidget->horizontalHeader()->setDefaultSectionSize(85); 200 | tableWidget->horizontalHeader()->setHighlightSections(false); 201 | tableWidget->horizontalHeader()->setMinimumSectionSize(60); 202 | tableWidget->horizontalHeader()->setStretchLastSection(true); 203 | tableWidget->verticalHeader()->setVisible(false); 204 | tableWidget->verticalHeader()->setHighlightSections(false); 205 | tableWidget->verticalHeader()->setMinimumSectionSize(30); 206 | 207 | verticalLayout_2->addWidget(tableWidget); 208 | 209 | tabWidget->addTab(tab_1, QString()); 210 | tab_2 = new QWidget(); 211 | tab_2->setObjectName(QStringLiteral("tab_2")); 212 | verticalLayout_3 = new QVBoxLayout(tab_2); 213 | verticalLayout_3->setSpacing(0); 214 | verticalLayout_3->setContentsMargins(11, 11, 11, 11); 215 | verticalLayout_3->setObjectName(QStringLiteral("verticalLayout_3")); 216 | verticalLayout_3->setContentsMargins(0, 0, 0, 0); 217 | pushButton_logClean = new QPushButton(tab_2); 218 | pushButton_logClean->setObjectName(QStringLiteral("pushButton_logClean")); 219 | 220 | verticalLayout_3->addWidget(pushButton_logClean); 221 | 222 | plainTextEdit = new QPlainTextEdit(tab_2); 223 | plainTextEdit->setObjectName(QStringLiteral("plainTextEdit")); 224 | plainTextEdit->setStyleSheet(QStringLiteral("margin:-1px;")); 225 | plainTextEdit->setReadOnly(true); 226 | 227 | verticalLayout_3->addWidget(plainTextEdit); 228 | 229 | tabWidget->addTab(tab_2, QString()); 230 | 231 | horizontalLayout->addWidget(tabWidget); 232 | 233 | 234 | verticalLayout->addLayout(horizontalLayout); 235 | 236 | MainWindow->setCentralWidget(centralWidget); 237 | menuBar = new QMenuBar(MainWindow); 238 | menuBar->setObjectName(QStringLiteral("menuBar")); 239 | menuBar->setGeometry(QRect(0, 0, 1000, 25)); 240 | menu_file = new QMenu(menuBar); 241 | menu_file->setObjectName(QStringLiteral("menu_file")); 242 | menu_help = new QMenu(menuBar); 243 | menu_help->setObjectName(QStringLiteral("menu_help")); 244 | MainWindow->setMenuBar(menuBar); 245 | statusBar = new QStatusBar(MainWindow); 246 | statusBar->setObjectName(QStringLiteral("statusBar")); 247 | statusBar->setStyleSheet(QStringLiteral("padding-left:20px;")); 248 | MainWindow->setStatusBar(statusBar); 249 | 250 | menuBar->addAction(menu_file->menuAction()); 251 | menuBar->addAction(menu_help->menuAction()); 252 | menu_file->addAction(action_importRules); 253 | menu_file->addAction(action_exportRules); 254 | menu_file->addAction(action_exitAPP); 255 | menu_help->addAction(action_about); 256 | 257 | retranslateUi(MainWindow); 258 | 259 | tabWidget->setCurrentIndex(0); 260 | 261 | 262 | QMetaObject::connectSlotsByName(MainWindow); 263 | } // setupUi 264 | 265 | void retranslateUi(QMainWindow *MainWindow) 266 | { 267 | MainWindow->setWindowTitle(QApplication::translate("MainWindow", "WJ firewall", Q_NULLPTR)); 268 | action_importRules->setText(QApplication::translate("MainWindow", "\345\257\274\345\205\245\350\247\204\345\210\231", Q_NULLPTR)); 269 | action_exportRules->setText(QApplication::translate("MainWindow", "\345\257\274\345\207\272\350\247\204\345\210\231", Q_NULLPTR)); 270 | action_exitAPP->setText(QApplication::translate("MainWindow", "\351\200\200\345\207\272", Q_NULLPTR)); 271 | action_about->setText(QApplication::translate("MainWindow", "\345\205\263\344\272\216", Q_NULLPTR)); 272 | pushButton_addRule->setText(QApplication::translate("MainWindow", "\346\267\273\345\212\240\350\247\204\345\210\231", Q_NULLPTR)); 273 | pushButton_modRule->setText(QApplication::translate("MainWindow", "\344\277\256\346\224\271\350\247\204\345\210\231", Q_NULLPTR)); 274 | pushButton_delRule->setText(QApplication::translate("MainWindow", "\345\210\240\351\231\244\350\247\204\345\210\231", Q_NULLPTR)); 275 | pushButton_fiterOn->setText(QApplication::translate("MainWindow", "\345\274\200\345\220\257\350\277\207\346\273\244", Q_NULLPTR)); 276 | pushButton_fiterOff->setText(QApplication::translate("MainWindow", "\345\201\234\346\255\242\350\277\207\346\273\244", Q_NULLPTR)); 277 | QTableWidgetItem *___qtablewidgetitem = tableWidget->horizontalHeaderItem(0); 278 | ___qtablewidgetitem->setText(QApplication::translate("MainWindow", "NO", Q_NULLPTR)); 279 | QTableWidgetItem *___qtablewidgetitem1 = tableWidget->horizontalHeaderItem(1); 280 | ___qtablewidgetitem1->setText(QApplication::translate("MainWindow", "SADDR", Q_NULLPTR)); 281 | QTableWidgetItem *___qtablewidgetitem2 = tableWidget->horizontalHeaderItem(2); 282 | ___qtablewidgetitem2->setText(QApplication::translate("MainWindow", "SPORT", Q_NULLPTR)); 283 | QTableWidgetItem *___qtablewidgetitem3 = tableWidget->horizontalHeaderItem(3); 284 | ___qtablewidgetitem3->setText(QApplication::translate("MainWindow", "DADDR", Q_NULLPTR)); 285 | QTableWidgetItem *___qtablewidgetitem4 = tableWidget->horizontalHeaderItem(4); 286 | ___qtablewidgetitem4->setText(QApplication::translate("MainWindow", "DPORT", Q_NULLPTR)); 287 | QTableWidgetItem *___qtablewidgetitem5 = tableWidget->horizontalHeaderItem(5); 288 | ___qtablewidgetitem5->setText(QApplication::translate("MainWindow", "TIME_FLAG", Q_NULLPTR)); 289 | QTableWidgetItem *___qtablewidgetitem6 = tableWidget->horizontalHeaderItem(6); 290 | ___qtablewidgetitem6->setText(QApplication::translate("MainWindow", "TIME_BEGIN", Q_NULLPTR)); 291 | QTableWidgetItem *___qtablewidgetitem7 = tableWidget->horizontalHeaderItem(7); 292 | ___qtablewidgetitem7->setText(QApplication::translate("MainWindow", "TIME_END", Q_NULLPTR)); 293 | QTableWidgetItem *___qtablewidgetitem8 = tableWidget->horizontalHeaderItem(8); 294 | ___qtablewidgetitem8->setText(QApplication::translate("MainWindow", "PROTOCOL", Q_NULLPTR)); 295 | QTableWidgetItem *___qtablewidgetitem9 = tableWidget->horizontalHeaderItem(9); 296 | ___qtablewidgetitem9->setText(QApplication::translate("MainWindow", "ACTION", Q_NULLPTR)); 297 | tabWidget->setTabText(tabWidget->indexOf(tab_1), QApplication::translate("MainWindow", "\350\247\204\345\210\231", Q_NULLPTR)); 298 | pushButton_logClean->setText(QApplication::translate("MainWindow", "\346\270\205\351\231\244\346\227\245\345\277\227", Q_NULLPTR)); 299 | tabWidget->setTabText(tabWidget->indexOf(tab_2), QApplication::translate("MainWindow", "\346\227\245\345\277\227", Q_NULLPTR)); 300 | menu_file->setTitle(QApplication::translate("MainWindow", "\346\226\207\344\273\266", Q_NULLPTR)); 301 | menu_help->setTitle(QApplication::translate("MainWindow", "\345\270\256\345\212\251", Q_NULLPTR)); 302 | } // retranslateUi 303 | 304 | }; 305 | 306 | namespace Ui { 307 | class MainWindow: public Ui_MainWindow {}; 308 | } // namespace Ui 309 | 310 | QT_END_NAMESPACE 311 | 312 | #endif // UI_MAINWINDOW_H 313 | -------------------------------------------------------------------------------- /build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Debug/ui_messagedialog.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | ** Form generated from reading UI file 'messagedialog.ui' 3 | ** 4 | ** Created by: Qt User Interface Compiler version 5.9.0 5 | ** 6 | ** WARNING! All changes made in this file will be lost when recompiling UI file! 7 | ********************************************************************************/ 8 | 9 | #ifndef UI_MESSAGEDIALOG_H 10 | #define UI_MESSAGEDIALOG_H 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | QT_BEGIN_NAMESPACE 22 | 23 | class Ui_MessageDialog 24 | { 25 | public: 26 | QLabel *label; 27 | QPushButton *pushButton_ok; 28 | QPushButton *pushButton_cancel; 29 | 30 | void setupUi(QDialog *MessageDialog) 31 | { 32 | if (MessageDialog->objectName().isEmpty()) 33 | MessageDialog->setObjectName(QStringLiteral("MessageDialog")); 34 | MessageDialog->resize(340, 150); 35 | label = new QLabel(MessageDialog); 36 | label->setObjectName(QStringLiteral("label")); 37 | label->setGeometry(QRect(50, 30, 300, 51)); 38 | label->setMinimumSize(QSize(300, 0)); 39 | label->setMaximumSize(QSize(300, 16777215)); 40 | pushButton_ok = new QPushButton(MessageDialog); 41 | pushButton_ok->setObjectName(QStringLiteral("pushButton_ok")); 42 | pushButton_ok->setGeometry(QRect(130, 100, 80, 30)); 43 | pushButton_ok->setMinimumSize(QSize(80, 30)); 44 | pushButton_ok->setMaximumSize(QSize(80, 30)); 45 | pushButton_cancel = new QPushButton(MessageDialog); 46 | pushButton_cancel->setObjectName(QStringLiteral("pushButton_cancel")); 47 | pushButton_cancel->setGeometry(QRect(230, 100, 80, 30)); 48 | pushButton_cancel->setMinimumSize(QSize(80, 30)); 49 | pushButton_cancel->setMaximumSize(QSize(80, 30)); 50 | 51 | retranslateUi(MessageDialog); 52 | 53 | QMetaObject::connectSlotsByName(MessageDialog); 54 | } // setupUi 55 | 56 | void retranslateUi(QDialog *MessageDialog) 57 | { 58 | MessageDialog->setWindowTitle(QApplication::translate("MessageDialog", "\345\210\240\351\231\244\350\247\204\345\210\231", Q_NULLPTR)); 59 | label->setText(QApplication::translate("MessageDialog", "TextLabel", Q_NULLPTR)); 60 | pushButton_ok->setText(QApplication::translate("MessageDialog", "\347\241\256\345\256\232", Q_NULLPTR)); 61 | pushButton_cancel->setText(QApplication::translate("MessageDialog", "\345\217\226\346\266\210", Q_NULLPTR)); 62 | } // retranslateUi 63 | 64 | }; 65 | 66 | namespace Ui { 67 | class MessageDialog: public Ui_MessageDialog {}; 68 | } // namespace Ui 69 | 70 | QT_END_NAMESPACE 71 | 72 | #endif // UI_MESSAGEDIALOG_H 73 | -------------------------------------------------------------------------------- /build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Debug/ui_ruledialog.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | ** Form generated from reading UI file 'ruledialog.ui' 3 | ** 4 | ** Created by: Qt User Interface Compiler version 5.9.0 5 | ** 6 | ** WARNING! All changes made in this file will be lost when recompiling UI file! 7 | ********************************************************************************/ 8 | 9 | #ifndef UI_RULEDIALOG_H 10 | #define UI_RULEDIALOG_H 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | QT_BEGIN_NAMESPACE 25 | 26 | class Ui_RuleDialog 27 | { 28 | public: 29 | QPushButton *pushButton_ok; 30 | QPushButton *pushButton_cancel; 31 | QLabel *label; 32 | QLabel *label_2; 33 | QLabel *label_3; 34 | QLabel *label_4; 35 | QLineEdit *lineEdit_src_ip; 36 | QLineEdit *lineEdit_src_port; 37 | QLineEdit *lineEdit_dst_port; 38 | QLineEdit *lineEdit_dst_ip; 39 | QComboBox *comboBox_time; 40 | QLabel *label_5; 41 | QLabel *label_6; 42 | QComboBox *comboBox_protocol; 43 | QLabel *label_7; 44 | QTimeEdit *timeEdit; 45 | QLabel *label_8; 46 | QTimeEdit *timeEdit_2; 47 | 48 | void setupUi(QDialog *RuleDialog) 49 | { 50 | if (RuleDialog->objectName().isEmpty()) 51 | RuleDialog->setObjectName(QStringLiteral("RuleDialog")); 52 | RuleDialog->resize(600, 250); 53 | QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); 54 | sizePolicy.setHorizontalStretch(0); 55 | sizePolicy.setVerticalStretch(0); 56 | sizePolicy.setHeightForWidth(RuleDialog->sizePolicy().hasHeightForWidth()); 57 | RuleDialog->setSizePolicy(sizePolicy); 58 | RuleDialog->setMinimumSize(QSize(600, 250)); 59 | RuleDialog->setMaximumSize(QSize(600, 250)); 60 | pushButton_ok = new QPushButton(RuleDialog); 61 | pushButton_ok->setObjectName(QStringLiteral("pushButton_ok")); 62 | pushButton_ok->setGeometry(QRect(400, 200, 60, 25)); 63 | pushButton_cancel = new QPushButton(RuleDialog); 64 | pushButton_cancel->setObjectName(QStringLiteral("pushButton_cancel")); 65 | pushButton_cancel->setGeometry(QRect(490, 200, 60, 25)); 66 | label = new QLabel(RuleDialog); 67 | label->setObjectName(QStringLiteral("label")); 68 | label->setGeometry(QRect(40, 20, 67, 25)); 69 | label_2 = new QLabel(RuleDialog); 70 | label_2->setObjectName(QStringLiteral("label_2")); 71 | label_2->setGeometry(QRect(40, 60, 67, 25)); 72 | label_3 = new QLabel(RuleDialog); 73 | label_3->setObjectName(QStringLiteral("label_3")); 74 | label_3->setGeometry(QRect(320, 20, 71, 25)); 75 | label_4 = new QLabel(RuleDialog); 76 | label_4->setObjectName(QStringLiteral("label_4")); 77 | label_4->setGeometry(QRect(320, 60, 71, 25)); 78 | lineEdit_src_ip = new QLineEdit(RuleDialog); 79 | lineEdit_src_ip->setObjectName(QStringLiteral("lineEdit_src_ip")); 80 | lineEdit_src_ip->setGeometry(QRect(110, 20, 150, 25)); 81 | lineEdit_src_port = new QLineEdit(RuleDialog); 82 | lineEdit_src_port->setObjectName(QStringLiteral("lineEdit_src_port")); 83 | lineEdit_src_port->setGeometry(QRect(110, 60, 150, 25)); 84 | lineEdit_dst_port = new QLineEdit(RuleDialog); 85 | lineEdit_dst_port->setObjectName(QStringLiteral("lineEdit_dst_port")); 86 | lineEdit_dst_port->setGeometry(QRect(400, 60, 150, 25)); 87 | lineEdit_dst_ip = new QLineEdit(RuleDialog); 88 | lineEdit_dst_ip->setObjectName(QStringLiteral("lineEdit_dst_ip")); 89 | lineEdit_dst_ip->setGeometry(QRect(399, 20, 151, 25)); 90 | comboBox_time = new QComboBox(RuleDialog); 91 | comboBox_time->setObjectName(QStringLiteral("comboBox_time")); 92 | comboBox_time->setGeometry(QRect(110, 110, 150, 25)); 93 | sizePolicy.setHeightForWidth(comboBox_time->sizePolicy().hasHeightForWidth()); 94 | comboBox_time->setSizePolicy(sizePolicy); 95 | label_5 = new QLabel(RuleDialog); 96 | label_5->setObjectName(QStringLiteral("label_5")); 97 | label_5->setGeometry(QRect(40, 110, 67, 25)); 98 | label_6 = new QLabel(RuleDialog); 99 | label_6->setObjectName(QStringLiteral("label_6")); 100 | label_6->setGeometry(QRect(320, 110, 67, 25)); 101 | comboBox_protocol = new QComboBox(RuleDialog); 102 | comboBox_protocol->setObjectName(QStringLiteral("comboBox_protocol")); 103 | comboBox_protocol->setGeometry(QRect(400, 110, 150, 25)); 104 | sizePolicy.setHeightForWidth(comboBox_protocol->sizePolicy().hasHeightForWidth()); 105 | comboBox_protocol->setSizePolicy(sizePolicy); 106 | label_7 = new QLabel(RuleDialog); 107 | label_7->setObjectName(QStringLiteral("label_7")); 108 | label_7->setGeometry(QRect(40, 150, 80, 25)); 109 | timeEdit = new QTimeEdit(RuleDialog); 110 | timeEdit->setObjectName(QStringLiteral("timeEdit")); 111 | timeEdit->setGeometry(QRect(130, 150, 130, 26)); 112 | timeEdit->setAlignment(Qt::AlignCenter); 113 | label_8 = new QLabel(RuleDialog); 114 | label_8->setObjectName(QStringLiteral("label_8")); 115 | label_8->setGeometry(QRect(320, 150, 80, 25)); 116 | timeEdit_2 = new QTimeEdit(RuleDialog); 117 | timeEdit_2->setObjectName(QStringLiteral("timeEdit_2")); 118 | timeEdit_2->setGeometry(QRect(420, 150, 130, 26)); 119 | timeEdit_2->setAlignment(Qt::AlignCenter); 120 | 121 | retranslateUi(RuleDialog); 122 | 123 | QMetaObject::connectSlotsByName(RuleDialog); 124 | } // setupUi 125 | 126 | void retranslateUi(QDialog *RuleDialog) 127 | { 128 | RuleDialog->setWindowTitle(QApplication::translate("RuleDialog", "\346\267\273\345\212\240\350\247\204\345\210\231", Q_NULLPTR)); 129 | pushButton_ok->setText(QApplication::translate("RuleDialog", "\347\241\256\345\256\232", Q_NULLPTR)); 130 | pushButton_cancel->setText(QApplication::translate("RuleDialog", "\345\217\226\346\266\210", Q_NULLPTR)); 131 | label->setText(QApplication::translate("RuleDialog", "\346\272\220\345\234\260\345\235\200\357\274\232", Q_NULLPTR)); 132 | label_2->setText(QApplication::translate("RuleDialog", "\346\272\220\347\253\257\345\217\243\357\274\232", Q_NULLPTR)); 133 | label_3->setText(QApplication::translate("RuleDialog", "\347\233\256\347\232\204\345\234\260\345\235\200\357\274\232", Q_NULLPTR)); 134 | label_4->setText(QApplication::translate("RuleDialog", "\347\233\256\347\232\204\347\253\257\345\217\243\357\274\232", Q_NULLPTR)); 135 | lineEdit_src_ip->setText(QApplication::translate("RuleDialog", "any", Q_NULLPTR)); 136 | lineEdit_src_port->setText(QApplication::translate("RuleDialog", "any", Q_NULLPTR)); 137 | lineEdit_dst_port->setText(QApplication::translate("RuleDialog", "any", Q_NULLPTR)); 138 | lineEdit_dst_ip->setText(QApplication::translate("RuleDialog", "any", Q_NULLPTR)); 139 | label_5->setText(QApplication::translate("RuleDialog", "\346\227\266\351\227\264\357\274\232", Q_NULLPTR)); 140 | label_6->setText(QApplication::translate("RuleDialog", "\345\215\217\350\256\256\357\274\232", Q_NULLPTR)); 141 | label_7->setText(QApplication::translate("RuleDialog", "\345\274\200\345\247\213\346\227\266\351\227\264\357\274\232", Q_NULLPTR)); 142 | label_8->setText(QApplication::translate("RuleDialog", "\347\273\223\346\235\237\346\227\266\351\227\264\357\274\232", Q_NULLPTR)); 143 | } // retranslateUi 144 | 145 | }; 146 | 147 | namespace Ui { 148 | class RuleDialog: public Ui_RuleDialog {}; 149 | } // namespace Ui 150 | 151 | QT_END_NAMESPACE 152 | 153 | #endif // UI_RULEDIALOG_H 154 | -------------------------------------------------------------------------------- /build-WJ_firewall-Desktop_Qt_5_9_0_GCC_64bit-Debug/ui_ruledialog_m.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | ** Form generated from reading UI file 'ruledialog_m.ui' 3 | ** 4 | ** Created by: Qt User Interface Compiler version 5.9.0 5 | ** 6 | ** WARNING! All changes made in this file will be lost when recompiling UI file! 7 | ********************************************************************************/ 8 | 9 | #ifndef UI_RULEDIALOG_M_H 10 | #define UI_RULEDIALOG_M_H 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | QT_BEGIN_NAMESPACE 25 | 26 | class Ui_ruledialog_m 27 | { 28 | public: 29 | QLabel *label_2; 30 | QPushButton *pushButton_ok; 31 | QTimeEdit *timeEdit; 32 | QPushButton *pushButton_cancel; 33 | QLabel *label_5; 34 | QTimeEdit *timeEdit_2; 35 | QLabel *label_4; 36 | QLabel *label_3; 37 | QLabel *label_7; 38 | QLineEdit *lineEdit_src_port; 39 | QComboBox *comboBox_time; 40 | QLineEdit *lineEdit_dst_ip; 41 | QLabel *label_8; 42 | QLineEdit *lineEdit_dst_port; 43 | QLineEdit *lineEdit_src_ip; 44 | QLabel *label_6; 45 | QComboBox *comboBox_protocol; 46 | QLabel *label; 47 | 48 | void setupUi(QDialog *ruledialog_m) 49 | { 50 | if (ruledialog_m->objectName().isEmpty()) 51 | ruledialog_m->setObjectName(QStringLiteral("ruledialog_m")); 52 | ruledialog_m->resize(600, 250); 53 | label_2 = new QLabel(ruledialog_m); 54 | label_2->setObjectName(QStringLiteral("label_2")); 55 | label_2->setGeometry(QRect(40, 70, 67, 25)); 56 | pushButton_ok = new QPushButton(ruledialog_m); 57 | pushButton_ok->setObjectName(QStringLiteral("pushButton_ok")); 58 | pushButton_ok->setGeometry(QRect(400, 210, 60, 25)); 59 | timeEdit = new QTimeEdit(ruledialog_m); 60 | timeEdit->setObjectName(QStringLiteral("timeEdit")); 61 | timeEdit->setGeometry(QRect(130, 160, 130, 26)); 62 | pushButton_cancel = new QPushButton(ruledialog_m); 63 | pushButton_cancel->setObjectName(QStringLiteral("pushButton_cancel")); 64 | pushButton_cancel->setGeometry(QRect(490, 210, 60, 25)); 65 | label_5 = new QLabel(ruledialog_m); 66 | label_5->setObjectName(QStringLiteral("label_5")); 67 | label_5->setGeometry(QRect(40, 120, 67, 25)); 68 | timeEdit_2 = new QTimeEdit(ruledialog_m); 69 | timeEdit_2->setObjectName(QStringLiteral("timeEdit_2")); 70 | timeEdit_2->setGeometry(QRect(420, 160, 130, 26)); 71 | label_4 = new QLabel(ruledialog_m); 72 | label_4->setObjectName(QStringLiteral("label_4")); 73 | label_4->setGeometry(QRect(320, 70, 71, 25)); 74 | label_3 = new QLabel(ruledialog_m); 75 | label_3->setObjectName(QStringLiteral("label_3")); 76 | label_3->setGeometry(QRect(320, 30, 71, 25)); 77 | label_7 = new QLabel(ruledialog_m); 78 | label_7->setObjectName(QStringLiteral("label_7")); 79 | label_7->setGeometry(QRect(40, 160, 80, 25)); 80 | lineEdit_src_port = new QLineEdit(ruledialog_m); 81 | lineEdit_src_port->setObjectName(QStringLiteral("lineEdit_src_port")); 82 | lineEdit_src_port->setGeometry(QRect(110, 70, 150, 25)); 83 | comboBox_time = new QComboBox(ruledialog_m); 84 | comboBox_time->setObjectName(QStringLiteral("comboBox_time")); 85 | comboBox_time->setGeometry(QRect(110, 120, 150, 25)); 86 | QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); 87 | sizePolicy.setHorizontalStretch(0); 88 | sizePolicy.setVerticalStretch(0); 89 | sizePolicy.setHeightForWidth(comboBox_time->sizePolicy().hasHeightForWidth()); 90 | comboBox_time->setSizePolicy(sizePolicy); 91 | lineEdit_dst_ip = new QLineEdit(ruledialog_m); 92 | lineEdit_dst_ip->setObjectName(QStringLiteral("lineEdit_dst_ip")); 93 | lineEdit_dst_ip->setGeometry(QRect(399, 30, 151, 25)); 94 | label_8 = new QLabel(ruledialog_m); 95 | label_8->setObjectName(QStringLiteral("label_8")); 96 | label_8->setGeometry(QRect(320, 160, 80, 25)); 97 | lineEdit_dst_port = new QLineEdit(ruledialog_m); 98 | lineEdit_dst_port->setObjectName(QStringLiteral("lineEdit_dst_port")); 99 | lineEdit_dst_port->setGeometry(QRect(400, 70, 150, 25)); 100 | lineEdit_src_ip = new QLineEdit(ruledialog_m); 101 | lineEdit_src_ip->setObjectName(QStringLiteral("lineEdit_src_ip")); 102 | lineEdit_src_ip->setGeometry(QRect(110, 30, 150, 25)); 103 | label_6 = new QLabel(ruledialog_m); 104 | label_6->setObjectName(QStringLiteral("label_6")); 105 | label_6->setGeometry(QRect(320, 120, 67, 25)); 106 | comboBox_protocol = new QComboBox(ruledialog_m); 107 | comboBox_protocol->setObjectName(QStringLiteral("comboBox_protocol")); 108 | comboBox_protocol->setGeometry(QRect(400, 120, 150, 25)); 109 | sizePolicy.setHeightForWidth(comboBox_protocol->sizePolicy().hasHeightForWidth()); 110 | comboBox_protocol->setSizePolicy(sizePolicy); 111 | label = new QLabel(ruledialog_m); 112 | label->setObjectName(QStringLiteral("label")); 113 | label->setGeometry(QRect(40, 30, 67, 25)); 114 | 115 | retranslateUi(ruledialog_m); 116 | 117 | QMetaObject::connectSlotsByName(ruledialog_m); 118 | } // setupUi 119 | 120 | void retranslateUi(QDialog *ruledialog_m) 121 | { 122 | ruledialog_m->setWindowTitle(QApplication::translate("ruledialog_m", "\344\277\256\346\224\271\350\247\204\345\210\231", Q_NULLPTR)); 123 | label_2->setText(QApplication::translate("ruledialog_m", "\346\272\220\347\253\257\345\217\243\357\274\232", Q_NULLPTR)); 124 | pushButton_ok->setText(QApplication::translate("ruledialog_m", "\347\241\256\345\256\232", Q_NULLPTR)); 125 | pushButton_cancel->setText(QApplication::translate("ruledialog_m", "\345\217\226\346\266\210", Q_NULLPTR)); 126 | label_5->setText(QApplication::translate("ruledialog_m", "\346\227\266\351\227\264\357\274\232", Q_NULLPTR)); 127 | label_4->setText(QApplication::translate("ruledialog_m", "\347\233\256\347\232\204\347\253\257\345\217\243\357\274\232", Q_NULLPTR)); 128 | label_3->setText(QApplication::translate("ruledialog_m", "\347\233\256\347\232\204\345\234\260\345\235\200\357\274\232", Q_NULLPTR)); 129 | label_7->setText(QApplication::translate("ruledialog_m", "\345\274\200\345\247\213\346\227\266\351\227\264\357\274\232", Q_NULLPTR)); 130 | lineEdit_src_port->setText(QApplication::translate("ruledialog_m", "any", Q_NULLPTR)); 131 | lineEdit_dst_ip->setText(QApplication::translate("ruledialog_m", "any", Q_NULLPTR)); 132 | label_8->setText(QApplication::translate("ruledialog_m", "\347\273\223\346\235\237\346\227\266\351\227\264\357\274\232", Q_NULLPTR)); 133 | lineEdit_dst_port->setText(QApplication::translate("ruledialog_m", "any", Q_NULLPTR)); 134 | lineEdit_src_ip->setText(QApplication::translate("ruledialog_m", "any", Q_NULLPTR)); 135 | label_6->setText(QApplication::translate("ruledialog_m", "\345\215\217\350\256\256\357\274\232", Q_NULLPTR)); 136 | label->setText(QApplication::translate("ruledialog_m", "\346\272\220\345\234\260\345\235\200\357\274\232", Q_NULLPTR)); 137 | } // retranslateUi 138 | 139 | }; 140 | 141 | namespace Ui { 142 | class ruledialog_m: public Ui_ruledialog_m {}; 143 | } // namespace Ui 144 | 145 | QT_END_NAMESPACE 146 | 147 | #endif // UI_RULEDIALOG_M_H 148 | -------------------------------------------------------------------------------- /data/log.txt: -------------------------------------------------------------------------------- 1 | 2018/12/06 19:49:07 TCP packet from 192.168.44.10:43930 to 192.168.33.10:21 rejected by rule 3 2 | 2018/12/06 19:49:07 TCP packet from 192.168.44.10:43930 to 192.168.33.10:21 rejected by rule 3 3 | 2018/12/06 19:49:07 TCP packet from 192.168.44.10:43930 to 192.168.33.10:21 rejected by rule 3 4 | 2018/12/06 19:49:08 TCP packet from 192.168.44.10:43930 to 192.168.33.10:21 rejected by rule 3 5 | 2018/12/06 19:49:09 TCP packet from 192.168.44.10:43930 to 192.168.33.10:21 rejected by rule 3 6 | 2018/12/06 19:49:10 TCP packet from 192.168.44.10:43930 to 192.168.33.10:21 rejected by rule 3 7 | 2018/12/06 19:49:14 TCP packet from 192.168.44.10:43930 to 192.168.33.10:21 rejected by rule 3 8 | 2018/12/06 19:49:16 ICMP packet from 192.168.44.10 to 192.168.33.10 rejected by rule 1 9 | 2018/12/06 19:49:17 ICMP packet from 192.168.44.10 to 192.168.33.10 rejected by rule 1 10 | 2018/12/06 19:49:18 ICMP packet from 192.168.44.10 to 192.168.33.10 rejected by rule 1 11 | 2018/12/06 19:49:20 TCP packet from 192.168.44.10:43930 to 192.168.33.10:21 rejected by rule 3 12 | 2018/12/06 19:49:32 ICMP packet from 192.168.44.10 to 192.168.33.11 rejected by rule 1 13 | 2018/12/06 19:49:33 ICMP packet from 192.168.44.10 to 192.168.33.11 rejected by rule 1 14 | 2018/12/06 19:49:33 TCP packet from 192.168.44.10:43930 to 192.168.33.10:21 rejected by rule 3 15 | 2018/12/06 19:49:34 ICMP packet from 192.168.44.10 to 192.168.33.11 rejected by rule 1 16 | 2018/12/06 19:49:59 TCP packet from 192.168.44.10:43930 to 192.168.33.10:21 rejected by rule 3 17 | 2018/12/06 19:50:06 TCP packet from 192.168.44.10:45222 to 192.168.33.10:80 rejected by rule 2 18 | 2018/12/06 19:50:06 TCP packet from 192.168.44.10:45224 to 192.168.33.10:80 rejected by rule 2 19 | 2018/12/06 19:50:07 TCP packet from 192.168.44.10:45222 to 192.168.33.10:80 rejected by rule 2 20 | 2018/12/06 19:50:07 TCP packet from 192.168.44.10:45224 to 192.168.33.10:80 rejected by rule 2 21 | 2018/12/06 19:50:09 TCP packet from 192.168.44.10:45226 to 192.168.33.10:80 rejected by rule 2 22 | 2018/12/06 19:50:09 TCP packet from 192.168.44.10:45222 to 192.168.33.10:80 rejected by rule 2 23 | 2018/12/06 19:50:09 TCP packet from 192.168.44.10:45228 to 192.168.33.10:80 rejected by rule 2 24 | 2018/12/06 19:50:09 TCP packet from 192.168.44.10:45224 to 192.168.33.10:80 rejected by rule 2 25 | 2018/12/06 19:50:10 TCP packet from 192.168.44.10:45226 to 192.168.33.10:80 rejected by rule 2 26 | 2018/12/06 19:50:10 TCP packet from 192.168.44.10:45228 to 192.168.33.10:80 rejected by rule 2 27 | 2018/12/06 19:50:12 TCP packet from 192.168.44.10:45226 to 192.168.33.10:80 rejected by rule 2 28 | 2018/12/06 19:50:12 TCP packet from 192.168.44.10:45228 to 192.168.33.10:80 rejected by rule 2 29 | 2018/12/06 19:50:13 TCP packet from 192.168.44.10:45222 to 192.168.33.10:80 rejected by rule 2 30 | 2018/12/06 19:50:13 TCP packet from 192.168.44.10:45224 to 192.168.33.10:80 rejected by rule 2 31 | 2018/12/06 19:50:21 TCP packet from 192.168.44.10:45222 to 192.168.33.10:80 rejected by rule 2 32 | 2018/12/06 19:50:21 TCP packet from 192.168.44.10:45224 to 192.168.33.10:80 rejected by rule 2 33 | 2018/12/06 19:50:35 TCP packet from 192.168.44.10:43942 to 192.168.33.10:21 rejected by rule 3 34 | 2018/12/06 19:50:36 TCP packet from 192.168.44.10:43942 to 192.168.33.10:21 rejected by rule 3 35 | 2018/12/06 19:50:37 TCP packet from 192.168.44.10:45222 to 192.168.33.10:80 rejected by rule 2 36 | 2018/12/06 19:50:37 TCP packet from 192.168.44.10:45224 to 192.168.33.10:80 rejected by rule 2 37 | 2018/12/06 19:50:38 TCP packet from 192.168.44.10:43942 to 192.168.33.10:21 rejected by rule 3 38 | 2018/12/06 19:51:15 TCP packet from 192.168.44.10:45234 to 192.168.33.10:80 rejected by rule 1 39 | 2018/12/06 19:51:15 TCP packet from 192.168.44.10:45236 to 192.168.33.10:80 rejected by rule 1 40 | 2018/12/06 19:51:16 TCP packet from 192.168.44.10:45234 to 192.168.33.10:80 rejected by rule 1 41 | 2018/12/06 19:51:16 TCP packet from 192.168.44.10:45236 to 192.168.33.10:80 rejected by rule 1 42 | 2018/12/06 19:51:16 TCP packet from 192.168.44.10:45238 to 192.168.33.10:80 rejected by rule 1 43 | 2018/12/06 19:51:17 TCP packet from 192.168.44.10:45240 to 192.168.33.10:80 rejected by rule 1 44 | 2018/12/06 19:51:17 TCP packet from 192.168.44.10:45238 to 192.168.33.10:80 rejected by rule 1 45 | 2018/12/06 19:51:18 TCP packet from 192.168.44.10:45234 to 192.168.33.10:80 rejected by rule 1 46 | 2018/12/06 19:51:18 TCP packet from 192.168.44.10:45240 to 192.168.33.10:80 rejected by rule 1 47 | 2018/12/06 19:51:18 TCP packet from 192.168.44.10:45236 to 192.168.33.10:80 rejected by rule 1 48 | 2018/12/06 19:51:19 TCP packet from 192.168.44.10:45238 to 192.168.33.10:80 rejected by rule 1 49 | 2018/12/06 19:51:20 TCP packet from 192.168.44.10:45240 to 192.168.33.10:80 rejected by rule 1 50 | 2018/12/06 19:51:22 TCP packet from 192.168.44.10:45234 to 192.168.33.10:80 rejected by rule 1 51 | 2018/12/06 19:51:22 TCP packet from 192.168.44.10:45236 to 192.168.33.10:80 rejected by rule 1 52 | 2018/12/06 19:51:23 TCP packet from 192.168.44.10:45238 to 192.168.33.10:80 rejected by rule 1 53 | 2018/12/06 19:51:24 TCP packet from 192.168.44.10:45240 to 192.168.33.10:80 rejected by rule 1 54 | 2018/12/06 19:51:30 TCP packet from 192.168.44.10:45234 to 192.168.33.10:80 rejected by rule 1 55 | 2018/12/06 19:51:30 TCP packet from 192.168.44.10:45236 to 192.168.33.10:80 rejected by rule 1 56 | 2018/12/06 19:51:33 TCP packet from 192.168.44.10:43954 to 192.168.33.10:21 rejected by rule 2 57 | 2018/12/06 19:51:34 TCP packet from 192.168.44.10:43954 to 192.168.33.10:21 rejected by rule 2 58 | 2018/12/06 19:52:36 ICMP packet from 192.168.44.10 to 192.168.33.10 rejected by rule 3 59 | 2018/12/06 19:52:37 ICMP packet from 192.168.44.10 to 192.168.33.10 rejected by rule 3 60 | 2018/12/06 19:52:38 ICMP packet from 192.168.44.10 to 192.168.33.10 rejected by rule 3 61 | 2018/12/06 19:52:44 TCP packet from 192.168.44.10:45246 to 192.168.33.10:80 rejected by rule 1 62 | 2018/12/06 19:52:44 TCP packet from 192.168.44.10:45248 to 192.168.33.10:80 rejected by rule 1 63 | 2018/12/06 19:52:45 TCP packet from 192.168.44.10:45246 to 192.168.33.10:80 rejected by rule 1 64 | 2018/12/06 19:52:45 TCP packet from 192.168.44.10:45250 to 192.168.33.10:80 rejected by rule 1 65 | 2018/12/06 19:52:45 TCP packet from 192.168.44.10:45248 to 192.168.33.10:80 rejected by rule 1 66 | 2018/12/06 19:52:45 TCP packet from 192.168.44.10:45252 to 192.168.33.10:80 rejected by rule 1 67 | 2018/12/06 19:52:46 TCP packet from 192.168.44.10:45250 to 192.168.33.10:80 rejected by rule 1 68 | 2018/12/06 19:52:46 TCP packet from 192.168.44.10:45252 to 192.168.33.10:80 rejected by rule 1 69 | 2018/12/06 19:52:47 TCP packet from 192.168.44.10:45246 to 192.168.33.10:80 rejected by rule 1 70 | 2018/12/06 19:52:47 TCP packet from 192.168.44.10:45248 to 192.168.33.10:80 rejected by rule 1 71 | 2018/12/06 19:52:48 TCP packet from 192.168.44.10:45250 to 192.168.33.10:80 rejected by rule 1 72 | 2018/12/06 19:52:48 TCP packet from 192.168.44.10:45252 to 192.168.33.10:80 rejected by rule 1 73 | 2018/12/06 19:52:51 TCP packet from 192.168.44.10:45246 to 192.168.33.10:80 rejected by rule 1 74 | 2018/12/06 19:52:51 TCP packet from 192.168.44.10:45248 to 192.168.33.10:80 rejected by rule 1 75 | 2018/12/06 19:53:39 ICMP packet from 192.168.44.10 to 192.168.33.11 rejected by rule 3 76 | 2018/12/06 19:53:40 ICMP packet from 192.168.44.10 to 192.168.33.11 rejected by rule 3 77 | 2018/12/06 19:54:50 ICMP packet from 192.168.44.10 to 192.168.33.11 rejected by rule 1 78 | 2018/12/06 19:54:51 ICMP packet from 192.168.44.10 to 192.168.33.11 rejected by rule 1 79 | 2018/12/06 19:54:53 ICMP packet from 192.168.44.10 to 192.168.33.10 rejected by rule 1 80 | 2018/12/06 19:54:54 ICMP packet from 192.168.44.10 to 192.168.33.10 rejected by rule 1 81 | 2018/12/06 19:55:07 TCP packet from 192.168.44.10:45256 to 192.168.33.10:80 rejected by rule 2 82 | 2018/12/06 19:55:07 TCP packet from 192.168.44.10:45258 to 192.168.33.10:80 rejected by rule 2 83 | 2018/12/06 19:55:08 TCP packet from 192.168.44.10:45256 to 192.168.33.10:80 rejected by rule 2 84 | 2018/12/06 19:55:08 TCP packet from 192.168.44.10:45258 to 192.168.33.10:80 rejected by rule 2 85 | 2018/12/06 19:55:10 TCP packet from 192.168.44.10:45256 to 192.168.33.10:80 rejected by rule 2 86 | 2018/12/06 19:55:13 TCP packet from 192.168.44.10:35272 to 192.168.33.11:80 rejected by rule 3 87 | 2018/12/06 19:55:13 TCP packet from 192.168.44.10:35274 to 192.168.33.11:80 rejected by rule 3 88 | 2018/12/06 19:55:14 TCP packet from 192.168.44.10:35272 to 192.168.33.11:80 rejected by rule 3 89 | 2018/12/06 19:55:14 TCP packet from 192.168.44.10:35274 to 192.168.33.11:80 rejected by rule 3 90 | 2018/12/06 19:55:16 TCP packet from 192.168.44.10:35272 to 192.168.33.11:80 rejected by rule 3 91 | 2018/12/06 19:55:16 TCP packet from 192.168.44.10:35274 to 192.168.33.11:80 rejected by rule 3 92 | 2018/12/06 20:01:57 ICMP packet from 192.168.44.10 to 192.168.33.10 rejected by rule 1 93 | 2018/12/06 20:01:58 ICMP packet from 192.168.44.10 to 192.168.33.10 rejected by rule 1 94 | 2018/12/06 20:02:16 TCP packet from 192.168.44.10:45274 to 192.168.33.10:80 rejected by rule 2 95 | 2018/12/06 20:02:17 TCP packet from 192.168.44.10:45276 to 192.168.33.10:80 rejected by rule 2 96 | 2018/12/06 20:02:17 TCP packet from 192.168.44.10:45274 to 192.168.33.10:80 rejected by rule 2 97 | 2018/12/06 20:02:18 TCP packet from 192.168.44.10:45276 to 192.168.33.10:80 rejected by rule 2 98 | 2018/12/06 20:02:18 TCP packet from 192.168.44.10:45278 to 192.168.33.10:80 rejected by rule 2 99 | 2018/12/06 20:02:18 TCP packet from 192.168.44.10:45280 to 192.168.33.10:80 rejected by rule 2 100 | 2018/12/06 20:02:19 TCP packet from 192.168.44.10:45278 to 192.168.33.10:80 rejected by rule 2 101 | 2018/12/06 20:02:19 TCP packet from 192.168.44.10:45280 to 192.168.33.10:80 rejected by rule 2 102 | 2018/12/06 20:02:19 TCP packet from 192.168.44.10:45274 to 192.168.33.10:80 rejected by rule 2 103 | 2018/12/06 20:02:20 TCP packet from 192.168.44.10:45276 to 192.168.33.10:80 rejected by rule 2 104 | 2018/12/06 20:02:23 TCP packet from 192.168.44.10:45274 to 192.168.33.10:80 rejected by rule 2 105 | 2018/12/06 20:02:24 TCP packet from 192.168.44.10:45276 to 192.168.33.10:80 rejected by rule 2 106 | 2018/12/06 20:03:19 ICMP packet from 192.168.44.10 to 192.168.33.10 rejected by rule 1 107 | 2018/12/06 20:03:20 ICMP packet from 192.168.44.10 to 192.168.33.10 rejected by rule 1 108 | 2018/12/06 20:03:30 TCP packet from 192.168.44.10:45284 to 192.168.33.10:80 rejected by rule 2 109 | 2018/12/06 20:03:30 TCP packet from 192.168.44.10:45286 to 192.168.33.10:80 rejected by rule 2 110 | 2018/12/06 20:03:31 TCP packet from 192.168.44.10:45284 to 192.168.33.10:80 rejected by rule 2 111 | 2018/12/06 20:03:31 TCP packet from 192.168.44.10:45286 to 192.168.33.10:80 rejected by rule 2 112 | 2018/12/06 20:03:31 TCP packet from 192.168.44.10:45288 to 192.168.33.10:80 rejected by rule 2 113 | 2018/12/06 20:03:31 TCP packet from 192.168.44.10:45290 to 192.168.33.10:80 rejected by rule 2 114 | 2018/12/06 20:03:32 TCP packet from 192.168.44.10:45288 to 192.168.33.10:80 rejected by rule 2 115 | 2018/12/06 20:03:32 TCP packet from 192.168.44.10:45290 to 192.168.33.10:80 rejected by rule 2 116 | 2018/12/06 20:03:33 TCP packet from 192.168.44.10:45284 to 192.168.33.10:80 rejected by rule 2 117 | 2018/12/06 20:03:33 TCP packet from 192.168.44.10:45286 to 192.168.33.10:80 rejected by rule 2 118 | 2018/12/06 20:03:34 TCP packet from 192.168.44.10:45288 to 192.168.33.10:80 rejected by rule 2 119 | 2018/12/06 20:03:34 TCP packet from 192.168.44.10:45290 to 192.168.33.10:80 rejected by rule 2 120 | 2018/12/06 20:03:37 TCP packet from 192.168.44.10:45284 to 192.168.33.10:80 rejected by rule 2 121 | 2018/12/06 20:03:37 TCP packet from 192.168.44.10:45286 to 192.168.33.10:80 rejected by rule 2 122 | 2018/12/06 20:03:38 TCP packet from 192.168.44.10:45288 to 192.168.33.10:80 rejected by rule 2 123 | 2018/12/06 20:03:38 TCP packet from 192.168.44.10:45290 to 192.168.33.10:80 rejected by rule 2 124 | 2018/12/06 20:03:45 TCP packet from 192.168.44.10:45284 to 192.168.33.10:80 rejected by rule 2 125 | 2018/12/06 20:03:45 TCP packet from 192.168.44.10:45286 to 192.168.33.10:80 rejected by rule 2 126 | 2018/12/06 20:05:15 UDP packet from 192.168.44.10:54231 to 192.168.33.10:69 rejected by rule 3 127 | 2018/12/06 21:31:24 ICMP packet from 192.168.33.254 to 192.168.33.10 rejected by rule 1 128 | 2018/12/06 21:31:25 ICMP packet from 192.168.33.254 to 192.168.33.10 rejected by rule 1 129 | 2018/12/06 21:32:23 UDP packet from 192.168.33.254:50036 to 192.168.33.10:69 rejected by rule 3 130 | 2018/12/06 21:32:23 UDP packet from 192.168.33.254:50036 to 192.168.33.10:69 rejected by rule 3 131 | 2018/12/06 21:33:43 UDP packet from 192.168.33.254:40692 to 192.168.33.10:69 rejected by rule 3 132 | 2018/12/06 21:33:43 UDP packet from 192.168.33.254:40692 to 192.168.33.10:69 rejected by rule 3 133 | 2018/12/06 21:34:55 TCP packet from 192.168.33.254:43222 to 192.168.33.10:80 rejected by rule 4 134 | 2018/12/06 21:34:55 TCP packet from 192.168.33.254:43224 to 192.168.33.10:80 rejected by rule 4 135 | 2018/12/06 21:34:56 TCP packet from 192.168.33.254:43222 to 192.168.33.10:80 rejected by rule 4 136 | 2018/12/06 21:34:56 TCP packet from 192.168.33.254:43224 to 192.168.33.10:80 rejected by rule 4 137 | 2018/12/06 21:34:58 TCP packet from 192.168.33.254:43222 to 192.168.33.10:80 rejected by rule 4 138 | 2018/12/06 21:34:58 TCP packet from 192.168.33.254:43224 to 192.168.33.10:80 rejected by rule 4 139 | 2018/12/06 21:35:28 TCP packet from 192.168.33.254:43226 to 192.168.33.10:80 rejected by rule 4 140 | 2018/12/06 21:35:28 TCP packet from 192.168.33.254:43228 to 192.168.33.10:80 rejected by rule 4 141 | 2018/12/06 21:35:29 TCP packet from 192.168.33.254:43226 to 192.168.33.10:80 rejected by rule 4 142 | 2018/12/06 21:35:29 TCP packet from 192.168.33.254:43228 to 192.168.33.10:80 rejected by rule 4 143 | 2018/12/06 21:35:31 TCP packet from 192.168.33.254:43226 to 192.168.33.10:80 rejected by rule 4 144 | 2018/12/06 21:35:31 TCP packet from 192.168.33.254:43228 to 192.168.33.10:80 rejected by rule 4 145 | 2018/12/06 21:35:33 TCP packet from 192.168.33.254:43230 to 192.168.33.10:80 rejected by rule 4 146 | 2018/12/06 21:35:34 TCP packet from 192.168.33.254:43230 to 192.168.33.10:80 rejected by rule 4 147 | 2018/12/06 21:35:35 TCP packet from 192.168.33.254:43226 to 192.168.33.10:80 rejected by rule 4 148 | 2018/12/06 21:35:40 TCP packet from 192.168.33.254:43232 to 192.168.33.10:80 rejected by rule 4 149 | 2018/12/06 21:35:41 TCP packet from 192.168.33.254:43234 to 192.168.33.10:80 rejected by rule 4 150 | 2018/12/06 21:35:41 TCP packet from 192.168.33.254:43232 to 192.168.33.10:80 rejected by rule 4 151 | 2018/12/06 21:35:42 TCP packet from 192.168.33.254:43234 to 192.168.33.10:80 rejected by rule 4 152 | 2018/12/06 21:35:53 TCP packet from 192.168.33.254:43236 to 192.168.33.10:80 rejected by rule 4 153 | 2018/12/06 21:35:53 TCP packet from 192.168.33.254:43238 to 192.168.33.10:80 rejected by rule 4 154 | 2018/12/06 21:35:54 TCP packet from 192.168.33.254:43236 to 192.168.33.10:80 rejected by rule 4 155 | 2018/12/06 21:36:16 TCP packet from 192.168.33.254:43240 to 192.168.33.10:80 rejected by rule 4 156 | 2018/12/06 21:36:16 TCP packet from 192.168.33.254:43242 to 192.168.33.10:80 rejected by rule 4 157 | 2018/12/06 21:36:17 TCP packet from 192.168.33.254:43240 to 192.168.33.10:80 rejected by rule 4 158 | 2018/12/06 21:36:17 TCP packet from 192.168.33.254:43242 to 192.168.33.10:80 rejected by rule 4 159 | -------------------------------------------------------------------------------- /data/rule.txt: -------------------------------------------------------------------------------- 1 | any%any%any%any%no%0%0%0%0%icmp 2 | 192.168.44.10%192.168.33.10%any%80%no%0%0%0%0%tcp 3 | any%192.168.33.10%any%any%no%0%0%0%0%udp 4 | 192.168.44.10%any%any%80%yes%08%00%16%00%tcp 5 | -------------------------------------------------------------------------------- /data/rule_new: -------------------------------------------------------------------------------- 1 | any%any%any%any%no%0%0%0%0%icmp 2 | 192.168.44.10%192.168.33.10%any%80%no%0%0%0%0%tcp 3 | any%any%any%80%no%0%0%0%0%tcp 4 | -------------------------------------------------------------------------------- /data/rule_out: -------------------------------------------------------------------------------- 1 | any%any%any%any%no%0%0%0%0%icmp 2 | 192.168.44.10%192.168.33.10%any%80%no%0%0%0%0%tcp 3 | any%192.168.33.10%any%any%no%0%0%0%0%udp 4 | 192.168.44.10%any%any%80%yes%08%00%16%00%tcp 5 | 6 | - Meaning: --------------------------------------------------------------------------------- 7 | 8 | | SIP | DIP | SPort | DPort | Time | SHour | SMin | EHour | EMin | Protocol | 9 | | any| any| any| any| no| 0| 0| 0| 0| icmp| 10 | | 192.168.44.10| 192.168.33.10| any| 80| no| 0| 0| 0| 0| tcp| 11 | | any| 192.168.33.10| any| any| no| 0| 0| 0| 0| udp| 12 | | 192.168.44.10| any| any| 80| yes| 08| 00| 16| 00| tcp| 13 | -------------------------------------------------------------------------------- /image/About.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mryuan0428/Firewall-Based-on-Netfilter/902149e65a9a289c0c6e13441cd8af678654e432/image/About.png -------------------------------------------------------------------------------- /image/AddRule.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mryuan0428/Firewall-Based-on-Netfilter/902149e65a9a289c0c6e13441cd8af678654e432/image/AddRule.png -------------------------------------------------------------------------------- /image/DeleteRule.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mryuan0428/Firewall-Based-on-Netfilter/902149e65a9a289c0c6e13441cd8af678654e432/image/DeleteRule.png -------------------------------------------------------------------------------- /image/ExportRule.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mryuan0428/Firewall-Based-on-Netfilter/902149e65a9a289c0c6e13441cd8af678654e432/image/ExportRule.png -------------------------------------------------------------------------------- /image/ImportRule.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mryuan0428/Firewall-Based-on-Netfilter/902149e65a9a289c0c6e13441cd8af678654e432/image/ImportRule.png -------------------------------------------------------------------------------- /image/Log.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mryuan0428/Firewall-Based-on-Netfilter/902149e65a9a289c0c6e13441cd8af678654e432/image/Log.png -------------------------------------------------------------------------------- /image/MainWindow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mryuan0428/Firewall-Based-on-Netfilter/902149e65a9a289c0c6e13441cd8af678654e432/image/MainWindow.png -------------------------------------------------------------------------------- /image/ModifyRule.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mryuan0428/Firewall-Based-on-Netfilter/902149e65a9a289c0c6e13441cd8af678654e432/image/ModifyRule.png -------------------------------------------------------------------------------- /my_mod/Makefile: -------------------------------------------------------------------------------- 1 | obj-m += WJ_firewall.o 2 | 3 | KDIR := /lib/modules/$(shell uname -r)/build 4 | PWD := $(shell pwd) 5 | MOD_NAME := "WJ_firewall.ko" 6 | 7 | default: 8 | #gcc -o WJ_firewall.o WJ_firewall.c 9 | $(MAKE) -C $(KDIR) M=$(PWD) modules 10 | cp $(MOD_NAME) "../bin/" 11 | -------------------------------------------------------------------------------- /my_mod/WJ_firewall.c: -------------------------------------------------------------------------------- 1 | //#define __KERNEL__ 2 | //#define MODULE 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #define MATCH 1 19 | #define NMATCH 0 20 | 21 | struct nf_hook_ops myhook; 22 | 23 | //保存正在使用规则的信息 24 | unsigned int controlled_protocol = 0; 25 | unsigned short controlled_srcport = 0; 26 | unsigned short controlled_dstport = 0; 27 | unsigned int controlled_saddr = 0; 28 | unsigned int controlled_daddr = 0; 29 | 30 | unsigned int controlled_time_flag = 0; 31 | unsigned int controlled_time_begin = 0; 32 | unsigned int controlled_time_end = 0; 33 | 34 | //正在处理数据包信息转化为字符串用于日志输出 35 | char ip_buff_src[16]; 36 | char ip_buff_dst[16]; 37 | char port_buff_src[10]; 38 | char port_buff_dst[10]; 39 | char time_buff[50]; 40 | char protocol_buff[10]; 41 | 42 | char controlinfo[1600]; //存储多条规则,每条32byte 43 | char *pchar; 44 | int num = 0; //规则条数 45 | 46 | struct sk_buff *tmpskb; 47 | struct iphdr *piphdr; 48 | 49 | char * addr_from_net(char * buff, __be32 addr) 50 | { 51 | __u8 *p = (__u8*)&addr; 52 | snprintf(buff, 16, "%u.%u.%u.%u", 53 | (__u32)p[0], (__u32)p[1], (__u32)p[2], (__u32)p[3]); 54 | return buff; 55 | } 56 | 57 | char * time_from_tm(char * buff, struct rtc_time *tm) 58 | { 59 | snprintf(buff, 50, "%04d/%02d/%02d %02d:%02d:%02d", 60 | tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday, 61 | tm->tm_hour, tm->tm_min, tm->tm_sec); 62 | return buff; 63 | } 64 | 65 | bool cktime(struct rtc_time *tm) //1不运行 66 | { 67 | if(controlled_time_flag == 0){ //Time_Flag关闭,直接判断下一条规则 68 | return 0; 69 | } 70 | if(controlled_time_flag == 1){ //Time_Flag开启,判断时间区间 71 | if(((tm->tm_hour*60+tm->tm_min)tm_hour*60+tm->tm_min)>controlled_time_end)){ 72 | return 1; 73 | } 74 | else return 0; 75 | } 76 | return 0; 77 | } 78 | 79 | bool port_check(unsigned short srcport, unsigned short dstport){ 80 | if ((controlled_srcport == 0 ) && ( controlled_dstport == 0 )) 81 | return MATCH; 82 | if ((controlled_srcport != 0 ) && ( controlled_dstport == 0 )) 83 | { 84 | if (controlled_srcport == srcport) 85 | return MATCH; 86 | else 87 | return NMATCH; 88 | } 89 | if ((controlled_srcport == 0 ) && ( controlled_dstport != 0 )) 90 | { 91 | if (controlled_dstport == dstport) 92 | return MATCH; 93 | else 94 | return NMATCH; 95 | } 96 | if ((controlled_srcport != 0 ) && ( controlled_dstport != 0 )) 97 | { 98 | if ((controlled_srcport == srcport) && (controlled_dstport == dstport)) 99 | return MATCH; 100 | else 101 | return NMATCH; 102 | } 103 | return NMATCH; 104 | } 105 | 106 | bool ipaddr_check(unsigned int saddr, unsigned int daddr){ 107 | if ((controlled_saddr == 0 ) && ( controlled_daddr == 0 )) 108 | return MATCH; 109 | if ((controlled_saddr != 0 ) && ( controlled_daddr == 0 )) 110 | { 111 | if (controlled_saddr == saddr) 112 | return MATCH; 113 | else 114 | return NMATCH; 115 | } 116 | if ((controlled_saddr == 0 ) && ( controlled_daddr != 0 )) 117 | { 118 | if (controlled_daddr == daddr) 119 | return MATCH; 120 | else 121 | return NMATCH; 122 | } 123 | if ((controlled_saddr != 0 ) && ( controlled_daddr != 0 )) 124 | { 125 | if ((controlled_saddr == saddr) && (controlled_daddr == daddr)) 126 | return MATCH; 127 | else 128 | return NMATCH; 129 | } 130 | return NMATCH; 131 | } 132 | 133 | bool icmp_check(void){ 134 | struct icmphdr *picmphdr; 135 | //printk("<0>This is an ICMP packet.\n"); 136 | picmphdr = (struct icmphdr *)(tmpskb->data +(piphdr->ihl*4)); 137 | 138 | if (picmphdr->type == 0){ 139 | if (ipaddr_check(piphdr->daddr,piphdr->saddr) == MATCH){ 140 | printk("An ICMP packet is denied! \n"); 141 | return 1; 142 | } 143 | } 144 | if (picmphdr->type == 8){ 145 | if (ipaddr_check(piphdr->saddr,piphdr->daddr) == MATCH){ 146 | printk("An ICMP packet is denied! \n"); 147 | return 1; 148 | } 149 | } 150 | return 0; 151 | } 152 | 153 | bool tcp_check(void){ 154 | struct tcphdr *ptcphdr; 155 | // printk("<0>This is an tcp packet.\n"); 156 | ptcphdr = (struct tcphdr *)(tmpskb->data +(piphdr->ihl*4)); 157 | if ((ipaddr_check(piphdr->saddr,piphdr->daddr) == MATCH) && (port_check(ptcphdr->source,ptcphdr->dest) == MATCH)){ 158 | printk("A TCP packet is denied! \n"); 159 | snprintf(port_buff_src, 10, ":%d", ntohs(ptcphdr->source)); 160 | snprintf(port_buff_dst, 10, ":%d", ntohs(ptcphdr->dest)); 161 | return 1; 162 | } 163 | else 164 | return 0; 165 | } 166 | 167 | bool udp_check(void){ 168 | struct udphdr *pudphdr; 169 | // printk("<0>This is an udp packet.\n"); 170 | pudphdr = (struct udphdr *)(tmpskb->data +(piphdr->ihl*4)); 171 | if ((ipaddr_check(piphdr->saddr,piphdr->daddr) == MATCH) && (port_check(pudphdr->source,pudphdr->dest) == MATCH)){ 172 | snprintf(port_buff_src, 10, ":%d", ntohs(pudphdr->source)); 173 | snprintf(port_buff_dst, 10, ":%d", ntohs(pudphdr->dest)); 174 | printk("A UDP packet is denied! \n"); 175 | return 1; 176 | } 177 | else 178 | return 0; 179 | } 180 | 181 | /*unsigned int hook_func(unsigned int hooknum,struct sk_buff **skb,const struct net_device *in,const struct net_device *out,int (*okfn)(struct sk_buff *)) 182 | */ 183 | unsigned int hook_func(void * priv,struct sk_buff *skb,const struct nf_hook_state * state){ 184 | 185 | bool result = 0; 186 | struct timex txc; 187 | struct rtc_time tm; 188 | 189 | tmpskb = skb; 190 | piphdr = ip_hdr(tmpskb); 191 | 192 | //时间 193 | do_gettimeofday(&txc.time); //获取当前UTC时间 194 | txc.time.tv_sec += 8 * 60 * 60; //把UTC时间调整为本地时间 195 | rtc_time_to_tm(txc.time.tv_sec, &tm); //算出时间中的年月日等数值到tm中 196 | time_from_tm(time_buff, &tm); 197 | 198 | addr_from_net(ip_buff_src, piphdr->saddr); 199 | addr_from_net(ip_buff_dst, piphdr->daddr); 200 | 201 | 202 | if(num == 0) return NF_ACCEPT; 203 | else { 204 | int i; 205 | pchar = controlinfo; 206 | for (i = 0; iprotocol != controlled_protocol) 231 | { result = 0; continue; } 232 | else{ 233 | if (piphdr->protocol == 1){ //ICMP packet 234 | snprintf(protocol_buff, 10, "%s", "ICMP"); 235 | snprintf(port_buff_src, 10, " "); 236 | snprintf(port_buff_dst, 10, " "); 237 | result = icmp_check(); 238 | } 239 | else if (piphdr->protocol == 6){ //TCP packet 240 | snprintf(protocol_buff, 10, "%s", "TCP"); 241 | result = tcp_check(); 242 | } 243 | else if (piphdr->protocol == 17){ //UDP packet 244 | snprintf(protocol_buff, 10, "%s", "UDP"); 245 | result = udp_check(); 246 | } 247 | else 248 | { 249 | printk("Unkonwn type's packet! \n"); 250 | return NF_ACCEPT; 251 | } 252 | 253 | //Judge 254 | if(result == 0) continue; 255 | else { 256 | printk("%s %s packet from %s%s to %s%s rejected by rule %d \n", 257 | time_buff, protocol_buff, ip_buff_src, port_buff_src, 258 | ip_buff_dst, port_buff_dst, i+1); 259 | return NF_DROP; 260 | } 261 | } 262 | 263 | } 264 | return NF_ACCEPT; 265 | } 266 | 267 | } 268 | 269 | static ssize_t write_controlinfo(struct file * fd, const char __user *buf, size_t len, loff_t *ppos) 270 | { 271 | 272 | if (len == 0){ 273 | return len; 274 | } 275 | 276 | if (copy_from_user(controlinfo, buf, len) != 0){ 277 | printk("Can't get the control rule! \n"); 278 | printk("Something may be wrong, please check it! \n"); 279 | return 0; 280 | } 281 | 282 | pchar = controlinfo; 283 | num = len/32; 284 | 285 | return len; 286 | } 287 | 288 | 289 | struct file_operations fops = { 290 | .owner=THIS_MODULE, 291 | .write=write_controlinfo, 292 | }; 293 | 294 | 295 | static int __init initmodule(void) 296 | { 297 | int ret; 298 | printk("Init Module\n"); 299 | myhook.hook=hook_func; 300 | myhook.hooknum=NF_INET_POST_ROUTING; 301 | myhook.pf=PF_INET; 302 | myhook.priority=NF_IP_PRI_FIRST; 303 | nf_register_hook(&myhook); 304 | ret = register_chrdev(124, "/dev/controlinfo", &fops); 305 | if (ret != 0) printk("Can't register device file! \n"); 306 | 307 | return 0; 308 | } 309 | 310 | static void __exit cleanupmodule(void) 311 | { 312 | nf_unregister_hook(&myhook); 313 | unregister_chrdev(124, "controlinfo"); 314 | printk("CleanUp\n"); 315 | } 316 | 317 | module_init(initmodule); 318 | module_exit(cleanupmodule); 319 | MODULE_LICENSE("GPL"); 320 | MODULE_AUTHOR("WJ_Yuan"); 321 | --------------------------------------------------------------------------------