WriteProcessMemoryToFile try to write a byte slice to the specified directory
(path string, file string, data []byte)
| 195 | |
| 196 | // WriteProcessMemoryToFile try to write a byte slice to the specified directory |
| 197 | func WriteProcessMemoryToFile(path string, file string, data []byte) (err error) { |
| 198 | _, err = os.Stat(path) |
| 199 | if os.IsNotExist(err) { |
| 200 | if err := os.MkdirAll(path, 0600); err != nil { |
| 201 | return err |
| 202 | } |
| 203 | } |
| 204 | |
| 205 | if err := os.WriteFile(path+"/"+file, data, 0644); err != nil { |
| 206 | return err |
| 207 | } |
| 208 | |
| 209 | return nil |
| 210 | } |
no outgoing calls
no test coverage detected