2025-03-18 15:12:42 +08:00
|
|
|
#ifndef SERVER_HPP
|
|
|
|
|
#define SERVER_HPP
|
|
|
|
|
|
|
|
|
|
#include <httplib.h>
|
2025-05-26 20:29:41 +08:00
|
|
|
#include <map>
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include <string>
|
2025-03-18 15:12:42 +08:00
|
|
|
|
|
|
|
|
class CrackerServer: public httplib::Server {
|
|
|
|
|
public:
|
2025-05-26 20:29:41 +08:00
|
|
|
struct WebPage {
|
|
|
|
|
std::string type;
|
|
|
|
|
std::vector<unsigned char> content;
|
|
|
|
|
};
|
|
|
|
|
|
2025-03-18 15:12:42 +08:00
|
|
|
CrackerServer();
|
|
|
|
|
~CrackerServer() override = default;
|
|
|
|
|
|
|
|
|
|
static void Start();
|
2025-05-26 20:29:41 +08:00
|
|
|
|
|
|
|
|
static std::map<
|
|
|
|
|
std::string,
|
|
|
|
|
WebPage
|
|
|
|
|
> WebRes;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void set_web_page();
|
|
|
|
|
|
|
|
|
|
class WebPageResponder {
|
|
|
|
|
public:
|
|
|
|
|
WebPageResponder(WebPage& page);
|
|
|
|
|
|
|
|
|
|
void operator()(const httplib::Request& req, httplib::Response& res) const;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
WebPage& m_page;
|
|
|
|
|
};
|
2025-03-18 15:12:42 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif //SERVER_HPP
|