-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathAChCln_lin.go
57 lines (47 loc) · 1.86 KB
/
AChCln_lin.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// ****************************************************************
// * Only Include this file for windows version *
// * - Uses the Embed Directive - Requires GoLang 1.16 *
// ****************************************************************
package main
import (
"fmt"
"os"
"syscall"
)
// ****************************************************************
// Platform Specific - Return OS (Version) *
// ****************************************************************
func GetOSVer() string {
return "Linux"
}
//****************************************************************
// Check for Linux Root by checking Effective UserId *
//****************************************************************
func IsUserAdmin() bool {
if os.Geteuid() != 0 {
return false
}
return true
}
//******************************************************************
// Get Memory Size: Linux Version *
// Copied from: *
// https://github.com/pbnjay/memory/blob/master/memory_windows.go *
//******************************************************************
func sysTotalMemory() uint64 {
sysin := &syscall.Sysinfo_t{}
sys_err := syscall.Sysinfo(sysin)
if sys_err != nil {
return 0
}
// If this is a 32-bit system, then these fields are
// uint32 instead of uint64.
// So we always convert to uint64 to match signature.
return uint64(sysin.Totalram) * uint64(sysin.Unit)
}
// ****************************************************************
// Windows Console Hide and Show *
// ****************************************************************
func winConHideShow(HideOrShow int) {
fmt.Printf("[+] Console Hide/Show not Implemented for Linux\n")
}