forked from 0xrawsec/whids
-
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.
- API changed in sysmon package - removed unused utilities
- Loading branch information
Showing
12 changed files
with
479 additions
and
346 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
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 |
---|---|---|
|
@@ -57,4 +57,6 @@ type SystemInfo struct { | |
} `json:"cpu"` | ||
|
||
Sysmon *sysmon.Info `json:"sysmon"` | ||
|
||
Err error `json:"error"` | ||
} |
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
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,59 @@ | ||
//go:build windows | ||
// +build windows | ||
|
||
package sysmon | ||
|
||
import ( | ||
"bytes" | ||
"encoding/xml" | ||
"testing" | ||
"time" | ||
|
||
"github.com/0xrawsec/toast" | ||
"github.com/0xrawsec/whids/utils" | ||
) | ||
|
||
func init() { | ||
// testing on WSL makes Windows command | ||
// very long to respond | ||
defaultTimeout = 60 * time.Second | ||
} | ||
|
||
func TestSysmonInfo(t *testing.T) { | ||
var c *Config | ||
|
||
tt := toast.FromT(t) | ||
|
||
// we run uninstall first | ||
Uninstall() | ||
defer Uninstall() | ||
|
||
_, err := NewSysmonInfo() | ||
|
||
tt.ExpectErr(err, ErrSysmonNotInstalled) | ||
|
||
tt.CheckErr(InstallOrUpdate("./data/Sysmon64.exe")) | ||
|
||
i, err := NewSysmonInfo() | ||
t.Log(utils.PrettyJson(i)) | ||
tt.CheckErr(err) | ||
|
||
// we deserialize config | ||
tt.CheckErr(xml.Unmarshal([]byte(config), &c)) | ||
// we force the good schema version to be the one of sysmon installed | ||
c.SchemaVersion = i.Config.Version.Schema | ||
xmlConfig, err := c.XML() | ||
tt.CheckErr(err) | ||
|
||
// configuring Sysmon | ||
tt.CheckErr(Configure(bytes.NewBuffer(xmlConfig))) | ||
|
||
i, err = NewSysmonInfo() | ||
tt.CheckErr(err) | ||
|
||
sha256, err := c.Sha256() | ||
tt.CheckErr(err) | ||
tt.Assert(i.Config.Hash == sha256) | ||
|
||
tt.CheckErr(Uninstall()) | ||
} |
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