Eyre
17th March 2017, 16:41
Hello, folks.
Here I have a problem.
I was planning to make some kind of sniffer, just for practising. And so I started facing problems from the setup.
So, basically program does not start.
.pro file
#-------------------------------------------------
#
# Project created by QtCreator 2017-03-16T17:23:52
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = untitled
TEMPLATE = app
#CONFIG += c++11
INCLUDEPATH += E:/lib/PcapPlusPlus-17.02-windows-mingw32-gcc-5.3.0/header
LIBS += E:/lib/PcapPlusPlus-17.02-windows-mingw32-gcc-5.3.0/Pcap++.lib
LIBS += E:/lib/PcapPlusPlus-17.02-windows-mingw32-gcc-5.3.0/Packet++.lib
LIBS += E:/lib/PcapPlusPlus-17.02-windows-mingw32-gcc-5.3.0/Common++.lib
INCLUDEPATH += E:/lib/WpdPack/Include
LIBS += -LE:/lib/WpdPack/Lib -lwpcap -lpacket
LIBS += -lpthread
LIBS += -lws2_32
LIBS += -liphlpapi
LIBS += -static-libgcc -static-libstdc++
SOURCES += main.cpp\
sniffer.cpp
HEADERS += sniffer.h
FORMS += sniffer.ui
then goes sniffer.h
#ifndef SNIFFER_H
#define SNIFFER_H
#include <winsock2.h>
#include <QMainWindow>
namespace Ui {
class Sniffer;
}
class Sniffer : public QMainWindow
{
Q_OBJECT
public:
explicit Sniffer(QWidget *parent = 0);
~Sniffer();
private slots:
void on_pushButton_2_clicked();
private:
Ui::Sniffer *ui;
};
#endif // SNIFFER_H
.cpp
#include "sniffer.h"
#include "ui_sniffer.h"
#include <MacAddress.h>
#include <IpAddress.h>
#include <PlatformSpecificUtils.h>
#include <PcapLiveDeviceList.h>
#include <PcapLiveDevice.h>
#include <EthLayer.h>
#include <ArpLayer.h>
#include <Logger.h>
#include <QMessageBox>
using namespace pcpp;
Sniffer::Sniffer(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::Sniffer)
{
ui->setupUi(this);
}
Sniffer::~Sniffer()
{
delete ui;
}
void Sniffer::on_pushButton_2_clicked()
{
const std::vector <PcapLiveDevice*>& a = PcapLiveDeviceList::getInstance().getPcapLiveDevic esList();
/*QString showme(*a[0]->getName());
QMessageBox::information(this, "info",showme);*/
}
and main
#include "sniffer.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Sniffer w;
w.show();
return a.exec();
}
so there's just 1 button and some headers.
I was using dll for pthreads from somewhere here
https://sourceforge.net/p/mingw-w64/wiki2/Compile%20pthreads/
which I copied to /mingw53_32/bin
precompiled pcapplusplus from.. here
http://seladb.github.io/PcapPlusPlus-Doc/download.html
and winpcap-dev from their site.
when I try to run the app, it appears in memory, visible in taskmgr, but window with my fancy button doesn't show.
Hope to your assistance, folks :)
Here I have a problem.
I was planning to make some kind of sniffer, just for practising. And so I started facing problems from the setup.
So, basically program does not start.
.pro file
#-------------------------------------------------
#
# Project created by QtCreator 2017-03-16T17:23:52
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = untitled
TEMPLATE = app
#CONFIG += c++11
INCLUDEPATH += E:/lib/PcapPlusPlus-17.02-windows-mingw32-gcc-5.3.0/header
LIBS += E:/lib/PcapPlusPlus-17.02-windows-mingw32-gcc-5.3.0/Pcap++.lib
LIBS += E:/lib/PcapPlusPlus-17.02-windows-mingw32-gcc-5.3.0/Packet++.lib
LIBS += E:/lib/PcapPlusPlus-17.02-windows-mingw32-gcc-5.3.0/Common++.lib
INCLUDEPATH += E:/lib/WpdPack/Include
LIBS += -LE:/lib/WpdPack/Lib -lwpcap -lpacket
LIBS += -lpthread
LIBS += -lws2_32
LIBS += -liphlpapi
LIBS += -static-libgcc -static-libstdc++
SOURCES += main.cpp\
sniffer.cpp
HEADERS += sniffer.h
FORMS += sniffer.ui
then goes sniffer.h
#ifndef SNIFFER_H
#define SNIFFER_H
#include <winsock2.h>
#include <QMainWindow>
namespace Ui {
class Sniffer;
}
class Sniffer : public QMainWindow
{
Q_OBJECT
public:
explicit Sniffer(QWidget *parent = 0);
~Sniffer();
private slots:
void on_pushButton_2_clicked();
private:
Ui::Sniffer *ui;
};
#endif // SNIFFER_H
.cpp
#include "sniffer.h"
#include "ui_sniffer.h"
#include <MacAddress.h>
#include <IpAddress.h>
#include <PlatformSpecificUtils.h>
#include <PcapLiveDeviceList.h>
#include <PcapLiveDevice.h>
#include <EthLayer.h>
#include <ArpLayer.h>
#include <Logger.h>
#include <QMessageBox>
using namespace pcpp;
Sniffer::Sniffer(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::Sniffer)
{
ui->setupUi(this);
}
Sniffer::~Sniffer()
{
delete ui;
}
void Sniffer::on_pushButton_2_clicked()
{
const std::vector <PcapLiveDevice*>& a = PcapLiveDeviceList::getInstance().getPcapLiveDevic esList();
/*QString showme(*a[0]->getName());
QMessageBox::information(this, "info",showme);*/
}
and main
#include "sniffer.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Sniffer w;
w.show();
return a.exec();
}
so there's just 1 button and some headers.
I was using dll for pthreads from somewhere here
https://sourceforge.net/p/mingw-w64/wiki2/Compile%20pthreads/
which I copied to /mingw53_32/bin
precompiled pcapplusplus from.. here
http://seladb.github.io/PcapPlusPlus-Doc/download.html
and winpcap-dev from their site.
when I try to run the app, it appears in memory, visible in taskmgr, but window with my fancy button doesn't show.
Hope to your assistance, folks :)