Skip to content

Commit

Permalink
v3.2.20-rc8
Browse files Browse the repository at this point in the history
fixing MythicRPC issue for generating payloads from scratch
  • Loading branch information
its-a-feature committed Apr 5, 2024
1 parent f923eb1 commit 8bfc904
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 20 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [3.2.20-rc8] - 2024-04-05

### Changed

- Fixed an RPC call for generating a new payload that wasn't calling the right function

## [3.2.20-rc7] - 2024-03-29

### Changed
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.2.20-rc7
3.2.20-rc8
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ type MythicRPCPayloadCreateFromScratchMessageResponse struct {
func init() {
RabbitMQConnection.AddRPCQueue(RPCQueueStruct{
Exchange: MYTHIC_EXCHANGE,
Queue: MYTHIC_RPC_PAYLOAD_CREATE_FROM_SCRATCH, // swap out with queue in rabbitmq.constants.go file
RoutingKey: MYTHIC_RPC_PAYLOAD_CREATE_FROM_SCRATCH, // swap out with routing key in rabbitmq.constants.go file
Handler: processMythicRPCPayloadCreateFromUUID, // points to function that takes in amqp.Delivery and returns interface{}
Queue: MYTHIC_RPC_PAYLOAD_CREATE_FROM_SCRATCH, // swap out with queue in rabbitmq.constants.go file
RoutingKey: MYTHIC_RPC_PAYLOAD_CREATE_FROM_SCRATCH, // swap out with routing key in rabbitmq.constants.go file
Handler: processMythicRPCPayloadCreateFromScratch, // points to function that takes in amqp.Delivery and returns interface{}
})
}

Expand All @@ -38,38 +38,40 @@ func MythicRPCPayloadCreateFromScratch(input MythicRPCPayloadCreateFromScratchMe
Success: false,
}
task := databaseStructs.Task{}
if err := database.DB.Get(&task, `SELECT operator_id,
callback.operation_id "callback.operation_id"
if err := database.DB.Get(&task, `SELECT
operator_id, operation_id
FROM task
JOIN callback ON task.callback_id = callback.id
WHERE id=$1`, input.TaskID); err != nil {
logging.LogError(err, "Failed to get operator_id from task when generating payload")
response.Error = err.Error()
return response
}
if newUUID, newID, err := RegisterNewPayload(input.PayloadConfiguration, &databaseStructs.Operatoroperation{
CurrentOperation: databaseStructs.Operation{ID: task.Callback.OperationID},
newUUID, newID, err := RegisterNewPayload(input.PayloadConfiguration, &databaseStructs.Operatoroperation{
CurrentOperation: databaseStructs.Operation{ID: task.OperationID},
CurrentOperator: databaseStructs.Operator{ID: task.OperatorID},
}); err != nil {
})
if err != nil {
response.Error = err.Error()
return response
} else if _, err := database.DB.Exec(`UPDATE payload SET auto_generated=true WHERE id=$1`, newID); err != nil {
}
_, err = database.DB.Exec(`UPDATE payload SET auto_generated=true WHERE id=$1`, newID)
if err != nil {
logging.LogError(err, "failed to update payload auto_generated status")
response.Error = err.Error()
return response
} else {
if input.RemoteHost != nil {
if _, err := database.DB.Exec(`INSERT INTO payloadonhost
}
if input.RemoteHost != nil {
if _, err := database.DB.Exec(`INSERT INTO payloadonhost
(host, payload_id, operation_id, task_id)
VALUES
($1, $2, $3, $4)`, strings.ToUpper(*input.RemoteHost), newID, task.Callback.OperationID, input.TaskID); err != nil {
logging.LogError(err, "Failed to register payload on host")
}
($1, $2, $3, $4)`, strings.ToUpper(*input.RemoteHost), newID, task.OperationID, input.TaskID); err != nil {
logging.LogError(err, "Failed to register payload on host")
}
response.NewPayloadUUID = newUUID
response.Success = true
return response
}
response.NewPayloadUUID = newUUID
response.Success = true
return response

}
func processMythicRPCPayloadCreateFromScratch(msg amqp.Delivery) interface{} {
incomingMessage := MythicRPCPayloadCreateFromScratchMessage{}
Expand Down

0 comments on commit 8bfc904

Please sign in to comment.