Skip to content

Commit

Permalink
Using temporary data by creating them and removing them after completion
Browse files Browse the repository at this point in the history
Signed-off-by: GLVS Kiriti <glvskiriti2003369@gmail.com>
  • Loading branch information
GLVSKiriti authored and poiana committed Apr 2, 2024
1 parent 141a455 commit ceef898
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion events/syscall/read_ssh_information.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,20 @@ var _ = events.Register(
)

func ReadSshInformation(h events.Helper) error {
const filename = "/root/.ssh/known_hosts"
// Creates temporary data for testing.
directoryname := "/home/created-by-falco-event-generator/.ssh"
if err := os.MkdirAll(directoryname, 0755); err != nil {
return err
}

filename := directoryname + "/known_hosts"
if err := os.WriteFile(filename, nil, os.FileMode(0755)); err != nil {
return err
}

h.Log().Info("attempting to simulate SSH information read")
file, err := os.Open(filename)
defer file.Close()
defer os.RemoveAll("/home/created-by-falco-event-generator")
return err
}

0 comments on commit ceef898

Please sign in to comment.