-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
182 additions
and
280 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// Evtx functions. | ||
package flog | ||
|
||
import ( | ||
"os" | ||
"path/filepath" | ||
|
||
"github.com/cuhsat/fact/internal/fact/ez" | ||
"github.com/cuhsat/fact/internal/sys" | ||
) | ||
|
||
func ImportEvent(src, dir string) (lines []string, err error) { | ||
log, err := evtxecmd(src, src+".json", dir) | ||
|
||
if err != nil { | ||
return | ||
} | ||
|
||
lines, err = ReadLines(log) | ||
|
||
if err != nil { | ||
return | ||
} | ||
|
||
err = os.Remove(log) | ||
|
||
return | ||
} | ||
|
||
func ExportEvent(b []byte, dst string) (err error) { | ||
f, err := os.Create(dst) | ||
|
||
if err != nil { | ||
return | ||
} | ||
|
||
_, err = f.Write(b) | ||
|
||
f.Close() | ||
|
||
return | ||
} | ||
|
||
func evtxecmd(src, dst, dir string) (log string, err error) { | ||
asm, err := ez.Path("EvtxECmd.dll") | ||
|
||
if err != nil { | ||
return | ||
} | ||
|
||
if len(dir) == 0 { | ||
dir = filepath.Dir(dst) | ||
} | ||
|
||
dst = filepath.Base(dst) | ||
log = filepath.Join(dir, dst) | ||
|
||
_, err = sys.StdCall("dotnet", asm, "-f", src, "--fj", "--json", dir, "--jsonf", dst) | ||
|
||
return | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.