5#include "proto/service.grpc.pb.h"
6#include "proto/service.pb.h"
10#include <grpcpp/server_context.h>
11#include <grpcpp/support/sync_stream.h>
13#include <tins/sniffer.h>
14#include <unordered_map>
23class Service :
public proto::Sniffer::Service {
39 std::optional<uuid::UUIDv4>
46 const proto::SnifferCreateRequest *request,
47 proto::SnifferID *reply)
override;
50 const proto::SnifferID *request,
51 proto::Empty *reply)
override;
53 grpc::Status
SnifferList(grpc::ServerContext *context,
54 const proto::Empty *request,
55 proto::SnifferListResponse *reply)
override;
58 const proto::SnifferID *request,
59 proto::APListResponse *reply)
override;
62 const proto::APGetRequest *request,
63 proto::APGetResponse *reply)
override;
67 const proto::APProvidePasswordRequest *request,
68 proto::APProvidePasswordResponse *reply)
override;
71 grpc::ServerContext *context,
72 const proto::APGetDeryptedStreamRequest *request,
73 grpc::ServerWriter<proto::Packet> *writer)
override;
76 const proto::APDeauthRequest *request,
77 proto::Empty *reply)
override;
81 const proto::APDeauthClientRequest *request,
82 proto::Empty *reply)
override;
85 const proto::APGetHashRequest *request,
86 proto::APGetHashResponse *reply)
override;
89 const proto::APIgnoreRequest *request,
90 proto::Empty *reply)
override;
93 const proto::SnifferID *request,
94 proto::APListResponse *reply)
override;
98 const proto::APCreateRecordingRequest *request,
99 proto::APCreateRecordingResponse *reply)
override;
101 grpc::Status
FocusStart(grpc::ServerContext *context,
102 const proto::FocusStartRequest *request,
103 proto::FocusStartResponse *reply)
override;
106 const proto::SnifferID *request,
107 proto::FocusGetActiveResponse *reply)
override;
109 grpc::Status
FocusStop(grpc::ServerContext *context,
110 const proto::SnifferID *request,
111 proto::Empty *reply)
override;
114 const proto::RecordingCreateRequest *request,
115 proto::RecordingCreateResponse *reply)
override;
118 const proto::RecordingListRequest *request,
119 proto::RecordingListResponse *reply)
override;
123 const proto::RecordingLoadDecryptedRequest *request,
124 grpc::ServerWriter<proto::Packet> *writer)
override;
128 const proto::Empty *request,
129 proto::NetworkInterfaceListResponse *reply)
override;
132 LogGetStream(grpc::ServerContext *context,
const proto::Empty *request,
133 grpc::ServerWriter<proto::LogEntry> *writer)
override;
136 const proto::Empty *request,
137 proto::BatteryGetLevelResponse *reply)
override;
147 std::optional<std::unique_ptr<PacketChannel>>
150 std::unordered_map<uuid::UUIDv4, std::unique_ptr<Sniffer>> sniffers;
151 std::unordered_map<uuid::UUIDv4, std::unique_ptr<Sniffer>>
153 std::shared_ptr<spdlog::logger> logger;
Service delivering an external gRPC API.
Definition service.h:23
grpc::Status SnifferCreate(grpc::ServerContext *context, const proto::SnifferCreateRequest *request, proto::SnifferID *reply) override
Definition service.cpp:173
grpc::Status SnifferList(grpc::ServerContext *context, const proto::Empty *request, proto::SnifferListResponse *reply) override
Definition service.cpp:225
grpc::Status RecordingList(grpc::ServerContext *context, const proto::RecordingListRequest *request, proto::RecordingListResponse *reply) override
Definition service.cpp:701
grpc::Status AccessPointListIgnored(grpc::ServerContext *context, const proto::SnifferID *request, proto::APListResponse *reply) override
Definition service.cpp:581
void shutdown()
Definition service.cpp:118
grpc::Status FocusStop(grpc::ServerContext *context, const proto::SnifferID *request, proto::Empty *reply) override
Definition service.cpp:664
grpc::Status AccessPointDeauth(grpc::ServerContext *context, const proto::APDeauthRequest *request, proto::Empty *reply) override
Definition service.cpp:452
std::optional< uuid::UUIDv4 > add_iface_sniffer(const std::string &iface_name)
Definition service.cpp:83
grpc::Status AccessPointGetHash(grpc::ServerContext *context, const proto::APGetHashRequest *request, proto::APGetHashResponse *reply) override
Definition service.cpp:515
grpc::Status AccessPointGet(grpc::ServerContext *context, const proto::APGetRequest *request, proto::APGetResponse *reply) override
Definition service.cpp:261
grpc::Status RecordingLoadDecrypted(grpc::ServerContext *context, const proto::RecordingLoadDecryptedRequest *request, grpc::ServerWriter< proto::Packet > *writer) override
Definition service.cpp:728
grpc::Status BatteryGetLevel(grpc::ServerContext *context, const proto::Empty *request, proto::BatteryGetLevelResponse *reply) override
Definition service.cpp:784
grpc::Status FocusStart(grpc::ServerContext *context, const proto::FocusStartRequest *request, proto::FocusStartResponse *reply) override
Definition service.cpp:625
grpc::Status FocusGetActive(grpc::ServerContext *context, const proto::SnifferID *request, proto::FocusGetActiveResponse *reply) override
Definition service.cpp:646
std::optional< uuid::UUIDv4 > add_file_sniffer(const std::filesystem::path &file)
Definition service.cpp:64
grpc::Status SnifferDestroy(grpc::ServerContext *context, const proto::SnifferID *request, proto::Empty *reply) override
Definition service.cpp:213
grpc::Status AccessPointGetDeryptedStream(grpc::ServerContext *context, const proto::APGetDeryptedStreamRequest *request, grpc::ServerWriter< proto::Packet > *writer) override
Definition service.cpp:408
grpc::Status AccessPointProvidePassword(grpc::ServerContext *context, const proto::APProvidePasswordRequest *request, proto::APProvidePasswordResponse *reply) override
Definition service.cpp:368
grpc::Status AccessPointDeauthClient(grpc::ServerContext *context, const proto::APDeauthClientRequest *request, proto::Empty *reply) override
Definition service.cpp:484
grpc::Status NetworkInterfaceList(grpc::ServerContext *context, const proto::Empty *request, proto::NetworkInterfaceListResponse *reply) override
Definition service.cpp:760
grpc::Status LogGetStream(grpc::ServerContext *context, const proto::Empty *request, grpc::ServerWriter< proto::LogEntry > *writer) override
Definition service.cpp:769
void clean_save_dir()
Definition service.cpp:132
grpc::Status AccessPointIgnore(grpc::ServerContext *context, const proto::APIgnoreRequest *request, proto::Empty *reply) override
Definition service.cpp:551
grpc::Status AccessPointList(grpc::ServerContext *context, const proto::SnifferID *request, proto::APListResponse *reply) override
Definition service.cpp:245
Service(const config &cfg)
Definition service.cpp:42
grpc::Status RecordingCreate(grpc::ServerContext *context, const proto::RecordingCreateRequest *request, proto::RecordingCreateResponse *reply) override
Definition service.cpp:682
grpc::Status AccessPointCreateRecording(grpc::ServerContext *context, const proto::APCreateRecordingRequest *request, proto::APCreateRecordingResponse *reply) override
Definition service.cpp:597
std::string UUIDv4
Definition uuid.h:11
Definition access_point.cpp:22
Configuration of the service.
Definition service.h:28
std::filesystem::path oid_file
Definition service.h:32
std::filesystem::path db_file
Definition service.h:31
bool save_on_shutdown
Definition service.h:29
std::vector< MACAddress > ignored_bssids
Definition service.h:34
std::filesystem::path battery_file_path
Definition service.h:33
std::filesystem::path saves_path
Definition service.h:30