diff --git a/tavern/config.go b/tavern/config.go index 0bed76bc1..bdd4565e3 100644 --- a/tavern/config.go +++ b/tavern/config.go @@ -59,11 +59,11 @@ var ( // EnvMySQLUser defines the MySQL user to authenticate as. // EnvMySQLPasswd defines the password for the MySQL user to authenticate with. // EnvMySQLDB defines the name of the MySQL database to use. - EnvMySQLAddr = EnvString{"MYSQL_ADDR", ""} - EnvMySQLNet = EnvString{"MYSQL_NET", "tcp"} - EnvMySQLUser = EnvString{"MYSQL_USER", "root"} - EnvMySQLPasswd = EnvString{"MYSQL_PASSWD", ""} - EnvMySQLDB = EnvString{"MYSQL_DB", "tavern"} + EnvMySQLAddr = EnvString{"MYSQL_ADDR", ""} + EnvMySQLNet = EnvString{"MYSQL_NET", "tcp"} + EnvMySQLUser = EnvString{"MYSQL_USER", "root"} + EnvMySQLPasswd = EnvString{"MYSQL_PASSWD", ""} + EnvMySQLDB = EnvString{"MYSQL_DB", "tavern"} // EnvDBMaxIdleConns defines the maximum number of idle db connections to allow. // EnvDBMaxOpenConns defines the maximum number of open db connections to allow. diff --git a/tavern/internal/c2/c2pb/c2.pb.go b/tavern/internal/c2/c2pb/c2.pb.go index 12a7ca5bc..80f17afb2 100644 --- a/tavern/internal/c2/c2pb/c2.pb.go +++ b/tavern/internal/c2/c2pb/c2.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.1 -// protoc v5.29.2 +// protoc-gen-go v1.28.1 +// protoc v3.21.12 // source: c2.proto package c2pb @@ -128,17 +128,20 @@ func (Host_Platform) EnumDescriptor() ([]byte, []int) { // Agent information to identify the type of beacon. type Agent struct { - state protoimpl.MessageState `protogen:"open.v1"` - Identifier string `protobuf:"bytes,1,opt,name=identifier,proto3" json:"identifier,omitempty"` - unknownFields protoimpl.UnknownFields + state protoimpl.MessageState sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Identifier string `protobuf:"bytes,1,opt,name=identifier,proto3" json:"identifier,omitempty"` } func (x *Agent) Reset() { *x = Agent{} - mi := &file_c2_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_c2_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *Agent) String() string { @@ -149,7 +152,7 @@ func (*Agent) ProtoMessage() {} func (x *Agent) ProtoReflect() protoreflect.Message { mi := &file_c2_proto_msgTypes[0] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -173,21 +176,24 @@ func (x *Agent) GetIdentifier() string { // Beacon information that is unique to the current running beacon. type Beacon struct { - state protoimpl.MessageState `protogen:"open.v1"` - Identifier string `protobuf:"bytes,1,opt,name=identifier,proto3" json:"identifier,omitempty"` - Principal string `protobuf:"bytes,2,opt,name=principal,proto3" json:"principal,omitempty"` - Host *Host `protobuf:"bytes,3,opt,name=host,proto3" json:"host,omitempty"` - Agent *Agent `protobuf:"bytes,4,opt,name=agent,proto3" json:"agent,omitempty"` - Interval uint64 `protobuf:"varint,5,opt,name=interval,proto3" json:"interval,omitempty"` // Duration until next callback, in seconds. - unknownFields protoimpl.UnknownFields + state protoimpl.MessageState sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Identifier string `protobuf:"bytes,1,opt,name=identifier,proto3" json:"identifier,omitempty"` + Principal string `protobuf:"bytes,2,opt,name=principal,proto3" json:"principal,omitempty"` + Host *Host `protobuf:"bytes,3,opt,name=host,proto3" json:"host,omitempty"` + Agent *Agent `protobuf:"bytes,4,opt,name=agent,proto3" json:"agent,omitempty"` + Interval uint64 `protobuf:"varint,5,opt,name=interval,proto3" json:"interval,omitempty"` // Duration until next callback, in seconds. } func (x *Beacon) Reset() { *x = Beacon{} - mi := &file_c2_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_c2_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *Beacon) String() string { @@ -198,7 +204,7 @@ func (*Beacon) ProtoMessage() {} func (x *Beacon) ProtoReflect() protoreflect.Message { mi := &file_c2_proto_msgTypes[1] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -250,20 +256,23 @@ func (x *Beacon) GetInterval() uint64 { // Host information for the system a beacon is running on. type Host struct { - state protoimpl.MessageState `protogen:"open.v1"` - Identifier string `protobuf:"bytes,1,opt,name=identifier,proto3" json:"identifier,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Platform Host_Platform `protobuf:"varint,3,opt,name=platform,proto3,enum=c2.Host_Platform" json:"platform,omitempty"` - PrimaryIp string `protobuf:"bytes,4,opt,name=primary_ip,json=primaryIp,proto3" json:"primary_ip,omitempty"` - unknownFields protoimpl.UnknownFields + state protoimpl.MessageState sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Identifier string `protobuf:"bytes,1,opt,name=identifier,proto3" json:"identifier,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Platform Host_Platform `protobuf:"varint,3,opt,name=platform,proto3,enum=c2.Host_Platform" json:"platform,omitempty"` + PrimaryIp string `protobuf:"bytes,4,opt,name=primary_ip,json=primaryIp,proto3" json:"primary_ip,omitempty"` } func (x *Host) Reset() { *x = Host{} - mi := &file_c2_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_c2_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *Host) String() string { @@ -274,7 +283,7 @@ func (*Host) ProtoMessage() {} func (x *Host) ProtoReflect() protoreflect.Message { mi := &file_c2_proto_msgTypes[2] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -319,19 +328,22 @@ func (x *Host) GetPrimaryIp() string { // Task instructions for the beacon to execute. type Task struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - Tome *epb.Tome `protobuf:"bytes,2,opt,name=tome,proto3" json:"tome,omitempty"` - QuestName string `protobuf:"bytes,3,opt,name=quest_name,json=questName,proto3" json:"quest_name,omitempty"` - unknownFields protoimpl.UnknownFields + state protoimpl.MessageState sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Tome *epb.Tome `protobuf:"bytes,2,opt,name=tome,proto3" json:"tome,omitempty"` + QuestName string `protobuf:"bytes,3,opt,name=quest_name,json=questName,proto3" json:"quest_name,omitempty"` } func (x *Task) Reset() { *x = Task{} - mi := &file_c2_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_c2_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *Task) String() string { @@ -342,7 +354,7 @@ func (*Task) ProtoMessage() {} func (x *Task) ProtoReflect() protoreflect.Message { mi := &file_c2_proto_msgTypes[3] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -380,17 +392,20 @@ func (x *Task) GetQuestName() string { // TaskError provides information when task execution fails. type TaskError struct { - state protoimpl.MessageState `protogen:"open.v1"` - Msg string `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,omitempty"` - unknownFields protoimpl.UnknownFields + state protoimpl.MessageState sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Msg string `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,omitempty"` } func (x *TaskError) Reset() { *x = TaskError{} - mi := &file_c2_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_c2_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *TaskError) String() string { @@ -401,7 +416,7 @@ func (*TaskError) ProtoMessage() {} func (x *TaskError) ProtoReflect() protoreflect.Message { mi := &file_c2_proto_msgTypes[4] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -425,23 +440,26 @@ func (x *TaskError) GetMsg() string { // TaskOutput provides information about a running task. type TaskOutput struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - Output string `protobuf:"bytes,2,opt,name=output,proto3" json:"output,omitempty"` - Error *TaskError `protobuf:"bytes,3,opt,name=error,proto3" json:"error,omitempty"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Output string `protobuf:"bytes,2,opt,name=output,proto3" json:"output,omitempty"` + Error *TaskError `protobuf:"bytes,3,opt,name=error,proto3" json:"error,omitempty"` // Indicates the UTC timestamp task execution began, set only in the first message for reporting. ExecStartedAt *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=exec_started_at,json=execStartedAt,proto3" json:"exec_started_at,omitempty"` // Indicates the UTC timestamp task execution completed, set only in last message for reporting. ExecFinishedAt *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=exec_finished_at,json=execFinishedAt,proto3" json:"exec_finished_at,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache } func (x *TaskOutput) Reset() { *x = TaskOutput{} - mi := &file_c2_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_c2_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *TaskOutput) String() string { @@ -452,7 +470,7 @@ func (*TaskOutput) ProtoMessage() {} func (x *TaskOutput) ProtoReflect() protoreflect.Message { mi := &file_c2_proto_msgTypes[5] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -504,17 +522,20 @@ func (x *TaskOutput) GetExecFinishedAt() *timestamppb.Timestamp { // RPC Messages type ClaimTasksRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - Beacon *Beacon `protobuf:"bytes,1,opt,name=beacon,proto3" json:"beacon,omitempty"` - unknownFields protoimpl.UnknownFields + state protoimpl.MessageState sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Beacon *Beacon `protobuf:"bytes,1,opt,name=beacon,proto3" json:"beacon,omitempty"` } func (x *ClaimTasksRequest) Reset() { *x = ClaimTasksRequest{} - mi := &file_c2_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_c2_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *ClaimTasksRequest) String() string { @@ -525,7 +546,7 @@ func (*ClaimTasksRequest) ProtoMessage() {} func (x *ClaimTasksRequest) ProtoReflect() protoreflect.Message { mi := &file_c2_proto_msgTypes[6] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -548,17 +569,20 @@ func (x *ClaimTasksRequest) GetBeacon() *Beacon { } type ClaimTasksResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - Tasks []*Task `protobuf:"bytes,1,rep,name=tasks,proto3" json:"tasks,omitempty"` - unknownFields protoimpl.UnknownFields + state protoimpl.MessageState sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Tasks []*Task `protobuf:"bytes,1,rep,name=tasks,proto3" json:"tasks,omitempty"` } func (x *ClaimTasksResponse) Reset() { *x = ClaimTasksResponse{} - mi := &file_c2_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_c2_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *ClaimTasksResponse) String() string { @@ -569,7 +593,7 @@ func (*ClaimTasksResponse) ProtoMessage() {} func (x *ClaimTasksResponse) ProtoReflect() protoreflect.Message { mi := &file_c2_proto_msgTypes[7] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -592,17 +616,20 @@ func (x *ClaimTasksResponse) GetTasks() []*Task { } type FetchAssetRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - unknownFields protoimpl.UnknownFields + state protoimpl.MessageState sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` } func (x *FetchAssetRequest) Reset() { *x = FetchAssetRequest{} - mi := &file_c2_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_c2_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *FetchAssetRequest) String() string { @@ -613,7 +640,7 @@ func (*FetchAssetRequest) ProtoMessage() {} func (x *FetchAssetRequest) ProtoReflect() protoreflect.Message { mi := &file_c2_proto_msgTypes[8] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -636,17 +663,20 @@ func (x *FetchAssetRequest) GetName() string { } type FetchAssetResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - Chunk []byte `protobuf:"bytes,1,opt,name=chunk,proto3" json:"chunk,omitempty"` - unknownFields protoimpl.UnknownFields + state protoimpl.MessageState sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Chunk []byte `protobuf:"bytes,1,opt,name=chunk,proto3" json:"chunk,omitempty"` } func (x *FetchAssetResponse) Reset() { *x = FetchAssetResponse{} - mi := &file_c2_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_c2_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *FetchAssetResponse) String() string { @@ -657,7 +687,7 @@ func (*FetchAssetResponse) ProtoMessage() {} func (x *FetchAssetResponse) ProtoReflect() protoreflect.Message { mi := &file_c2_proto_msgTypes[9] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -680,18 +710,21 @@ func (x *FetchAssetResponse) GetChunk() []byte { } type ReportCredentialRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - TaskId int64 `protobuf:"varint,1,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` - Credential *epb.Credential `protobuf:"bytes,2,opt,name=credential,proto3" json:"credential,omitempty"` - unknownFields protoimpl.UnknownFields + state protoimpl.MessageState sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TaskId int64 `protobuf:"varint,1,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` + Credential *epb.Credential `protobuf:"bytes,2,opt,name=credential,proto3" json:"credential,omitempty"` } func (x *ReportCredentialRequest) Reset() { *x = ReportCredentialRequest{} - mi := &file_c2_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_c2_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *ReportCredentialRequest) String() string { @@ -702,7 +735,7 @@ func (*ReportCredentialRequest) ProtoMessage() {} func (x *ReportCredentialRequest) ProtoReflect() protoreflect.Message { mi := &file_c2_proto_msgTypes[10] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -732,16 +765,18 @@ func (x *ReportCredentialRequest) GetCredential() *epb.Credential { } type ReportCredentialResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - unknownFields protoimpl.UnknownFields + state protoimpl.MessageState sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields } func (x *ReportCredentialResponse) Reset() { *x = ReportCredentialResponse{} - mi := &file_c2_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_c2_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *ReportCredentialResponse) String() string { @@ -752,7 +787,7 @@ func (*ReportCredentialResponse) ProtoMessage() {} func (x *ReportCredentialResponse) ProtoReflect() protoreflect.Message { mi := &file_c2_proto_msgTypes[11] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -768,18 +803,21 @@ func (*ReportCredentialResponse) Descriptor() ([]byte, []int) { } type ReportFileRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - TaskId int64 `protobuf:"varint,1,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` - Chunk *epb.File `protobuf:"bytes,2,opt,name=chunk,proto3" json:"chunk,omitempty"` - unknownFields protoimpl.UnknownFields + state protoimpl.MessageState sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TaskId int64 `protobuf:"varint,1,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` + Chunk *epb.File `protobuf:"bytes,2,opt,name=chunk,proto3" json:"chunk,omitempty"` } func (x *ReportFileRequest) Reset() { *x = ReportFileRequest{} - mi := &file_c2_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_c2_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *ReportFileRequest) String() string { @@ -790,7 +828,7 @@ func (*ReportFileRequest) ProtoMessage() {} func (x *ReportFileRequest) ProtoReflect() protoreflect.Message { mi := &file_c2_proto_msgTypes[12] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -820,16 +858,18 @@ func (x *ReportFileRequest) GetChunk() *epb.File { } type ReportFileResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - unknownFields protoimpl.UnknownFields + state protoimpl.MessageState sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields } func (x *ReportFileResponse) Reset() { *x = ReportFileResponse{} - mi := &file_c2_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_c2_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *ReportFileResponse) String() string { @@ -840,7 +880,7 @@ func (*ReportFileResponse) ProtoMessage() {} func (x *ReportFileResponse) ProtoReflect() protoreflect.Message { mi := &file_c2_proto_msgTypes[13] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -856,18 +896,21 @@ func (*ReportFileResponse) Descriptor() ([]byte, []int) { } type ReportProcessListRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - TaskId int64 `protobuf:"varint,1,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` - List *epb.ProcessList `protobuf:"bytes,2,opt,name=list,proto3" json:"list,omitempty"` - unknownFields protoimpl.UnknownFields + state protoimpl.MessageState sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TaskId int64 `protobuf:"varint,1,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` + List *epb.ProcessList `protobuf:"bytes,2,opt,name=list,proto3" json:"list,omitempty"` } func (x *ReportProcessListRequest) Reset() { *x = ReportProcessListRequest{} - mi := &file_c2_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_c2_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *ReportProcessListRequest) String() string { @@ -878,7 +921,7 @@ func (*ReportProcessListRequest) ProtoMessage() {} func (x *ReportProcessListRequest) ProtoReflect() protoreflect.Message { mi := &file_c2_proto_msgTypes[14] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -908,16 +951,18 @@ func (x *ReportProcessListRequest) GetList() *epb.ProcessList { } type ReportProcessListResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - unknownFields protoimpl.UnknownFields + state protoimpl.MessageState sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields } func (x *ReportProcessListResponse) Reset() { *x = ReportProcessListResponse{} - mi := &file_c2_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_c2_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *ReportProcessListResponse) String() string { @@ -928,7 +973,7 @@ func (*ReportProcessListResponse) ProtoMessage() {} func (x *ReportProcessListResponse) ProtoReflect() protoreflect.Message { mi := &file_c2_proto_msgTypes[15] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -944,17 +989,20 @@ func (*ReportProcessListResponse) Descriptor() ([]byte, []int) { } type ReportTaskOutputRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - Output *TaskOutput `protobuf:"bytes,1,opt,name=output,proto3" json:"output,omitempty"` - unknownFields protoimpl.UnknownFields + state protoimpl.MessageState sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Output *TaskOutput `protobuf:"bytes,1,opt,name=output,proto3" json:"output,omitempty"` } func (x *ReportTaskOutputRequest) Reset() { *x = ReportTaskOutputRequest{} - mi := &file_c2_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_c2_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *ReportTaskOutputRequest) String() string { @@ -965,7 +1013,7 @@ func (*ReportTaskOutputRequest) ProtoMessage() {} func (x *ReportTaskOutputRequest) ProtoReflect() protoreflect.Message { mi := &file_c2_proto_msgTypes[16] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -988,16 +1036,18 @@ func (x *ReportTaskOutputRequest) GetOutput() *TaskOutput { } type ReportTaskOutputResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - unknownFields protoimpl.UnknownFields + state protoimpl.MessageState sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields } func (x *ReportTaskOutputResponse) Reset() { *x = ReportTaskOutputResponse{} - mi := &file_c2_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_c2_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *ReportTaskOutputResponse) String() string { @@ -1008,7 +1058,7 @@ func (*ReportTaskOutputResponse) ProtoMessage() {} func (x *ReportTaskOutputResponse) ProtoReflect() protoreflect.Message { mi := &file_c2_proto_msgTypes[17] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1024,19 +1074,22 @@ func (*ReportTaskOutputResponse) Descriptor() ([]byte, []int) { } type ReverseShellRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - Kind ReverseShellMessageKind `protobuf:"varint,1,opt,name=kind,proto3,enum=c2.ReverseShellMessageKind" json:"kind,omitempty"` - Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` - TaskId int64 `protobuf:"varint,3,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` - unknownFields protoimpl.UnknownFields + state protoimpl.MessageState sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Kind ReverseShellMessageKind `protobuf:"varint,1,opt,name=kind,proto3,enum=c2.ReverseShellMessageKind" json:"kind,omitempty"` + Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` + TaskId int64 `protobuf:"varint,3,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` } func (x *ReverseShellRequest) Reset() { *x = ReverseShellRequest{} - mi := &file_c2_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_c2_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *ReverseShellRequest) String() string { @@ -1047,7 +1100,7 @@ func (*ReverseShellRequest) ProtoMessage() {} func (x *ReverseShellRequest) ProtoReflect() protoreflect.Message { mi := &file_c2_proto_msgTypes[18] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1084,18 +1137,21 @@ func (x *ReverseShellRequest) GetTaskId() int64 { } type ReverseShellResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - Kind ReverseShellMessageKind `protobuf:"varint,1,opt,name=kind,proto3,enum=c2.ReverseShellMessageKind" json:"kind,omitempty"` - Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` - unknownFields protoimpl.UnknownFields + state protoimpl.MessageState sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Kind ReverseShellMessageKind `protobuf:"varint,1,opt,name=kind,proto3,enum=c2.ReverseShellMessageKind" json:"kind,omitempty"` + Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` } func (x *ReverseShellResponse) Reset() { *x = ReverseShellResponse{} - mi := &file_c2_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_c2_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *ReverseShellResponse) String() string { @@ -1106,7 +1162,7 @@ func (*ReverseShellResponse) ProtoMessage() {} func (x *ReverseShellResponse) ProtoReflect() protoreflect.Message { mi := &file_c2_proto_msgTypes[19] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1307,7 +1363,7 @@ func file_c2_proto_rawDescGZIP() []byte { var file_c2_proto_enumTypes = make([]protoimpl.EnumInfo, 2) var file_c2_proto_msgTypes = make([]protoimpl.MessageInfo, 20) -var file_c2_proto_goTypes = []any{ +var file_c2_proto_goTypes = []interface{}{ (ReverseShellMessageKind)(0), // 0: c2.ReverseShellMessageKind (Host_Platform)(0), // 1: c2.Host.Platform (*Agent)(nil), // 2: c2.Agent @@ -1378,6 +1434,248 @@ func file_c2_proto_init() { if File_c2_proto != nil { return } + if !protoimpl.UnsafeEnabled { + file_c2_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Agent); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_c2_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Beacon); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_c2_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Host); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_c2_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Task); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_c2_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TaskError); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_c2_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TaskOutput); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_c2_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ClaimTasksRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_c2_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ClaimTasksResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_c2_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FetchAssetRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_c2_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FetchAssetResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_c2_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReportCredentialRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_c2_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReportCredentialResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_c2_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReportFileRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_c2_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReportFileResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_c2_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReportProcessListRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_c2_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReportProcessListResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_c2_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReportTaskOutputRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_c2_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReportTaskOutputResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_c2_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReverseShellRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_c2_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReverseShellResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/tavern/internal/c2/c2pb/c2_grpc.pb.go b/tavern/internal/c2/c2pb/c2_grpc.pb.go index 6c27e9257..1f0ffb0cc 100644 --- a/tavern/internal/c2/c2pb/c2_grpc.pb.go +++ b/tavern/internal/c2/c2pb/c2_grpc.pb.go @@ -1,8 +1,4 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.5.1 -// - protoc v5.29.2 -// source: c2.proto package c2pb @@ -15,18 +11,7 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.64.0 or later. -const _ = grpc.SupportPackageIsVersion9 - -const ( - C2_ClaimTasks_FullMethodName = "/c2.C2/ClaimTasks" - C2_FetchAsset_FullMethodName = "/c2.C2/FetchAsset" - C2_ReportCredential_FullMethodName = "/c2.C2/ReportCredential" - C2_ReportFile_FullMethodName = "/c2.C2/ReportFile" - C2_ReportProcessList_FullMethodName = "/c2.C2/ReportProcessList" - C2_ReportTaskOutput_FullMethodName = "/c2.C2/ReportTaskOutput" - C2_ReverseShell_FullMethodName = "/c2.C2/ReverseShell" -) +const _ = grpc.SupportPackageIsVersion7 // C2Client is the client API for C2 service. // @@ -41,7 +26,7 @@ type C2Client interface { // - "file-size": The number of bytes contained by the file. // // If no associated file can be found, a NotFound status error is returned. - FetchAsset(ctx context.Context, in *FetchAssetRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[FetchAssetResponse], error) + FetchAsset(ctx context.Context, in *FetchAssetRequest, opts ...grpc.CallOption) (C2_FetchAssetClient, error) // Report a credential from the host to the server. ReportCredential(ctx context.Context, in *ReportCredentialRequest, opts ...grpc.CallOption) (*ReportCredentialResponse, error) // Report a file from the host to the server. @@ -51,14 +36,14 @@ type C2Client interface { // // Content is provided as chunks, the size of which are up to the agent to define (based on memory constraints). // Any existing files at the provided path for the host are replaced. - ReportFile(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[ReportFileRequest, ReportFileResponse], error) + ReportFile(ctx context.Context, opts ...grpc.CallOption) (C2_ReportFileClient, error) // Report the active list of running processes. This list will replace any previously reported // lists for the same host. ReportProcessList(ctx context.Context, in *ReportProcessListRequest, opts ...grpc.CallOption) (*ReportProcessListResponse, error) // Report execution output for a task. ReportTaskOutput(ctx context.Context, in *ReportTaskOutputRequest, opts ...grpc.CallOption) (*ReportTaskOutputResponse, error) // Open a reverse shell bi-directional stream. - ReverseShell(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ReverseShellRequest, ReverseShellResponse], error) + ReverseShell(ctx context.Context, opts ...grpc.CallOption) (C2_ReverseShellClient, error) } type c2Client struct { @@ -70,22 +55,20 @@ func NewC2Client(cc grpc.ClientConnInterface) C2Client { } func (c *c2Client) ClaimTasks(ctx context.Context, in *ClaimTasksRequest, opts ...grpc.CallOption) (*ClaimTasksResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ClaimTasksResponse) - err := c.cc.Invoke(ctx, C2_ClaimTasks_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, "/c2.C2/ClaimTasks", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *c2Client) FetchAsset(ctx context.Context, in *FetchAssetRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[FetchAssetResponse], error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - stream, err := c.cc.NewStream(ctx, &C2_ServiceDesc.Streams[0], C2_FetchAsset_FullMethodName, cOpts...) +func (c *c2Client) FetchAsset(ctx context.Context, in *FetchAssetRequest, opts ...grpc.CallOption) (C2_FetchAssetClient, error) { + stream, err := c.cc.NewStream(ctx, &_C2_serviceDesc.Streams[0], "/c2.C2/FetchAsset", opts...) if err != nil { return nil, err } - x := &grpc.GenericClientStream[FetchAssetRequest, FetchAssetResponse]{ClientStream: stream} + x := &c2FetchAssetClient{stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -95,36 +78,69 @@ func (c *c2Client) FetchAsset(ctx context.Context, in *FetchAssetRequest, opts . return x, nil } -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type C2_FetchAssetClient = grpc.ServerStreamingClient[FetchAssetResponse] +type C2_FetchAssetClient interface { + Recv() (*FetchAssetResponse, error) + grpc.ClientStream +} + +type c2FetchAssetClient struct { + grpc.ClientStream +} + +func (x *c2FetchAssetClient) Recv() (*FetchAssetResponse, error) { + m := new(FetchAssetResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} func (c *c2Client) ReportCredential(ctx context.Context, in *ReportCredentialRequest, opts ...grpc.CallOption) (*ReportCredentialResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ReportCredentialResponse) - err := c.cc.Invoke(ctx, C2_ReportCredential_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, "/c2.C2/ReportCredential", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *c2Client) ReportFile(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[ReportFileRequest, ReportFileResponse], error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - stream, err := c.cc.NewStream(ctx, &C2_ServiceDesc.Streams[1], C2_ReportFile_FullMethodName, cOpts...) +func (c *c2Client) ReportFile(ctx context.Context, opts ...grpc.CallOption) (C2_ReportFileClient, error) { + stream, err := c.cc.NewStream(ctx, &_C2_serviceDesc.Streams[1], "/c2.C2/ReportFile", opts...) if err != nil { return nil, err } - x := &grpc.GenericClientStream[ReportFileRequest, ReportFileResponse]{ClientStream: stream} + x := &c2ReportFileClient{stream} return x, nil } -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type C2_ReportFileClient = grpc.ClientStreamingClient[ReportFileRequest, ReportFileResponse] +type C2_ReportFileClient interface { + Send(*ReportFileRequest) error + CloseAndRecv() (*ReportFileResponse, error) + grpc.ClientStream +} + +type c2ReportFileClient struct { + grpc.ClientStream +} + +func (x *c2ReportFileClient) Send(m *ReportFileRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *c2ReportFileClient) CloseAndRecv() (*ReportFileResponse, error) { + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + m := new(ReportFileResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} func (c *c2Client) ReportProcessList(ctx context.Context, in *ReportProcessListRequest, opts ...grpc.CallOption) (*ReportProcessListResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ReportProcessListResponse) - err := c.cc.Invoke(ctx, C2_ReportProcessList_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, "/c2.C2/ReportProcessList", in, out, opts...) if err != nil { return nil, err } @@ -132,31 +148,48 @@ func (c *c2Client) ReportProcessList(ctx context.Context, in *ReportProcessListR } func (c *c2Client) ReportTaskOutput(ctx context.Context, in *ReportTaskOutputRequest, opts ...grpc.CallOption) (*ReportTaskOutputResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ReportTaskOutputResponse) - err := c.cc.Invoke(ctx, C2_ReportTaskOutput_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, "/c2.C2/ReportTaskOutput", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *c2Client) ReverseShell(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ReverseShellRequest, ReverseShellResponse], error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - stream, err := c.cc.NewStream(ctx, &C2_ServiceDesc.Streams[2], C2_ReverseShell_FullMethodName, cOpts...) +func (c *c2Client) ReverseShell(ctx context.Context, opts ...grpc.CallOption) (C2_ReverseShellClient, error) { + stream, err := c.cc.NewStream(ctx, &_C2_serviceDesc.Streams[2], "/c2.C2/ReverseShell", opts...) if err != nil { return nil, err } - x := &grpc.GenericClientStream[ReverseShellRequest, ReverseShellResponse]{ClientStream: stream} + x := &c2ReverseShellClient{stream} return x, nil } -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type C2_ReverseShellClient = grpc.BidiStreamingClient[ReverseShellRequest, ReverseShellResponse] +type C2_ReverseShellClient interface { + Send(*ReverseShellRequest) error + Recv() (*ReverseShellResponse, error) + grpc.ClientStream +} + +type c2ReverseShellClient struct { + grpc.ClientStream +} + +func (x *c2ReverseShellClient) Send(m *ReverseShellRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *c2ReverseShellClient) Recv() (*ReverseShellResponse, error) { + m := new(ReverseShellResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} // C2Server is the server API for C2 service. // All implementations must embed UnimplementedC2Server -// for forward compatibility. +// for forward compatibility type C2Server interface { // Contact the server for new tasks to execute. ClaimTasks(context.Context, *ClaimTasksRequest) (*ClaimTasksResponse, error) @@ -167,7 +200,7 @@ type C2Server interface { // - "file-size": The number of bytes contained by the file. // // If no associated file can be found, a NotFound status error is returned. - FetchAsset(*FetchAssetRequest, grpc.ServerStreamingServer[FetchAssetResponse]) error + FetchAsset(*FetchAssetRequest, C2_FetchAssetServer) error // Report a credential from the host to the server. ReportCredential(context.Context, *ReportCredentialRequest) (*ReportCredentialResponse, error) // Report a file from the host to the server. @@ -177,34 +210,31 @@ type C2Server interface { // // Content is provided as chunks, the size of which are up to the agent to define (based on memory constraints). // Any existing files at the provided path for the host are replaced. - ReportFile(grpc.ClientStreamingServer[ReportFileRequest, ReportFileResponse]) error + ReportFile(C2_ReportFileServer) error // Report the active list of running processes. This list will replace any previously reported // lists for the same host. ReportProcessList(context.Context, *ReportProcessListRequest) (*ReportProcessListResponse, error) // Report execution output for a task. ReportTaskOutput(context.Context, *ReportTaskOutputRequest) (*ReportTaskOutputResponse, error) // Open a reverse shell bi-directional stream. - ReverseShell(grpc.BidiStreamingServer[ReverseShellRequest, ReverseShellResponse]) error + ReverseShell(C2_ReverseShellServer) error mustEmbedUnimplementedC2Server() } -// UnimplementedC2Server must be embedded to have -// forward compatible implementations. -// -// NOTE: this should be embedded by value instead of pointer to avoid a nil -// pointer dereference when methods are called. -type UnimplementedC2Server struct{} +// UnimplementedC2Server must be embedded to have forward compatible implementations. +type UnimplementedC2Server struct { +} func (UnimplementedC2Server) ClaimTasks(context.Context, *ClaimTasksRequest) (*ClaimTasksResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ClaimTasks not implemented") } -func (UnimplementedC2Server) FetchAsset(*FetchAssetRequest, grpc.ServerStreamingServer[FetchAssetResponse]) error { +func (UnimplementedC2Server) FetchAsset(*FetchAssetRequest, C2_FetchAssetServer) error { return status.Errorf(codes.Unimplemented, "method FetchAsset not implemented") } func (UnimplementedC2Server) ReportCredential(context.Context, *ReportCredentialRequest) (*ReportCredentialResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ReportCredential not implemented") } -func (UnimplementedC2Server) ReportFile(grpc.ClientStreamingServer[ReportFileRequest, ReportFileResponse]) error { +func (UnimplementedC2Server) ReportFile(C2_ReportFileServer) error { return status.Errorf(codes.Unimplemented, "method ReportFile not implemented") } func (UnimplementedC2Server) ReportProcessList(context.Context, *ReportProcessListRequest) (*ReportProcessListResponse, error) { @@ -213,11 +243,10 @@ func (UnimplementedC2Server) ReportProcessList(context.Context, *ReportProcessLi func (UnimplementedC2Server) ReportTaskOutput(context.Context, *ReportTaskOutputRequest) (*ReportTaskOutputResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ReportTaskOutput not implemented") } -func (UnimplementedC2Server) ReverseShell(grpc.BidiStreamingServer[ReverseShellRequest, ReverseShellResponse]) error { +func (UnimplementedC2Server) ReverseShell(C2_ReverseShellServer) error { return status.Errorf(codes.Unimplemented, "method ReverseShell not implemented") } func (UnimplementedC2Server) mustEmbedUnimplementedC2Server() {} -func (UnimplementedC2Server) testEmbeddedByValue() {} // UnsafeC2Server may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to C2Server will @@ -226,15 +255,8 @@ type UnsafeC2Server interface { mustEmbedUnimplementedC2Server() } -func RegisterC2Server(s grpc.ServiceRegistrar, srv C2Server) { - // If the following call pancis, it indicates UnimplementedC2Server was - // embedded by pointer and is nil. This will cause panics if an - // unimplemented method is ever invoked, so we test this at initialization - // time to prevent it from happening at runtime later due to I/O. - if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { - t.testEmbeddedByValue() - } - s.RegisterService(&C2_ServiceDesc, srv) +func RegisterC2Server(s *grpc.Server, srv C2Server) { + s.RegisterService(&_C2_serviceDesc, srv) } func _C2_ClaimTasks_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { @@ -247,7 +269,7 @@ func _C2_ClaimTasks_Handler(srv interface{}, ctx context.Context, dec func(inter } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: C2_ClaimTasks_FullMethodName, + FullMethod: "/c2.C2/ClaimTasks", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(C2Server).ClaimTasks(ctx, req.(*ClaimTasksRequest)) @@ -260,11 +282,21 @@ func _C2_FetchAsset_Handler(srv interface{}, stream grpc.ServerStream) error { if err := stream.RecvMsg(m); err != nil { return err } - return srv.(C2Server).FetchAsset(m, &grpc.GenericServerStream[FetchAssetRequest, FetchAssetResponse]{ServerStream: stream}) + return srv.(C2Server).FetchAsset(m, &c2FetchAssetServer{stream}) +} + +type C2_FetchAssetServer interface { + Send(*FetchAssetResponse) error + grpc.ServerStream +} + +type c2FetchAssetServer struct { + grpc.ServerStream } -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type C2_FetchAssetServer = grpc.ServerStreamingServer[FetchAssetResponse] +func (x *c2FetchAssetServer) Send(m *FetchAssetResponse) error { + return x.ServerStream.SendMsg(m) +} func _C2_ReportCredential_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ReportCredentialRequest) @@ -276,7 +308,7 @@ func _C2_ReportCredential_Handler(srv interface{}, ctx context.Context, dec func } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: C2_ReportCredential_FullMethodName, + FullMethod: "/c2.C2/ReportCredential", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(C2Server).ReportCredential(ctx, req.(*ReportCredentialRequest)) @@ -285,11 +317,30 @@ func _C2_ReportCredential_Handler(srv interface{}, ctx context.Context, dec func } func _C2_ReportFile_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(C2Server).ReportFile(&grpc.GenericServerStream[ReportFileRequest, ReportFileResponse]{ServerStream: stream}) + return srv.(C2Server).ReportFile(&c2ReportFileServer{stream}) +} + +type C2_ReportFileServer interface { + SendAndClose(*ReportFileResponse) error + Recv() (*ReportFileRequest, error) + grpc.ServerStream } -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type C2_ReportFileServer = grpc.ClientStreamingServer[ReportFileRequest, ReportFileResponse] +type c2ReportFileServer struct { + grpc.ServerStream +} + +func (x *c2ReportFileServer) SendAndClose(m *ReportFileResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *c2ReportFileServer) Recv() (*ReportFileRequest, error) { + m := new(ReportFileRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} func _C2_ReportProcessList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ReportProcessListRequest) @@ -301,7 +352,7 @@ func _C2_ReportProcessList_Handler(srv interface{}, ctx context.Context, dec fun } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: C2_ReportProcessList_FullMethodName, + FullMethod: "/c2.C2/ReportProcessList", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(C2Server).ReportProcessList(ctx, req.(*ReportProcessListRequest)) @@ -319,7 +370,7 @@ func _C2_ReportTaskOutput_Handler(srv interface{}, ctx context.Context, dec func } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: C2_ReportTaskOutput_FullMethodName, + FullMethod: "/c2.C2/ReportTaskOutput", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(C2Server).ReportTaskOutput(ctx, req.(*ReportTaskOutputRequest)) @@ -328,16 +379,32 @@ func _C2_ReportTaskOutput_Handler(srv interface{}, ctx context.Context, dec func } func _C2_ReverseShell_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(C2Server).ReverseShell(&grpc.GenericServerStream[ReverseShellRequest, ReverseShellResponse]{ServerStream: stream}) + return srv.(C2Server).ReverseShell(&c2ReverseShellServer{stream}) } -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type C2_ReverseShellServer = grpc.BidiStreamingServer[ReverseShellRequest, ReverseShellResponse] +type C2_ReverseShellServer interface { + Send(*ReverseShellResponse) error + Recv() (*ReverseShellRequest, error) + grpc.ServerStream +} + +type c2ReverseShellServer struct { + grpc.ServerStream +} + +func (x *c2ReverseShellServer) Send(m *ReverseShellResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *c2ReverseShellServer) Recv() (*ReverseShellRequest, error) { + m := new(ReverseShellRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} -// C2_ServiceDesc is the grpc.ServiceDesc for C2 service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var C2_ServiceDesc = grpc.ServiceDesc{ +var _C2_serviceDesc = grpc.ServiceDesc{ ServiceName: "c2.C2", HandlerType: (*C2Server)(nil), Methods: []grpc.MethodDesc{ diff --git a/tavern/internal/c2/epb/eldritch.pb.go b/tavern/internal/c2/epb/eldritch.pb.go index 629c43de6..d6fae90b5 100644 --- a/tavern/internal/c2/epb/eldritch.pb.go +++ b/tavern/internal/c2/epb/eldritch.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.1 -// protoc v5.29.2 +// protoc-gen-go v1.28.1 +// protoc v3.21.12 // source: eldritch.proto package epb @@ -153,19 +153,22 @@ func (Process_Status) EnumDescriptor() ([]byte, []int) { // Tome for eldritch to execute. type Tome struct { - state protoimpl.MessageState `protogen:"open.v1"` - Eldritch string `protobuf:"bytes,1,opt,name=eldritch,proto3" json:"eldritch,omitempty"` - Parameters map[string]string `protobuf:"bytes,2,rep,name=parameters,proto3" json:"parameters,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - FileNames []string `protobuf:"bytes,3,rep,name=file_names,json=fileNames,proto3" json:"file_names,omitempty"` - unknownFields protoimpl.UnknownFields + state protoimpl.MessageState sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Eldritch string `protobuf:"bytes,1,opt,name=eldritch,proto3" json:"eldritch,omitempty"` + Parameters map[string]string `protobuf:"bytes,2,rep,name=parameters,proto3" json:"parameters,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + FileNames []string `protobuf:"bytes,3,rep,name=file_names,json=fileNames,proto3" json:"file_names,omitempty"` } func (x *Tome) Reset() { *x = Tome{} - mi := &file_eldritch_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_eldritch_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *Tome) String() string { @@ -176,7 +179,7 @@ func (*Tome) ProtoMessage() {} func (x *Tome) ProtoReflect() protoreflect.Message { mi := &file_eldritch_proto_msgTypes[0] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -214,19 +217,22 @@ func (x *Tome) GetFileNames() []string { // Credential reported on the host system. type Credential struct { - state protoimpl.MessageState `protogen:"open.v1"` - Principal string `protobuf:"bytes,1,opt,name=principal,proto3" json:"principal,omitempty"` - Secret string `protobuf:"bytes,2,opt,name=secret,proto3" json:"secret,omitempty"` - Kind Credential_Kind `protobuf:"varint,3,opt,name=kind,proto3,enum=eldritch.Credential_Kind" json:"kind,omitempty"` - unknownFields protoimpl.UnknownFields + state protoimpl.MessageState sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Principal string `protobuf:"bytes,1,opt,name=principal,proto3" json:"principal,omitempty"` + Secret string `protobuf:"bytes,2,opt,name=secret,proto3" json:"secret,omitempty"` + Kind Credential_Kind `protobuf:"varint,3,opt,name=kind,proto3,enum=eldritch.Credential_Kind" json:"kind,omitempty"` } func (x *Credential) Reset() { *x = Credential{} - mi := &file_eldritch_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_eldritch_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *Credential) String() string { @@ -237,7 +243,7 @@ func (*Credential) ProtoMessage() {} func (x *Credential) ProtoReflect() protoreflect.Message { mi := &file_eldritch_proto_msgTypes[1] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -275,25 +281,28 @@ func (x *Credential) GetKind() Credential_Kind { // Process running on the host system. type Process struct { - state protoimpl.MessageState `protogen:"open.v1"` - Pid uint64 `protobuf:"varint,1,opt,name=pid,proto3" json:"pid,omitempty"` - Ppid uint64 `protobuf:"varint,2,opt,name=ppid,proto3" json:"ppid,omitempty"` - Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` - Principal string `protobuf:"bytes,4,opt,name=principal,proto3" json:"principal,omitempty"` - Path string `protobuf:"bytes,5,opt,name=path,proto3" json:"path,omitempty"` - Cmd string `protobuf:"bytes,6,opt,name=cmd,proto3" json:"cmd,omitempty"` - Env string `protobuf:"bytes,7,opt,name=env,proto3" json:"env,omitempty"` - Cwd string `protobuf:"bytes,8,opt,name=cwd,proto3" json:"cwd,omitempty"` - Status Process_Status `protobuf:"varint,9,opt,name=status,proto3,enum=eldritch.Process_Status" json:"status,omitempty"` - unknownFields protoimpl.UnknownFields + state protoimpl.MessageState sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Pid uint64 `protobuf:"varint,1,opt,name=pid,proto3" json:"pid,omitempty"` + Ppid uint64 `protobuf:"varint,2,opt,name=ppid,proto3" json:"ppid,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + Principal string `protobuf:"bytes,4,opt,name=principal,proto3" json:"principal,omitempty"` + Path string `protobuf:"bytes,5,opt,name=path,proto3" json:"path,omitempty"` + Cmd string `protobuf:"bytes,6,opt,name=cmd,proto3" json:"cmd,omitempty"` + Env string `protobuf:"bytes,7,opt,name=env,proto3" json:"env,omitempty"` + Cwd string `protobuf:"bytes,8,opt,name=cwd,proto3" json:"cwd,omitempty"` + Status Process_Status `protobuf:"varint,9,opt,name=status,proto3,enum=eldritch.Process_Status" json:"status,omitempty"` } func (x *Process) Reset() { *x = Process{} - mi := &file_eldritch_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_eldritch_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *Process) String() string { @@ -304,7 +313,7 @@ func (*Process) ProtoMessage() {} func (x *Process) ProtoReflect() protoreflect.Message { mi := &file_eldritch_proto_msgTypes[2] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -384,17 +393,20 @@ func (x *Process) GetStatus() Process_Status { // ProcessList of running processes on the host system. type ProcessList struct { - state protoimpl.MessageState `protogen:"open.v1"` - List []*Process `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` - unknownFields protoimpl.UnknownFields + state protoimpl.MessageState sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + List []*Process `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` } func (x *ProcessList) Reset() { *x = ProcessList{} - mi := &file_eldritch_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_eldritch_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *ProcessList) String() string { @@ -405,7 +417,7 @@ func (*ProcessList) ProtoMessage() {} func (x *ProcessList) ProtoReflect() protoreflect.Message { mi := &file_eldritch_proto_msgTypes[3] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -429,22 +441,25 @@ func (x *ProcessList) GetList() []*Process { // FileMetadata about a file on the host system. type FileMetadata struct { - state protoimpl.MessageState `protogen:"open.v1"` - Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` - Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` - Group string `protobuf:"bytes,3,opt,name=group,proto3" json:"group,omitempty"` - Permissions string `protobuf:"bytes,4,opt,name=permissions,proto3" json:"permissions,omitempty"` - Size uint64 `protobuf:"varint,5,opt,name=size,proto3" json:"size,omitempty"` - Sha3_256Hash string `protobuf:"bytes,6,opt,name=sha3_256_hash,json=sha3256Hash,proto3" json:"sha3_256_hash,omitempty"` - unknownFields protoimpl.UnknownFields + state protoimpl.MessageState sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` + Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` + Group string `protobuf:"bytes,3,opt,name=group,proto3" json:"group,omitempty"` + Permissions string `protobuf:"bytes,4,opt,name=permissions,proto3" json:"permissions,omitempty"` + Size uint64 `protobuf:"varint,5,opt,name=size,proto3" json:"size,omitempty"` + Sha3_256Hash string `protobuf:"bytes,6,opt,name=sha3_256_hash,json=sha3256Hash,proto3" json:"sha3_256_hash,omitempty"` } func (x *FileMetadata) Reset() { *x = FileMetadata{} - mi := &file_eldritch_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_eldritch_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *FileMetadata) String() string { @@ -455,7 +470,7 @@ func (*FileMetadata) ProtoMessage() {} func (x *FileMetadata) ProtoReflect() protoreflect.Message { mi := &file_eldritch_proto_msgTypes[4] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -514,18 +529,21 @@ func (x *FileMetadata) GetSha3_256Hash() string { // File on the host system. type File struct { - state protoimpl.MessageState `protogen:"open.v1"` - Metadata *FileMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` - Chunk []byte `protobuf:"bytes,2,opt,name=chunk,proto3" json:"chunk,omitempty"` - unknownFields protoimpl.UnknownFields + state protoimpl.MessageState sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Metadata *FileMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` + Chunk []byte `protobuf:"bytes,2,opt,name=chunk,proto3" json:"chunk,omitempty"` } func (x *File) Reset() { *x = File{} - mi := &file_eldritch_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_eldritch_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *File) String() string { @@ -536,7 +554,7 @@ func (*File) ProtoMessage() {} func (x *File) ProtoReflect() protoreflect.Message { mi := &file_eldritch_proto_msgTypes[5] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -665,7 +683,7 @@ func file_eldritch_proto_rawDescGZIP() []byte { var file_eldritch_proto_enumTypes = make([]protoimpl.EnumInfo, 2) var file_eldritch_proto_msgTypes = make([]protoimpl.MessageInfo, 7) -var file_eldritch_proto_goTypes = []any{ +var file_eldritch_proto_goTypes = []interface{}{ (Credential_Kind)(0), // 0: eldritch.Credential.Kind (Process_Status)(0), // 1: eldritch.Process.Status (*Tome)(nil), // 2: eldritch.Tome @@ -694,6 +712,80 @@ func file_eldritch_proto_init() { if File_eldritch_proto != nil { return } + if !protoimpl.UnsafeEnabled { + file_eldritch_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Tome); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_eldritch_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Credential); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_eldritch_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Process); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_eldritch_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ProcessList); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_eldritch_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FileMetadata); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_eldritch_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*File); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/tavern/internal/ent/migrate/schema.go b/tavern/internal/ent/migrate/schema.go index 293eb4031..bd9b49537 100644 --- a/tavern/internal/ent/migrate/schema.go +++ b/tavern/internal/ent/migrate/schema.go @@ -485,28 +485,65 @@ var ( func init() { BeaconsTable.ForeignKeys[0].RefTable = HostsTable + BeaconsTable.Annotation = &entsql.Annotation{ + Collation: "utf8mb4_general_ci", + } + FilesTable.Annotation = &entsql.Annotation{ + Collation: "utf8mb4_general_ci", + } + HostsTable.Annotation = &entsql.Annotation{ + Collation: "utf8mb4_general_ci", + } HostCredentialsTable.ForeignKeys[0].RefTable = HostsTable HostCredentialsTable.ForeignKeys[1].RefTable = TasksTable + HostCredentialsTable.Annotation = &entsql.Annotation{ + Collation: "utf8mb4_general_ci", + } HostFilesTable.ForeignKeys[0].RefTable = HostsTable HostFilesTable.ForeignKeys[1].RefTable = HostsTable HostFilesTable.ForeignKeys[2].RefTable = TasksTable + HostFilesTable.Annotation = &entsql.Annotation{ + Collation: "utf8mb4_general_ci", + } HostProcessesTable.ForeignKeys[0].RefTable = HostsTable HostProcessesTable.ForeignKeys[1].RefTable = HostsTable HostProcessesTable.ForeignKeys[2].RefTable = TasksTable + HostProcessesTable.Annotation = &entsql.Annotation{ + Collation: "utf8mb4_general_ci", + } QuestsTable.ForeignKeys[0].RefTable = TomesTable QuestsTable.ForeignKeys[1].RefTable = FilesTable QuestsTable.ForeignKeys[2].RefTable = UsersTable + QuestsTable.Annotation = &entsql.Annotation{ + Collation: "utf8mb4_general_ci", + } RepositoriesTable.ForeignKeys[0].RefTable = UsersTable RepositoriesTable.Annotation = &entsql.Annotation{ - Table: "repositories", + Table: "repositories", + Collation: "utf8mb4_general_ci", } ShellsTable.ForeignKeys[0].RefTable = TasksTable ShellsTable.ForeignKeys[1].RefTable = BeaconsTable ShellsTable.ForeignKeys[2].RefTable = UsersTable + ShellsTable.Annotation = &entsql.Annotation{ + Collation: "utf8mb4_general_ci", + } + TagsTable.Annotation = &entsql.Annotation{ + Collation: "utf8mb4_general_ci", + } TasksTable.ForeignKeys[0].RefTable = QuestsTable TasksTable.ForeignKeys[1].RefTable = BeaconsTable + TasksTable.Annotation = &entsql.Annotation{ + Collation: "utf8mb4_general_ci", + } TomesTable.ForeignKeys[0].RefTable = UsersTable TomesTable.ForeignKeys[1].RefTable = RepositoriesTable + TomesTable.Annotation = &entsql.Annotation{ + Collation: "utf8mb4_general_ci", + } + UsersTable.Annotation = &entsql.Annotation{ + Collation: "utf8mb4_general_ci", + } HostTagsTable.ForeignKeys[0].RefTable = HostsTable HostTagsTable.ForeignKeys[1].RefTable = TagsTable ShellActiveUsersTable.ForeignKeys[0].RefTable = ShellsTable diff --git a/tavern/internal/ent/schema/beacon.go b/tavern/internal/ent/schema/beacon.go index b348b61fb..3cfaa2c74 100644 --- a/tavern/internal/ent/schema/beacon.go +++ b/tavern/internal/ent/schema/beacon.go @@ -102,6 +102,9 @@ func (Beacon) Annotations() []schema.Annotation { entgql.Mutations( entgql.MutationUpdate(), ), + entsql.Annotation{ + Collation: "utf8mb4_general_ci", + }, } } diff --git a/tavern/internal/ent/schema/file.go b/tavern/internal/ent/schema/file.go index 9197e601b..f122eae7f 100644 --- a/tavern/internal/ent/schema/file.go +++ b/tavern/internal/ent/schema/file.go @@ -10,6 +10,7 @@ import ( "entgo.io/contrib/entgql" "entgo.io/ent" "entgo.io/ent/dialect" + "entgo.io/ent/dialect/entsql" "entgo.io/ent/schema" "entgo.io/ent/schema/edge" "entgo.io/ent/schema/field" @@ -61,7 +62,11 @@ func (File) Edges() []ent.Edge { // Annotations describes additional information for the ent. func (File) Annotations() []schema.Annotation { - return []schema.Annotation{} + return []schema.Annotation{ + entsql.Annotation{ + Collation: "utf8mb4_general_ci", + }, + } } // Mixin defines common shared properties for the ent. diff --git a/tavern/internal/ent/schema/host.go b/tavern/internal/ent/schema/host.go index 6c58079ca..f7416d5ce 100644 --- a/tavern/internal/ent/schema/host.go +++ b/tavern/internal/ent/schema/host.go @@ -3,6 +3,7 @@ package schema import ( "entgo.io/contrib/entgql" "entgo.io/ent" + "entgo.io/ent/dialect/entsql" "entgo.io/ent/schema" "entgo.io/ent/schema/edge" "entgo.io/ent/schema/field" @@ -80,6 +81,9 @@ func (Host) Annotations() []schema.Annotation { entgql.Mutations( entgql.MutationUpdate(), ), + entsql.Annotation{ + Collation: "utf8mb4_general_ci", + }, } } diff --git a/tavern/internal/ent/schema/host_credential.go b/tavern/internal/ent/schema/host_credential.go index b90fb2ff9..3f0acaddd 100644 --- a/tavern/internal/ent/schema/host_credential.go +++ b/tavern/internal/ent/schema/host_credential.go @@ -61,6 +61,9 @@ func (HostCredential) Edges() []ent.Edge { func (HostCredential) Annotations() []schema.Annotation { return []schema.Annotation{ entgql.Mutations(entgql.MutationCreate()), + entsql.Annotation{ + Collation: "utf8mb4_general_ci", + }, } } diff --git a/tavern/internal/ent/schema/host_file.go b/tavern/internal/ent/schema/host_file.go index be4f6c66d..2642d35a4 100644 --- a/tavern/internal/ent/schema/host_file.go +++ b/tavern/internal/ent/schema/host_file.go @@ -82,7 +82,11 @@ func (HostFile) Edges() []ent.Edge { // Annotations describes additional information for the ent. func (HostFile) Annotations() []schema.Annotation { - return []schema.Annotation{} + return []schema.Annotation{ + entsql.Annotation{ + Collation: "utf8mb4_general_ci", + }, + } } // Mixin defines common shared properties for the ent. diff --git a/tavern/internal/ent/schema/host_process.go b/tavern/internal/ent/schema/host_process.go index 080d53f6c..9d2ffa902 100644 --- a/tavern/internal/ent/schema/host_process.go +++ b/tavern/internal/ent/schema/host_process.go @@ -79,7 +79,11 @@ func (HostProcess) Edges() []ent.Edge { // Annotations describes additional information for the ent. func (HostProcess) Annotations() []schema.Annotation { - return []schema.Annotation{} + return []schema.Annotation{ + entsql.Annotation{ + Collation: "utf8mb4_general_ci", + }, + } } // Mixin defines common shared properties for the ent. diff --git a/tavern/internal/ent/schema/quest.go b/tavern/internal/ent/schema/quest.go index cbd3e36d0..f8db9c9c7 100644 --- a/tavern/internal/ent/schema/quest.go +++ b/tavern/internal/ent/schema/quest.go @@ -4,6 +4,7 @@ import ( "entgo.io/contrib/entgql" "entgo.io/ent" "entgo.io/ent/dialect" + "entgo.io/ent/dialect/entsql" "entgo.io/ent/schema" "entgo.io/ent/schema/edge" "entgo.io/ent/schema/field" @@ -91,6 +92,9 @@ func (Quest) Annotations() []schema.Annotation { entgql.Mutations( entgql.MutationCreate(), ), + entsql.Annotation{ + Collation: "utf8mb4_general_ci", + }, } } diff --git a/tavern/internal/ent/schema/repository.go b/tavern/internal/ent/schema/repository.go index c6a9c5981..e24678972 100644 --- a/tavern/internal/ent/schema/repository.go +++ b/tavern/internal/ent/schema/repository.go @@ -87,6 +87,9 @@ func (Repository) Annotations() []schema.Annotation { entgql.RelayConnection(), entgql.MultiOrder(), entsql.Annotation{Table: "repositories"}, + entsql.Annotation{ + Collation: "utf8mb4_general_ci", + }, } } diff --git a/tavern/internal/ent/schema/shell.go b/tavern/internal/ent/schema/shell.go index 542b0b0f7..94428abbf 100644 --- a/tavern/internal/ent/schema/shell.go +++ b/tavern/internal/ent/schema/shell.go @@ -4,6 +4,7 @@ import ( "entgo.io/contrib/entgql" "entgo.io/ent" "entgo.io/ent/dialect" + "entgo.io/ent/dialect/entsql" "entgo.io/ent/schema" "entgo.io/ent/schema/edge" "entgo.io/ent/schema/field" @@ -60,6 +61,9 @@ func (Shell) Annotations() []schema.Annotation { return []schema.Annotation{ entgql.RelayConnection(), entgql.MultiOrder(), + entsql.Annotation{ + Collation: "utf8mb4_general_ci", + }, } } diff --git a/tavern/internal/ent/schema/tag.go b/tavern/internal/ent/schema/tag.go index 3e1fefd7a..2d4f701bd 100644 --- a/tavern/internal/ent/schema/tag.go +++ b/tavern/internal/ent/schema/tag.go @@ -3,6 +3,7 @@ package schema import ( "entgo.io/contrib/entgql" "entgo.io/ent" + "entgo.io/ent/dialect/entsql" "entgo.io/ent/schema" "entgo.io/ent/schema/edge" "entgo.io/ent/schema/field" @@ -44,5 +45,8 @@ func (Tag) Annotations() []schema.Annotation { entgql.MutationCreate(), entgql.MutationUpdate(), ), + entsql.Annotation{ + Collation: "utf8mb4_general_ci", + }, } } diff --git a/tavern/internal/ent/schema/task.go b/tavern/internal/ent/schema/task.go index a3cae88db..c6e354c84 100644 --- a/tavern/internal/ent/schema/task.go +++ b/tavern/internal/ent/schema/task.go @@ -95,6 +95,9 @@ func (Task) Annotations() []schema.Annotation { return []schema.Annotation{ entgql.RelayConnection(), entgql.MultiOrder(), + entsql.Annotation{ + Collation: "utf8mb4_general_ci", + }, } } diff --git a/tavern/internal/ent/schema/tome.go b/tavern/internal/ent/schema/tome.go index 5cbb25237..7b803b86d 100644 --- a/tavern/internal/ent/schema/tome.go +++ b/tavern/internal/ent/schema/tome.go @@ -7,6 +7,7 @@ import ( "entgo.io/contrib/entgql" "entgo.io/ent" "entgo.io/ent/dialect" + "entgo.io/ent/dialect/entsql" "entgo.io/ent/schema" "entgo.io/ent/schema/edge" "entgo.io/ent/schema/field" @@ -106,6 +107,9 @@ func (Tome) Annotations() []schema.Annotation { entgql.MutationCreate(), entgql.MutationUpdate(), ), + entsql.Annotation{ + Collation: "utf8mb4_general_ci", + }, } } diff --git a/tavern/internal/ent/schema/user.go b/tavern/internal/ent/schema/user.go index 5fc56a426..263d1bb08 100644 --- a/tavern/internal/ent/schema/user.go +++ b/tavern/internal/ent/schema/user.go @@ -9,6 +9,7 @@ import ( "entgo.io/contrib/entgql" "entgo.io/ent" "entgo.io/ent/dialect" + "entgo.io/ent/dialect/entsql" "entgo.io/ent/schema" "entgo.io/ent/schema/edge" "entgo.io/ent/schema/field" @@ -79,6 +80,9 @@ func (User) Annotations() []schema.Annotation { entgql.Mutations( entgql.MutationUpdate(), ), + entsql.Annotation{ + Collation: "utf8mb4_general_ci", + }, } }