Skip to content

Commit

Permalink
🔖 Release: v0.9.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
comstering committed Nov 9, 2021
2 parents f6239da + be8ea92 commit 8cc0fea
Show file tree
Hide file tree
Showing 35 changed files with 46,662 additions and 166 deletions.
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,8 @@ Thumbs.db
*.dll
*.exe

bin/
build-*/
bin/*
!bin/oui.db
!bin/manuf_rep.txt

build-*/
17 changes: 17 additions & 0 deletions Documentation/RelNotes/0.9.0.0.txt
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
17 changes: 17 additions & 0 deletions README.md
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
57 changes: 57 additions & 0 deletions app/manuf2oui/main.cpp
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();
}
}
}
}
19 changes: 19 additions & 0 deletions app/manuf2oui/manuf2oui.pro
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
1 change: 1 addition & 0 deletions app/netblock/dinfo.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "dinfo.h"
24 changes: 24 additions & 0 deletions app/netblock/dinfo.h
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
Binary file added app/netblock/edit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions app/netblock/image.qrc
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 added app/netblock/logo.ico
Binary file not shown.
36 changes: 30 additions & 6 deletions app/netblock/main.cpp
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();
}
}
Loading

0 comments on commit 8cc0fea

Please sign in to comment.