-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
46,662 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,5 +71,8 @@ Thumbs.db | |
*.dll | ||
*.exe | ||
|
||
bin/ | ||
build-*/ | ||
bin/* | ||
!bin/oui.db | ||
!bin/manuf_rep.txt | ||
|
||
build-*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
NetBlock v0.9.0.0 Release Notes | ||
======================== | ||
|
||
This release NetBlock program v.0.9.0.0 | ||
|
||
Introduction: | ||
Internet Netwrok Control Service (NetBlock) | ||
|
||
Configuration: | ||
Standard C++ | ||
Qt Framework | ||
npcap | ||
Snoopspy g library: https://github.com/snoopspy/g | ||
|
||
Feature: | ||
Set network policy | ||
Block using network |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# NetBlock | ||
Network control solution in Host Level. | ||
|
||
visit the website: [WiFi Event](http://wifievent.io) | ||
|
||
## Develop doc | ||
### Library | ||
- [libpcap](https://www.tcpdump.org/) : For Linux | ||
- [npcap](https://nmap.org/) : For Widows | ||
- [sqlite3](https://www.sqlite.org/) | ||
- [STL(Standard Template Library)](https://www.cplusplus.com/reference/stl/) | ||
|
||
### Language | ||
- C++ 11 | ||
|
||
### Lastest Version | ||
- v0.9.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#include <QCoreApplication> | ||
#include <QtSql> | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
QCoreApplication a(argc, argv); | ||
|
||
QSqlDatabase ouiDB = QSqlDatabase::addDatabase("QSQLITE", "oui.db"); | ||
ouiDB.setDatabaseName("oui.db"); | ||
if(!ouiDB.open()) { | ||
qWarning() << QString("ouiDB.open() return false %1").arg(ouiDB.lastError().text()); | ||
ouiDB.close(); | ||
return -1; | ||
} | ||
|
||
QSqlQuery ouiQuery(ouiDB); | ||
|
||
QMutex m; | ||
|
||
{ | ||
QMutexLocker ml(&m); | ||
ouiQuery.exec("SELECT name FROM sqlite_master WHERE name = 'oui'"); | ||
} | ||
|
||
ouiQuery.next(); | ||
QString result = ouiQuery.value(0).toString(); | ||
if(result.compare("oui")) { | ||
qDebug() << QString("Create oui table"); | ||
|
||
{ | ||
QMutexLocker ml(&m); | ||
ouiQuery.exec("CREATE TABLE oui (mac CHAR(20) NOT NULL PRIMARY KEY, organ VARCHAR(64) NOT NULL)"); | ||
} | ||
|
||
QFile file("manuf_rep.txt"); | ||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { | ||
qWarning() << QString("Not open oui file"); | ||
// error message here | ||
return -1; | ||
} | ||
|
||
QString getLine; | ||
QTextStream fileStream(&file); | ||
while (!fileStream.atEnd()) { | ||
getLine = fileStream.readLine(); | ||
QStringList ouiResult = getLine.split('\t'); | ||
|
||
{ | ||
QMutexLocker ml(&m); | ||
ouiQuery.prepare("INSERT INTO oui VALUES(:mac, :organ)"); | ||
ouiQuery.bindValue(":mac", ouiResult.at(0)); | ||
ouiQuery.bindValue(":organ", ouiResult.at(1)); | ||
ouiQuery.exec(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
QT -= gui | ||
|
||
QT += sql | ||
|
||
CONFIG += c++11 console | ||
CONFIG -= app_bundle | ||
|
||
DESTDIR = ../../bin | ||
# You can make your code fail to compile if it uses deprecated APIs. | ||
# In order to do so, uncomment the following line. | ||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 | ||
|
||
SOURCES += \ | ||
main.cpp | ||
|
||
# Default rules for deployment. | ||
qnx: target.path = /tmp/$${TARGET}/bin | ||
else: unix:!android: target.path = /opt/$${TARGET}/bin | ||
!isEmpty(target.path): INSTALLS += target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include "dinfo.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#ifndef DINFO_H | ||
#define DINFO_H | ||
|
||
#include <QString> | ||
#include "host.h" | ||
|
||
struct DInfo : Host | ||
{ | ||
DInfo() {} | ||
DInfo(const Host &host) : Host(host) {} | ||
|
||
bool operator == (const DInfo& r) const { return hostId_ == r.hostId_ && mac_ == r.mac_; } | ||
|
||
int hostId_; | ||
QString oui_; | ||
bool isConnect_ = false; | ||
}; | ||
|
||
struct DInfoList : QList<DInfo> | ||
{ | ||
QMutex m_; | ||
}; | ||
|
||
#endif // DINFO_H |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<RCC> | ||
<qresource prefix="/logo"> | ||
<file>logo.ico</file> | ||
</qresource> | ||
</RCC> |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,35 @@ | ||
#include "widget.h" | ||
#include "mainwindow.h" | ||
|
||
#include <QApplication> | ||
#include <GApp> | ||
|
||
const char *version() | ||
{ | ||
return | ||
#ifdef _DEBUG | ||
#include "../../version.txt" | ||
" Debug Build(" __DATE__ " " __TIME__ ")"; | ||
#else // RELEASE | ||
#include "../../version.txt" | ||
" Release Build(" __DATE__ " " __TIME__ ")"; | ||
#endif // _DEBUG | ||
} | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
QApplication a(argc, argv); | ||
Widget w; | ||
w.show(); | ||
return a.exec(); | ||
qDebug() << "NetBlock Started" << version(); | ||
GApp a(argc, argv); | ||
|
||
QIcon icon(":/image/logo/logo.ico"); | ||
a.setWindowIcon(icon); | ||
|
||
MainWindow m; | ||
if (!m.openCheck) | ||
{ | ||
qDebug() << QString("NB Do not open"); | ||
} | ||
else | ||
{ | ||
m.show(); | ||
a.exec(); | ||
} | ||
} |
Oops, something went wrong.