Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiple updates #19

Merged
merged 12 commits into from
Jul 7, 2022
Prev Previous commit
Next Next commit
fixed mod to reflect case files changes
stuartjash committed Jun 17, 2022

Verified

This commit was signed with the committer’s verified signature.
ssbarnea Sorin Sbarnea
commit e43d5fd7cba86a90386bbc9336a1ffe5c7308d06
27 changes: 19 additions & 8 deletions aftermath/Module.swift
Original file line number Diff line number Diff line change
@@ -27,15 +27,12 @@ class AftermathModule {
var caseDirSelector: URL

init() {
let cf = CaseFiles()
if argManager.mode == "--analyze" {
caseLogSelector = cf.analysisLogFile
caseDirSelector = cf.analysisCaseDir

caseLogSelector = CaseFiles.analysisLogFile
caseDirSelector = CaseFiles.analysisCaseDir
} else {

caseLogSelector = cf.logFile
caseDirSelector = cf.caseDir
caseLogSelector = CaseFiles.logFile
caseDirSelector = CaseFiles.caseDir
}
users = getUsersOnSystem()
}
@@ -171,12 +168,26 @@ class AftermathModule {

let module = URL(fileURLWithPath: file).lastPathComponent
let entry = "\(Date().ISO8601Format()) - \(module) - \(note)"
print(entry)

let colorized = "\(Color.magenta.rawValue)\(Date().ISO8601Format())\(Color.colorstop.rawValue) - \(Color.yellow.rawValue)\(module)\(Color.colorstop.rawValue) - \(Color.cyan.rawValue)\(note)\(Color.colorstop.rawValue)"
print(colorized)

if displayOnly == false {
addTextToFile(atUrl: caseLogSelector, text: entry)
}
}

enum Color: String {
case black = "\u{001B}[0;30m"
case red = "\u{001B}[0;31m"
case green = "\u{001B}[0;32m"
case yellow = "\u{001B}[0;33m"
case blue = "\u{001B}[0;34m"
case magenta = "\u{001B}[0;35m"
case cyan = "\u{001B}[0;36m"
case white = "\u{001B}[0;37m"
case colorstop = "\u{001B}[0;0m"
}
enum SystemUsers: String, CaseIterable {
case nobody = "nobody"
case daemon = "daemon"