T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/sysinfo.py:144- Finding
Undisclosed System-Wide Process Reconnaissance Enabled by Default
- Content
View full analysis
List[Dict[str, Any]]: """Get top processes.""" processes = [] try: result = subprocess.run( ['ps', 'aux', '--sort=-pcpu'], capture_output=True, text=True ) lines = result.stdout.splitlines()[1:11] # Top 10 for line in lines: parts = line.split(None, 10) if len(parts) >= 11: processes.append({ 'user': parts[0], 'pid': parts[1], 'cpu': float(parts[2]), 'mem': float(parts[3]), 'command': parts[10] }) except: pass return processes ``` The process information is included in the general report unless brief mode is selected: ```python info = { 'hostname': platform.node(), 'os': platform.system(), 'os_version': platform.version(), 'architecture': platform.machine(), 'python_version': platform.python_version(), 'uptime': get_uptime(), 'cpu': get_cpu_info(), 'memory': get_memory_info(), 'disk': get_disk_info(), 'network': get_network_info(), 'top_processes': get_process_info() if not brief else [] } ``` A normal invocation without section flags enables the complete report: ```python # If no specific option, show all show_all = args.all or not any([args.cpu, args.memory, args.disk, args.network, args.processes]) if args.json: print_system_info(json_output=True, brief=args.brief) elif show_all: print_system_info(brief=args.brief) ``` ### Technical Analysis The tool invokes `ps aux --sort=-pcpu` and extracts the owner, PID, CPU usage, memory usage, and full command line for the ten highest ...[truncated 2497 chars]- Remediation
View remediation
