Documentation
¶
Index ¶
- Constants
- Variables
- func CompressOutput(srcDir, outputFilename string) error
- func Contains(slice []string, item string) bool
- func ConvertCFAbsoluteTimeToDate(cfTimeStr string) (string, error)
- func ConvertDateString(input string) (string, error)
- func CopyFile(src, dst string) error
- func ExecuteCommand(command string, args ...string) (string, error)
- func GetCodeSignature(program string) (string, error)
- func GetHostname() (string, error)
- func GetMacOSVersion() (string, error)
- func GetNestedValue(m map[string]interface{}, keys ...string) interface{}
- func GetOutputFileName(moduleName, format, outputDir string) string
- func GetUsernameFromPath(path string) string
- func ListFiles(pattern string) ([]string, error)
- func Now() string
- func ParseBiPList(data string) (map[string]interface{}, error)
- func ParseChromeTimestamp(microsecondsStr string) string
- func ParseTimestamp(value string) (string, error)
- func ParseTimestampWithFormats(value string) (string, error)
- func QuerySQLite(dbPath string, query string) (*sql.Rows, error)
- type CSVDataWriter
- type DataWriter
- type JSONDataWriter
- type Logger
- type Record
Constants ¶
const TimeFormat = "2006-01-02T15:04:05Z07:00"
Variables ¶
var ExecCommand = func(name string, arg ...string) ([]byte, error) { cmd := exec.Command(name, arg...) return cmd.Output() }
ExecCommand is a variable that can be replaced in tests to mock command execution
var ExecuteCommandWithEnv = func(command string, env []string, args ...string) (string, error) { cmd := exec.Command(command, args...) cmd.Env = append(os.Environ(), env...) output, err := cmd.Output() return strings.TrimSpace(string(output)), err }
ExecuteCommandWithEnv is a variable that can be replaced in tests to mock command execution with env
Functions ¶
func CompressOutput ¶
func ConvertDateString ¶
Parse from Oct 26 19:34:13 to 2006-01-02T15:04:05Z07:00 format
func GetCodeSignature ¶
GetCodeSignature returns the code signature information for a given program path. It uses the macOS `codesign` utility to verify the signature. Returns a string containing the signature information or an error if verification fails.
func GetHostname ¶
func GetMacOSVersion ¶
func GetNestedValue ¶
Helper function to safely get nested map values
func GetOutputFileName ¶
func GetUsernameFromPath ¶
func ListFiles ¶
ListFiles lists all files that match the given glob-like pattern. Example pattern: /path/starts*/*ends/file-*.asl
func ParseBiPList ¶
func ParseChromeTimestamp ¶
func ParseTimestamp ¶
func ParseTimestampWithFormats ¶
ParseTimestampWithFormats attempts to parse a timestamp string using multiple common formats It returns the timestamp in the standard TimeFormat (2006-01-02T15:04:05Z07:00)
Types ¶
type CSVDataWriter ¶
type CSVDataWriter struct {
// contains filtered or unexported fields
}
func (*CSVDataWriter) Close ¶
func (dw *CSVDataWriter) Close() error
func (*CSVDataWriter) WriteRecord ¶
func (dw *CSVDataWriter) WriteRecord(record Record) error
type DataWriter ¶
func NewDataWriter ¶
func NewDataWriter(outDir, filename, format string) (DataWriter, error)
type JSONDataWriter ¶
type JSONDataWriter struct {
// contains filtered or unexported fields
}
func (*JSONDataWriter) Close ¶
func (dw *JSONDataWriter) Close() error
func (*JSONDataWriter) WriteRecord ¶
func (dw *JSONDataWriter) WriteRecord(record Record) error
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}