Skip to content

Commit

Permalink
updating mythic-cli to reflect .env changes for 3rd party services
Browse files Browse the repository at this point in the history
  • Loading branch information
its-a-feature committed Jan 21, 2024
1 parent 2bd9ece commit ab3e058
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion Mythic_CLI/src/cmd/internal/serviceExecution.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,12 @@ func ServiceStart(containers []string) error {
finalContainers = append(finalContainers, val)
}
}
// make sure we always update the config when starting in case .env variables changed
for _, service := range finalContainers {
if utils.StringInSlice(service, config.MythicPossibleServices) {
AddMythicService(service)
} else {
Add3rdPartyService(service, map[string]interface{}{})
}
}
manager.GetManager().TestPorts(finalContainers)
Expand All @@ -90,13 +93,19 @@ func ServiceStop(containers []string) error {
return manager.GetManager().StopServices(containers, config.GetMythicEnv().GetBool("REBUILD_ON_START"))
}
func ServiceBuild(containers []string) error {
composeServices, err := manager.GetManager().GetAllInstalled3rdPartyServiceNames()
if err != nil {
log.Fatalf("[-] Failed to get installed service list: %v", err)
}
for _, container := range containers {
if utils.StringInSlice(container, config.MythicPossibleServices) {
// update the necessary docker compose entries for mythic services
AddMythicService(container)
} else if utils.StringInSlice(container, composeServices) {
Add3rdPartyService(container, map[string]interface{}{})
}
}
err := manager.GetManager().BuildServices(containers)
err = manager.GetManager().BuildServices(containers)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion Mythic_CLI/src/cmd/internal/serviceMetadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -562,8 +562,8 @@ func Add3rdPartyService(service string, additionalConfigs map[string]interface{}
if useBuildContext, ok := agentConfigs[agentUseBuildContextKey]; ok {
if useBuildContext == "false" {
delete(pStruct, "build")
pStruct["image"] = agentConfigs[agentRemoteImageKey]
}
pStruct["image"] = agentConfigs[agentRemoteImageKey]
}
if useVolume, ok := agentConfigs[agentUseVolumeKey]; ok {
if useVolume == "true" {
Expand Down

0 comments on commit ab3e058

Please sign in to comment.