T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/state_awareness.py:81- Finding
Overbroad Host Reconnaissance and Log Collection
- Content
View full analysis
Dict[str, float]: """Get current system resource usage metrics.""" try: cpu_percent = psutil.cpu_percent(interval=1) memory = psutil.virtual_memory() disk = psutil.disk_usage('/') return { 'cpu_percent': cpu_percent, 'memory_percent': memory.percent, 'memory_available_gb': memory.available / (1024**3), 'disk_percent': disk.percent, 'disk_free_gb': disk.free / (1024**3), 'process_count': len(psutil.pids()) } except Exception as e: print(f"Error getting resource metrics: {e}") return { 'cpu_percent': 0, 'memory_percent': 0, 'memory_available_gb': 0, 'disk_percent': 0, 'disk_free_gb': 0, 'process_count': 0 } def _get_recent_errors(self, hours: int = 24) -> List[Dict]: """Get recent system errors from logs.""" errors = [] cutoff_time = datetime.now() - timedelta(hours=hours) # Look for error logs in common locations log_locations = [ "os.path.expanduser('~/.claude/logs')", "/var/log", "./logs" ] for log_dir in log_locations: if os.path.exists(log_dir): try: for log_file in os.listdir(log_dir): if log_file.endswith('.log'): file_path = os.path.join(log_dir, log_file) file_errors = self._parse_error_log(file_path, cutoff_time) errors.extend(file_errors) except Exception as e: print(f"Error reading log directory {log_dir}: {e}") return errors def _parse_error_log(self, f ...[truncated 2989 chars]- Remediation
View remediation
