126 lines
2.4 KiB
Protocol Buffer
126 lines
2.4 KiB
Protocol Buffer
syntax = "proto3";
|
|
package exploits;
|
|
|
|
option go_package = "exploits";
|
|
|
|
import "fileserver/api.proto";
|
|
|
|
import "google/protobuf/duration.proto";
|
|
|
|
message TeamBucket {
|
|
map<string, string> teams = 1;
|
|
}
|
|
|
|
message ExploitConfiguration {
|
|
string entrypoint = 1;
|
|
bool is_archive = 2;
|
|
google.protobuf.Duration run_every = 3;
|
|
google.protobuf.Duration timeout = 4;
|
|
bool disabled = 5;
|
|
bool endless = 6;
|
|
}
|
|
|
|
message ExploitState {
|
|
string exploit_id = 1;
|
|
int64 version = 2;
|
|
fileserver.FileInfo file = 3;
|
|
ExploitConfiguration config = 6;
|
|
}
|
|
|
|
message Config {
|
|
string farm_url = 1;
|
|
string farm_password = 2;
|
|
string flag_regexp = 3;
|
|
google.protobuf.Duration ping_every = 4;
|
|
google.protobuf.Duration submit_every = 5;
|
|
repeated string environ = 6;
|
|
}
|
|
|
|
message ServerState {
|
|
// Распределение опросов по клиентам
|
|
map<string, TeamBucket> client_team_map = 1;
|
|
repeated ExploitState exploits = 2;
|
|
Config config = 3;
|
|
}
|
|
|
|
message PingRequest {
|
|
string client_id = 1;
|
|
|
|
message ServerInfo {
|
|
}
|
|
|
|
message Heartbeat {
|
|
int32 weight = 1;
|
|
}
|
|
|
|
message Leave {
|
|
}
|
|
|
|
oneof payload {
|
|
ServerInfo server_info_request = 2;
|
|
Heartbeat heartbeat_request = 3;
|
|
Leave leave_request = 4;
|
|
}
|
|
}
|
|
|
|
message PingResponse {
|
|
ServerState state = 1;
|
|
}
|
|
|
|
message ExploitRequest {
|
|
string exploit_id = 1;
|
|
}
|
|
|
|
message ExploitResponse {
|
|
ExploitState state = 1;
|
|
}
|
|
|
|
message UpdateExploitRequest {
|
|
ExploitState state = 1;
|
|
}
|
|
|
|
message UpdateExploitResponse {
|
|
ExploitState state = 1;
|
|
}
|
|
|
|
message BroadcastRequest {
|
|
string command = 1;
|
|
}
|
|
|
|
message BroadcastResponse {
|
|
}
|
|
|
|
message BroadcastSubscribeRequest {
|
|
}
|
|
|
|
message BroadcastSubscribeResponse {
|
|
string command = 1;
|
|
}
|
|
|
|
message SingleRunRequest {
|
|
string exploit_id = 1;
|
|
}
|
|
|
|
message SingleRunResponse {
|
|
}
|
|
|
|
message SingleRunSubscribeRequest {
|
|
}
|
|
|
|
message SingleRunSubscribeResponse {
|
|
string exploit_id = 1;
|
|
}
|
|
|
|
service Service {
|
|
rpc Ping (PingRequest) returns (PingResponse) {}
|
|
|
|
rpc Exploit(ExploitRequest) returns (ExploitResponse) {}
|
|
rpc UpdateExploit(UpdateExploitRequest) returns (UpdateExploitResponse) {}
|
|
|
|
rpc BroadcastCommand(BroadcastRequest) returns (BroadcastResponse) {}
|
|
rpc BroadcastSubscribe(BroadcastSubscribeRequest) returns (stream BroadcastSubscribeResponse) {}
|
|
|
|
rpc SingleRun(SingleRunRequest) returns (SingleRunResponse) {}
|
|
rpc SingleRunSubscribe(SingleRunSubscribeRequest) returns (stream SingleRunSubscribeResponse) {}
|
|
}
|