This commit is contained in:
Tim Blume 2021-03-19 17:40:33 +01:00
parent a0ce50b7cd
commit f99ee2abde
11 changed files with 100 additions and 72 deletions

View file

@ -1,4 +1,5 @@
add_library(mitmproxy_plugin MODULE mitmproxy_network.cpp mitmproxy_network.h)
SET(CMAKE_AUTOMOC ON)
add_library(mitmproxy_plugin MODULE mitmproxy_network.cpp mitmproxy_network.h mitmproxy.json)
target_include_directories(mitmproxy_plugin PRIVATE ../../include/)
target_link_libraries(mitmproxy_plugin PRIVATE Qt5::Core cppzmq)
set_target_properties(mitmproxy_plugin PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PLUGIN_DIR})

View file

@ -9,7 +9,7 @@ void mitmproxyPlugin::connect()
socket->bind(this->path);
} catch (zmq::error_t err) {
qDebug() << "failed binding socket" << err.what();
emit error(err.what());
error(err.what());
throw;
};
is_connected = true;
@ -47,7 +47,7 @@ void mitmproxyPlugin::process(std::string path)
qDebug() << "received " << msg_type.c_str();
} else if(msg_type == "response") {
qDebug() << "received " << msg_type.c_str();
//emit httpMessage(j);
message(j);
} else if(msg_type == "requestheaders") {
qDebug() << "received " << msg_type.c_str();
} else if(msg_type == "request") {
@ -78,6 +78,11 @@ void mitmproxyPlugin::process(std::string path)
}
}
bool mitmproxyPlugin::connected()
{
return is_connected;
}
void mitmproxyPlugin::disconnect()
{
delete socket;

View file

@ -3,14 +3,20 @@
#include "api.h"
#include "proxyinterface.h"
#include <QObject>
#include <QtPlugin>
#include <set>
#include <zmq.hpp>
class mitmproxyPlugin : public http::ProxyInterface
/*
mitmproxy base plugin
This plugin implements the interface for the basic mitmproxy plugin.
*/
class mitmproxyPlugin : public QObject, http::ProxyInterface
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "bigsnitch.api.HTTPProxyInterface/100" FILE "mitmproxy.json")
Q_PLUGIN_METADATA(IID HTTPProxyInterfaceIID FILE "mitmproxy.json")
Q_INTERFACES(http::ProxyInterface)
private:
std::set<std::string> received;
@ -29,9 +35,4 @@ public:
//! disconnects the handle
void disconnect() override;
// options/settings
signals:
//void finished();
//void error(QString err);
//void message(http::Flow flow);
};