Skip to content

Commit

Permalink
Update delete_or_rename_shell_history.go
Browse files Browse the repository at this point in the history
Signed-off-by: Kapil Sharma <[email protected]>
  • Loading branch information
h4l0gen authored and poiana committed Apr 2, 2024
1 parent 66b7a90 commit 9942d9f
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions events/syscall/delete_or_rename_shell_history.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,26 @@ import (
)

var _ = events.Register(
DeleteOrRenameShellHistory,
events.WithDisabled(), // this rule is not included in falco_rules.yaml (stable rules), so disable the action
DeleteOrRenameShellHistory,
events.WithDisabled(), // this rule is not included in falco_rules.yaml (stable rules), so disable the action
)

func DeleteOrRenameShellHistory(h events.Helper) error {
homeDir, err := os.UserHomeDir()
// Define the path to the file
tmpDir := "/tmp"
tmpFile := filepath.Join(tmpDir, "ash_history")

// Create the file
file, err := os.Create(tmpFile)
if err != nil {
return err
}
defer file.Close()

historyFile := filepath.Join(homeDir, ".bash_history")
// Remove the file
if err := os.Remove(tmpFile); err != nil {
return err
}

os.Remove(historyFile)
return nil
return nil
}

0 comments on commit 9942d9f

Please sign in to comment.