Updated benchmark

This commit is contained in:
nik012003
2022-06-26 02:12:57 +02:00
committed by DomySh
parent 67f04cc8dc
commit a3e9dd3269
6 changed files with 40 additions and 154 deletions

View File

@@ -64,6 +64,7 @@ def get_status():
@app.route("/api/login", methods = ['POST'])
def login():
if DEBUG: return { "status":"ok" }
if app.config["STATUS"] != "run": return abort(404)
req = request.get_json(force = True)
@@ -89,12 +90,14 @@ def login():
@app.route("/api/logout")
def logout():
if DEBUG: return { "status":"ok" }
session["loggined"] = False
return { "status":"ok" }
@app.route('/api/change-password', methods = ['POST'])
@login_required
def change_password():
if DEBUG: return { "status":"ok" }
if app.config["STATUS"] != "run": return abort(404)
req = request.get_json(force = True)
@@ -123,6 +126,7 @@ def change_password():
@app.route('/api/set-password', methods = ['POST'])
def set_password():
if DEBUG: return { "status":"ok" }
if app.config["STATUS"] != "init": return abort(404)
req = request.get_json(force = True)
try:

View File

@@ -10,7 +10,7 @@
#include <boost/thread.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <boost/bind.hpp>
#include <boost/bind/bind.hpp>
#include <boost/asio.hpp>
#include <boost/thread/mutex.hpp>
@@ -45,15 +45,15 @@ struct regex_rules{
shared_ptr<regex_rules> regex_config;
const char* config_file;
mutex mtx;
mutex update_mutex;
bool filter_data(unsigned char* data, const size_t& bytes_transferred, vector<pair<string,regex>> const &blacklist, vector<pair<string,regex>> const &whitelist){
#ifdef DEBUG_PACKET
cout << "---------------- Packet ----------------" << endl;
cerr << "---------------- Packet ----------------" << endl;
for(int i=0;i<bytes_transferred;i++){
cout << data[i];
cerr << data[i];
}
cout << "\n" << "---------------- End Packet ----------------" << endl;
cerr << "\n" << "---------------- End Packet ----------------" << endl;
#endif
for (pair<string,regex> ele:blacklist){
try{
@@ -76,7 +76,7 @@ bool filter_data(unsigned char* data, const size_t& bytes_transferred, vector<pa
}
}
#ifdef DEBUG
cout << "Packet Accepted!" << endl;
cerr << "Packet Accepted!" << endl;
#endif
return true;
}
@@ -325,7 +325,6 @@ namespace tcp_proxy
}
void push_regex(char* arg, bool case_sensitive, vector<pair<string,regex>> &v){
std::unique_lock<std::mutex> lck(mtx);
size_t expr_len = (strlen(arg)-2)/2;
char expr[expr_len];
unhexlify(arg+2, arg+strlen(arg)-1, expr);
@@ -334,13 +333,13 @@ void push_regex(char* arg, bool case_sensitive, vector<pair<string,regex>> &v){
if (case_sensitive){
regex regex(expr_str);
#ifdef DEBUG
cout << "Added case sensitive regex " << expr_str << endl;
cerr << "Added case sensitive regex " << expr_str << endl;
#endif
v.push_back(make_pair(string(arg), regex));
} else {
regex regex(expr_str,regex_constants::icase);
#ifdef DEBUG
cout << "Added case insensitive regex " << expr_str << endl;
cerr << "Added case insensitive regex " << expr_str << endl;
#endif
v.push_back(make_pair(string(arg), regex));
}
@@ -351,6 +350,7 @@ void push_regex(char* arg, bool case_sensitive, vector<pair<string,regex>> &v){
void update_regex(){
std::unique_lock<std::mutex> lck(update_mutex);
fstream fd;
fd.open(config_file,ios::in);
if (!fd.is_open()){
@@ -397,13 +397,19 @@ void signal_handler(int signal_num)
{
if (signal_num == SIGUSR1){
#ifdef DEBUG
cout << "Updating configurtation" << endl;
cerr << "Updating configurtation" << endl;
#endif
update_regex();
}else if(signal_num == SIGTERM){
if (ios_loop != nullptr) ios_loop->stop();
#ifdef DEBUG
cerr << "Close Requested" << endl;
#endif
exit(0);
}else if (signal_num == SIGSEGV){
#ifdef DEBUG
cerr << "Forced Close" << endl;
#endif
exit(0);
}
}

View File

@@ -1,126 +0,0 @@
S3065376433366539666631353833373263633764613966396235313538633766
1C3638316561366437356466353765656265383933396630326262393338336438
1S3638316561366437356466353765656265383933396630326262393338336438
1C3739663566343265663536633261656665623338346135616464633539663930
1S3739663566343265663536633261656665623338346135616464633539663930
1C3733353138303461313162386234323563313931613664373937666264356630
1S3733353138303461313162386234323563313931613664373937666264356630
1C3065376433366539666631353833373263633764613966396235313538633766
1S3065376433366539666631353833373263633764613966396235313538633766
1C3638316561366437356466353765656265383933396630326262393338336438
1S3638316561366437356466353765656265383933396630326262393338336438
1C3739663566343265663536633261656665623338346135616464633539663930
1S3739663566343265663536633261656665623338346135616464633539663930
1C3733353138303461313162386234323563313931613664373937666264356630
1S3733353138303461313162386234323563313931613664373937666264356630
1C3065376433366539666631353833373263633764613966396235313538633766
1S3065376433366539666631353833373263633764613966396235313538633766
1C3638316561366437356466353765656265383933396630326262393338336438
1S3638316561366437356466353765656265383933396630326262393338336438
1C3739663566343265663536633261656665623338346135616464633539663930
1S3739663566343265663536633261656665623338346135616464633539663930
S3065376433366539666631353833373263633764613966396235313538633766
1C3638316561366437356466353765656265383933396630326262393338336438
1S3638316561366437356466353765656265383933396630326262393338336438
1C3739663566343265663536633261656665623338346135616464633539663930
1S3739663566343265663536633261656665623338346135616464633539663930
1C3733353138303461313162386234323563313931613664373937666264356630
1S3733353138303461313162386234323563313931613664373937666264356630
1C3065376433366539666631353833373263633764613966396235313538633766
1S3065376433366539666631353833373263633764613966396235313538633766
1C3638316561366437356466353765656265383933396630326262393338336438
1S3638316561366437356466353765656265383933396630326262393338336438
1C3739663566343265663536633261656665623338346135616464633539663930
1S3739663566343265663536633261656665623338346135616464633539663930
1C3733353138303461313162386234323563313931613664373937666264356630
1S3733353138303461313162386234323563313931613664373937666264356630
1C3065376433366539666631353833373263633764613966396235313538633766
1S3065376433366539666631353833373263633764613966396235313538633766
1C3638316561366437356466353765656265383933396630326262393338336438
1S3638316561366437356466353765656265383933396630326262393338336438
1C3739663566343265663536633261656665623338346135616464633539663930
1S3739663566343265663536633261656665623338346135616464633539663930
S3065376433366539666631353833373263633764613966396235313538633766
1C3638316561366437356466353765656265383933396630326262393338336438
1S3638316561366437356466353765656265383933396630326262393338336438
1C3739663566343265663536633261656665623338346135616464633539663930
1S3739663566343265663536633261656665623338346135616464633539663930
1C3733353138303461313162386234323563313931613664373937666264356630
1S3733353138303461313162386234323563313931613664373937666264356630
1C3065376433366539666631353833373263633764613966396235313538633766
1S3065376433366539666631353833373263633764613966396235313538633766
1C3638316561366437356466353765656265383933396630326262393338336438
1S3638316561366437356466353765656265383933396630326262393338336438
1C3739663566343265663536633261656665623338346135616464633539663930
1S3739663566343265663536633261656665623338346135616464633539663930
1C3733353138303461313162386234323563313931613664373937666264356630
1S3733353138303461313162386234323563313931613664373937666264356630
1C3065376433366539666631353833373263633764613966396235313538633766
1S3065376433366539666631353833373263633764613966396235313538633766
1C3638316561366437356466353765656265383933396630326262393338336438
1S3638316561366437356466353765656265383933396630326262393338336438
1C3739663566343265663536633261656665623338346135616464633539663930
1S3739663566343265663536633261656665623338346135616464633539663930
S3065376433366539666631353833373263633764613966396235313538633766
1C3638316561366437356466353765656265383933396630326262393338336438
1S3638316561366437356466353765656265383933396630326262393338336438
1C3739663566343265663536633261656665623338346135616464633539663930
1S3739663566343265663536633261656665623338346135616464633539663930
1C3733353138303461313162386234323563313931613664373937666264356630
1S3733353138303461313162386234323563313931613664373937666264356630
1C3065376433366539666631353833373263633764613966396235313538633766
1S3065376433366539666631353833373263633764613966396235313538633766
1C3638316561366437356466353765656265383933396630326262393338336438
1S3638316561366437356466353765656265383933396630326262393338336438
1C3739663566343265663536633261656665623338346135616464633539663930
1S3739663566343265663536633261656665623338346135616464633539663930
1C3733353138303461313162386234323563313931613664373937666264356630
1S3733353138303461313162386234323563313931613664373937666264356630
1C3065376433366539666631353833373263633764613966396235313538633766
1S3065376433366539666631353833373263633764613966396235313538633766
1C3638316561366437356466353765656265383933396630326262393338336438
1S3638316561366437356466353765656265383933396630326262393338336438
1C3739663566343265663536633261656665623338346135616464633539663930
1S3739663566343265663536633261656665623338346135616464633539663930
S3065376433366539666631353833373263633764613966396235313538633766
1C3638316561366437356466353765656265383933396630326262393338336438
1S3638316561366437356466353765656265383933396630326262393338336438
1C3739663566343265663536633261656665623338346135616464633539663930
1S3739663566343265663536633261656665623338346135616464633539663930
1C3733353138303461313162386234323563313931613664373937666264356630
1S3733353138303461313162386234323563313931613664373937666264356630
1C3065376433366539666631353833373263633764613966396235313538633766
1S3065376433366539666631353833373263633764613966396235313538633766
1C3638316561366437356466353765656265383933396630326262393338336438
1S3638316561366437356466353765656265383933396630326262393338336438
1C3739663566343265663536633261656665623338346135616464633539663930
1S3739663566343265663536633261656665623338346135616464633539663930
1C3733353138303461313162386234323563313931613664373937666264356630
1S3733353138303461313162386234323563313931613664373937666264356630
1C3065376433366539666631353833373263633764613966396235313538633766
1S3065376433366539666631353833373263633764613966396235313538633766
1C3638316561366437356466353765656265383933396630326262393338336438
1S3638316561366437356466353765656265383933396630326262393338336438
1C3739663566343265663536633261656665623338346135616464633539663930
1S3739663566343265663536633261656665623338346135616464633539663930
S3065376433366539666631353833373263633764613966396235313538633766
1C3638316561366437356466353765656265383933396630326262393338336438
1S3638316561366437356466353765656265383933396630326262393338336438
1C3739663566343265663536633261656665623338346135616464633539663930
1S3739663566343265663536633261656665623338346135616464633539663930
1C3733353138303461313162386234323563313931613664373937666264356630
1S3733353138303461313162386234323563313931613664373937666264356630
1C3065376433366539666631353833373263633764613966396235313538633766
1S3065376433366539666631353833373263633764613966396235313538633766
1C3638316561366437356466353765656265383933396630326262393338336438
1S3638316561366437356466353765656265383933396630326262393338336438
1C3739663566343265663536633261656665623338346135616464633539663930
1S3739663566343265663536633261656665623338346135616464633539663930
1C3733353138303461313162386234323563313931613664373937666264356630
1S3733353138303461313162386234323563313931613664373937666264356630
1C3065376433366539666631353833373263633764613966396235313538633766
1S3065376433366539666631353833373263633764613966396235313538633766
1C3638316561366437356466353765656265383933396630326262393338336438
1S3638316561366437356466353765656265383933396630326262393338336438
1C3739663566343265663536633261656665623338346135616464633539663930
1S3739663566343265663536633261656665623338346135616464633539663930