perlogix / cmon Goto Github PK
View Code? Open in Web Editor NEWNIST Information Security Continuous Monitoring (ISCM) and configuration baseline data collector
License: GNU General Public License v3.0
NIST Information Security Continuous Monitoring (ISCM) and configuration baseline data collector
License: GNU General Public License v3.0
Implement library github.com/shirou/gopsutil/process
under the system package. The library will handle OS compatibility.
Mostly working example:
package main
import (
"fmt"
"github.com/shirou/gopsutil/process"
)
func main() {
processes, err := process.Processes()
if err != nil {
return
}
for _, proc := range processes {
pid := proc.Pid
ppid, _ := proc.Ppid()
name, err := proc.Name()
if err != nil {
name = "UNKNOWN"
}
username, err := proc.Username()
if err != nil {
username = "UNKNOWN"
}
var cpuPct int
cpuFloat, err := proc.CPUPercent()
if err == nil {
cpuPct = int(cpuFloat)
}
var memPct int
memFloat, err := proc.MemoryPercent()
if err == nil {
memPct = int(memFloat)
}
fmt.Printf("pid=%d ppid=%d name=%s user=%s cpu_pct=%d mem_pct=%d\n", pid, ppid, name, username, cpuPct, memPct)
}
}
JSON output:
"processes": ["pid=191321 ppid=191281 name=code user=timski cpu_pct=5 mem_pct=0","pid=173684 ppid=2 name=kworker/u24:7-kcryptd/254:0 user=root cpu_pct=0 mem_pct=0","pid=158019 ppid=59419 name=/usr/bin/python3 user=timski cpu_pct=0 mem_pct=0","pid=66657 ppid=66570 name=slack user=timski cpu_pct=2 mem_pct=0"]
Implement command lsmod | grep -v Module
under the system package.
lsmod | grep -v Module
Raw output:
pinctrl_intel 28672 2 pinctrl_cannonlake
wmi 32768 4 intel_wmi_thunderbolt,wmi_bmof,msi_wmi,mxm_wmi
video 49152 2 msi_wmi,i915
JSON output:
"loaded_kernel_modules": ["pinctrl_intel 28672 2 pinctrl_cannonlake", "wmi 32768 4 intel_wmi_thunderbolt,wmi_bmof,msi_wmi,mxm_wmi", "video 49152 2 msi_wmi,i915"]
Implement command sysclt -a
under system package.
sysctl -a
Raw output:
vm.swappiness = 1
vm.unprivileged_userfaultfd = 1
vm.user_reserve_kbytes = 131072
JSON output:
"sysctl": ["vm.swappiness = 1", "vm.unprivileged_userfaultfd = 1", "vm.user_reserve_kbytes = 131072"]
Detect Cloud Service Provider (CSP) and if service is within a container.
Implement command dmidecode --string chassis-type
under the system package. The command should only run on Linux.
JSON output:
"chassis_type": "other"
Convert this current CircleCI CI project into a GitHub Actions project.
Implement some of the CI technologies we implemented in our reference projects.
Implement command systemctl list-timers --all --no-pager | grep -v 'NEXT\|listed'
under system package.
Check if the system is not Windows (Run on Linux only)
Parse the table output of systemctl
Store List of table entries
Raw output:
Thu 2020-11-19 14:31:46 EST 9min left Thu 2020-11-19 13:33:12 EST 49min ago anacron.timer anacron.service
Thu 2020-11-19 19:50:39 EST 5h 28min left Thu 2020-11-19 11:29:13 EST 2h 53min ago fwupd-refresh.timer fwupd-refresh.service
Fri 2020-11-20 00:00:00 EST 9h left Thu 2020-11-19 11:29:13 EST 2h 53min ago logrotate.timer logrotate.service
Fri 2020-11-20 00:00:00 EST 9h left Thu 2020-11-19 11:29:13 EST 2h 53min ago man-db.timer man-db.service
JSON output:
"systemd_timers": ["Thu 2020-11-19 14:31:46 EST 6min left Thu 2020-11-19 13:33:12 EST 51min ago anacron.timer anacron.service", "Thu 2020-11-19 19:50:39 EST 5h 25min left Thu 2020-11-19 11:29:13 EST 2h 55min ago fwupd-refresh.timer fwupd-refresh.service"]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.