|
1 | 1 | package metric |
2 | 2 |
|
| 3 | +// BOOL is an int32 for structure align. |
| 4 | +type BOOL int32 |
| 5 | + |
| 6 | +// ToBool is used to convert to go bool. |
| 7 | +func (b BOOL) ToBool() bool { |
| 8 | + return b != 0 |
| 9 | +} |
| 10 | + |
| 11 | +func (b BOOL) String() string { |
| 12 | + if b.ToBool() { |
| 13 | + return "true" |
| 14 | + } |
| 15 | + return "false" |
| 16 | +} |
| 17 | + |
3 | 18 | // Metrics contains status about runtime submodules. |
4 | 19 | type Metrics struct { |
5 | 20 | Library LTStatus `toml:"library" json:"library"` |
@@ -49,27 +64,29 @@ type RTStatus struct { |
49 | 64 |
|
50 | 65 | // DTStatus contains status about detector. |
51 | 66 | type DTStatus struct { |
52 | | - IsEnabled bool `toml:"is_enabled" json:"is_enabled"` |
53 | | - HasDebugger bool `toml:"has_debugger" json:"has_debugger"` |
54 | | - HasMemoryScanner bool `toml:"has_memory_scanner" json:"has_memory_scanner"` |
55 | | - InSandbox bool `toml:"in_sandbox" json:"in_sandbox"` |
56 | | - InVirtualMachine bool `toml:"in_virtual_machine" json:"in_virtual_machine"` |
57 | | - InEmulator bool `toml:"in_emulator" json:"in_emulator"` |
58 | | - IsAccelerated bool `toml:"is_accelerated" json:"is_accelerated"` |
59 | | - SafeRank int8 `toml:"safe_rank" json:"safe_rank"` |
| 67 | + IsEnabled BOOL `toml:"is_enabled" json:"is_enabled"` |
| 68 | + HasDebugger BOOL `toml:"has_debugger" json:"has_debugger"` |
| 69 | + HasMemoryScanner BOOL `toml:"has_memory_scanner" json:"has_memory_scanner"` |
| 70 | + InSandbox BOOL `toml:"in_sandbox" json:"in_sandbox"` |
| 71 | + InVirtualMachine BOOL `toml:"in_virtual_machine" json:"in_virtual_machine"` |
| 72 | + InEmulator BOOL `toml:"in_emulator" json:"in_emulator"` |
| 73 | + IsAccelerated BOOL `toml:"is_accelerated" json:"is_accelerated"` |
| 74 | + SafeRank int32 `toml:"safe_rank" json:"safe_rank"` |
60 | 75 | } |
61 | 76 |
|
62 | 77 | // SMStatus contains status about sysmon. |
63 | 78 | type SMStatus struct { |
64 | | - IsEnabled bool `toml:"is_enabled" json:"is_enabled"` |
| 79 | + IsEnabled BOOL `toml:"is_enabled" json:"is_enabled"` |
| 80 | + Reserved int32 `toml:"-" json:"-"` |
65 | 81 | NumNormal int64 `toml:"num_normal" json:"num_normal"` |
66 | 82 | NumRecover int64 `toml:"num_recover" json:"num_recover"` |
67 | 83 | NumPanic int64 `toml:"num_panic" json:"num_panic"` |
68 | 84 | } |
69 | 85 |
|
70 | 86 | // WDStatus contains status about watchdog. |
71 | 87 | type WDStatus struct { |
72 | | - IsEnabled bool `toml:"is_enabled" json:"is_enabled"` |
| 88 | + IsEnabled BOOL `toml:"is_enabled" json:"is_enabled"` |
| 89 | + Reserved int32 `toml:"-" json:"-"` |
73 | 90 | NumKick int64 `toml:"num_kick" json:"num_kick"` |
74 | 91 | NumNormal int64 `toml:"num_normal" json:"num_normal"` |
75 | 92 | NumReset int64 `toml:"num_reset" json:"num_reset"` |
|
0 commit comments