Skip to content

Commit

Permalink
Update modify_shell_configuration_file.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 ddbadae commit 5e65be2
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions events/syscall/modify_shell_configuration_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,24 @@ import (

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

func ModifyShellConfigurationFile(h events.Helper) error {
// Define the path to the file
tmpDir := "/tmp"
tmpConfigFile := filepath.Join(tmpDir, ".bashrc")

homeDir, err := os.UserHomeDir()
// Create the file
file, err := os.Create(tmpConfigFile)
if err != nil {
return err
}
file.Close()

configFile := filepath.Join(homeDir, ".bashrc")

// Modify the file
content := []byte("# written by event-generator\n")
err = os.WriteFile(configFile, content, 0644)
err = os.WriteFile(tmpConfigFile, content, 0644)
if err != nil {
return err
}
Expand Down

0 comments on commit 5e65be2

Please sign in to comment.