adding authContext to gRPC calls

This commit is contained in:
its-a-feature
2026-05-27 15:53:59 -07:00
parent 829aee698a
commit 8dee1271ff
22 changed files with 769 additions and 1018 deletions
+7 -1
View File
@@ -48,11 +48,17 @@ run_local_build:
./${BINARY_NAME}
build_protobuf_go:
protoc --go_out=`pwd`/grpc/services --go_opt=paths=source_relative \
~/protoc/bin/protoc --go_out=`pwd`/grpc/services --go_opt=paths=source_relative \
--go-grpc_out=`pwd`/grpc/services --go-grpc_opt=paths=source_relative \
--proto_path=`pwd`/grpc/services \
`pwd`/grpc/services/*.proto
build_protobuf_go_mythic_container:
~/protoc/bin/protoc --go_out=`pwd`/../../../MythicMeta/MythicContainer/grpc/services --go_opt=paths=source_relative \
--go-grpc_out=`pwd`/../../../MythicMeta/MythicContainer/grpc/services --go-grpc_opt=paths=source_relative \
--proto_path=`pwd`/grpc/services \
`pwd`/grpc/services/*.proto
build_protobuf_python:
python3 -m grpc_tools.protoc --python_out=`pwd`/../../../MythicMeta/MythicContainerPyPi/mythic_container/grpc \
--pyi_out=`pwd`/../../../MythicMeta/MythicContainerPyPi/mythic_container/grpc \
@@ -48,6 +48,7 @@ func (t *translationContainerServer) GenerateEncryptionKeys(stream services.Tran
Success: false,
Error: err.Error(),
TranslationContainerName: clientName,
AuthContext: msgToSend.GetAuthContext(),
}:
case <-time.After(t.GetChannelTimeout()):
logging.LogError(errors.New("timeout sending to channel"), "gRPC stream connection needs to exit due to timeouts")
@@ -64,6 +65,7 @@ func (t *translationContainerServer) GenerateEncryptionKeys(stream services.Tran
Success: false,
Error: err.Error(),
TranslationContainerName: clientName,
AuthContext: msgToSend.GetAuthContext(),
}:
case <-time.After(t.GetChannelTimeout()):
logging.LogError(errors.New("timeout sending to channel"), "gRPC stream connection needs to exit due to timeouts")
@@ -79,6 +81,7 @@ func (t *translationContainerServer) GenerateEncryptionKeys(stream services.Tran
Success: false,
Error: err.Error(),
TranslationContainerName: clientName,
AuthContext: msgToSend.GetAuthContext(),
}:
case <-time.After(t.GetChannelTimeout()):
logging.LogError(errors.New("timeout sending to channel"), "gRPC stream connection needs to exit due to timeouts")
@@ -4,14 +4,15 @@ import (
"database/sql"
"errors"
"fmt"
"io"
"sync"
"time"
"github.com/its-a-feature/Mythic/database"
databaseStructs "github.com/its-a-feature/Mythic/database/structs"
"github.com/its-a-feature/Mythic/grpc/services"
"github.com/its-a-feature/Mythic/logging"
"github.com/jmoiron/sqlx"
"io"
"sync"
"time"
)
func (t *pushC2Server) StartPushC2StreamingOneToMany(stream services.PushC2_StartPushC2StreamingOneToManyServer) error {
@@ -4,13 +4,14 @@ import (
"database/sql"
"errors"
"fmt"
"io"
"sync"
"time"
"github.com/its-a-feature/Mythic/database"
databaseStructs "github.com/its-a-feature/Mythic/database/structs"
"github.com/its-a-feature/Mythic/grpc/services"
"github.com/its-a-feature/Mythic/logging"
"io"
"sync"
"time"
)
type RabbitMQProcessAgentMessageFromPushC2 struct {
+54 -111
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v3.21.12
// protoc-gen-go v1.36.10
// protoc v6.33.0
// source: pushC2GRPC.proto
package services
@@ -11,6 +11,7 @@ import (
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
const (
@@ -28,26 +29,23 @@ const (
// Base64Message is what an agent would normally send. This is mutually exclusive with Message
// TrackingID is some custom string that the c2 server provides so that it can correlate input with output from the stream
type PushC2MessageFromAgent struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
C2ProfileName string `protobuf:"bytes,1,opt,name=C2ProfileName,proto3" json:"C2ProfileName,omitempty"`
RemoteIP string `protobuf:"bytes,2,opt,name=RemoteIP,proto3" json:"RemoteIP,omitempty"`
Message []byte `protobuf:"bytes,3,opt,name=Message,proto3" json:"Message,omitempty"`
OuterUUID string `protobuf:"bytes,4,opt,name=OuterUUID,proto3" json:"OuterUUID,omitempty"`
Base64Message []byte `protobuf:"bytes,5,opt,name=Base64Message,proto3" json:"Base64Message,omitempty"`
TrackingID string `protobuf:"bytes,6,opt,name=TrackingID,proto3" json:"TrackingID,omitempty"`
AgentDisconnected bool `protobuf:"varint,7,opt,name=AgentDisconnected,proto3" json:"AgentDisconnected,omitempty"`
state protoimpl.MessageState `protogen:"open.v1"`
C2ProfileName string `protobuf:"bytes,1,opt,name=C2ProfileName,proto3" json:"C2ProfileName,omitempty"`
RemoteIP string `protobuf:"bytes,2,opt,name=RemoteIP,proto3" json:"RemoteIP,omitempty"`
Message []byte `protobuf:"bytes,3,opt,name=Message,proto3" json:"Message,omitempty"`
OuterUUID string `protobuf:"bytes,4,opt,name=OuterUUID,proto3" json:"OuterUUID,omitempty"`
Base64Message []byte `protobuf:"bytes,5,opt,name=Base64Message,proto3" json:"Base64Message,omitempty"`
TrackingID string `protobuf:"bytes,6,opt,name=TrackingID,proto3" json:"TrackingID,omitempty"`
AgentDisconnected bool `protobuf:"varint,7,opt,name=AgentDisconnected,proto3" json:"AgentDisconnected,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *PushC2MessageFromAgent) Reset() {
*x = PushC2MessageFromAgent{}
if protoimpl.UnsafeEnabled {
mi := &file_pushC2GRPC_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
mi := &file_pushC2GRPC_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *PushC2MessageFromAgent) String() string {
@@ -58,7 +56,7 @@ func (*PushC2MessageFromAgent) ProtoMessage() {}
func (x *PushC2MessageFromAgent) ProtoReflect() protoreflect.Message {
mi := &file_pushC2GRPC_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
@@ -125,23 +123,20 @@ func (x *PushC2MessageFromAgent) GetAgentDisconnected() bool {
// mythic sends along success/error information if any
// mythic sends along the messages
type PushC2MessageFromMythic struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
state protoimpl.MessageState `protogen:"open.v1"`
Success bool `protobuf:"varint,1,opt,name=Success,proto3" json:"Success,omitempty"`
Error string `protobuf:"bytes,2,opt,name=Error,proto3" json:"Error,omitempty"`
Message []byte `protobuf:"bytes,3,opt,name=Message,proto3" json:"Message,omitempty"`
TrackingID string `protobuf:"bytes,4,opt,name=TrackingID,proto3" json:"TrackingID,omitempty"`
unknownFields protoimpl.UnknownFields
Success bool `protobuf:"varint,1,opt,name=Success,proto3" json:"Success,omitempty"`
Error string `protobuf:"bytes,2,opt,name=Error,proto3" json:"Error,omitempty"`
Message []byte `protobuf:"bytes,3,opt,name=Message,proto3" json:"Message,omitempty"`
TrackingID string `protobuf:"bytes,4,opt,name=TrackingID,proto3" json:"TrackingID,omitempty"`
sizeCache protoimpl.SizeCache
}
func (x *PushC2MessageFromMythic) Reset() {
*x = PushC2MessageFromMythic{}
if protoimpl.UnsafeEnabled {
mi := &file_pushC2GRPC_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
mi := &file_pushC2GRPC_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *PushC2MessageFromMythic) String() string {
@@ -152,7 +147,7 @@ func (*PushC2MessageFromMythic) ProtoMessage() {}
func (x *PushC2MessageFromMythic) ProtoReflect() protoreflect.Message {
mi := &file_pushC2GRPC_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
@@ -197,69 +192,44 @@ func (x *PushC2MessageFromMythic) GetTrackingID() string {
var File_pushC2GRPC_proto protoreflect.FileDescriptor
var file_pushC2GRPC_proto_rawDesc = []byte{
0x0a, 0x10, 0x70, 0x75, 0x73, 0x68, 0x43, 0x32, 0x47, 0x52, 0x50, 0x43, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x12, 0x0e, 0x70, 0x75, 0x73, 0x68, 0x43, 0x32, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,
0x65, 0x73, 0x22, 0x86, 0x02, 0x0a, 0x16, 0x50, 0x75, 0x73, 0x68, 0x43, 0x32, 0x4d, 0x65, 0x73,
0x73, 0x61, 0x67, 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x12, 0x24, 0x0a,
0x0d, 0x43, 0x32, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x43, 0x32, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x4e,
0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x49, 0x50, 0x18,
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x49, 0x50, 0x12,
0x18, 0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c,
0x52, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x4f, 0x75, 0x74,
0x65, 0x72, 0x55, 0x55, 0x49, 0x44, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x4f, 0x75,
0x74, 0x65, 0x72, 0x55, 0x55, 0x49, 0x44, 0x12, 0x24, 0x0a, 0x0d, 0x42, 0x61, 0x73, 0x65, 0x36,
0x34, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d,
0x42, 0x61, 0x73, 0x65, 0x36, 0x34, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1e, 0x0a,
0x0a, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x69, 0x6e, 0x67, 0x49, 0x44, 0x18, 0x06, 0x20, 0x01, 0x28,
0x09, 0x52, 0x0a, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x69, 0x6e, 0x67, 0x49, 0x44, 0x12, 0x2c, 0x0a,
0x11, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74,
0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x44,
0x69, 0x73, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x65, 0x64, 0x22, 0x83, 0x01, 0x0a, 0x17,
0x50, 0x75, 0x73, 0x68, 0x43, 0x32, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x46, 0x72, 0x6f,
0x6d, 0x4d, 0x79, 0x74, 0x68, 0x69, 0x63, 0x12, 0x18, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65,
0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73,
0x73, 0x12, 0x14, 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x52, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61,
0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67,
0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x69, 0x6e, 0x67, 0x49, 0x44, 0x18,
0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x69, 0x6e, 0x67, 0x49,
0x44, 0x32, 0xef, 0x01, 0x0a, 0x06, 0x50, 0x75, 0x73, 0x68, 0x43, 0x32, 0x12, 0x6d, 0x0a, 0x14,
0x53, 0x74, 0x61, 0x72, 0x74, 0x50, 0x75, 0x73, 0x68, 0x43, 0x32, 0x53, 0x74, 0x72, 0x65, 0x61,
0x6d, 0x69, 0x6e, 0x67, 0x12, 0x26, 0x2e, 0x70, 0x75, 0x73, 0x68, 0x43, 0x32, 0x53, 0x65, 0x72,
0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x50, 0x75, 0x73, 0x68, 0x43, 0x32, 0x4d, 0x65, 0x73, 0x73,
0x61, 0x67, 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x1a, 0x27, 0x2e, 0x70,
0x75, 0x73, 0x68, 0x43, 0x32, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x50, 0x75,
0x73, 0x68, 0x43, 0x32, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x4d,
0x79, 0x74, 0x68, 0x69, 0x63, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x12, 0x76, 0x0a, 0x1d, 0x53,
0x74, 0x61, 0x72, 0x74, 0x50, 0x75, 0x73, 0x68, 0x43, 0x32, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d,
0x69, 0x6e, 0x67, 0x4f, 0x6e, 0x65, 0x54, 0x6f, 0x4d, 0x61, 0x6e, 0x79, 0x12, 0x26, 0x2e, 0x70,
0x75, 0x73, 0x68, 0x43, 0x32, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x50, 0x75,
0x73, 0x68, 0x43, 0x32, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x41,
0x67, 0x65, 0x6e, 0x74, 0x1a, 0x27, 0x2e, 0x70, 0x75, 0x73, 0x68, 0x43, 0x32, 0x53, 0x65, 0x72,
0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x50, 0x75, 0x73, 0x68, 0x43, 0x32, 0x4d, 0x65, 0x73, 0x73,
0x61, 0x67, 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x4d, 0x79, 0x74, 0x68, 0x69, 0x63, 0x22, 0x00, 0x28,
0x01, 0x30, 0x01, 0x42, 0x2f, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f,
0x6d, 0x2f, 0x69, 0x74, 0x73, 0x2d, 0x61, 0x2d, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x2f,
0x4d, 0x79, 0x74, 0x68, 0x69, 0x63, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x73, 0x65, 0x72, 0x76,
0x69, 0x63, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
const file_pushC2GRPC_proto_rawDesc = "" +
"\n" +
"\x10pushC2GRPC.proto\x12\x0epushC2Services\"\x86\x02\n" +
"\x16PushC2MessageFromAgent\x12$\n" +
"\rC2ProfileName\x18\x01 \x01(\tR\rC2ProfileName\x12\x1a\n" +
"\bRemoteIP\x18\x02 \x01(\tR\bRemoteIP\x12\x18\n" +
"\aMessage\x18\x03 \x01(\fR\aMessage\x12\x1c\n" +
"\tOuterUUID\x18\x04 \x01(\tR\tOuterUUID\x12$\n" +
"\rBase64Message\x18\x05 \x01(\fR\rBase64Message\x12\x1e\n" +
"\n" +
"TrackingID\x18\x06 \x01(\tR\n" +
"TrackingID\x12,\n" +
"\x11AgentDisconnected\x18\a \x01(\bR\x11AgentDisconnected\"\x83\x01\n" +
"\x17PushC2MessageFromMythic\x12\x18\n" +
"\aSuccess\x18\x01 \x01(\bR\aSuccess\x12\x14\n" +
"\x05Error\x18\x02 \x01(\tR\x05Error\x12\x18\n" +
"\aMessage\x18\x03 \x01(\fR\aMessage\x12\x1e\n" +
"\n" +
"TrackingID\x18\x04 \x01(\tR\n" +
"TrackingID2\xef\x01\n" +
"\x06PushC2\x12m\n" +
"\x14StartPushC2Streaming\x12&.pushC2Services.PushC2MessageFromAgent\x1a'.pushC2Services.PushC2MessageFromMythic\"\x00(\x010\x01\x12v\n" +
"\x1dStartPushC2StreamingOneToMany\x12&.pushC2Services.PushC2MessageFromAgent\x1a'.pushC2Services.PushC2MessageFromMythic\"\x00(\x010\x01B/Z-github.com/its-a-feature/Mythic/grpc/servicesb\x06proto3"
var (
file_pushC2GRPC_proto_rawDescOnce sync.Once
file_pushC2GRPC_proto_rawDescData = file_pushC2GRPC_proto_rawDesc
file_pushC2GRPC_proto_rawDescData []byte
)
func file_pushC2GRPC_proto_rawDescGZIP() []byte {
file_pushC2GRPC_proto_rawDescOnce.Do(func() {
file_pushC2GRPC_proto_rawDescData = protoimpl.X.CompressGZIP(file_pushC2GRPC_proto_rawDescData)
file_pushC2GRPC_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_pushC2GRPC_proto_rawDesc), len(file_pushC2GRPC_proto_rawDesc)))
})
return file_pushC2GRPC_proto_rawDescData
}
var file_pushC2GRPC_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_pushC2GRPC_proto_goTypes = []interface{}{
var file_pushC2GRPC_proto_goTypes = []any{
(*PushC2MessageFromAgent)(nil), // 0: pushC2Services.PushC2MessageFromAgent
(*PushC2MessageFromMythic)(nil), // 1: pushC2Services.PushC2MessageFromMythic
}
@@ -280,37 +250,11 @@ func file_pushC2GRPC_proto_init() {
if File_pushC2GRPC_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_pushC2GRPC_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*PushC2MessageFromAgent); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_pushC2GRPC_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*PushC2MessageFromMythic); 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{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_pushC2GRPC_proto_rawDesc,
RawDescriptor: unsafe.Slice(unsafe.StringData(file_pushC2GRPC_proto_rawDesc), len(file_pushC2GRPC_proto_rawDesc)),
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
@@ -321,7 +265,6 @@ func file_pushC2GRPC_proto_init() {
MessageInfos: file_pushC2GRPC_proto_msgTypes,
}.Build()
File_pushC2GRPC_proto = out.File
file_pushC2GRPC_proto_rawDesc = nil
file_pushC2GRPC_proto_goTypes = nil
file_pushC2GRPC_proto_depIdxs = nil
}
@@ -29,8 +29,8 @@ message PushC2MessageFromAgent {
// mythic sends along success/error information if any
// mythic sends along the messages
message PushC2MessageFromMythic {
bool Success = 1;
string Error = 2;
bytes Message = 3;
string TrackingID = 4;
bool Success = 1;
string Error = 2;
bytes Message = 3;
string TrackingID = 4;
}
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc v3.21.12
// - protoc-gen-go-grpc v1.5.1
// - protoc v6.33.0
// source: pushC2GRPC.proto
package services
@@ -15,16 +15,21 @@ 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.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
PushC2_StartPushC2Streaming_FullMethodName = "/pushC2Services.PushC2/StartPushC2Streaming"
PushC2_StartPushC2StreamingOneToMany_FullMethodName = "/pushC2Services.PushC2/StartPushC2StreamingOneToMany"
)
// PushC2Client is the client API for PushC2 service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type PushC2Client interface {
// rpc function(messageFromClient) messageToClient
StartPushC2Streaming(ctx context.Context, opts ...grpc.CallOption) (PushC2_StartPushC2StreamingClient, error)
StartPushC2StreamingOneToMany(ctx context.Context, opts ...grpc.CallOption) (PushC2_StartPushC2StreamingOneToManyClient, error)
StartPushC2Streaming(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[PushC2MessageFromAgent, PushC2MessageFromMythic], error)
StartPushC2StreamingOneToMany(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[PushC2MessageFromAgent, PushC2MessageFromMythic], error)
}
type pushC2Client struct {
@@ -35,89 +40,57 @@ func NewPushC2Client(cc grpc.ClientConnInterface) PushC2Client {
return &pushC2Client{cc}
}
func (c *pushC2Client) StartPushC2Streaming(ctx context.Context, opts ...grpc.CallOption) (PushC2_StartPushC2StreamingClient, error) {
stream, err := c.cc.NewStream(ctx, &PushC2_ServiceDesc.Streams[0], "/pushC2Services.PushC2/StartPushC2Streaming", opts...)
func (c *pushC2Client) StartPushC2Streaming(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[PushC2MessageFromAgent, PushC2MessageFromMythic], error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
stream, err := c.cc.NewStream(ctx, &PushC2_ServiceDesc.Streams[0], PushC2_StartPushC2Streaming_FullMethodName, cOpts...)
if err != nil {
return nil, err
}
x := &pushC2StartPushC2StreamingClient{stream}
x := &grpc.GenericClientStream[PushC2MessageFromAgent, PushC2MessageFromMythic]{ClientStream: stream}
return x, nil
}
type PushC2_StartPushC2StreamingClient interface {
Send(*PushC2MessageFromAgent) error
Recv() (*PushC2MessageFromMythic, error)
grpc.ClientStream
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type PushC2_StartPushC2StreamingClient = grpc.BidiStreamingClient[PushC2MessageFromAgent, PushC2MessageFromMythic]
type pushC2StartPushC2StreamingClient struct {
grpc.ClientStream
}
func (x *pushC2StartPushC2StreamingClient) Send(m *PushC2MessageFromAgent) error {
return x.ClientStream.SendMsg(m)
}
func (x *pushC2StartPushC2StreamingClient) Recv() (*PushC2MessageFromMythic, error) {
m := new(PushC2MessageFromMythic)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func (c *pushC2Client) StartPushC2StreamingOneToMany(ctx context.Context, opts ...grpc.CallOption) (PushC2_StartPushC2StreamingOneToManyClient, error) {
stream, err := c.cc.NewStream(ctx, &PushC2_ServiceDesc.Streams[1], "/pushC2Services.PushC2/StartPushC2StreamingOneToMany", opts...)
func (c *pushC2Client) StartPushC2StreamingOneToMany(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[PushC2MessageFromAgent, PushC2MessageFromMythic], error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
stream, err := c.cc.NewStream(ctx, &PushC2_ServiceDesc.Streams[1], PushC2_StartPushC2StreamingOneToMany_FullMethodName, cOpts...)
if err != nil {
return nil, err
}
x := &pushC2StartPushC2StreamingOneToManyClient{stream}
x := &grpc.GenericClientStream[PushC2MessageFromAgent, PushC2MessageFromMythic]{ClientStream: stream}
return x, nil
}
type PushC2_StartPushC2StreamingOneToManyClient interface {
Send(*PushC2MessageFromAgent) error
Recv() (*PushC2MessageFromMythic, error)
grpc.ClientStream
}
type pushC2StartPushC2StreamingOneToManyClient struct {
grpc.ClientStream
}
func (x *pushC2StartPushC2StreamingOneToManyClient) Send(m *PushC2MessageFromAgent) error {
return x.ClientStream.SendMsg(m)
}
func (x *pushC2StartPushC2StreamingOneToManyClient) Recv() (*PushC2MessageFromMythic, error) {
m := new(PushC2MessageFromMythic)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type PushC2_StartPushC2StreamingOneToManyClient = grpc.BidiStreamingClient[PushC2MessageFromAgent, PushC2MessageFromMythic]
// PushC2Server is the server API for PushC2 service.
// All implementations must embed UnimplementedPushC2Server
// for forward compatibility
// for forward compatibility.
type PushC2Server interface {
// rpc function(messageFromClient) messageToClient
StartPushC2Streaming(PushC2_StartPushC2StreamingServer) error
StartPushC2StreamingOneToMany(PushC2_StartPushC2StreamingOneToManyServer) error
StartPushC2Streaming(grpc.BidiStreamingServer[PushC2MessageFromAgent, PushC2MessageFromMythic]) error
StartPushC2StreamingOneToMany(grpc.BidiStreamingServer[PushC2MessageFromAgent, PushC2MessageFromMythic]) error
mustEmbedUnimplementedPushC2Server()
}
// UnimplementedPushC2Server must be embedded to have forward compatible implementations.
type UnimplementedPushC2Server struct {
}
// UnimplementedPushC2Server 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 UnimplementedPushC2Server struct{}
func (UnimplementedPushC2Server) StartPushC2Streaming(PushC2_StartPushC2StreamingServer) error {
func (UnimplementedPushC2Server) StartPushC2Streaming(grpc.BidiStreamingServer[PushC2MessageFromAgent, PushC2MessageFromMythic]) error {
return status.Errorf(codes.Unimplemented, "method StartPushC2Streaming not implemented")
}
func (UnimplementedPushC2Server) StartPushC2StreamingOneToMany(PushC2_StartPushC2StreamingOneToManyServer) error {
func (UnimplementedPushC2Server) StartPushC2StreamingOneToMany(grpc.BidiStreamingServer[PushC2MessageFromAgent, PushC2MessageFromMythic]) error {
return status.Errorf(codes.Unimplemented, "method StartPushC2StreamingOneToMany not implemented")
}
func (UnimplementedPushC2Server) mustEmbedUnimplementedPushC2Server() {}
func (UnimplementedPushC2Server) testEmbeddedByValue() {}
// UnsafePushC2Server may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to PushC2Server will
@@ -127,60 +100,29 @@ type UnsafePushC2Server interface {
}
func RegisterPushC2Server(s grpc.ServiceRegistrar, srv PushC2Server) {
// If the following call pancis, it indicates UnimplementedPushC2Server 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(&PushC2_ServiceDesc, srv)
}
func _PushC2_StartPushC2Streaming_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(PushC2Server).StartPushC2Streaming(&pushC2StartPushC2StreamingServer{stream})
return srv.(PushC2Server).StartPushC2Streaming(&grpc.GenericServerStream[PushC2MessageFromAgent, PushC2MessageFromMythic]{ServerStream: stream})
}
type PushC2_StartPushC2StreamingServer interface {
Send(*PushC2MessageFromMythic) error
Recv() (*PushC2MessageFromAgent, error)
grpc.ServerStream
}
type pushC2StartPushC2StreamingServer struct {
grpc.ServerStream
}
func (x *pushC2StartPushC2StreamingServer) Send(m *PushC2MessageFromMythic) error {
return x.ServerStream.SendMsg(m)
}
func (x *pushC2StartPushC2StreamingServer) Recv() (*PushC2MessageFromAgent, error) {
m := new(PushC2MessageFromAgent)
if err := x.ServerStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type PushC2_StartPushC2StreamingServer = grpc.BidiStreamingServer[PushC2MessageFromAgent, PushC2MessageFromMythic]
func _PushC2_StartPushC2StreamingOneToMany_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(PushC2Server).StartPushC2StreamingOneToMany(&pushC2StartPushC2StreamingOneToManyServer{stream})
return srv.(PushC2Server).StartPushC2StreamingOneToMany(&grpc.GenericServerStream[PushC2MessageFromAgent, PushC2MessageFromMythic]{ServerStream: stream})
}
type PushC2_StartPushC2StreamingOneToManyServer interface {
Send(*PushC2MessageFromMythic) error
Recv() (*PushC2MessageFromAgent, error)
grpc.ServerStream
}
type pushC2StartPushC2StreamingOneToManyServer struct {
grpc.ServerStream
}
func (x *pushC2StartPushC2StreamingOneToManyServer) Send(m *PushC2MessageFromMythic) error {
return x.ServerStream.SendMsg(m)
}
func (x *pushC2StartPushC2StreamingOneToManyServer) Recv() (*PushC2MessageFromAgent, error) {
m := new(PushC2MessageFromAgent)
if err := x.ServerStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type PushC2_StartPushC2StreamingOneToManyServer = grpc.BidiStreamingServer[PushC2MessageFromAgent, PushC2MessageFromMythic]
// PushC2_ServiceDesc is the grpc.ServiceDesc for PushC2 service.
// It's only intended for direct use with grpc.RegisterService,
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v3.21.12
// protoc-gen-go v1.36.10
// protoc v6.33.0
// source: translationContainerGRPC.proto
package services
@@ -11,6 +11,7 @@ import (
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
const (
@@ -21,25 +22,23 @@ const (
)
type TrCustomMessageToMythicC2FormatMessage struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
TranslationContainerName string `protobuf:"bytes,1,opt,name=TranslationContainerName,proto3" json:"TranslationContainerName,omitempty"`
C2Name string `protobuf:"bytes,2,opt,name=C2Name,proto3" json:"C2Name,omitempty"`
Message []byte `protobuf:"bytes,3,opt,name=Message,proto3" json:"Message,omitempty"`
UUID string `protobuf:"bytes,4,opt,name=UUID,proto3" json:"UUID,omitempty"`
MythicEncrypts bool `protobuf:"varint,5,opt,name=MythicEncrypts,proto3" json:"MythicEncrypts,omitempty"`
CryptoKeys []*CryptoKeysFormat `protobuf:"bytes,6,rep,name=CryptoKeys,proto3" json:"CryptoKeys,omitempty"`
state protoimpl.MessageState `protogen:"open.v1"`
TranslationContainerName string `protobuf:"bytes,1,opt,name=TranslationContainerName,proto3" json:"TranslationContainerName,omitempty"`
C2Name string `protobuf:"bytes,2,opt,name=C2Name,proto3" json:"C2Name,omitempty"`
Message []byte `protobuf:"bytes,3,opt,name=Message,proto3" json:"Message,omitempty"`
UUID string `protobuf:"bytes,4,opt,name=UUID,proto3" json:"UUID,omitempty"`
MythicEncrypts bool `protobuf:"varint,5,opt,name=MythicEncrypts,proto3" json:"MythicEncrypts,omitempty"`
CryptoKeys []*CryptoKeysFormat `protobuf:"bytes,6,rep,name=CryptoKeys,proto3" json:"CryptoKeys,omitempty"`
AuthContext string `protobuf:"bytes,7,opt,name=AuthContext,proto3" json:"AuthContext,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *TrCustomMessageToMythicC2FormatMessage) Reset() {
*x = TrCustomMessageToMythicC2FormatMessage{}
if protoimpl.UnsafeEnabled {
mi := &file_translationContainerGRPC_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
mi := &file_translationContainerGRPC_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *TrCustomMessageToMythicC2FormatMessage) String() string {
@@ -50,7 +49,7 @@ func (*TrCustomMessageToMythicC2FormatMessage) ProtoMessage() {}
func (x *TrCustomMessageToMythicC2FormatMessage) ProtoReflect() protoreflect.Message {
mi := &file_translationContainerGRPC_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
@@ -107,23 +106,28 @@ func (x *TrCustomMessageToMythicC2FormatMessage) GetCryptoKeys() []*CryptoKeysFo
return nil
}
type CryptoKeysFormat struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
func (x *TrCustomMessageToMythicC2FormatMessage) GetAuthContext() string {
if x != nil {
return x.AuthContext
}
return ""
}
EncKey []byte `protobuf:"bytes,1,opt,name=EncKey,proto3" json:"EncKey,omitempty"`
DecKey []byte `protobuf:"bytes,2,opt,name=DecKey,proto3" json:"DecKey,omitempty"`
Value string `protobuf:"bytes,3,opt,name=Value,proto3" json:"Value,omitempty"`
type CryptoKeysFormat struct {
state protoimpl.MessageState `protogen:"open.v1"`
EncKey []byte `protobuf:"bytes,1,opt,name=EncKey,proto3" json:"EncKey,omitempty"`
DecKey []byte `protobuf:"bytes,2,opt,name=DecKey,proto3" json:"DecKey,omitempty"`
Value string `protobuf:"bytes,3,opt,name=Value,proto3" json:"Value,omitempty"`
Location string `protobuf:"bytes,4,opt,name=Location,proto3" json:"Location,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *CryptoKeysFormat) Reset() {
*x = CryptoKeysFormat{}
if protoimpl.UnsafeEnabled {
mi := &file_translationContainerGRPC_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
mi := &file_translationContainerGRPC_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *CryptoKeysFormat) String() string {
@@ -134,7 +138,7 @@ func (*CryptoKeysFormat) ProtoMessage() {}
func (x *CryptoKeysFormat) ProtoReflect() protoreflect.Message {
mi := &file_translationContainerGRPC_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
@@ -170,24 +174,29 @@ func (x *CryptoKeysFormat) GetValue() string {
return ""
}
type TrCustomMessageToMythicC2FormatMessageResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
func (x *CryptoKeysFormat) GetLocation() string {
if x != nil {
return x.Location
}
return ""
}
Success bool `protobuf:"varint,1,opt,name=Success,proto3" json:"Success,omitempty"`
Error string `protobuf:"bytes,2,opt,name=Error,proto3" json:"Error,omitempty"`
Message []byte `protobuf:"bytes,3,opt,name=Message,proto3" json:"Message,omitempty"`
TranslationContainerName string `protobuf:"bytes,4,opt,name=TranslationContainerName,proto3" json:"TranslationContainerName,omitempty"`
type TrCustomMessageToMythicC2FormatMessageResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
Success bool `protobuf:"varint,1,opt,name=Success,proto3" json:"Success,omitempty"`
Error string `protobuf:"bytes,2,opt,name=Error,proto3" json:"Error,omitempty"`
Message []byte `protobuf:"bytes,3,opt,name=Message,proto3" json:"Message,omitempty"`
TranslationContainerName string `protobuf:"bytes,4,opt,name=TranslationContainerName,proto3" json:"TranslationContainerName,omitempty"`
AuthContext string `protobuf:"bytes,5,opt,name=AuthContext,proto3" json:"AuthContext,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *TrCustomMessageToMythicC2FormatMessageResponse) Reset() {
*x = TrCustomMessageToMythicC2FormatMessageResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_translationContainerGRPC_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
mi := &file_translationContainerGRPC_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *TrCustomMessageToMythicC2FormatMessageResponse) String() string {
@@ -198,7 +207,7 @@ func (*TrCustomMessageToMythicC2FormatMessageResponse) ProtoMessage() {}
func (x *TrCustomMessageToMythicC2FormatMessageResponse) ProtoReflect() protoreflect.Message {
mi := &file_translationContainerGRPC_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
@@ -241,26 +250,31 @@ func (x *TrCustomMessageToMythicC2FormatMessageResponse) GetTranslationContainer
return ""
}
type TrMythicC2ToCustomMessageFormatMessage struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
func (x *TrCustomMessageToMythicC2FormatMessageResponse) GetAuthContext() string {
if x != nil {
return x.AuthContext
}
return ""
}
TranslationContainerName string `protobuf:"bytes,1,opt,name=TranslationContainerName,proto3" json:"TranslationContainerName,omitempty"`
C2Name string `protobuf:"bytes,2,opt,name=C2Name,proto3" json:"C2Name,omitempty"`
Message []byte `protobuf:"bytes,3,opt,name=Message,proto3" json:"Message,omitempty"`
UUID string `protobuf:"bytes,4,opt,name=UUID,proto3" json:"UUID,omitempty"`
MythicEncrypts bool `protobuf:"varint,5,opt,name=MythicEncrypts,proto3" json:"MythicEncrypts,omitempty"`
CryptoKeys []*CryptoKeysFormat `protobuf:"bytes,6,rep,name=CryptoKeys,proto3" json:"CryptoKeys,omitempty"`
type TrMythicC2ToCustomMessageFormatMessage struct {
state protoimpl.MessageState `protogen:"open.v1"`
TranslationContainerName string `protobuf:"bytes,1,opt,name=TranslationContainerName,proto3" json:"TranslationContainerName,omitempty"`
C2Name string `protobuf:"bytes,2,opt,name=C2Name,proto3" json:"C2Name,omitempty"`
Message []byte `protobuf:"bytes,3,opt,name=Message,proto3" json:"Message,omitempty"`
UUID string `protobuf:"bytes,4,opt,name=UUID,proto3" json:"UUID,omitempty"`
MythicEncrypts bool `protobuf:"varint,5,opt,name=MythicEncrypts,proto3" json:"MythicEncrypts,omitempty"`
CryptoKeys []*CryptoKeysFormat `protobuf:"bytes,6,rep,name=CryptoKeys,proto3" json:"CryptoKeys,omitempty"`
AuthContext string `protobuf:"bytes,7,opt,name=AuthContext,proto3" json:"AuthContext,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *TrMythicC2ToCustomMessageFormatMessage) Reset() {
*x = TrMythicC2ToCustomMessageFormatMessage{}
if protoimpl.UnsafeEnabled {
mi := &file_translationContainerGRPC_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
mi := &file_translationContainerGRPC_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *TrMythicC2ToCustomMessageFormatMessage) String() string {
@@ -271,7 +285,7 @@ func (*TrMythicC2ToCustomMessageFormatMessage) ProtoMessage() {}
func (x *TrMythicC2ToCustomMessageFormatMessage) ProtoReflect() protoreflect.Message {
mi := &file_translationContainerGRPC_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
@@ -328,24 +342,29 @@ func (x *TrMythicC2ToCustomMessageFormatMessage) GetCryptoKeys() []*CryptoKeysFo
return nil
}
type TrMythicC2ToCustomMessageFormatMessageResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
func (x *TrMythicC2ToCustomMessageFormatMessage) GetAuthContext() string {
if x != nil {
return x.AuthContext
}
return ""
}
Success bool `protobuf:"varint,1,opt,name=Success,proto3" json:"Success,omitempty"`
Error string `protobuf:"bytes,2,opt,name=Error,proto3" json:"Error,omitempty"`
Message []byte `protobuf:"bytes,3,opt,name=Message,proto3" json:"Message,omitempty"`
TranslationContainerName string `protobuf:"bytes,4,opt,name=TranslationContainerName,proto3" json:"TranslationContainerName,omitempty"`
type TrMythicC2ToCustomMessageFormatMessageResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
Success bool `protobuf:"varint,1,opt,name=Success,proto3" json:"Success,omitempty"`
Error string `protobuf:"bytes,2,opt,name=Error,proto3" json:"Error,omitempty"`
Message []byte `protobuf:"bytes,3,opt,name=Message,proto3" json:"Message,omitempty"`
TranslationContainerName string `protobuf:"bytes,4,opt,name=TranslationContainerName,proto3" json:"TranslationContainerName,omitempty"`
AuthContext string `protobuf:"bytes,5,opt,name=AuthContext,proto3" json:"AuthContext,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *TrMythicC2ToCustomMessageFormatMessageResponse) Reset() {
*x = TrMythicC2ToCustomMessageFormatMessageResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_translationContainerGRPC_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
mi := &file_translationContainerGRPC_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *TrMythicC2ToCustomMessageFormatMessageResponse) String() string {
@@ -356,7 +375,7 @@ func (*TrMythicC2ToCustomMessageFormatMessageResponse) ProtoMessage() {}
func (x *TrMythicC2ToCustomMessageFormatMessageResponse) ProtoReflect() protoreflect.Message {
mi := &file_translationContainerGRPC_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
@@ -399,24 +418,29 @@ func (x *TrMythicC2ToCustomMessageFormatMessageResponse) GetTranslationContainer
return ""
}
type TrGenerateEncryptionKeysMessage struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
func (x *TrMythicC2ToCustomMessageFormatMessageResponse) GetAuthContext() string {
if x != nil {
return x.AuthContext
}
return ""
}
TranslationContainerName string `protobuf:"bytes,1,opt,name=TranslationContainerName,proto3" json:"TranslationContainerName,omitempty"`
C2Name string `protobuf:"bytes,2,opt,name=C2Name,proto3" json:"C2Name,omitempty"`
CryptoParamValue string `protobuf:"bytes,3,opt,name=CryptoParamValue,proto3" json:"CryptoParamValue,omitempty"`
CryptoParamName string `protobuf:"bytes,4,opt,name=CryptoParamName,proto3" json:"CryptoParamName,omitempty"`
type TrGenerateEncryptionKeysMessage struct {
state protoimpl.MessageState `protogen:"open.v1"`
TranslationContainerName string `protobuf:"bytes,1,opt,name=TranslationContainerName,proto3" json:"TranslationContainerName,omitempty"`
C2Name string `protobuf:"bytes,2,opt,name=C2Name,proto3" json:"C2Name,omitempty"`
CryptoParamValue string `protobuf:"bytes,3,opt,name=CryptoParamValue,proto3" json:"CryptoParamValue,omitempty"`
CryptoParamName string `protobuf:"bytes,4,opt,name=CryptoParamName,proto3" json:"CryptoParamName,omitempty"`
AuthContext string `protobuf:"bytes,5,opt,name=AuthContext,proto3" json:"AuthContext,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *TrGenerateEncryptionKeysMessage) Reset() {
*x = TrGenerateEncryptionKeysMessage{}
if protoimpl.UnsafeEnabled {
mi := &file_translationContainerGRPC_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
mi := &file_translationContainerGRPC_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *TrGenerateEncryptionKeysMessage) String() string {
@@ -427,7 +451,7 @@ func (*TrGenerateEncryptionKeysMessage) ProtoMessage() {}
func (x *TrGenerateEncryptionKeysMessage) ProtoReflect() protoreflect.Message {
mi := &file_translationContainerGRPC_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
@@ -470,25 +494,30 @@ func (x *TrGenerateEncryptionKeysMessage) GetCryptoParamName() string {
return ""
}
type TrGenerateEncryptionKeysMessageResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
func (x *TrGenerateEncryptionKeysMessage) GetAuthContext() string {
if x != nil {
return x.AuthContext
}
return ""
}
Success bool `protobuf:"varint,1,opt,name=Success,proto3" json:"Success,omitempty"`
Error string `protobuf:"bytes,2,opt,name=Error,proto3" json:"Error,omitempty"`
EncryptionKey []byte `protobuf:"bytes,3,opt,name=EncryptionKey,proto3" json:"EncryptionKey,omitempty"`
DecryptionKey []byte `protobuf:"bytes,4,opt,name=DecryptionKey,proto3" json:"DecryptionKey,omitempty"`
TranslationContainerName string `protobuf:"bytes,5,opt,name=TranslationContainerName,proto3" json:"TranslationContainerName,omitempty"`
type TrGenerateEncryptionKeysMessageResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
Success bool `protobuf:"varint,1,opt,name=Success,proto3" json:"Success,omitempty"`
Error string `protobuf:"bytes,2,opt,name=Error,proto3" json:"Error,omitempty"`
EncryptionKey []byte `protobuf:"bytes,3,opt,name=EncryptionKey,proto3" json:"EncryptionKey,omitempty"`
DecryptionKey []byte `protobuf:"bytes,4,opt,name=DecryptionKey,proto3" json:"DecryptionKey,omitempty"`
TranslationContainerName string `protobuf:"bytes,5,opt,name=TranslationContainerName,proto3" json:"TranslationContainerName,omitempty"`
AuthContext string `protobuf:"bytes,6,opt,name=AuthContext,proto3" json:"AuthContext,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *TrGenerateEncryptionKeysMessageResponse) Reset() {
*x = TrGenerateEncryptionKeysMessageResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_translationContainerGRPC_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
mi := &file_translationContainerGRPC_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *TrGenerateEncryptionKeysMessageResponse) String() string {
@@ -499,7 +528,7 @@ func (*TrGenerateEncryptionKeysMessageResponse) ProtoMessage() {}
func (x *TrGenerateEncryptionKeysMessageResponse) ProtoReflect() protoreflect.Message {
mi := &file_translationContainerGRPC_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
@@ -549,161 +578,87 @@ func (x *TrGenerateEncryptionKeysMessageResponse) GetTranslationContainerName()
return ""
}
func (x *TrGenerateEncryptionKeysMessageResponse) GetAuthContext() string {
if x != nil {
return x.AuthContext
}
return ""
}
var File_translationContainerGRPC_proto protoreflect.FileDescriptor
var file_translationContainerGRPC_proto_rawDesc = []byte{
0x0a, 0x1e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e,
0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x47, 0x52, 0x50, 0x43, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x12, 0x1c, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e,
0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x22, 0xa2,
0x02, 0x0a, 0x26, 0x54, 0x72, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x4d, 0x65, 0x73, 0x73, 0x61,
0x67, 0x65, 0x54, 0x6f, 0x4d, 0x79, 0x74, 0x68, 0x69, 0x63, 0x43, 0x32, 0x46, 0x6f, 0x72, 0x6d,
0x61, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x3a, 0x0a, 0x18, 0x54, 0x72, 0x61,
0x6e, 0x73, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65,
0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x18, 0x54, 0x72, 0x61,
0x6e, 0x73, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65,
0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x43, 0x32, 0x4e, 0x61, 0x6d, 0x65, 0x18,
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x43, 0x32, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a,
0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07,
0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x55, 0x55, 0x49, 0x44, 0x18,
0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x55, 0x55, 0x49, 0x44, 0x12, 0x26, 0x0a, 0x0e, 0x4d,
0x79, 0x74, 0x68, 0x69, 0x63, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x73, 0x18, 0x05, 0x20,
0x01, 0x28, 0x08, 0x52, 0x0e, 0x4d, 0x79, 0x74, 0x68, 0x69, 0x63, 0x45, 0x6e, 0x63, 0x72, 0x79,
0x70, 0x74, 0x73, 0x12, 0x4e, 0x0a, 0x0a, 0x43, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x4b, 0x65, 0x79,
0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6c,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65,
0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x43, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x4b, 0x65, 0x79,
0x73, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x52, 0x0a, 0x43, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x4b,
0x65, 0x79, 0x73, 0x22, 0x58, 0x0a, 0x10, 0x43, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x4b, 0x65, 0x79,
0x73, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x45, 0x6e, 0x63, 0x4b, 0x65,
0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x45, 0x6e, 0x63, 0x4b, 0x65, 0x79, 0x12,
0x16, 0x0a, 0x06, 0x44, 0x65, 0x63, 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52,
0x06, 0x44, 0x65, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x56, 0x61, 0x6c, 0x75, 0x65,
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xb6, 0x01,
0x0a, 0x2e, 0x54, 0x72, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67,
0x65, 0x54, 0x6f, 0x4d, 0x79, 0x74, 0x68, 0x69, 0x63, 0x43, 0x32, 0x46, 0x6f, 0x72, 0x6d, 0x61,
0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x12, 0x18, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28,
0x08, 0x52, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x45, 0x72,
0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72,
0x12, 0x18, 0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28,
0x0c, 0x52, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x3a, 0x0a, 0x18, 0x54, 0x72,
0x61, 0x6e, 0x73, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e,
0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x18, 0x54, 0x72,
0x61, 0x6e, 0x73, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e,
0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0xa2, 0x02, 0x0a, 0x26, 0x54, 0x72, 0x4d, 0x79, 0x74,
0x68, 0x69, 0x63, 0x43, 0x32, 0x54, 0x6f, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x4d, 0x65, 0x73,
0x73, 0x61, 0x67, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67,
0x65, 0x12, 0x3a, 0x0a, 0x18, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x52, 0x18, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a,
0x06, 0x43, 0x32, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x43,
0x32, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12,
0x12, 0x0a, 0x04, 0x55, 0x55, 0x49, 0x44, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x55,
0x55, 0x49, 0x44, 0x12, 0x26, 0x0a, 0x0e, 0x4d, 0x79, 0x74, 0x68, 0x69, 0x63, 0x45, 0x6e, 0x63,
0x72, 0x79, 0x70, 0x74, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x4d, 0x79, 0x74,
0x68, 0x69, 0x63, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x73, 0x12, 0x4e, 0x0a, 0x0a, 0x43,
0x72, 0x79, 0x70, 0x74, 0x6f, 0x4b, 0x65, 0x79, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x2e, 0x2e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e,
0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x43,
0x72, 0x79, 0x70, 0x74, 0x6f, 0x4b, 0x65, 0x79, 0x73, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x52,
0x0a, 0x43, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x4b, 0x65, 0x79, 0x73, 0x22, 0xb6, 0x01, 0x0a, 0x2e,
0x54, 0x72, 0x4d, 0x79, 0x74, 0x68, 0x69, 0x63, 0x43, 0x32, 0x54, 0x6f, 0x43, 0x75, 0x73, 0x74,
0x6f, 0x6d, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x4d,
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18,
0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52,
0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f,
0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x18,
0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52,
0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x3a, 0x0a, 0x18, 0x54, 0x72, 0x61, 0x6e,
0x73, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72,
0x4e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x18, 0x54, 0x72, 0x61, 0x6e,
0x73, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72,
0x4e, 0x61, 0x6d, 0x65, 0x22, 0xcb, 0x01, 0x0a, 0x1f, 0x54, 0x72, 0x47, 0x65, 0x6e, 0x65, 0x72,
0x61, 0x74, 0x65, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79,
0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x3a, 0x0a, 0x18, 0x54, 0x72, 0x61, 0x6e,
0x73, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72,
0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x18, 0x54, 0x72, 0x61, 0x6e,
0x73, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72,
0x4e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x43, 0x32, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02,
0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x43, 0x32, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x10,
0x43, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65,
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x43, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x50, 0x61,
0x72, 0x61, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x28, 0x0a, 0x0f, 0x43, 0x72, 0x79, 0x70,
0x74, 0x6f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28,
0x09, 0x52, 0x0f, 0x43, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x4e, 0x61,
0x6d, 0x65, 0x22, 0xe1, 0x01, 0x0a, 0x27, 0x54, 0x72, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74,
0x65, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x73, 0x4d,
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18,
0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52,
0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f,
0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x24,
0x0a, 0x0d, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x18,
0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f,
0x6e, 0x4b, 0x65, 0x79, 0x12, 0x24, 0x0a, 0x0d, 0x44, 0x65, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69,
0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x44, 0x65, 0x63,
0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x12, 0x3a, 0x0a, 0x18, 0x54, 0x72,
0x61, 0x6e, 0x73, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e,
0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x18, 0x54, 0x72,
0x61, 0x6e, 0x73, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e,
0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x32, 0xbd, 0x04, 0x0a, 0x14, 0x54, 0x72, 0x61, 0x6e, 0x73,
0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12,
0xbd, 0x01, 0x0a, 0x21, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x6c, 0x61, 0x74, 0x65, 0x46, 0x72, 0x6f,
0x6d, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x54, 0x6f, 0x4d, 0x79, 0x74, 0x68, 0x69, 0x63, 0x46,
0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x4c, 0x2e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6c, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76,
0x69, 0x63, 0x65, 0x73, 0x2e, 0x54, 0x72, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x4d, 0x65, 0x73,
0x73, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x4d, 0x79, 0x74, 0x68, 0x69, 0x63, 0x43, 0x32, 0x46, 0x6f,
0x72, 0x6d, 0x61, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x1a, 0x44, 0x2e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6c, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,
0x65, 0x73, 0x2e, 0x54, 0x72, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x4d, 0x65, 0x73, 0x73, 0x61,
0x67, 0x65, 0x54, 0x6f, 0x4d, 0x79, 0x74, 0x68, 0x69, 0x63, 0x43, 0x32, 0x46, 0x6f, 0x72, 0x6d,
0x61, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x12,
0xbd, 0x01, 0x0a, 0x21, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x6c, 0x61, 0x74, 0x65, 0x46, 0x72, 0x6f,
0x6d, 0x4d, 0x79, 0x74, 0x68, 0x69, 0x63, 0x54, 0x6f, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x46,
0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x4c, 0x2e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6c, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76,
0x69, 0x63, 0x65, 0x73, 0x2e, 0x54, 0x72, 0x4d, 0x79, 0x74, 0x68, 0x69, 0x63, 0x43, 0x32, 0x54,
0x6f, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x46, 0x6f,
0x72, 0x6d, 0x61, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x1a, 0x44, 0x2e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6c, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,
0x65, 0x73, 0x2e, 0x54, 0x72, 0x4d, 0x79, 0x74, 0x68, 0x69, 0x63, 0x43, 0x32, 0x54, 0x6f, 0x43,
0x75, 0x73, 0x74, 0x6f, 0x6d, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x46, 0x6f, 0x72, 0x6d,
0x61, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x12,
0xa4, 0x01, 0x0a, 0x16, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x45, 0x6e, 0x63, 0x72,
0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x45, 0x2e, 0x74, 0x72, 0x61,
0x6e, 0x73, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65,
0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x54, 0x72, 0x47, 0x65, 0x6e, 0x65,
0x72, 0x61, 0x74, 0x65, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65,
0x79, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x1a, 0x3d, 0x2e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43,
0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73,
0x2e, 0x54, 0x72, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x45, 0x6e, 0x63, 0x72, 0x79,
0x70, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x42, 0x2f, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62,
0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x74, 0x73, 0x2d, 0x61, 0x2d, 0x66, 0x65, 0x61, 0x74, 0x75,
0x72, 0x65, 0x2f, 0x4d, 0x79, 0x74, 0x68, 0x69, 0x63, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x73,
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
const file_translationContainerGRPC_proto_rawDesc = "" +
"\n" +
"\x1etranslationContainerGRPC.proto\x12\x1ctranslationContainerServices\"\xc4\x02\n" +
"&TrCustomMessageToMythicC2FormatMessage\x12:\n" +
"\x18TranslationContainerName\x18\x01 \x01(\tR\x18TranslationContainerName\x12\x16\n" +
"\x06C2Name\x18\x02 \x01(\tR\x06C2Name\x12\x18\n" +
"\aMessage\x18\x03 \x01(\fR\aMessage\x12\x12\n" +
"\x04UUID\x18\x04 \x01(\tR\x04UUID\x12&\n" +
"\x0eMythicEncrypts\x18\x05 \x01(\bR\x0eMythicEncrypts\x12N\n" +
"\n" +
"CryptoKeys\x18\x06 \x03(\v2..translationContainerServices.CryptoKeysFormatR\n" +
"CryptoKeys\x12 \n" +
"\vAuthContext\x18\a \x01(\tR\vAuthContext\"t\n" +
"\x10CryptoKeysFormat\x12\x16\n" +
"\x06EncKey\x18\x01 \x01(\fR\x06EncKey\x12\x16\n" +
"\x06DecKey\x18\x02 \x01(\fR\x06DecKey\x12\x14\n" +
"\x05Value\x18\x03 \x01(\tR\x05Value\x12\x1a\n" +
"\bLocation\x18\x04 \x01(\tR\bLocation\"\xd8\x01\n" +
".TrCustomMessageToMythicC2FormatMessageResponse\x12\x18\n" +
"\aSuccess\x18\x01 \x01(\bR\aSuccess\x12\x14\n" +
"\x05Error\x18\x02 \x01(\tR\x05Error\x12\x18\n" +
"\aMessage\x18\x03 \x01(\fR\aMessage\x12:\n" +
"\x18TranslationContainerName\x18\x04 \x01(\tR\x18TranslationContainerName\x12 \n" +
"\vAuthContext\x18\x05 \x01(\tR\vAuthContext\"\xc4\x02\n" +
"&TrMythicC2ToCustomMessageFormatMessage\x12:\n" +
"\x18TranslationContainerName\x18\x01 \x01(\tR\x18TranslationContainerName\x12\x16\n" +
"\x06C2Name\x18\x02 \x01(\tR\x06C2Name\x12\x18\n" +
"\aMessage\x18\x03 \x01(\fR\aMessage\x12\x12\n" +
"\x04UUID\x18\x04 \x01(\tR\x04UUID\x12&\n" +
"\x0eMythicEncrypts\x18\x05 \x01(\bR\x0eMythicEncrypts\x12N\n" +
"\n" +
"CryptoKeys\x18\x06 \x03(\v2..translationContainerServices.CryptoKeysFormatR\n" +
"CryptoKeys\x12 \n" +
"\vAuthContext\x18\a \x01(\tR\vAuthContext\"\xd8\x01\n" +
".TrMythicC2ToCustomMessageFormatMessageResponse\x12\x18\n" +
"\aSuccess\x18\x01 \x01(\bR\aSuccess\x12\x14\n" +
"\x05Error\x18\x02 \x01(\tR\x05Error\x12\x18\n" +
"\aMessage\x18\x03 \x01(\fR\aMessage\x12:\n" +
"\x18TranslationContainerName\x18\x04 \x01(\tR\x18TranslationContainerName\x12 \n" +
"\vAuthContext\x18\x05 \x01(\tR\vAuthContext\"\xed\x01\n" +
"\x1fTrGenerateEncryptionKeysMessage\x12:\n" +
"\x18TranslationContainerName\x18\x01 \x01(\tR\x18TranslationContainerName\x12\x16\n" +
"\x06C2Name\x18\x02 \x01(\tR\x06C2Name\x12*\n" +
"\x10CryptoParamValue\x18\x03 \x01(\tR\x10CryptoParamValue\x12(\n" +
"\x0fCryptoParamName\x18\x04 \x01(\tR\x0fCryptoParamName\x12 \n" +
"\vAuthContext\x18\x05 \x01(\tR\vAuthContext\"\x83\x02\n" +
"'TrGenerateEncryptionKeysMessageResponse\x12\x18\n" +
"\aSuccess\x18\x01 \x01(\bR\aSuccess\x12\x14\n" +
"\x05Error\x18\x02 \x01(\tR\x05Error\x12$\n" +
"\rEncryptionKey\x18\x03 \x01(\fR\rEncryptionKey\x12$\n" +
"\rDecryptionKey\x18\x04 \x01(\fR\rDecryptionKey\x12:\n" +
"\x18TranslationContainerName\x18\x05 \x01(\tR\x18TranslationContainerName\x12 \n" +
"\vAuthContext\x18\x06 \x01(\tR\vAuthContext2\xbd\x04\n" +
"\x14TranslationContainer\x12\xbd\x01\n" +
"!TranslateFromCustomToMythicFormat\x12L.translationContainerServices.TrCustomMessageToMythicC2FormatMessageResponse\x1aD.translationContainerServices.TrCustomMessageToMythicC2FormatMessage\"\x00(\x010\x01\x12\xbd\x01\n" +
"!TranslateFromMythicToCustomFormat\x12L.translationContainerServices.TrMythicC2ToCustomMessageFormatMessageResponse\x1aD.translationContainerServices.TrMythicC2ToCustomMessageFormatMessage\"\x00(\x010\x01\x12\xa4\x01\n" +
"\x16GenerateEncryptionKeys\x12E.translationContainerServices.TrGenerateEncryptionKeysMessageResponse\x1a=.translationContainerServices.TrGenerateEncryptionKeysMessage\"\x00(\x010\x01B/Z-github.com/its-a-feature/Mythic/grpc/servicesb\x06proto3"
var (
file_translationContainerGRPC_proto_rawDescOnce sync.Once
file_translationContainerGRPC_proto_rawDescData = file_translationContainerGRPC_proto_rawDesc
file_translationContainerGRPC_proto_rawDescData []byte
)
func file_translationContainerGRPC_proto_rawDescGZIP() []byte {
file_translationContainerGRPC_proto_rawDescOnce.Do(func() {
file_translationContainerGRPC_proto_rawDescData = protoimpl.X.CompressGZIP(file_translationContainerGRPC_proto_rawDescData)
file_translationContainerGRPC_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_translationContainerGRPC_proto_rawDesc), len(file_translationContainerGRPC_proto_rawDesc)))
})
return file_translationContainerGRPC_proto_rawDescData
}
var file_translationContainerGRPC_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
var file_translationContainerGRPC_proto_goTypes = []interface{}{
var file_translationContainerGRPC_proto_goTypes = []any{
(*TrCustomMessageToMythicC2FormatMessage)(nil), // 0: translationContainerServices.TrCustomMessageToMythicC2FormatMessage
(*CryptoKeysFormat)(nil), // 1: translationContainerServices.CryptoKeysFormat
(*TrCustomMessageToMythicC2FormatMessageResponse)(nil), // 2: translationContainerServices.TrCustomMessageToMythicC2FormatMessageResponse
@@ -733,97 +688,11 @@ func file_translationContainerGRPC_proto_init() {
if File_translationContainerGRPC_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_translationContainerGRPC_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TrCustomMessageToMythicC2FormatMessage); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_translationContainerGRPC_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CryptoKeysFormat); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_translationContainerGRPC_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TrCustomMessageToMythicC2FormatMessageResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_translationContainerGRPC_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TrMythicC2ToCustomMessageFormatMessage); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_translationContainerGRPC_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TrMythicC2ToCustomMessageFormatMessageResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_translationContainerGRPC_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TrGenerateEncryptionKeysMessage); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_translationContainerGRPC_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TrGenerateEncryptionKeysMessageResponse); 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{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_translationContainerGRPC_proto_rawDesc,
RawDescriptor: unsafe.Slice(unsafe.StringData(file_translationContainerGRPC_proto_rawDesc), len(file_translationContainerGRPC_proto_rawDesc)),
NumEnums: 0,
NumMessages: 7,
NumExtensions: 0,
@@ -834,7 +703,6 @@ func file_translationContainerGRPC_proto_init() {
MessageInfos: file_translationContainerGRPC_proto_msgTypes,
}.Build()
File_translationContainerGRPC_proto = out.File
file_translationContainerGRPC_proto_rawDesc = nil
file_translationContainerGRPC_proto_goTypes = nil
file_translationContainerGRPC_proto_depIdxs = nil
}
@@ -19,44 +19,51 @@ message TrCustomMessageToMythicC2FormatMessage {
string UUID = 4;
bool MythicEncrypts = 5;
repeated CryptoKeysFormat CryptoKeys = 6;
string AuthContext = 7;
}
message CryptoKeysFormat {
bytes EncKey = 1;
bytes DecKey = 2;
string Value = 3;
string Location = 4;
}
message TrCustomMessageToMythicC2FormatMessageResponse {
bool Success =1;
string Error =2;
bytes Message = 3;
string TranslationContainerName = 4;
bool Success =1;
string Error =2;
bytes Message = 3;
string TranslationContainerName = 4;
string AuthContext = 5;
}
message TrMythicC2ToCustomMessageFormatMessage {
string TranslationContainerName =1;
string C2Name =2;
bytes Message = 3;
string UUID =4;
bool MythicEncrypts =5;
repeated CryptoKeysFormat CryptoKeys =6;
string TranslationContainerName =1;
string C2Name =2;
bytes Message = 3;
string UUID =4;
bool MythicEncrypts =5;
repeated CryptoKeysFormat CryptoKeys =6;
string AuthContext =7;
}
message TrMythicC2ToCustomMessageFormatMessageResponse {
bool Success =1;
string Error =2;
bytes Message =3;
string TranslationContainerName = 4;
bool Success =1;
string Error =2;
bytes Message =3;
string TranslationContainerName = 4;
string AuthContext =5;
}
message TrGenerateEncryptionKeysMessage {
string TranslationContainerName =1;
string C2Name =2;
string CryptoParamValue =3;
string CryptoParamName =4;
string TranslationContainerName =1;
string C2Name =2;
string CryptoParamValue =3;
string CryptoParamName =4;
string AuthContext =5;
}
message TrGenerateEncryptionKeysMessageResponse {
bool Success =1;
string Error =2;
bytes EncryptionKey =3;
bytes DecryptionKey =4;
string TranslationContainerName = 5;
bool Success =1;
string Error =2;
bytes EncryptionKey =3;
bytes DecryptionKey =4;
string TranslationContainerName = 5;
string AuthContext =6;
}
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc v3.21.12
// - protoc-gen-go-grpc v1.5.1
// - protoc v6.33.0
// source: translationContainerGRPC.proto
package services
@@ -15,8 +15,14 @@ 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.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
TranslationContainer_TranslateFromCustomToMythicFormat_FullMethodName = "/translationContainerServices.TranslationContainer/TranslateFromCustomToMythicFormat"
TranslationContainer_TranslateFromMythicToCustomFormat_FullMethodName = "/translationContainerServices.TranslationContainer/TranslateFromMythicToCustomFormat"
TranslationContainer_GenerateEncryptionKeys_FullMethodName = "/translationContainerServices.TranslationContainer/GenerateEncryptionKeys"
)
// TranslationContainerClient is the client API for TranslationContainer service.
//
@@ -24,9 +30,9 @@ const _ = grpc.SupportPackageIsVersion7
type TranslationContainerClient interface {
// rpc function(messageFromClient) messageToClient
// all of these functions start off by sending messageToClient and getting the result back
TranslateFromCustomToMythicFormat(ctx context.Context, opts ...grpc.CallOption) (TranslationContainer_TranslateFromCustomToMythicFormatClient, error)
TranslateFromMythicToCustomFormat(ctx context.Context, opts ...grpc.CallOption) (TranslationContainer_TranslateFromMythicToCustomFormatClient, error)
GenerateEncryptionKeys(ctx context.Context, opts ...grpc.CallOption) (TranslationContainer_GenerateEncryptionKeysClient, error)
TranslateFromCustomToMythicFormat(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[TrCustomMessageToMythicC2FormatMessageResponse, TrCustomMessageToMythicC2FormatMessage], error)
TranslateFromMythicToCustomFormat(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[TrMythicC2ToCustomMessageFormatMessageResponse, TrMythicC2ToCustomMessageFormatMessage], error)
GenerateEncryptionKeys(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[TrGenerateEncryptionKeysMessageResponse, TrGenerateEncryptionKeysMessage], error)
}
type translationContainerClient struct {
@@ -37,125 +43,75 @@ func NewTranslationContainerClient(cc grpc.ClientConnInterface) TranslationConta
return &translationContainerClient{cc}
}
func (c *translationContainerClient) TranslateFromCustomToMythicFormat(ctx context.Context, opts ...grpc.CallOption) (TranslationContainer_TranslateFromCustomToMythicFormatClient, error) {
stream, err := c.cc.NewStream(ctx, &TranslationContainer_ServiceDesc.Streams[0], "/translationContainerServices.TranslationContainer/TranslateFromCustomToMythicFormat", opts...)
func (c *translationContainerClient) TranslateFromCustomToMythicFormat(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[TrCustomMessageToMythicC2FormatMessageResponse, TrCustomMessageToMythicC2FormatMessage], error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
stream, err := c.cc.NewStream(ctx, &TranslationContainer_ServiceDesc.Streams[0], TranslationContainer_TranslateFromCustomToMythicFormat_FullMethodName, cOpts...)
if err != nil {
return nil, err
}
x := &translationContainerTranslateFromCustomToMythicFormatClient{stream}
x := &grpc.GenericClientStream[TrCustomMessageToMythicC2FormatMessageResponse, TrCustomMessageToMythicC2FormatMessage]{ClientStream: stream}
return x, nil
}
type TranslationContainer_TranslateFromCustomToMythicFormatClient interface {
Send(*TrCustomMessageToMythicC2FormatMessageResponse) error
Recv() (*TrCustomMessageToMythicC2FormatMessage, error)
grpc.ClientStream
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type TranslationContainer_TranslateFromCustomToMythicFormatClient = grpc.BidiStreamingClient[TrCustomMessageToMythicC2FormatMessageResponse, TrCustomMessageToMythicC2FormatMessage]
type translationContainerTranslateFromCustomToMythicFormatClient struct {
grpc.ClientStream
}
func (x *translationContainerTranslateFromCustomToMythicFormatClient) Send(m *TrCustomMessageToMythicC2FormatMessageResponse) error {
return x.ClientStream.SendMsg(m)
}
func (x *translationContainerTranslateFromCustomToMythicFormatClient) Recv() (*TrCustomMessageToMythicC2FormatMessage, error) {
m := new(TrCustomMessageToMythicC2FormatMessage)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func (c *translationContainerClient) TranslateFromMythicToCustomFormat(ctx context.Context, opts ...grpc.CallOption) (TranslationContainer_TranslateFromMythicToCustomFormatClient, error) {
stream, err := c.cc.NewStream(ctx, &TranslationContainer_ServiceDesc.Streams[1], "/translationContainerServices.TranslationContainer/TranslateFromMythicToCustomFormat", opts...)
func (c *translationContainerClient) TranslateFromMythicToCustomFormat(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[TrMythicC2ToCustomMessageFormatMessageResponse, TrMythicC2ToCustomMessageFormatMessage], error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
stream, err := c.cc.NewStream(ctx, &TranslationContainer_ServiceDesc.Streams[1], TranslationContainer_TranslateFromMythicToCustomFormat_FullMethodName, cOpts...)
if err != nil {
return nil, err
}
x := &translationContainerTranslateFromMythicToCustomFormatClient{stream}
x := &grpc.GenericClientStream[TrMythicC2ToCustomMessageFormatMessageResponse, TrMythicC2ToCustomMessageFormatMessage]{ClientStream: stream}
return x, nil
}
type TranslationContainer_TranslateFromMythicToCustomFormatClient interface {
Send(*TrMythicC2ToCustomMessageFormatMessageResponse) error
Recv() (*TrMythicC2ToCustomMessageFormatMessage, error)
grpc.ClientStream
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type TranslationContainer_TranslateFromMythicToCustomFormatClient = grpc.BidiStreamingClient[TrMythicC2ToCustomMessageFormatMessageResponse, TrMythicC2ToCustomMessageFormatMessage]
type translationContainerTranslateFromMythicToCustomFormatClient struct {
grpc.ClientStream
}
func (x *translationContainerTranslateFromMythicToCustomFormatClient) Send(m *TrMythicC2ToCustomMessageFormatMessageResponse) error {
return x.ClientStream.SendMsg(m)
}
func (x *translationContainerTranslateFromMythicToCustomFormatClient) Recv() (*TrMythicC2ToCustomMessageFormatMessage, error) {
m := new(TrMythicC2ToCustomMessageFormatMessage)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func (c *translationContainerClient) GenerateEncryptionKeys(ctx context.Context, opts ...grpc.CallOption) (TranslationContainer_GenerateEncryptionKeysClient, error) {
stream, err := c.cc.NewStream(ctx, &TranslationContainer_ServiceDesc.Streams[2], "/translationContainerServices.TranslationContainer/GenerateEncryptionKeys", opts...)
func (c *translationContainerClient) GenerateEncryptionKeys(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[TrGenerateEncryptionKeysMessageResponse, TrGenerateEncryptionKeysMessage], error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
stream, err := c.cc.NewStream(ctx, &TranslationContainer_ServiceDesc.Streams[2], TranslationContainer_GenerateEncryptionKeys_FullMethodName, cOpts...)
if err != nil {
return nil, err
}
x := &translationContainerGenerateEncryptionKeysClient{stream}
x := &grpc.GenericClientStream[TrGenerateEncryptionKeysMessageResponse, TrGenerateEncryptionKeysMessage]{ClientStream: stream}
return x, nil
}
type TranslationContainer_GenerateEncryptionKeysClient interface {
Send(*TrGenerateEncryptionKeysMessageResponse) error
Recv() (*TrGenerateEncryptionKeysMessage, error)
grpc.ClientStream
}
type translationContainerGenerateEncryptionKeysClient struct {
grpc.ClientStream
}
func (x *translationContainerGenerateEncryptionKeysClient) Send(m *TrGenerateEncryptionKeysMessageResponse) error {
return x.ClientStream.SendMsg(m)
}
func (x *translationContainerGenerateEncryptionKeysClient) Recv() (*TrGenerateEncryptionKeysMessage, error) {
m := new(TrGenerateEncryptionKeysMessage)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type TranslationContainer_GenerateEncryptionKeysClient = grpc.BidiStreamingClient[TrGenerateEncryptionKeysMessageResponse, TrGenerateEncryptionKeysMessage]
// TranslationContainerServer is the server API for TranslationContainer service.
// All implementations must embed UnimplementedTranslationContainerServer
// for forward compatibility
// for forward compatibility.
type TranslationContainerServer interface {
// rpc function(messageFromClient) messageToClient
// all of these functions start off by sending messageToClient and getting the result back
TranslateFromCustomToMythicFormat(TranslationContainer_TranslateFromCustomToMythicFormatServer) error
TranslateFromMythicToCustomFormat(TranslationContainer_TranslateFromMythicToCustomFormatServer) error
GenerateEncryptionKeys(TranslationContainer_GenerateEncryptionKeysServer) error
TranslateFromCustomToMythicFormat(grpc.BidiStreamingServer[TrCustomMessageToMythicC2FormatMessageResponse, TrCustomMessageToMythicC2FormatMessage]) error
TranslateFromMythicToCustomFormat(grpc.BidiStreamingServer[TrMythicC2ToCustomMessageFormatMessageResponse, TrMythicC2ToCustomMessageFormatMessage]) error
GenerateEncryptionKeys(grpc.BidiStreamingServer[TrGenerateEncryptionKeysMessageResponse, TrGenerateEncryptionKeysMessage]) error
mustEmbedUnimplementedTranslationContainerServer()
}
// UnimplementedTranslationContainerServer must be embedded to have forward compatible implementations.
type UnimplementedTranslationContainerServer struct {
}
// UnimplementedTranslationContainerServer 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 UnimplementedTranslationContainerServer struct{}
func (UnimplementedTranslationContainerServer) TranslateFromCustomToMythicFormat(TranslationContainer_TranslateFromCustomToMythicFormatServer) error {
func (UnimplementedTranslationContainerServer) TranslateFromCustomToMythicFormat(grpc.BidiStreamingServer[TrCustomMessageToMythicC2FormatMessageResponse, TrCustomMessageToMythicC2FormatMessage]) error {
return status.Errorf(codes.Unimplemented, "method TranslateFromCustomToMythicFormat not implemented")
}
func (UnimplementedTranslationContainerServer) TranslateFromMythicToCustomFormat(TranslationContainer_TranslateFromMythicToCustomFormatServer) error {
func (UnimplementedTranslationContainerServer) TranslateFromMythicToCustomFormat(grpc.BidiStreamingServer[TrMythicC2ToCustomMessageFormatMessageResponse, TrMythicC2ToCustomMessageFormatMessage]) error {
return status.Errorf(codes.Unimplemented, "method TranslateFromMythicToCustomFormat not implemented")
}
func (UnimplementedTranslationContainerServer) GenerateEncryptionKeys(TranslationContainer_GenerateEncryptionKeysServer) error {
func (UnimplementedTranslationContainerServer) GenerateEncryptionKeys(grpc.BidiStreamingServer[TrGenerateEncryptionKeysMessageResponse, TrGenerateEncryptionKeysMessage]) error {
return status.Errorf(codes.Unimplemented, "method GenerateEncryptionKeys not implemented")
}
func (UnimplementedTranslationContainerServer) mustEmbedUnimplementedTranslationContainerServer() {}
func (UnimplementedTranslationContainerServer) testEmbeddedByValue() {}
// UnsafeTranslationContainerServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to TranslationContainerServer will
@@ -165,86 +121,36 @@ type UnsafeTranslationContainerServer interface {
}
func RegisterTranslationContainerServer(s grpc.ServiceRegistrar, srv TranslationContainerServer) {
// If the following call pancis, it indicates UnimplementedTranslationContainerServer 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(&TranslationContainer_ServiceDesc, srv)
}
func _TranslationContainer_TranslateFromCustomToMythicFormat_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(TranslationContainerServer).TranslateFromCustomToMythicFormat(&translationContainerTranslateFromCustomToMythicFormatServer{stream})
return srv.(TranslationContainerServer).TranslateFromCustomToMythicFormat(&grpc.GenericServerStream[TrCustomMessageToMythicC2FormatMessageResponse, TrCustomMessageToMythicC2FormatMessage]{ServerStream: stream})
}
type TranslationContainer_TranslateFromCustomToMythicFormatServer interface {
Send(*TrCustomMessageToMythicC2FormatMessage) error
Recv() (*TrCustomMessageToMythicC2FormatMessageResponse, error)
grpc.ServerStream
}
type translationContainerTranslateFromCustomToMythicFormatServer struct {
grpc.ServerStream
}
func (x *translationContainerTranslateFromCustomToMythicFormatServer) Send(m *TrCustomMessageToMythicC2FormatMessage) error {
return x.ServerStream.SendMsg(m)
}
func (x *translationContainerTranslateFromCustomToMythicFormatServer) Recv() (*TrCustomMessageToMythicC2FormatMessageResponse, error) {
m := new(TrCustomMessageToMythicC2FormatMessageResponse)
if err := x.ServerStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type TranslationContainer_TranslateFromCustomToMythicFormatServer = grpc.BidiStreamingServer[TrCustomMessageToMythicC2FormatMessageResponse, TrCustomMessageToMythicC2FormatMessage]
func _TranslationContainer_TranslateFromMythicToCustomFormat_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(TranslationContainerServer).TranslateFromMythicToCustomFormat(&translationContainerTranslateFromMythicToCustomFormatServer{stream})
return srv.(TranslationContainerServer).TranslateFromMythicToCustomFormat(&grpc.GenericServerStream[TrMythicC2ToCustomMessageFormatMessageResponse, TrMythicC2ToCustomMessageFormatMessage]{ServerStream: stream})
}
type TranslationContainer_TranslateFromMythicToCustomFormatServer interface {
Send(*TrMythicC2ToCustomMessageFormatMessage) error
Recv() (*TrMythicC2ToCustomMessageFormatMessageResponse, error)
grpc.ServerStream
}
type translationContainerTranslateFromMythicToCustomFormatServer struct {
grpc.ServerStream
}
func (x *translationContainerTranslateFromMythicToCustomFormatServer) Send(m *TrMythicC2ToCustomMessageFormatMessage) error {
return x.ServerStream.SendMsg(m)
}
func (x *translationContainerTranslateFromMythicToCustomFormatServer) Recv() (*TrMythicC2ToCustomMessageFormatMessageResponse, error) {
m := new(TrMythicC2ToCustomMessageFormatMessageResponse)
if err := x.ServerStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type TranslationContainer_TranslateFromMythicToCustomFormatServer = grpc.BidiStreamingServer[TrMythicC2ToCustomMessageFormatMessageResponse, TrMythicC2ToCustomMessageFormatMessage]
func _TranslationContainer_GenerateEncryptionKeys_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(TranslationContainerServer).GenerateEncryptionKeys(&translationContainerGenerateEncryptionKeysServer{stream})
return srv.(TranslationContainerServer).GenerateEncryptionKeys(&grpc.GenericServerStream[TrGenerateEncryptionKeysMessageResponse, TrGenerateEncryptionKeysMessage]{ServerStream: stream})
}
type TranslationContainer_GenerateEncryptionKeysServer interface {
Send(*TrGenerateEncryptionKeysMessage) error
Recv() (*TrGenerateEncryptionKeysMessageResponse, error)
grpc.ServerStream
}
type translationContainerGenerateEncryptionKeysServer struct {
grpc.ServerStream
}
func (x *translationContainerGenerateEncryptionKeysServer) Send(m *TrGenerateEncryptionKeysMessage) error {
return x.ServerStream.SendMsg(m)
}
func (x *translationContainerGenerateEncryptionKeysServer) Recv() (*TrGenerateEncryptionKeysMessageResponse, error) {
m := new(TrGenerateEncryptionKeysMessageResponse)
if err := x.ServerStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type TranslationContainer_GenerateEncryptionKeysServer = grpc.BidiStreamingServer[TrGenerateEncryptionKeysMessageResponse, TrGenerateEncryptionKeysMessage]
// TranslationContainer_ServiceDesc is the grpc.ServiceDesc for TranslationContainer service.
// It's only intended for direct use with grpc.RegisterService,
@@ -48,6 +48,7 @@ func (t *translationContainerServer) TranslateFromCustomToMythicFormat(stream se
Success: false,
Error: err.Error(),
TranslationContainerName: clientName,
AuthContext: msgToSend.GetAuthContext(),
}:
case <-time.After(t.GetChannelTimeout()):
logging.LogError(errors.New("timeout sending to channel"), "gRPC stream connection needs to exit due to timeouts")
@@ -64,6 +65,7 @@ func (t *translationContainerServer) TranslateFromCustomToMythicFormat(stream se
Success: false,
Error: err.Error(),
TranslationContainerName: clientName,
AuthContext: msgToSend.GetAuthContext(),
}:
case <-time.After(t.GetChannelTimeout()):
logging.LogError(errors.New("timeout sending to channel"), "gRPC stream connection needs to exit due to timeouts")
@@ -79,6 +81,7 @@ func (t *translationContainerServer) TranslateFromCustomToMythicFormat(stream se
Success: false,
Error: err.Error(),
TranslationContainerName: clientName,
AuthContext: msgToSend.GetAuthContext(),
}:
case <-time.After(t.GetChannelTimeout()):
logging.LogError(errors.New("timeout sending to channel"), "gRPC stream connection needs to exit due to timeouts")
@@ -48,6 +48,7 @@ func (t *translationContainerServer) TranslateFromMythicToCustomFormat(stream se
Success: false,
Error: err.Error(),
TranslationContainerName: clientName,
AuthContext: msgToSend.GetAuthContext(),
}:
case <-time.After(t.GetChannelTimeout()):
logging.LogError(errors.New("timeout sending to channel"), "gRPC stream connection needs to exit due to timeouts")
@@ -63,6 +64,7 @@ func (t *translationContainerServer) TranslateFromMythicToCustomFormat(stream se
Success: false,
Error: err.Error(),
TranslationContainerName: clientName,
AuthContext: msgToSend.GetAuthContext(),
}:
case <-time.After(t.GetChannelTimeout()):
logging.LogError(errors.New("timeout sending to channel"), "gRPC stream connection needs to exit due to timeouts")
@@ -78,6 +80,7 @@ func (t *translationContainerServer) TranslateFromMythicToCustomFormat(stream se
Success: false,
Error: err.Error(),
TranslationContainerName: clientName,
AuthContext: msgToSend.GetAuthContext(),
}:
case <-time.After(t.GetChannelTimeout()):
logging.LogError(errors.New("timeout sending to channel"), "gRPC stream connection needs to exit due to timeouts")
@@ -152,7 +152,7 @@ func processMythicRPCPayloadCreateFromUUID(msg amqp.Delivery) interface{} {
return MythicRPCPayloadCreateFromUUID(incomingMessage, authContext)
}
func associateBuildParametersWithPayload(databasePayload databaseStructs.Payload, buildParameters *[]PayloadConfigurationBuildParameter) (map[string]interface{}, error) {
func associateBuildParametersWithPayload(databasePayload databaseStructs.Payload, buildParameters *[]PayloadConfigurationBuildParameter, authContext RabbitMQAuthContext) (map[string]interface{}, error) {
logging.LogDebug("about to associate build parameters with payload", "buildParametersFromPayloadConfig", buildParameters)
if buildParameters == nil {
return nil, nil
@@ -220,36 +220,37 @@ func associateBuildParametersWithPayload(databasePayload databaseStructs.Payload
}
if databaseBuildParameter.IsCryptoType {
if databasePayload.Payloadtype.TranslationContainerID.Valid && !databasePayload.Payloadtype.MythicEncrypts {
if cryptoKeysResponse, err := RabbitMQConnection.SendTrRPCGenerateEncryptionKeys(TrGenerateEncryptionKeysMessage{
cryptoKeysResponse, err := RabbitMQConnection.SendTrRPCGenerateEncryptionKeys(TrGenerateEncryptionKeysMessage{
TranslationContainerName: databasePayload.Payloadtype.Translationcontainer.Name,
C2Name: "",
CryptoParamValue: finalBuildParameters[databaseBuildParameter.Name],
CryptoParamName: databaseBuildParameter.Name,
}); err != nil {
}, authContext)
if err != nil {
logging.LogError(err, "Failed to contact translation container to generate crypto keys")
return nil, errors.New(fmt.Sprintf("failed to contact translation container, %s, to generate encryption keys:\n %s", databasePayload.Payloadtype.Translationcontainer.Name, err.Error()))
} else if !cryptoKeysResponse.Success {
}
if !cryptoKeysResponse.Success {
logging.LogError(errors.New(cryptoKeysResponse.Error), "Failed to have translation container successfully generate keys")
return nil, errors.New(fmt.Sprintf("failed to have translation container, %s, to successfully generate keys:\n %s", databasePayload.Payloadtype.Translationcontainer.Name, cryptoKeysResponse.Error))
} else {
if cryptoKeysResponse.EncryptionKey != nil {
databaseBuildParameterInstance.EncKey = cryptoKeysResponse.EncryptionKey
}
if cryptoKeysResponse.DecryptionKey != nil {
databaseBuildParameterInstance.DecKey = cryptoKeysResponse.DecryptionKey
}
}
if cryptoKeysResponse.EncryptionKey != nil {
databaseBuildParameterInstance.EncKey = cryptoKeysResponse.EncryptionKey
}
if cryptoKeysResponse.DecryptionKey != nil {
databaseBuildParameterInstance.DecKey = cryptoKeysResponse.DecryptionKey
}
} else {
if cryptoKeys, err := mythicCrypto.GenerateKeysForPayload(finalBuildParameters[databaseBuildParameter.Name]); err != nil {
cryptoKeys, err := mythicCrypto.GenerateKeysForPayload(finalBuildParameters[databaseBuildParameter.Name])
if err != nil {
logging.LogError(err, "Failed to generate crypto keys for payload")
return nil, err
} else {
if cryptoKeys.EncKey != nil {
databaseBuildParameterInstance.EncKey = cryptoKeys.EncKey
}
if cryptoKeys.DecKey != nil {
databaseBuildParameterInstance.DecKey = cryptoKeys.DecKey
}
}
if cryptoKeys.EncKey != nil {
databaseBuildParameterInstance.EncKey = cryptoKeys.EncKey
}
if cryptoKeys.DecKey != nil {
databaseBuildParameterInstance.DecKey = cryptoKeys.DecKey
}
}
}
@@ -277,7 +278,7 @@ func associateBuildParametersWithPayload(databasePayload databaseStructs.Payload
return returnBuildParameters, nil
}
func associateC2ProfilesWithPayload(databasePayload databaseStructs.Payload, c2Profiles *[]PayloadConfigurationC2Profile) ([]PayloadBuildC2Profile, error) {
func associateC2ProfilesWithPayload(databasePayload databaseStructs.Payload, c2Profiles *[]PayloadConfigurationC2Profile, authContext RabbitMQAuthContext) ([]PayloadBuildC2Profile, error) {
// associate c2 profiles and their parameters with the payload
if c2Profiles == nil {
return nil, errors.New("Creating a Payload without any C2 Profiles")
@@ -415,39 +416,39 @@ func associateC2ProfilesWithPayload(databasePayload databaseStructs.Payload, c2P
c2ParameterInstance.OperationID.Int64 = int64(databasePayload.OperationID)
if databaseC2ProfileParameter.IsCryptoType {
if databasePayload.Payloadtype.TranslationContainerID.Valid && !databasePayload.Payloadtype.MythicEncrypts {
if cryptoKeysResponse, err := RabbitMQConnection.SendTrRPCGenerateEncryptionKeys(TrGenerateEncryptionKeysMessage{
cryptoKeysResponse, err := RabbitMQConnection.SendTrRPCGenerateEncryptionKeys(TrGenerateEncryptionKeysMessage{
TranslationContainerName: databasePayload.Payloadtype.Translationcontainer.Name,
C2Name: "",
CryptoParamValue: paramStringVal,
CryptoParamName: databaseC2ProfileParameter.Name,
}); err != nil {
}, authContext)
if err != nil {
logging.LogError(err, "Failed to contact translation container to generate crypto keys")
return nil, errors.New(fmt.Sprintf("failed to contact translation container, %s, to generate encryption keys:\n %s", databasePayload.Payloadtype.Translationcontainer.Name, err.Error()))
} else if !cryptoKeysResponse.Success {
}
if !cryptoKeysResponse.Success {
logging.LogError(errors.New(cryptoKeysResponse.Error), "Failed to have translation container successfully generate keys")
return nil, errors.New(fmt.Sprintf("failed to have translation container, %s, to successfully generate keys:\n %s", databasePayload.Payloadtype.Translationcontainer.Name, cryptoKeysResponse.Error))
} else {
if cryptoKeysResponse.EncryptionKey != nil {
c2ParameterInstance.EncKey = cryptoKeysResponse.EncryptionKey
}
if cryptoKeysResponse.DecryptionKey != nil {
c2ParameterInstance.DecKey = cryptoKeysResponse.DecryptionKey
}
}
if cryptoKeysResponse.EncryptionKey != nil {
c2ParameterInstance.EncKey = cryptoKeysResponse.EncryptionKey
}
if cryptoKeysResponse.DecryptionKey != nil {
c2ParameterInstance.DecKey = cryptoKeysResponse.DecryptionKey
}
} else {
if cryptoKeys, err := mythicCrypto.GenerateKeysForPayload(paramStringVal); err != nil {
cryptoKeys, err := mythicCrypto.GenerateKeysForPayload(paramStringVal)
if err != nil {
logging.LogError(err, "Failed to generate crypto keys for payload", "value", paramStringVal, "name", databaseC2ProfileParameter.Name)
return nil, err
} else {
if cryptoKeys.EncKey != nil {
c2ParameterInstance.EncKey = cryptoKeys.EncKey
}
if cryptoKeys.DecKey != nil {
c2ParameterInstance.DecKey = cryptoKeys.DecKey
}
}
if cryptoKeys.EncKey != nil {
c2ParameterInstance.EncKey = cryptoKeys.EncKey
}
if cryptoKeys.DecKey != nil {
c2ParameterInstance.DecKey = cryptoKeys.DecKey
}
}
}
interfaceParam, err := GetInterfaceValueForContainer(
databaseC2ProfileParameter.ParameterType,
@@ -157,7 +157,7 @@ func RegisterNewPayload(payloadDefinition PayloadConfiguration, operatorOperatio
}
go func() {
// now that we have a payload, we need to handle adding build parameters
buildParameters, err := associateBuildParametersWithPayload(databasePayload, payloadDefinition.BuildParameters)
buildParameters, err := associateBuildParametersWithPayload(databasePayload, payloadDefinition.BuildParameters, authContext)
if err != nil {
logging.LogError(err, "Failed to associate build parameters with new payload")
database.UpdatePayloadWithError(databasePayload, err)
@@ -165,7 +165,7 @@ func RegisterNewPayload(payloadDefinition PayloadConfiguration, operatorOperatio
}
// if this isn't a wrapper payload, we need to handle c2 profiles and commands
if !payloadtype.Wrapper {
c2Profiles, err := associateC2ProfilesWithPayload(databasePayload, payloadDefinition.C2Profiles)
c2Profiles, err := associateC2ProfilesWithPayload(databasePayload, payloadDefinition.C2Profiles, authContext)
if err != nil {
logging.LogError(err, "Failed to associated C2 Profiles with Payload", "c2_profiles", payloadDefinition.C2Profiles)
database.UpdatePayloadWithError(databasePayload, err)
@@ -4,9 +4,10 @@ import (
"encoding/json"
"errors"
"fmt"
"time"
"github.com/its-a-feature/Mythic/grpc"
"github.com/its-a-feature/Mythic/grpc/services"
"time"
mythicCrypto "github.com/its-a-feature/Mythic/crypto"
"github.com/its-a-feature/Mythic/logging"
@@ -29,20 +30,29 @@ type TrCustomMessageToMythicC2FormatMessageResponse struct {
Message map[string]interface{} `json:"message"`
}
func (r *rabbitMQConnection) SendTrRPCCustomMessageToMythicC2(toMythicC2Format TrCustomMessageToMythicC2FormatMessage) (*TrCustomMessageToMythicC2FormatMessageResponse, error) {
func (r *rabbitMQConnection) SendTrRPCCustomMessageToMythicC2(toMythicC2Format TrCustomMessageToMythicC2FormatMessage, authContext RabbitMQAuthContext) (*TrCustomMessageToMythicC2FormatMessageResponse, error) {
trCustomMessageToMythicC2Format := TrCustomMessageToMythicC2FormatMessageResponse{}
authToken, err := GenerateRabbitMQAuthContextToken(authContext)
if err != nil {
logging.LogError(err, "Failed to generate auth context token for translation gRPC")
trCustomMessageToMythicC2Format.Success = false
trCustomMessageToMythicC2Format.Error = err.Error()
return &trCustomMessageToMythicC2Format, err
}
grpcSendMsg := services.TrCustomMessageToMythicC2FormatMessage{
TranslationContainerName: toMythicC2Format.TranslationContainerName,
C2Name: toMythicC2Format.C2Name,
Message: toMythicC2Format.Message,
UUID: toMythicC2Format.UUID,
MythicEncrypts: toMythicC2Format.MythicEncrypts,
AuthContext: authToken,
}
adjustedKeys := make([]*services.CryptoKeysFormat, len(toMythicC2Format.CryptoKeys))
for i := 0; i < len(toMythicC2Format.CryptoKeys); i++ {
newCrypto := services.CryptoKeysFormat{}
adjustedKeys[i] = &newCrypto
adjustedKeys[i].Value = toMythicC2Format.CryptoKeys[i].Value
adjustedKeys[i].Location = toMythicC2Format.CryptoKeys[i].Location
if toMythicC2Format.CryptoKeys[i].EncKey != nil {
adjustedKeys[i].EncKey = *toMythicC2Format.CryptoKeys[i].EncKey
}
@@ -69,48 +79,32 @@ func (r *rabbitMQConnection) SendTrRPCCustomMessageToMythicC2(toMythicC2Format T
if !ok {
logging.LogError(nil, "Failed to receive from translation container")
return nil, errors.New(fmt.Sprintf("failed to receive from translation container: %s", toMythicC2Format.TranslationContainerName))
} else {
if response.GetSuccess() {
responseMap := map[string]interface{}{}
if err := json.Unmarshal(response.Message, &responseMap); err != nil {
logging.LogError(err, "Failed to convert mythic message to json bytes ")
trCustomMessageToMythicC2Format.Success = false
trCustomMessageToMythicC2Format.Error = err.Error()
} else {
trCustomMessageToMythicC2Format.Message = responseMap
trCustomMessageToMythicC2Format.Success = response.GetSuccess()
trCustomMessageToMythicC2Format.Error = response.GetError()
}
}
err = ValidateRabbitMQAuthContextResponseToken(authToken, response.GetAuthContext())
if err != nil {
logging.LogError(err, "Failed to validate translation gRPC response auth context")
trCustomMessageToMythicC2Format.Success = false
trCustomMessageToMythicC2Format.Error = err.Error()
return &trCustomMessageToMythicC2Format, err
}
if response.GetSuccess() {
responseMap := map[string]interface{}{}
if err := json.Unmarshal(response.Message, &responseMap); err != nil {
logging.LogError(err, "Failed to convert mythic message to json bytes ")
trCustomMessageToMythicC2Format.Success = false
trCustomMessageToMythicC2Format.Error = err.Error()
} else {
trCustomMessageToMythicC2Format.Message = responseMap
trCustomMessageToMythicC2Format.Success = response.GetSuccess()
trCustomMessageToMythicC2Format.Error = response.GetError()
}
return &trCustomMessageToMythicC2Format, err
} else {
trCustomMessageToMythicC2Format.Success = response.GetSuccess()
trCustomMessageToMythicC2Format.Error = response.GetError()
}
return &trCustomMessageToMythicC2Format, err
case <-time.After(grpc.TranslationContainerServer.GetTimeout()):
logging.LogError(err, "timeout hit waiting to receive a message from the translation container")
return nil, errors.New(fmt.Sprintf("timeout hit waiting to receive message from the translation container: %s", toMythicC2Format.TranslationContainerName))
}
/*
exclusiveQueue := true
if opsecBytes, err := json.Marshal(toMythicC2Format); err != nil {
logging.LogError(err, "Failed to convert toMythicC2Format to JSON", "toMythicC2Format", toMythicC2Format)
return nil, err
} else if response, err := r.SendRPCMessage(
MYTHIC_EXCHANGE,
GetTrRPCConvertToMythicFormatRoutingKey(toMythicC2Format.TranslationContainerName),
opsecBytes,
!exclusiveQueue,
); err != nil {
logging.LogError(err, "Failed to send RPC message")
return nil, err
} else if err := json.Unmarshal(response, &trCustomMessageToMythicC2Format); err != nil {
logging.LogError(err, "Failed to parse tr custom message to mythic c2 response back to struct", "response", response)
return nil, err
} else {
return &trCustomMessageToMythicC2Format, nil
}
*/
}
@@ -3,10 +3,11 @@ package rabbitmq
import (
"errors"
"fmt"
"time"
"github.com/its-a-feature/Mythic/grpc"
"github.com/its-a-feature/Mythic/grpc/services"
"github.com/its-a-feature/Mythic/logging"
"time"
)
// TRANSLATION_CONTAINER_GENERATE_ENCRYPTION_KEYS STRUCTS
@@ -25,63 +26,57 @@ type TrGenerateEncryptionKeysMessageResponse struct {
DecryptionKey *[]byte `json:"dec_key"`
}
func (r *rabbitMQConnection) SendTrRPCGenerateEncryptionKeys(generateEncryptionKeys TrGenerateEncryptionKeysMessage) (*TrGenerateEncryptionKeysMessageResponse, error) {
func (r *rabbitMQConnection) SendTrRPCGenerateEncryptionKeys(generateEncryptionKeys TrGenerateEncryptionKeysMessage, authContext RabbitMQAuthContext) (*TrGenerateEncryptionKeysMessageResponse, error) {
trGenerateEncryptionKeysResponse := TrGenerateEncryptionKeysMessageResponse{}
authToken, err := GenerateRabbitMQAuthContextToken(authContext)
if err != nil {
logging.LogError(err, "Failed to generate auth context token for translation gRPC")
trGenerateEncryptionKeysResponse.Success = false
trGenerateEncryptionKeysResponse.Error = err.Error()
return &trGenerateEncryptionKeysResponse, err
}
grpcSendMsg := services.TrGenerateEncryptionKeysMessage{
TranslationContainerName: generateEncryptionKeys.TranslationContainerName,
C2Name: generateEncryptionKeys.C2Name,
CryptoParamValue: generateEncryptionKeys.CryptoParamValue,
CryptoParamName: generateEncryptionKeys.CryptoParamName,
AuthContext: authToken,
}
if sndMsgChan, rcvMsgChan, err := grpc.TranslationContainerServer.GetGenerateKeysChannels(generateEncryptionKeys.TranslationContainerName); err != nil {
sndMsgChan, rcvMsgChan, err := grpc.TranslationContainerServer.GetGenerateKeysChannels(generateEncryptionKeys.TranslationContainerName)
if err != nil {
logging.LogError(err, "Failed to get channels for grpc to generate encryption keys")
trGenerateEncryptionKeysResponse.Success = false
trGenerateEncryptionKeysResponse.Error = err.Error()
return &trGenerateEncryptionKeysResponse, err
} else {
select {
case sndMsgChan <- grpcSendMsg:
case <-time.After(grpc.TranslationContainerServer.GetTimeout()):
return nil, errors.New(fmt.Sprintf("timeout trying to send to translation container: %s", generateEncryptionKeys.TranslationContainerName))
}
select {
case response, ok := <-rcvMsgChan:
if !ok {
return nil, errors.New(fmt.Sprintf("failed to receive from translation container: %s", generateEncryptionKeys.TranslationContainerName))
} else {
if response.GetSuccess() {
encKey := response.GetEncryptionKey()
decKey := response.GetDecryptionKey()
trGenerateEncryptionKeysResponse.EncryptionKey = &encKey
trGenerateEncryptionKeysResponse.DecryptionKey = &decKey
}
trGenerateEncryptionKeysResponse.Success = response.GetSuccess()
trGenerateEncryptionKeysResponse.Error = response.GetError()
return &trGenerateEncryptionKeysResponse, nil
}
case <-time.After(grpc.TranslationContainerServer.GetTimeout()):
return nil, errors.New(fmt.Sprintf("timeout hit waiting to receive message from the translation container: %s", generateEncryptionKeys.TranslationContainerName))
}
}
/*exclusiveQueue := true
if opsecBytes, err := json.Marshal(generateEncryptionKeys); err != nil {
logging.LogError(err, "Failed to convert generateEncryptionKeys to JSON", "generateEncryptionKeys", generateEncryptionKeys)
return nil, err
} else if response, err := r.SendRPCMessage(
MYTHIC_EXCHANGE,
GetTrRPCGenerateKeysRoutingKey(generateEncryptionKeys.TranslationContainerName),
opsecBytes,
!exclusiveQueue,
); err != nil {
logging.LogError(err, "Failed to send RPC message")
return nil, err
} else if err := json.Unmarshal(response, &trGenerateEncryptionKeysResponse); err != nil {
logging.LogError(err, "Failed to parse tr generate encryption keys response back to struct", "response", response)
return nil, err
} else {
select {
case sndMsgChan <- grpcSendMsg:
case <-time.After(grpc.TranslationContainerServer.GetTimeout()):
return nil, errors.New(fmt.Sprintf("timeout trying to send to translation container: %s", generateEncryptionKeys.TranslationContainerName))
}
select {
case response, ok := <-rcvMsgChan:
if !ok {
return nil, errors.New(fmt.Sprintf("failed to receive from translation container: %s", generateEncryptionKeys.TranslationContainerName))
}
err = ValidateRabbitMQAuthContextResponseToken(authToken, response.GetAuthContext())
if err != nil {
logging.LogError(err, "Failed to validate translation gRPC response auth context")
trGenerateEncryptionKeysResponse.Success = false
trGenerateEncryptionKeysResponse.Error = err.Error()
return &trGenerateEncryptionKeysResponse, err
}
if response.GetSuccess() {
encKey := response.GetEncryptionKey()
decKey := response.GetDecryptionKey()
trGenerateEncryptionKeysResponse.EncryptionKey = &encKey
trGenerateEncryptionKeysResponse.DecryptionKey = &decKey
}
trGenerateEncryptionKeysResponse.Success = response.GetSuccess()
trGenerateEncryptionKeysResponse.Error = response.GetError()
return &trGenerateEncryptionKeysResponse, nil
case <-time.After(grpc.TranslationContainerServer.GetTimeout()):
return nil, errors.New(fmt.Sprintf("timeout hit waiting to receive message from the translation container: %s", generateEncryptionKeys.TranslationContainerName))
}
*/
}
@@ -4,9 +4,10 @@ import (
"encoding/json"
"errors"
"fmt"
"time"
"github.com/its-a-feature/Mythic/grpc"
"github.com/its-a-feature/Mythic/grpc/services"
"time"
mythicCrypto "github.com/its-a-feature/Mythic/crypto"
"github.com/its-a-feature/Mythic/logging"
@@ -29,13 +30,21 @@ type TrMythicC2ToCustomMessageFormatMessageResponse struct {
Message []byte `json:"message"`
}
func (r *rabbitMQConnection) SendTrRPCMythicC2ToCustomMessage(toCustomC2Format TrMythicC2ToCustomMessageFormatMessage) (*TrMythicC2ToCustomMessageFormatMessageResponse, error) {
func (r *rabbitMQConnection) SendTrRPCMythicC2ToCustomMessage(toCustomC2Format TrMythicC2ToCustomMessageFormatMessage, authContext RabbitMQAuthContext) (*TrMythicC2ToCustomMessageFormatMessageResponse, error) {
trMythicC2ToCustomMessageFormat := TrMythicC2ToCustomMessageFormatMessageResponse{}
authToken, err := GenerateRabbitMQAuthContextToken(authContext)
if err != nil {
logging.LogError(err, "Failed to generate auth context token for translation gRPC")
trMythicC2ToCustomMessageFormat.Success = false
trMythicC2ToCustomMessageFormat.Error = err.Error()
return &trMythicC2ToCustomMessageFormat, err
}
grpcSendMsg := services.TrMythicC2ToCustomMessageFormatMessage{
TranslationContainerName: toCustomC2Format.TranslationContainerName,
C2Name: toCustomC2Format.C2Name,
UUID: toCustomC2Format.UUID,
MythicEncrypts: toCustomC2Format.MythicEncrypts,
AuthContext: authToken,
}
if messageBytes, err := json.Marshal(toCustomC2Format.Message); err != nil {
logging.LogError(err, "Failed to convert mythic message to json bytes ")
@@ -50,6 +59,7 @@ func (r *rabbitMQConnection) SendTrRPCMythicC2ToCustomMessage(toCustomC2Format T
newCrypto := services.CryptoKeysFormat{}
adjustedKeys[i] = &newCrypto
adjustedKeys[i].Value = toCustomC2Format.CryptoKeys[i].Value
adjustedKeys[i].Location = toCustomC2Format.CryptoKeys[i].Location
if toCustomC2Format.CryptoKeys[i].EncKey != nil {
adjustedKeys[i].EncKey = *toCustomC2Format.CryptoKeys[i].EncKey
}
@@ -58,52 +68,37 @@ func (r *rabbitMQConnection) SendTrRPCMythicC2ToCustomMessage(toCustomC2Format T
}
}
grpcSendMsg.CryptoKeys = adjustedKeys
if sndMsgChan, rcvMsgChan, err := grpc.TranslationContainerServer.GetMythicToCustomChannels(toCustomC2Format.TranslationContainerName); err != nil {
sndMsgChan, rcvMsgChan, err := grpc.TranslationContainerServer.GetMythicToCustomChannels(toCustomC2Format.TranslationContainerName)
if err != nil {
logging.LogError(err, "Failed to get channels for grpc to generate encryption keys")
trMythicC2ToCustomMessageFormat.Success = false
trMythicC2ToCustomMessageFormat.Error = err.Error()
return &trMythicC2ToCustomMessageFormat, err
} else {
select {
case sndMsgChan <- grpcSendMsg:
case <-time.After(grpc.TranslationContainerServer.GetTimeout()):
return nil, errors.New(fmt.Sprintf("timeout trying to send to translation container: %s", toCustomC2Format.TranslationContainerName))
}
select {
case response, ok := <-rcvMsgChan:
if !ok {
logging.LogError(nil, "Failed to receive from translation container")
return nil, errors.New(fmt.Sprintf("failed to receive from translation container: %s", toCustomC2Format.TranslationContainerName))
} else {
trMythicC2ToCustomMessageFormat.Message = response.GetMessage()
trMythicC2ToCustomMessageFormat.Success = response.GetSuccess()
trMythicC2ToCustomMessageFormat.Error = response.GetError()
return &trMythicC2ToCustomMessageFormat, nil
}
case <-time.After(grpc.TranslationContainerServer.GetTimeout()):
logging.LogError(err, "timeout hit waiting to receive a message from the translation container")
return nil, errors.New(fmt.Sprintf("timeout hit waiting to receive message from the translation container: %s", toCustomC2Format.TranslationContainerName))
}
}
/*
exclusiveQueue := true
if opsecBytes, err := json.Marshal(toCustomC2Format); err != nil {
logging.LogError(err, "Failed to convert toCustomC2Format to JSON", "toCustomC2Format", toCustomC2Format)
return nil, err
} else if response, err := r.SendRPCMessage(
MYTHIC_EXCHANGE,
GetTrRPCConvertFromMythicFormatRoutingKey(toCustomC2Format.TranslationContainerName),
opsecBytes,
!exclusiveQueue,
); err != nil {
logging.LogError(err, "Failed to send RPC message")
return nil, err
} else if err := json.Unmarshal(response, &trMythicC2ToCustomMessageFormat); err != nil {
logging.LogError(err, "Failed to parse tr mythic c2 to custom message format response back to struct", "response", response)
return nil, err
} else {
return &trMythicC2ToCustomMessageFormat, nil
select {
case sndMsgChan <- grpcSendMsg:
case <-time.After(grpc.TranslationContainerServer.GetTimeout()):
return nil, errors.New(fmt.Sprintf("timeout trying to send to translation container: %s", toCustomC2Format.TranslationContainerName))
}
select {
case response, ok := <-rcvMsgChan:
if !ok {
logging.LogError(nil, "Failed to receive from translation container")
return nil, errors.New(fmt.Sprintf("failed to receive from translation container: %s", toCustomC2Format.TranslationContainerName))
}
*/
err = ValidateRabbitMQAuthContextResponseToken(authToken, response.GetAuthContext())
if err != nil {
logging.LogError(err, "Failed to validate translation gRPC response auth context")
trMythicC2ToCustomMessageFormat.Success = false
trMythicC2ToCustomMessageFormat.Error = err.Error()
return &trMythicC2ToCustomMessageFormat, err
}
trMythicC2ToCustomMessageFormat.Message = response.GetMessage()
trMythicC2ToCustomMessageFormat.Success = response.GetSuccess()
trMythicC2ToCustomMessageFormat.Error = response.GetError()
return &trMythicC2ToCustomMessageFormat, nil
case <-time.After(grpc.TranslationContainerServer.GetTimeout()):
logging.LogError(err, "timeout hit waiting to receive a message from the translation container")
return nil, errors.New(fmt.Sprintf("timeout hit waiting to receive message from the translation container: %s", toCustomC2Format.TranslationContainerName))
}
}
+117 -105
View File
@@ -43,6 +43,7 @@ type AgentMessageRawInput struct {
Base64Response bool
UpdateCheckinTime bool
TrackingID string
AuthContext RabbitMQAuthContext
}
type cachedUUIDInfo struct {
@@ -719,8 +720,9 @@ func recursiveProcessAgentMessage(agentMessageInput *AgentMessageRawInput) recur
instanceResponse.Err = errors.New("can't generate callback from payload")
return instanceResponse
}
messageProcessingAuthContext := getMessageProcessingAuthContext(uuidInfo, agentMessageInput.AuthContext)
decryptBytes := base64DecodedMessage[agentUUIDLength:totalBase64Bytes]
decryptedMessage, err := DecryptMessage(uuidInfo, &decryptBytes)
decryptedMessage, err := DecryptMessageWithAuthContext(uuidInfo, &decryptBytes, messageProcessingAuthContext)
if err != nil {
logging.LogError(err, "Failed to decrypt message and process as JSON")
errorMessage := fmt.Sprintf("Failed to decrypt message due to: %s\n", err.Error())
@@ -737,7 +739,7 @@ func recursiveProcessAgentMessage(agentMessageInput *AgentMessageRawInput) recur
return instanceResponse
}
if instanceResponse.Message == nil {
instanceResponse.Message, err = EncryptMessage(uuidInfo, instanceResponse.OuterUuid, response, true)
instanceResponse.Message, err = EncryptMessageWithAuthContext(uuidInfo, instanceResponse.OuterUuid, response, true, messageProcessingAuthContext)
if err != nil {
logging.LogError(err, "Failed to encrypt message in agent_message")
instanceResponse.Err = err
@@ -962,7 +964,18 @@ func LookupEncryptionData(c2profile string, messageUUID string, updateCheckinTim
return uuidInfo, nil
}
func DecryptMessage(uuidInfo *cachedUUIDInfo, agentMessage *[]byte) (map[string]interface{}, error) {
func getMessageProcessingAuthContext(uuidInfo *cachedUUIDInfo, authContext RabbitMQAuthContext) RabbitMQAuthContext {
if authContext.IsEmpty() {
return RabbitMQAuthContext{OperationID: uuidInfo.OperationID}
}
if authContext.OperationID == 0 {
authContext.OperationID = uuidInfo.OperationID
}
return authContext
}
func DecryptMessageWithAuthContext(uuidInfo *cachedUUIDInfo, agentMessage *[]byte, authContext RabbitMQAuthContext) (map[string]interface{}, error) {
authContext = getMessageProcessingAuthContext(uuidInfo, authContext)
var jsonAgentMessage map[string]interface{}
if uuidInfo.MythicEncrypts {
if uuidInfo.TranslationContainerName == "" {
@@ -978,72 +991,73 @@ func DecryptMessage(uuidInfo *cachedUUIDInfo, agentMessage *[]byte) (map[string]
return nil, err
}
return jsonAgentMessage, nil
} else {
// we decrypt, but then need to pass to translation container
if decrypted, err := uuidInfo.IterateAndAct(agentMessage, "decrypt"); err != nil {
logging.LogError(err, "Failed to get decryption keys and decrypt")
return nil, err
} else if convertedResponse, err := RabbitMQConnection.SendTrRPCCustomMessageToMythicC2(TrCustomMessageToMythicC2FormatMessage{
TranslationContainerName: uuidInfo.TranslationContainerName,
C2Name: uuidInfo.C2ProfileName,
Message: *decrypted,
UUID: uuidInfo.UUID,
MythicEncrypts: uuidInfo.MythicEncrypts,
CryptoKeys: uuidInfo.getAllKeys(),
}); err != nil {
//logging.LogError(err, "Failed to send response to translate custom message to Mythic C2")
//go SendAllOperationsMessage(fmt.Sprintf("Failed to have translation container process message: %s\n%s", uuidInfo.TranslationContainerName, err.Error()), uuidInfo.OperationID,
// "c2_to_mythic_"+uuidInfo.TranslationContainerName, database.MESSAGE_LEVEL_WARNING)
return nil, err
} else if !convertedResponse.Success {
logging.LogError(errors.New(convertedResponse.Error), "Failed to have translation container process custom message from agent")
go SendAllOperationsMessage(fmt.Sprintf("Failed to have translation container process message: %s\n%s", uuidInfo.TranslationContainerName, convertedResponse.Error), uuidInfo.OperationID,
"c2_to_mythic_"+uuidInfo.TranslationContainerName, database.MESSAGE_LEVEL_AGENT_MESSGAGE, true)
return nil, errors.New(convertedResponse.Error)
} else {
return convertedResponse.Message, nil
}
}
} else {
// we don't decrypt
if uuidInfo.TranslationContainerName == "" {
// no translation container and we're not in charge of decrypting, so just return it
err := unmarshalMessageForAgentFormat(uuidInfo, agentMessage, &jsonAgentMessage)
//err := json.Unmarshal(agentMessage, &jsonAgentMessage)
if err != nil {
return nil, err
}
return jsonAgentMessage, nil
} else {
// we don't decrypt and there's a translation container
// translation container should decrypt and convert
if convertedResponse, err := RabbitMQConnection.SendTrRPCCustomMessageToMythicC2(TrCustomMessageToMythicC2FormatMessage{
TranslationContainerName: uuidInfo.TranslationContainerName,
C2Name: uuidInfo.C2ProfileName,
Message: *agentMessage,
UUID: uuidInfo.UUID,
MythicEncrypts: uuidInfo.MythicEncrypts,
CryptoKeys: uuidInfo.getAllKeys(),
}); err != nil {
//logging.LogError(err, "Failed to send response to translate custom message to Mythic C2")
//go SendAllOperationsMessage(fmt.Sprintf("Failed to have translation container process message: %s\n%s", uuidInfo.TranslationContainerName, err.Error()), uuidInfo.OperationID,
// "c2_to_mythic_"+uuidInfo.TranslationContainerName, database.MESSAGE_LEVEL_WARNING)
return nil, err
} else if !convertedResponse.Success {
logging.LogError(errors.New(convertedResponse.Error), "Failed to have translation container process custom message from agent")
go SendAllOperationsMessage(fmt.Sprintf("Failed to have translation container process message: %s\n%s", uuidInfo.TranslationContainerName, convertedResponse.Error), uuidInfo.OperationID,
"c2_to_mythic_"+uuidInfo.TranslationContainerName, database.MESSAGE_LEVEL_AGENT_MESSGAGE, true)
return nil, errors.New(convertedResponse.Error)
} else {
return convertedResponse.Message, nil
}
// we decrypt, but then need to pass to translation container
decrypted, err := uuidInfo.IterateAndAct(agentMessage, "decrypt")
if err != nil {
logging.LogError(err, "Failed to get decryption keys and decrypt")
return nil, err
}
convertedResponse, err := RabbitMQConnection.SendTrRPCCustomMessageToMythicC2(TrCustomMessageToMythicC2FormatMessage{
TranslationContainerName: uuidInfo.TranslationContainerName,
C2Name: uuidInfo.C2ProfileName,
Message: *decrypted,
UUID: uuidInfo.UUID,
MythicEncrypts: uuidInfo.MythicEncrypts,
CryptoKeys: uuidInfo.getAllKeys(),
}, authContext)
if err != nil {
//logging.LogError(err, "Failed to send response to translate custom message to Mythic C2")
//go SendAllOperationsMessage(fmt.Sprintf("Failed to have translation container process message: %s\n%s", uuidInfo.TranslationContainerName, err.Error()), uuidInfo.OperationID,
// "c2_to_mythic_"+uuidInfo.TranslationContainerName, database.MESSAGE_LEVEL_WARNING)
return nil, err
}
if !convertedResponse.Success {
logging.LogError(errors.New(convertedResponse.Error), "Failed to have translation container process custom message from agent")
go SendAllOperationsMessage(fmt.Sprintf("Failed to have translation container process message: %s\n%s", uuidInfo.TranslationContainerName, convertedResponse.Error), uuidInfo.OperationID,
"c2_to_mythic_"+uuidInfo.TranslationContainerName, database.MESSAGE_LEVEL_AGENT_MESSGAGE, true)
return nil, errors.New(convertedResponse.Error)
}
return convertedResponse.Message, nil
}
// we don't decrypt
if uuidInfo.TranslationContainerName == "" {
// no translation container and we're not in charge of decrypting, so just return it
err := unmarshalMessageForAgentFormat(uuidInfo, agentMessage, &jsonAgentMessage)
//err := json.Unmarshal(agentMessage, &jsonAgentMessage)
if err != nil {
return nil, err
}
return jsonAgentMessage, nil
}
// we don't decrypt and there's a translation container
// translation container should decrypt and convert
convertedResponse, err := RabbitMQConnection.SendTrRPCCustomMessageToMythicC2(TrCustomMessageToMythicC2FormatMessage{
TranslationContainerName: uuidInfo.TranslationContainerName,
C2Name: uuidInfo.C2ProfileName,
Message: *agentMessage,
UUID: uuidInfo.UUID,
MythicEncrypts: uuidInfo.MythicEncrypts,
CryptoKeys: uuidInfo.getAllKeys(),
}, authContext)
if err != nil {
//logging.LogError(err, "Failed to send response to translate custom message to Mythic C2")
//go SendAllOperationsMessage(fmt.Sprintf("Failed to have translation container process message: %s\n%s", uuidInfo.TranslationContainerName, err.Error()), uuidInfo.OperationID,
// "c2_to_mythic_"+uuidInfo.TranslationContainerName, database.MESSAGE_LEVEL_WARNING)
return nil, err
}
if !convertedResponse.Success {
logging.LogError(errors.New(convertedResponse.Error), "Failed to have translation container process custom message from agent")
go SendAllOperationsMessage(fmt.Sprintf("Failed to have translation container process message: %s\n%s", uuidInfo.TranslationContainerName, convertedResponse.Error), uuidInfo.OperationID,
"c2_to_mythic_"+uuidInfo.TranslationContainerName, database.MESSAGE_LEVEL_AGENT_MESSGAGE, true)
return nil, errors.New(convertedResponse.Error)
}
return convertedResponse.Message, nil
}
func EncryptMessage(uuidInfo *cachedUUIDInfo, outerUUID string, agentMessage map[string]interface{}, shouldBase64Encode bool) ([]byte, error) {
func EncryptMessageWithAuthContext(uuidInfo *cachedUUIDInfo, outerUUID string, agentMessage map[string]interface{}, shouldBase64Encode bool, authContext RabbitMQAuthContext) ([]byte, error) {
authContext = getMessageProcessingAuthContext(uuidInfo, authContext)
//logging.LogDebug("Sending back final message", "response", agentMessage)
if uuidInfo.MythicEncrypts {
if uuidInfo.TranslationContainerName == "" {
@@ -1069,7 +1083,6 @@ func EncryptMessage(uuidInfo *cachedUUIDInfo, outerUUID string, agentMessage map
return []byte(base64.StdEncoding.EncodeToString(finalBytes)), nil
}
return finalBytes, nil
}
convertedResponse, err := RabbitMQConnection.SendTrRPCMythicC2ToCustomMessage(TrMythicC2ToCustomMessageFormatMessage{
TranslationContainerName: uuidInfo.TranslationContainerName,
@@ -1078,7 +1091,7 @@ func EncryptMessage(uuidInfo *cachedUUIDInfo, outerUUID string, agentMessage map
UUID: uuidInfo.UUID,
MythicEncrypts: uuidInfo.MythicEncrypts,
CryptoKeys: uuidInfo.getAllKeys(),
})
}, authContext)
if err != nil {
// we send to translation container to convert to c2 specific format, then we encrypt
//logging.LogError(err, "Failed to send agent message response to translation container")
@@ -1115,49 +1128,46 @@ func EncryptMessage(uuidInfo *cachedUUIDInfo, outerUUID string, agentMessage map
return []byte(base64.StdEncoding.EncodeToString(finalBytes)), nil
}
return finalBytes, nil
} else {
if uuidInfo.TranslationContainerName == "" {
// mythic doesn't encrypt, but there's no translation container, so just return it
jsonBytes, err := marshalMessageForAgentFormat(uuidInfo, agentMessage)
//jsonBytes, err := json.Marshal(agentMessage)
if err != nil {
logging.LogError(err, "Failed to marshal agent message into json")
return nil, err
}
uuidBytes, err := GetUUIDBytes(outerUUID, uuidInfo.PayloadTypeMessageUUIDLength)
if err != nil {
logging.LogError(err, "Failed to generate final UUID bytes")
return nil, err
}
finalBytes := append(uuidBytes, jsonBytes...)
if shouldBase64Encode {
return []byte(base64.StdEncoding.EncodeToString(finalBytes)), nil
}
return finalBytes, nil
}
convertedResponse, err := RabbitMQConnection.SendTrRPCMythicC2ToCustomMessage(TrMythicC2ToCustomMessageFormatMessage{
TranslationContainerName: uuidInfo.TranslationContainerName,
C2Name: uuidInfo.C2ProfileName,
Message: agentMessage,
UUID: uuidInfo.UUID,
MythicEncrypts: uuidInfo.MythicEncrypts,
CryptoKeys: uuidInfo.getAllKeys(),
})
}
if uuidInfo.TranslationContainerName == "" {
// mythic doesn't encrypt, but there's no translation container, so just return it
jsonBytes, err := marshalMessageForAgentFormat(uuidInfo, agentMessage)
//jsonBytes, err := json.Marshal(agentMessage)
if err != nil {
//go SendAllOperationsMessage(fmt.Sprintf("Failed to send agent message response to translation container:\n%s", err.Error()), uuidInfo.OperationID,
// "mythic_to_c2_"+uuidInfo.TranslationContainerName, database.MESSAGE_LEVEL_WARNING)
logging.LogError(err, "Failed to marshal agent message into json")
return nil, err
}
if !convertedResponse.Success {
go SendAllOperationsMessage(fmt.Sprintf("Failed to send agent message response to translation container:\n%s", convertedResponse.Error), uuidInfo.OperationID,
"mythic_to_c2_"+uuidInfo.TranslationContainerName, database.MESSAGE_LEVEL_AGENT_MESSGAGE, true)
return nil, errors.New(convertedResponse.Error)
uuidBytes, err := GetUUIDBytes(outerUUID, uuidInfo.PayloadTypeMessageUUIDLength)
if err != nil {
logging.LogError(err, "Failed to generate final UUID bytes")
return nil, err
}
return convertedResponse.Message, nil
finalBytes := append(uuidBytes, jsonBytes...)
if shouldBase64Encode {
return []byte(base64.StdEncoding.EncodeToString(finalBytes)), nil
}
return finalBytes, nil
}
convertedResponse, err := RabbitMQConnection.SendTrRPCMythicC2ToCustomMessage(TrMythicC2ToCustomMessageFormatMessage{
TranslationContainerName: uuidInfo.TranslationContainerName,
C2Name: uuidInfo.C2ProfileName,
Message: agentMessage,
UUID: uuidInfo.UUID,
MythicEncrypts: uuidInfo.MythicEncrypts,
CryptoKeys: uuidInfo.getAllKeys(),
}, authContext)
if err != nil {
//go SendAllOperationsMessage(fmt.Sprintf("Failed to send agent message response to translation container:\n%s", err.Error()), uuidInfo.OperationID,
// "mythic_to_c2_"+uuidInfo.TranslationContainerName, database.MESSAGE_LEVEL_WARNING)
return nil, err
}
if !convertedResponse.Success {
go SendAllOperationsMessage(fmt.Sprintf("Failed to send agent message response to translation container:\n%s", convertedResponse.Error), uuidInfo.OperationID,
"mythic_to_c2_"+uuidInfo.TranslationContainerName, database.MESSAGE_LEVEL_AGENT_MESSGAGE, true)
return nil, errors.New(convertedResponse.Error)
}
return convertedResponse.Message, nil
}
func RecursivelyEncryptMessage(path []cbGraphAdjMatrixEntry, message map[string]interface{}, updateCheckinTime bool) ([]byte, error) {
@@ -1172,7 +1182,8 @@ func RecursivelyEncryptMessage(path []cbGraphAdjMatrixEntry, message map[string]
logging.LogError(err, "Failed to lookup encryption data for target", "target", path[i].DestinationAgentId, "target_id", path[i].DestinationId)
return nil, err
}
encryptedBytes, err := EncryptMessage(targetUuidInfo, path[i].DestinationAgentId, currentMessage, true)
encryptedBytes, err := EncryptMessageWithAuthContext(targetUuidInfo, path[i].DestinationAgentId, currentMessage, true,
getMessageProcessingAuthContext(targetUuidInfo, RabbitMQAuthContext{}))
if err != nil {
logging.LogError(err, "Failed to encrypt message when trying to prep tasks for delegates")
return nil, err
@@ -1197,7 +1208,8 @@ func RecursivelyEncryptMessage(path []cbGraphAdjMatrixEntry, message map[string]
logging.LogError(err, "Failed to lookup encryption data for target", "target", path[i].DestinationAgentId, "target_id", path[i].DestinationId)
return nil, err
}
encryptedBytes, err := EncryptMessage(targetUuidInfo, path[i].DestinationAgentId, currentMessage, true)
encryptedBytes, err := EncryptMessageWithAuthContext(targetUuidInfo, path[i].DestinationAgentId, currentMessage, true,
getMessageProcessingAuthContext(targetUuidInfo, RabbitMQAuthContext{}))
if err != nil {
logging.LogError(err, "Failed to encrypt message when trying to prep tasks for delegates")
return nil, err
@@ -3,6 +3,8 @@ package rabbitmq
import (
"encoding/base64"
"errors"
"time"
"github.com/its-a-feature/Mythic/database"
"github.com/its-a-feature/Mythic/database/enums/InteractiveTask"
"github.com/its-a-feature/Mythic/database/enums/PushC2Connections"
@@ -11,7 +13,6 @@ import (
"github.com/its-a-feature/Mythic/grpc/services"
"github.com/its-a-feature/Mythic/logging"
"github.com/jmoiron/sqlx"
"time"
)
func processAgentMessageFromPushC2() {
@@ -89,7 +90,8 @@ func sendMessageToDirectPushC2(callbackID int, message map[string]interface{}) e
logging.LogError(err, "Failed to find encryption data for callback")
return err
}
responseBytes, err := EncryptMessage(uUIDInfo, callbackUUID, message, base64Encoded)
responseBytes, err := EncryptMessageWithAuthContext(uUIDInfo, callbackUUID, message, base64Encoded,
getMessageProcessingAuthContext(uUIDInfo, RabbitMQAuthContext{}))
if err != nil {
logging.LogError(err, "Failed to encrypt message")
return err
@@ -253,7 +253,8 @@ func (s *submittedTasksForAgents) addTask(task databaseStructs.Task) {
logging.LogError(err, "Failed to find encryption data for callback")
break
}
responseBytes, err := EncryptMessage(uUIDInfo, callbackUUID, newTaskMsg, base64Encoded)
responseBytes, err := EncryptMessageWithAuthContext(uUIDInfo, callbackUUID, newTaskMsg, base64Encoded,
getMessageProcessingAuthContext(uUIDInfo, RabbitMQAuthContext{}))
if err != nil {
logging.LogError(err, "Failed to encrypt message")
break
@@ -162,15 +162,43 @@ func GenerateRabbitMQAuthTokenHeaderFromFields(operatorID int, operationID int,
}
func GenerateRabbitMQAuthTokenHeader(authContext RabbitMQAuthContext) (amqp.Table, error) {
if authContext.IsEmpty() {
token, err := GenerateRabbitMQAuthContextToken(authContext)
if err != nil {
return nil, err
}
if token == "" {
return nil, nil
}
return amqp.Table{MYTHIC_RABBITMQ_AUTH_CONTEXT_HEADER: token}, nil
}
func GenerateRabbitMQAuthContextToken(authContext RabbitMQAuthContext) (string, error) {
if authContext.IsEmpty() {
return "", nil
}
authContext.SourceScopes = append([]string{}, authContext.SourceScopes...)
token, err := generateRabbitMQAuthContext(authContext)
if err != nil {
return nil, err
return "", err
}
return amqp.Table{MYTHIC_RABBITMQ_AUTH_CONTEXT_HEADER: token}, nil
return token, nil
}
func ValidateRabbitMQAuthContextResponseToken(expectedToken string, responseToken string) error {
if expectedToken == "" && responseToken == "" {
return nil
}
if expectedToken == "" {
return errors.New("unexpected RabbitMQ auth context in response")
}
if responseToken == "" {
return errors.New("missing RabbitMQ auth context in response")
}
if responseToken != expectedToken {
return errors.New("mismatched RabbitMQ auth context in response")
}
_, err := ValidateRabbitMQAuthContextToken(responseToken)
return err
}
func (authContext RabbitMQAuthContext) IsEmpty() bool {
@@ -0,0 +1,40 @@
package rabbitmq
import (
"testing"
"github.com/its-a-feature/Mythic/authentication/mythicjwt"
)
func TestValidateRabbitMQAuthContextResponseToken(t *testing.T) {
if err := ValidateRabbitMQAuthContextResponseToken("", ""); err != nil {
t.Fatalf("empty request and response token should be valid: %v", err)
}
authToken, err := GenerateRabbitMQAuthContextToken(RabbitMQAuthContext{
OperationID: 1,
SourceScopes: []string{mythicjwt.SCOPE_PAYLOAD_WRITE},
})
if err != nil {
t.Fatalf("failed to generate auth context token: %v", err)
}
defer InvalidateRabbitMQAuthContextToken(authToken)
if err := ValidateRabbitMQAuthContextResponseToken(authToken, authToken); err != nil {
t.Fatalf("matching valid token should be accepted: %v", err)
}
if err := ValidateRabbitMQAuthContextResponseToken(authToken, ""); err == nil {
t.Fatal("missing response token should be rejected")
}
if err := ValidateRabbitMQAuthContextResponseToken(authToken, "mctx_other"); err == nil {
t.Fatal("mismatched response token should be rejected")
}
if err := ValidateRabbitMQAuthContextResponseToken("", authToken); err == nil {
t.Fatal("unexpected response token should be rejected")
}
InvalidateRabbitMQAuthContextToken(authToken)
if err := ValidateRabbitMQAuthContextResponseToken(authToken, authToken); err == nil {
t.Fatal("invalidated response token should be rejected")
}
}