From 22a4644f4b1ad9784f1fca00a1c679d6a25e0a6c Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Fri, 12 May 2023 16:48:01 +0200 Subject: [PATCH] zombierecovery: add date to message.txt --- cmd/chantools/zombierecovery_findmatches.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/chantools/zombierecovery_findmatches.go b/cmd/chantools/zombierecovery_findmatches.go index ee9c045..0822af1 100644 --- a/cmd/chantools/zombierecovery_findmatches.go +++ b/cmd/chantools/zombierecovery_findmatches.go @@ -300,6 +300,7 @@ func (c *zombieRecoveryFindMatchesCommand) Execute(_ *cobra.Command, } folder := fmt.Sprintf("results/match-%s", node1) + today := time.Now().Format("2006-01-02") for node2, match := range node1map { err = os.MkdirAll(folder, 0755) if err != nil { @@ -312,7 +313,7 @@ func (c *zombieRecoveryFindMatchesCommand) Execute(_ *cobra.Command, } fileName := fmt.Sprintf("%s/%s-%s.json", - folder, node2, time.Now().Format("2006-01-02")) + folder, node2, today) log.Infof("Writing result to %s", fileName) err = os.WriteFile(fileName, matchBytes, 0644) if err != nil { @@ -327,7 +328,7 @@ func (c *zombieRecoveryFindMatchesCommand) Execute(_ *cobra.Command, continue } - textFileName := fmt.Sprintf("%s/message.txt", folder) + textFileName := fmt.Sprintf("%s/message-%s.txt", folder, today) file, err := os.OpenFile( textFileName, os.O_RDWR|os.O_CREATE, 0644, )